Direction-Aware Diagonal Autoregressive Image Generation

Yijia Xu, Jianzhong Ju, Jian Luan, Jinshi CuiarXiv 2025 · OpenReview

Abstract: The raster-ordered image token sequence exhibits a significant Euclidean distance between index-adjacent tokens at line breaks, making it unsuitable for autoregressive generation. To address this issue, this paper proposes Direction-Aware Diagonal Autoregressive Image Generation (DAR) method, which generates image tokens following a diagonal scanning order. The proposed diagonal scanning order ensures that tokens with adjacent indices remain in close proximity while enabling causal attention to gather information from a broader range of directions. Additionally, two direction-aware modules: 4D-RoPE and direction embeddings are introduced, enhancing the model's capability to handle frequent changes in generation direction. To leverage the representational capacity of the image tokenizer, we use its codebook as the image token embeddings. We propose models of varying scales, ranging from 485M to 2.0B. On the 256$\times$256 ImageNet benchmark, our DAR-XL (2.0B) outperforms all previous autoregressive image generators, achieving a state-of-the-art FID score of 1.37.

Introduction: The Raster Scan Bottleneck

Most autoregressive (AR) image models process images row-by-row, similar to reading a book. This "raster scan" order, while intuitive for text, is suboptimal for 2D spatial data. It introduces a "Line Break Gap" where the end of one row is physically distant from the start of the next, hindering the model's ability to learn spatial dependencies. Furthermore, raster scanning limits the model's context to only the top and left directions.

Methodology: Direction-Aware Diagonal Generation

To overcome these limitations, the DAR framework introduces three primary innovations to the standard Transformer-based AR architecture:

Diagonal Scanning Order

DAR generates tokens along 45-degree diagonals. This approach ensures that tokens adjacent in the sequence are always physically close in the image grid, effectively eliminating the line break gap. It also expands the causal attention field, allowing the model to gather information from the top-left, top-right, and bottom-left simultaneously.

Comparison of (a) Raster scan order and (b) Diagonal scan order.

Direction-Aware Modules

Alternative scanning orders often fail because standard Transformers are "direction-blind." DAR introduces two key modules to handle the frequent directional changes inherent in diagonal scanning:

  1. 4D-RoPE (4D Rotary Positional Embedding): Incorporates both current and next positions into the attention mechanism, helping the model anticipate directional shifts at image boundaries.
  2. Direction Embeddings: Four learnable embeddings (right, down, upper-right, lower-left) are injected into the Adaptive Layer Normalization (AdaLN) layers to act as a spatial compass.

Key Results and Performance

DAR achieves state-of-the-art results on the ImageNet-1K benchmark at $256 \times 256$ resolution, demonstrating superior efficiency and quality.

Quantitative Benchmarks

  • SOTA FID: DAR-XL (2.0B) achieved an FID score of 1.37, the best recorded for any autoregressive image generator.
  • Efficiency: DAR-B (485M) outperforms models four times its size, such as IBQ-XXL (2.1B), demonstrating that spatial processing logic is more critical than raw parameter count.
  • Speed: DAR-L (1.1B) generates nearly 14 images per second on an H100, which is roughly 2-3x faster than competing AR models like LlamaGen-XL.

Qualitative Samples

The model produces high-fidelity images across a wide variety of classes, from natural landscapes to complex textures, leveraging the pre-trained representational power of the IBQ tokenizer codebook.

Qualitative samples generated by DAR on ImageNet-1K 256x256.

Conclusion

By reimagining the sequence order and equipping the Transformer with directional awareness, DAR sets a new standard for autoregressive image generation. The results suggest that aligning the sequence structure with the physical proximity of data is a powerful paradigm for generative modeling, allowing smaller models to outperform significantly larger, direction-blind counterparts.

Summary updated

BibTeX
@misc{xu2025direction,
  author = {Yijia Xu and Jianzhong Ju and Jian Luan and Jinshi Cui},
  title = {{Direction-Aware Diagonal Autoregressive Image Generation}},
  year = {2025},
  eprint = {2503.11129},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.11129},
}
Figure