TL;DR
This paper introduces Randomized Autoregressive (RAR) modeling, a novel training strategy for autoregressive image generators that significantly boosts performance by randomly permuting token order during training. This approach allows models to learn bidirectional context while retaining the efficient, language-model-compatible autoregressive framework, achieving state-of-the-art FID scores on ImageNet.
What Problem Does This Paper Address?
Autoregressive (AR) models have been incredibly successful in natural language processing, forming the backbone of large language models. However, when applied to visual generation, AR models often lag behind diffusion models and masked transformers. This performance gap is attributed to the inherent differences between text and visual data: text is compact and sequential, while images are more redundant and lack a natural, predefined order. Traditional AR models for vision typically process pixels or tokens in a fixed raster-scan order, enforcing a unidirectional context that limits their ability to capture the rich, bidirectional correlations present in visual data. While some methods have tried to incorporate bidirectional context, they often deviate from the standard AR framework, complicating integration with existing language modeling tools. This paper aims to bridge this gap by enhancing AR visual generation quality without sacrificing its compatibility with language modeling paradigms.
Methods
The core innovation of this paper is the Randomized Autoregressive (RAR) modeling training strategy. Instead of strictly adhering to a fixed raster-scan order for token prediction, RAR introduces a randomized permutation of the input sequence during training. This is achieved by introducing a permutation probability r, which starts at 1 (fully random permutations) and linearly decays to 0 over the course of training. This "randomness annealing" strategy allows the model to initially learn from diverse factorization orders, capturing bidirectional contexts, and then gradually transition to the more efficient raster-scan order by the end of training.
A key challenge addressed is how to effectively guide the model when predicting tokens in a permuted sequence. Standard positional embeddings can lead to identical prediction logits for different permuted sequences, hindering learning. To overcome this, the authors introduce target-aware positional embeddings. These embeddings encode information about which token is being predicted next, ensuring that each token prediction is aware of its target index and alleviating confusion. This allows the model to maximize the expected likelihood over all possible factorization orders, effectively learning bidirectional representations.
Datasets
The primary dataset used for training and evaluation is ImageNet-1K at a resolution of 256x256. The authors also mention using the MaskGIT-VQGAN tokenizer, which was pre-trained on ImageNet.
Key Insights and Ideas
- Random Permutations Unlock Bidirectional Context: The simple idea of randomly permuting token order during AR training is surprisingly effective at enabling models to learn bidirectional context, a crucial aspect for visual data that fixed raster-scan orders miss.
- Annealing is Key: Simply using random permutations all the time isn't optimal. Annealing the randomness down to a standard raster scan by the end of training balances exploration of diverse contexts with the efficiency and proven effectiveness of the raster order.
- Target-Aware Embeddings Solve a Subtle Problem: The introduction of target-aware positional embeddings is a clever solution to a specific issue arising from permuted sequences, ensuring that the model can correctly distinguish between similar but distinct prediction targets.
- AR Models Can Be State-of-the-Art for Vision: This work demonstrates that AR models, when trained with the right strategy, can not only match but surpass diffusion and masked transformer models in visual generation quality, while retaining their inherent advantages.
Key Results
- State-of-the-Art FID on ImageNet: The largest RAR model (RAR-XXL) achieves an FID score of 1.48 on ImageNet-256, outperforming previous state-of-the-art AR, diffusion, and masked transformer models.
- Competitive Performance with Fewer Parameters: The compact RAR-B model (261M parameters) achieves an FID of 1.95, outperforming larger AR models like LlamaGen-3B-384 (3.1B parameters) and Open-MAGVIT2-XL (1.5B parameters). It also surpasses diffusion models like DiT-XL/2 and SiT-XL with significantly fewer parameters.
- Strong Scalability: RAR models show consistent improvement in FID scores as model size increases, demonstrating good scaling behavior.
- Efficient Sampling: RAR models, being autoregressive, benefit from techniques like KV-caching, leading to significantly faster sampling speeds compared to diffusion and masked transformer models, especially at comparable FID scores. For instance, RAR-XL generates 8.3 images/sec, which is 11.9x faster than MaskBit.
Limitations and Future Work
- Global Context Challenge: The authors acknowledge that even with permutation objectives, fully capturing "global context" during generation remains challenging because tokens are generated sequentially. They suggest that techniques like resampling or refinement might help but are beyond the scope of this paper.
- Future Work: The paper suggests exploring solutions for the global context limitation and leveraging LLM optimization techniques (like vLLM) to further enhance RAR's sampling speed. The research also opens possibilities for more unified frameworks for visual understanding and generation.
Summary updated