Introduction
Generating high-resolution images (e.g., $1024 \times 1024$ pixels) remains a significant challenge for standard Vision Transformers due to the quadratic complexity of self-attention. As the number of image tokens increases, computational costs grow exponentially, making global attention impractical for high-fidelity synthesis. Efficient-VQGAN addresses this by rethinking the interaction between local and global visual information within a two-stage framework.
Rethinking Visual Modeling
The core innovation of Efficient-VQGAN lies in its specialized attention mechanisms for different stages of the image generation pipeline.
Stage 1: Local Attention for Quantization
The authors observe that image quantization—the process of mapping pixels to discrete codebook entries—is fundamentally a local operation. Unlike previous models that use global attention, Efficient-VQGAN employs Swin Transformer blocks. These blocks use window-based local attention, which not only accelerates the encoder/decoder but also reduces noise, leading to more faithful reconstructions of local textures.
Stage 2: Multi-Grained Generation
To model the distribution of these discrete codes, the framework introduces a multi-grained attention mechanism. This approach separates tokens into "Global Tokens" (coarse summaries of large areas) and "Local Tokens" (fine-grained details). By attending to a mix of these, the model maintains long-range semantic consistency (e.g., the overall structure of a scene) without the prohibitive $O(N^2)$ cost of full global attention.
Hybrid Training and Inference
Efficient-VQGAN utilizes a hybrid pipeline to optimize both training stability and inference speed. The model is trained using a Masked Autoencoding (MAE) objective, where it learns to reconstruct an image from a partially masked input.
For generation, the authors propose a Block-wise Autoregressive Inference strategy. Instead of the traditional, slow raster-scan (predicting one token at a time), the model predicts entire blocks of tokens in parallel.
This "middle ground" approach significantly boosts throughput while preserving the logical flow required for high-quality synthesis. It allows the model to scale to high resolutions where previous VQ-based methods often encountered Out-of-Memory (OOM) errors.
Experimental Results
Efficient-VQGAN sets new benchmarks for efficiency and quality across standard datasets like FFHQ, CelebA-HQ, and ImageNet:
- Reconstruction: On ImageNet ($256^2$), it achieved an FID (Fréchet Inception Distance) of 0.95, a substantial improvement over ViT-VQGAN's 1.55.
- Throughput: The model processes 142 images/sec, outperforming the original VQGAN (112 images/sec) despite its higher accuracy.
- Scalability: It successfully generates $1024 \times 1024$ images on FFHQ with an FID of 11.81, proving its ability to handle high-resolution grids efficiently.
Conclusion
By replacing global self-attention with local and multi-grained alternatives, Efficient-VQGAN demonstrates that high-resolution generation does not require prohibitive compute. While parallel block sampling can occasionally introduce minor alignment issues, the framework's efficiency and scalability mark a significant step toward practical, high-fidelity image synthesis.
Summary updated