Source-linked AI summary
MaskGIT: Masked Generative Image Transformer
Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, William T. Freeman
TL;DR
Existing generative transformers decode raster-ordered image tokens sequentially, limiting efficiency and treating images as flat sequences. MaskGIT uses bidirectional masked-token prediction with iterative parallel refinement, achieving up to 64x faster ImageNet decoding and extending to image editing tasks. The paper reports competitive image-editing performance and higher-quality ImageNet samples, while noting limitations in attention size and complex structures.
Problem
Generative transformers flatten images into raster-ordered token sequences and decode them sequentially, a strategy the paper describes as neither optimal nor efficient for images.
Source: §1 · p. 1Method
Results
On ImageNet, MaskGIT generates higher-quality samples than VQGAN and accelerates autoregressive decoding by up to 64x.
Source: §1 · p. 2Takeaways & Limitations
MaskGIT extends to image manipulation, inpainting, and extrapolation, obtaining comparable performance to dedicated models on image-editing tasks.
Source: §1 · pp. 2–3Limited attention size can cause semantic or color shifts, boundary-object changes, and artifacts or oversmoothing on complex structures.
Source: F. Limitations and Failure Cases · p. 13
Abstract
from arXiv · showhide
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.
1. Introduction
Existing generative transformers flatten images into raster-ordered token sequences and decode them sequentially, a strategy described as inefficient for images. MaskGIT instead uses bidirectional iterative parallel decoding, achieving faster and higher-quality ImageNet synthesis while extending to image editing.
Motivation
- Generative transformers commonly represent images as 1D raster-scan token sequences and generate them autoregressively.This inherited sequential formulation differs from the non-sequential structure described for images.Source: §1 · pp. 1–2
Approach
- MaskGIT trains a bidirectional transformer to predict masked tokens and iteratively retains confident parallel predictions while remasking the rest.The mask ratio decreases until all tokens are generated.Source: §1 · p. 2
Efficiency
- 8 iterations replace 256 sequential rounds in the illustrated MaskGIT decoding comparison.MaskGIT predicts scattered tokens in parallel, with the number of predicted tokens increasing over iterations.Source: §1 · p. 2, Figure 2 · p. 2
Results
- Up to 64x faster decoding and higher-quality samples are reported for MaskGIT than for VQGAN on ImageNet class-conditional generation.The comparison covers 256x256 and 512x512 resolutions.Source: §1 · p. 2
Image editing
- MaskGIT is readily extended to class-conditional editing, inpainting, and extrapolation, with comparable performance to dedicated models on the latter tasks.The model can regenerate masked content while preserving surrounding context.Source: §1 · pp. 2–3
2. Related Work
Prior image synthesis systems commonly use a two-stage latent-token pipeline, while masked modeling has mainly supported representation learning rather than image generation. MaskGIT applies bidirectional masked modeling to generation and presents evidence on ImageNet.
Image Synthesis
- VQVAE-style image synthesis compresses images into discrete latent tokens before modeling their latent priors and decoding them into pixels.The first stage uses an encoder, codebook, and decoder.Source: §2.1 · p. 3
- Generative transformer systems generally retain autoregressive sequential token prediction after image tokenization.Existing work focuses heavily on reducing information loss in tokenization while sharing the second-stage sequence model.Source: §2.1 · p. 3
Masked Modeling
- BERT-style masked modeling predicts masked elements using bidirectional context, and vision methods extended this setup to quantized image tokens for representation learning.The cited masked modeling uses context from both directions.Source: §2.2 · p. 3
MaskGIT
- MaskGIT's pipeline combines a visual tokenizer with a bidirectional transformer performing Masked Visual Token Modeling.The transformer learns to predict randomly masked visual tokens.Source: Figure 3 · p. 3
Masked Modeling
- Few works had successfully applied masked modeling to image generation because bidirectional attention complicates autoregressive decoding.The paper identifies its ImageNet results as first evidence of masked modeling efficacy for image generation on that benchmark.Source: §2.2 · p. 3
3. Method
MaskGIT improves the latent-token generation stage with bidirectional masked-token training and iterative parallel decoding. Its masking schedule controls how many tokens remain masked during training and inference, with cosine scheduling reported as the best tested option.
Method
- MaskGIT keeps the VQGAN tokenizer setup and replaces the second-stage autoregressive model with a bidirectional transformer trained by MVTM.Potential improvements to tokenization are left for future work.Source: §3 · p. 3
3.1. MVTM in Training
- MVTM randomly replaces selected visual tokens with [MASK] and trains the transformer to predict the masked tokens from bidirectional context.The objective is the cross-entropy between ground-truth tokens and predicted probabilities.Source: §3.1 · pp. 3–4
3.2. Iterative Decoding
- At inference, all masked positions are predicted simultaneously, sampled tokens receive confidence scores, and only the most confident predictions are retained.Unmasked positions receive confidence 1.0, while remaining tokens are remasked for later refinement.Source: §3.2 · p. 4
- The decoding process starts from an all-masked canvas and progressively reduces the mask ratio until all tokens are generated within T iterations.The procedure is iterative because a single-pass prediction is challenging due to mismatch with the training task.Source: §3.2 · p. 4
3.3. Masking Design
- The mask schedule γ determines the masked-token count as n = round(γ(t/T)N), where N is input length and T is total iterations.The schedule is used in both training and inference to represent decoding progress.Source: §3.2 · p. 4, §3.3 · p. 4
- Cosine scheduling achieves the best FID among the tested masking functions.The paper contrasts linear, concave, and convex schedules; cosine belongs to the concave family.Source: §3.3 · pp. 4–5
4. Experiments
MaskGIT is evaluated for image-generation quality, speed, editing flexibility, and mask-scheduling choices. Across ImageNet and image-editing tasks, it improves quality and diversity over key baselines while substantially reducing decoding runtime.
Class-conditional Image Synthesis
- MaskGIT significantly outperforms VQGAN in ImageNet class-conditional synthesis quality at 256ˆ256 and 512ˆ512 resolutions.The evaluation compares quality using FID and IS, including a VQGAN baseline trained with the same tokenizer and hyperparameters.Source: §4.2 · p. 5
- 30-64x runtime acceleration over VQGAN becomes more pronounced as image resolution and token length increase.Speed is assessed through decoding runtime and the number of neural-network forward passes required to generate a sample.Source: §4.2 · p. 5
- MaskGIT establishes state-of-the-art CAS on ImageNet at both evaluated resolutions and improves diversity through better recall than VQGAN.Its samples also achieve better coverage than BigGAN, while slightly boosting VQGAN’s precision.Source: §4.2 · pp. 5, 7
Image Editing Applications
- Without architecture or task-specific training, MaskGIT supports class-conditional editing, inpainting, and outpainting through constraints on the initial decoding mask.For class-conditional editing, the model regenerates a boxed region for a target class while preserving surrounding context.Source: §4.3 · pp. 7–8
- On Places2 inpainting with a central 50% ˆ 50% mask, MaskGIT beats DeepFillv2 and HiFill in FID and IS while approaching CoModGAN.The outpainting adaptation uses the same problem and model setup as inpainting, despite having fewer surrounding-pixel constraints.Source: §4.3 · p. 8
Ablation Studies
- Cosine mask scheduling achieves the best FID and becomes MaskGIT’s default, with a reported sweet spot at 8 to 12 decoding iterations.More iterations are not necessarily better; performance peaks and then worsens, with the peak depending on the scheduling function.Source: §4.4 · p. 8
5. Conclusion
MaskGIT introduces bidirectional transformer decoding with iterative generation in a constant number of iterations. It outperforms state-of-the-art transformer models on conditional image generation and extends to image manipulation tasks.
- MaskGIT uses a bidirectional transformer decoder and Masked Visual Token Modeling for iterative image generation.Source: §5 · p. 9
- MaskGIT generates samples through an iterative decoding process within a constant number of iterations.Source: §5 · p. 9
- MaskGIT significantly outperforms the state-of-the-art transformer model on conditional image generation.Source: §5 · p. 9
- MaskGIT is readily extendable to various image manipulation tasks.Source: §5 · p. 9
- The authors identify applying MaskGIT to other synthesis tasks as a promising direction because it achieves competitive performance with state-of-the-art GANs.Source: §5 · p. 9
A. Discussion on Image Reconstruction
MaskGIT reconstructs images from randomly masked visual tokens, with reconstruction quality evaluated across mask ratios. The results indicate that visual tokens are highly redundant, with a small portion sufficient for holistic reconstruction while additional tokens recover finer details.
- MaskGIT reconstructs images by randomly masking visual tokens and applying its iterative decoding algorithm.The reconstruction setup varies the mask ratio r and evaluates PSNR and LPIPS as functions of r.Source: A. Discussion on Image Reconstruction · p. 12
- PSNR and LPIPS measure reconstruction quality and diversity as functions of the masked-token ratio.Source: A. Discussion on Image Reconstruction · p. 12, Figure 10 · p. 12
- Visual tokens are highly redundant in holistic image reconstruction.Source: A. Discussion on Image Reconstruction · p. 12
- 10% of tokens are described as essential for holistic reconstruction, while remaining tokens improve finer appearance or details.Source: A. Discussion on Image Reconstruction · p. 12
- The finding supports the masking design, in which predictions of the first few tokens are key to image generation.Source: A. Discussion on Image Reconstruction · p. 12
B. Additional Class-conditional Image Generation Results
Additional ImageNet results evaluate MaskGIT's class-conditional generation quality and diversity against VQGAN, BigGAN, and ADM. MaskGIT achieves strong quality scores, improved recall, and state-of-the-art Inception Scores when using classifier-based rejection sampling.
- The additional experiments evaluate class-conditional image generation on ImageNet using classifier-based rejection sampling and feature-based Precision and Recall.Source: B. Additional Class-conditional Image… · pp. 12–13
- 355.6 on 256x256 and 342.0 on 512x512 are MaskGIT's state-of-the-art Inception Scores with rejection sampling.Source: B. Additional Class-conditional Image… · p. 13
- MaskGIT consistently improves over VQGAN and is comparable with ADM using classifier guidance.Source: B. Additional Class-conditional Image… · p. 13
- MaskGIT's recall scores outperform those of BigGAN and VQGAN under both reported measures.Source: B. Additional Class-conditional Image… · p. 13
- MaskGIT outperforms BigGAN and baseline VQGAN by a large margin on CAS evaluated without RandAugment-trained classifier augmentation.Source: B. Additional Class-conditional Image… · p. 13
- The section includes comparisons with BigGAN-deep and VQVAE-2 for class-conditional samples.Source: B. Additional Class-conditional Image… · p. 13
C. Additional Examples of Class-conditional Image Editing Applications
The paper provides additional examples of class-conditional image editing and image-conditional panorama synthesis. These examples illustrate applications beyond standard image generation.
- Additional examples demonstrate class-conditional image editing applications.Source: C. Additional Examples of… · p. 13
- Additional examples demonstrate image-conditional panorama synthesis.Source: C. Additional Examples of… · p. 13
D. Image Outpainting Comparisons with SOTA Transformer-based Approaches
MaskGIT is compared with ImageGPT and VQGAN for image outpainting, using ground-truth context from either the top or bottom half. It supports higher-resolution outputs and outpainting in arbitrary directions, unlike the autoregressive baselines.
- MaskGIT and VQGAN achieve higher sample fidelity at higher resolutions than ImageGPT, which supports a maximum resolution of 192 x 192.Tokenization enables the higher-resolution operation of MaskGIT and VQGAN.Source: D. Image Outpainting Comparisons with… · p. 13
- MaskGIT can outpaint in arbitrary directions, whereas ImageGPT and VQGAN handle only one direction with a single model.The comparison uses extrapolation from either the top or bottom half of the ground-truth image.Source: D. Image Outpainting Comparisons with… · p. 13
E. Image Inpainting and Outpainting Comparisons with SOTA GAN-based Approaches
MaskGIT is evaluated against GAN-based image-completion methods on qualitative inpainting and outpainting examples, including challenging large-mask settings. Compared with prior GAN methods, it produces more coherent structures and fewer artifacts in the reported examples.
- The qualitative comparisons cover image completion on Places2 and report examples for both inpainting and outpainting.The section states that quantitative results were discussed separately.Source: E. Image Inpainting and Outpainting… · p. 13
- MaskGIT demonstrates stronger capability than prior GAN-based methods in completing structures coherently, with fewer artifacts in its samples.Examples include bridges and buildings that the compared GAN methods struggle to complete.Source: E. Image Inpainting and Outpainting… · p. 13
- MaskGIT is compared with CoModGAN under large masking ratios, conditioning on center regions of 50% x 50% and 31.25% x 31.25%.These settings are identified as challenging for traditional GANs.Source: E. Image Inpainting and Outpainting… · p. 13
F. Limitations and Failure Cases
The paper reports failure cases in outpainting and inpainting, including semantic or color shifts, boundary-object changes, and artifacts or oversmoothing in complex structures. These cases identify settings where further improvement remains necessary.
- Limited attention can cause semantic or color shifts when MaskGIT outpaints in opposite directions.The model may forget synthesized semantics or color from one end while generating the other.Source: F. Limitations and Failure Cases · p. 13
- MaskGIT may ignore or modify objects located on image boundaries during outpainting and inpainting.Source: F. Limitations and Failure Cases · p. 13
- Complex structures such as human faces, text, and symmetric objects can trigger oversmoothing or undesired artifacts.The paper identifies improvement for these circumstances as future work.Source: F. Limitations and Failure Cases · p. 13
Related papers
This paper cites
- Attention Is All You Need2017
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- Language Models are Few-Shot Learners2020
- ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION2014
- Very Deep Convolutional Networks for Large-Scale Image Recognition2014
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale2020
Cited by
- Cord: Confidence-Anchored Order Residual Decoding for Masked Diffusion Language Models2026
- Unlocking Any-Order Generation in Pretrained Autoregressive Image Models2026
- Visual Autoregressive Generation with Next Token Imagination2026
- Nemotron-Labs-Diffusion-Uni: Elastic Self-Refining Unified Diffusion LLM with Cross-Paradigm On-Policy Distillation2026
- Whole-Body Humanoid Control via Stochastic Motion Tokenization2026
- TIMUSE: Text-Initialized Masked Semantic Token Modeling for Universal Speech Enhancement2026