{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/maskgit-masked-generative-image-transformer","title":"MaskGIT: Masked Generative Image Transformer","arxiv_id":"2202.04200","date":"2022-02-08","proceeding":"CVPR 2022 1","authors":["Huiwen Chang","Han Zhang","Lu Jiang","Ce Liu","William T. Freeman"],"abstract":"Generative transformers have experienced rapid popularity growth in the computer vision community in synthesizing high-fidelity and high-resolution images. The best generative transformer models so far, however, still treat an image naively as a sequence of tokens, and decode an image sequentially following the raster scan ordering (i.e. line-by-line). We find this strategy neither optimal nor efficient. This paper proposes a novel image synthesis paradigm using a bidirectional transformer decoder, which we term MaskGIT. During training, MaskGIT learns to predict randomly masked tokens by attending to tokens in all directions. At inference time, the model begins with generating all tokens of an image simultaneously, and then refines the image iteratively conditioned on the previous generation. Our experiments demonstrate that MaskGIT significantly outperforms the state-of-the-art transformer model on the ImageNet dataset, and accelerates autoregressive decoding by up to 64x. Besides, we illustrate that MaskGIT can be easily extended to various image editing tasks, such as inpainting, extrapolation, and image manipulation.","url_abs":"https://arxiv.org/abs/2202.04200v1","url_pdf":"https://arxiv.org/pdf/2202.04200v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/google-research/maskgit","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/HKUNLP/Dream","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/LAION-AI/phenaki","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/alibaba/graph-gpt","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/dome272/MaskGIT-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/lucidrains/phenaki-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/lucidrains/soundstorm-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/myscience/open-genie","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"maskgit-masked-generative-image-transformer","repo_url":"https://github.com/valeoai/maskgit-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-manipulation","task_name":"Image Manipulation"},{"task_slug":"image-outpainting","task_name":"Image Outpainting"},{"task_slug":"image-reconstruction","task_name":"Image Reconstruction"},{"task_slug":"text-to-image-generation","task_name":"Text-to-Image Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-generation-on-imagenet-256x256","task":"Image Generation","dataset":"ImageNet 256x256","model":"MaskGIT (a=0.05)","rank_in_archive_order":80,"of":94,"metrics":{"FID":"4.02"},"uses_additional_data":false},{"leaderboard":"/sota/image-generation-on-imagenet-256x256","task":"Image Generation","dataset":"ImageNet 256x256","model":"MaskGIT","rank_in_archive_order":89,"of":94,"metrics":{"FID":"6.18"},"uses_additional_data":false},{"leaderboard":"/sota/image-generation-on-imagenet-512x512","task":"Image Generation","dataset":"ImageNet 512x512","model":"MaskGIT (a=0.05)","rank_in_archive_order":49,"of":52,"metrics":{"FID":"4.46","Inception score":"342.0"},"uses_additional_data":false},{"leaderboard":"/sota/image-generation-on-imagenet-512x512","task":"Image Generation","dataset":"ImageNet 512x512","model":"MaskGIT","rank_in_archive_order":51,"of":52,"metrics":{"FID":"7.32","Inception score":"156.0"},"uses_additional_data":false},{"leaderboard":"/sota/image-outpainting-on-lhqc","task":"Image Outpainting","dataset":"LHQC","model":"MaskGIT","rank_in_archive_order":3,"of":4,"metrics":{"Block-FID  (Right Extend)":"14.68","Block-FID (Down Extend)":"25.57","Block-FID (Left Extend)":"14.81","Block-FID (Up Extend)":"25.38"},"uses_additional_data":false},{"leaderboard":"/sota/image-reconstruction-on-imagenet","task":"Image Reconstruction","dataset":"ImageNet","model":"MaskGIT-VQGAN (16x16)","rank_in_archive_order":13,"of":15,"metrics":{"FID":"2.28"},"uses_additional_data":false},{"leaderboard":"/sota/text-to-image-generation-on-lhqc","task":"Text-to-Image Generation","dataset":"LHQC","model":"MaskGIT","rank_in_archive_order":2,"of":3,"metrics":{"Block-FID":"24.33"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2202.04200","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2202.04200"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/google-research/maskgit","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/valeoai/maskgit-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/HKUNLP/Dream","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/LAION-AI/phenaki","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/soundstorm-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/alibaba/graph-gpt","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/phenaki-pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/myscience/open-genie","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dome272/MaskGIT-pytorch","reach":null}],"summary":{"ran":11,"ran_draft_wrong":3,"unverified":7},"by_repo_kind":{"listed":{"samples":21,"ran":14,"repositories":5}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":4,"samples":[{"code_sha256_prefix":"db6abd243470c35a","entry":"AdaNorm","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"db6abd243470c35a"}},{"code_sha256_prefix":"7fd4e0ce7bd6b27f","entry":"Attention","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7fd4e0ce7bd6b27f"}},{"code_sha256_prefix":"7e79dc89343596b8","entry":"Attention","repo":"LAION-AI/phenaki","repo_kind":"listed","path":"maskgit.py","file_url":"https://github.com/LAION-AI/phenaki/blob/HEAD/maskgit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7e79dc89343596b8"}},{"code_sha256_prefix":"c1c45512a825fc3b","entry":"Block","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c1c45512a825fc3b"}},{"code_sha256_prefix":"220f01cece0c0d8b","entry":"ContinuousPositionBias","repo":"lucidrains/phenaki-pytorch","repo_kind":"listed","path":"phenaki_pytorch/phenaki_pytorch.py","file_url":"https://github.com/lucidrains/phenaki-pytorch/blob/HEAD/phenaki_pytorch/phenaki_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"220f01cece0c0d8b"}},{"code_sha256_prefix":"6ee8c0748ff579f0","entry":"Encoder","repo":"dome272/MaskGIT-pytorch","repo_kind":"listed","path":"bidirectional_transformer.py","file_url":"https://github.com/dome272/MaskGIT-pytorch/blob/HEAD/bidirectional_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6ee8c0748ff579f0"}},{"code_sha256_prefix":"9bdc5ed60c59ed33","entry":"FeedForward","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9bdc5ed60c59ed33"}},{"code_sha256_prefix":"37eef98f3b06bc78","entry":"FeedForward","repo":"LAION-AI/phenaki","repo_kind":"listed","path":"maskgit.py","file_url":"https://github.com/LAION-AI/phenaki/blob/HEAD/maskgit.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"37eef98f3b06bc78"}},{"code_sha256_prefix":"3c34ec2ff05d28fd","entry":"QKNorm","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3c34ec2ff05d28fd"}},{"code_sha256_prefix":"86a159a05ae09375","entry":"RMSNorm","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"86a159a05ae09375"}},{"code_sha256_prefix":"c86e4af300cafb7a","entry":"Transformer","repo":"LAION-AI/phenaki","repo_kind":"listed","path":"maskgit.py","file_url":"https://github.com/LAION-AI/phenaki/blob/HEAD/maskgit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c86e4af300cafb7a"}},{"code_sha256_prefix":"93bc9d37c053dcd3","entry":"_batch_unmask_without_for_loop","repo":"alibaba/graph-gpt","repo_kind":"listed","path":"src/utils/generation_utils.py","file_url":"https://github.com/alibaba/graph-gpt/blob/HEAD/src/utils/generation_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"93bc9d37c053dcd3"}},{"code_sha256_prefix":"f11bef5e87ce3904","entry":"leaky_relu","repo":"lucidrains/phenaki-pytorch","repo_kind":"listed","path":"phenaki_pytorch/phenaki_pytorch.py","file_url":"https://github.com/lucidrains/phenaki-pytorch/blob/HEAD/phenaki_pytorch/phenaki_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f11bef5e87ce3904"}},{"code_sha256_prefix":"3028b4a113e4e8f8","entry":"sample_tokens","repo":"alibaba/graph-gpt","repo_kind":"listed","path":"src/utils/generation_utils.py","file_url":"https://github.com/alibaba/graph-gpt/blob/HEAD/src/utils/generation_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3028b4a113e4e8f8"}},{"code_sha256_prefix":"b3029d867f4bb08d","entry":"BidirectionalTransformer","repo":"dome272/MaskGIT-pytorch","repo_kind":"listed","path":"bidirectional_transformer.py","file_url":"https://github.com/dome272/MaskGIT-pytorch/blob/HEAD/bidirectional_transformer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b3029d867f4bb08d"}},{"code_sha256_prefix":"def2e2196cd17208","entry":"GenerationConfig","repo":"alibaba/graph-gpt","repo_kind":"listed","path":"src/utils/generation_utils.py","file_url":"https://github.com/alibaba/graph-gpt/blob/HEAD/src/utils/generation_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"def2e2196cd17208"}},{"code_sha256_prefix":"d683bf3267136071","entry":"MaskGit","repo":"lucidrains/phenaki-pytorch","repo_kind":"listed","path":"phenaki_pytorch/phenaki_pytorch.py","file_url":"https://github.com/lucidrains/phenaki-pytorch/blob/HEAD/phenaki_pytorch/phenaki_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d683bf3267136071"}},{"code_sha256_prefix":"78ffd63b86b6fe34","entry":"MaskGit","repo":"LAION-AI/phenaki","repo_kind":"listed","path":"maskgit.py","file_url":"https://github.com/LAION-AI/phenaki/blob/HEAD/maskgit.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"78ffd63b86b6fe34"}},{"code_sha256_prefix":"d14b816d459cd10d","entry":"Transformer","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d14b816d459cd10d"}},{"code_sha256_prefix":"ae6080e4032dcb9a","entry":"TransformerEncoder","repo":"valeoai/maskgit-pytorch","repo_kind":"listed","path":"Network/transformer.py","file_url":"https://github.com/valeoai/maskgit-pytorch/blob/HEAD/Network/transformer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ae6080e4032dcb9a"}},{"code_sha256_prefix":"323141756998f1c6","entry":"weights_init","repo":"dome272/MaskGIT-pytorch","repo_kind":"listed","path":"bidirectional_transformer.py","file_url":"https://github.com/dome272/MaskGIT-pytorch/blob/HEAD/bidirectional_transformer.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"323141756998f1c6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}