Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generation

Xunzhi Xiang, Qi Fan · DOI

Abstract

Autoregressive (AR) models have demonstrated significant potential in high-fidelity image synthesis by treating images as sequences of patches. However, the quadratic computational complexity of self-attention and the memory demands of the KV-cache limit their scalability. We present Adaptive Dynamic Sparse Attention (ADSA), a training-free approach that optimizes inference by dynamically pruning redundant image tokens. By prioritizing global style anchors and local texture continuity, ADSA reduces memory consumption by 50% without compromising image quality.

Introduction

The success of Large Language Models (LLMs) has paved the way for autoregressive image generation. Models like LlamaGen represent images as sequences of discrete tokens, predicting each subsequent patch based on the preceding context. While this paradigm enables high-quality synthesis, it introduces a heavy computational burden. Unlike natural language, where tokens are semantically dense, image patches are often redundant and high-entropy. Storing the entire history in a KV-cache leads to memory bottlenecks that hinder the generation of high-resolution images.

The Entropy Gap in Image Generation

A fundamental challenge in applying LLM-style sparse attention to images is the "entropy gap." An image patch contains significantly more information (approx. 26,000 bits) than a text token (approx. 16 bits). Consequently, simple pruning strategies like windowed attention often result in "semantic drift," where the model loses global coherence and produces repetitive or distorted artifacts.

Adaptive Dynamic Sparse Attention (ADSA)

To overcome these challenges, researchers from Nanjing University introduced ADSA, a plug-and-play mechanism that categorizes the KV-cache into three functional zones:

  1. The Prefix (Global Style): The first 5% of tokens, which establish the image's overall layout and color palette. These act as permanent anchors.
  2. The Local Region (Texture & Continuity): The most recent tokens, essential for maintaining spatial continuity between adjacent patches.
  3. The Previous Tokens (Contextual Glue): The intermediate tokens, which are filtered for redundancy.
Visualization of the diagonal stripe attention pattern used to maintain local and global context.

The core of ADSA is TopK-V Filtering. By calculating the cosine similarity between the Value (V) features of tokens, the model identifies and retains only the most informative and diverse tokens. This dynamic update mechanism ensures a constant memory footprint by evicting redundant data as new tokens are generated.

Experimental Results

ADSA was integrated into the LlamaGen model and evaluated on ImageNet and MS-COCO benchmarks.

Comparison of image generation quality across different prompts using ADSA. The method preserves the 'glowing style' and complex details while using significantly less memory.

The results demonstrate that ADSA achieves a 50% reduction in KV-cache size with negligible impact on quality. Notably, on ImageNet, ADSA-384 achieved an FID of 2.58, slightly outperforming the full-context baseline (FID 2.62). This suggests that pruning irrelevant tokens may act as a regularizer, helping the model focus on the most salient features. Furthermore, human preference studies indicate that ADSA-generated images are virtually indistinguishable from those produced by full-attention models.

Conclusion

Adaptive Dynamic Sparse Attention (ADSA) provides a robust, training-free solution for efficient autoregressive image generation. By intelligently managing the KV-cache based on the unique properties of image tokens, ADSA enables high-fidelity synthesis with significantly reduced hardware requirements. This work highlights the potential for smarter attention mechanisms to drive the next generation of scalable visual models.

Summary updated

BibTeX
@misc{xiang2025make,
  author = {Xunzhi Xiang and Qi Fan},
  title = {{Make It Efficient: Dynamic Sparse Attention for Autoregressive Image Generation}},
  year = {2025},
  eprint = {2506.18226},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.18226},
}
Figure