Abstract
MaskGIT introduces a paradigm shift in generative transformers by moving away from slow, sequential "raster-scan" image generation. By using a bidirectional transformer and a novel iterative parallel decoding scheme, MaskGIT generates high-quality images up to 64x faster than previous state-of-the-art models while offering unprecedented flexibility for image editing tasks like inpainting and outpainting.
Introduction: Beyond Sequential Generation
Most current generative transformers, such as VQGAN or DALL-E, treat an image as a 1D sequence of visual tokens. These models typically follow a "raster-scan" order, predicting tokens one by one from top-left to bottom-right. This approach suffers from two major flaws:
- Efficiency: Sequential generation for a 256x256 image requires hundreds of steps, making it computationally expensive and slow for real-time applications.
- Sub-optimal Modeling: Images are inherently non-sequential. A unidirectional model can only "look back" at previous tokens, ignoring the global context that a bidirectional model could capture. A human artist doesn't finish the top-left corner of a canvas before starting the rest; they sketch a global structure and then refine details.
Methodology: Masked Visual Token Modeling (MVTM)
MaskGIT utilizes a two-stage architecture to address these limitations. First, a VQGAN-style encoder compresses the image into a grid of discrete latent tokens. Second, instead of an autoregressive transformer, MaskGIT employs a bidirectional transformer.
Training and Iterative Decoding
During training, the model learns to predict a random subset of tokens that have been replaced by a special [MASK] token, similar to BERT in natural language processing. At inference, MaskGIT uses an Iterative Parallel Decoding scheme:
- The process begins with a completely masked grid.
- In each step, the model predicts probabilities for all masked tokens simultaneously.
- Based on a mask schedule, only the most confident predictions are kept, while the rest are re-masked.
- This repeats for a fixed number of iterations (typically 8 to 12) until the image is complete.
Key Insights
The "secret sauce" of MaskGIT lies in its cosine mask schedule. By keeping only a small fraction of tokens in early steps and rapidly increasing the count later, the model mimics a human artist—fixing the global "sketch" before filling in fine-grained textures. Furthermore, because the model is inherently bidirectional, tasks like inpainting and outpainting become trivial extensions of the generation process. You simply provide the known pixels as "unmasked" and let the model's standard decoding process fill in the rest.
Results and Applications
MaskGIT demonstrates significant improvements in both speed and quality. On a single GPU, it accelerates decoding by 30x to 64x compared to autoregressive models. On ImageNet 512x512, it achieved a state-of-the-art FID of 7.32, outperforming BigGAN and contemporary diffusion models.
Beyond standard synthesis, the model excels at extrapolation tasks. As shown in the panorama examples, the model can extend a central "Input" image into a wide-angle view while maintaining structural and stylistic consistency across the entire frame.
Limitations and Future Work
Despite its strengths, MaskGIT faces challenges in long-range outpainting, where it may occasionally "forget" the theme across the image due to the limited attention window. Additionally, highly structured objects like human faces or text can sometimes appear oversmoothed or contain artifacts. Future improvements in the underlying VQGAN tokenizer are expected to further enhance the model's performance, as the quality of the first-stage quantization remains a primary bottleneck.
Summary updated