Token-Shuffle: Towards High-Resolution Image Generation with Autoregressive Models

Xu Ma, Peize Sun, Haoyu Ma, Hao Tang, Chih-Yao Ma, Jialiang Wang, Kunpeng Li, Xiaoliang Dai, Yujun Shi, Xuan Ju, Yushi Hu, Artsiom Sanakoyeu, Felix Juefei-Xu, Ji Hou, Junjiao Tian, Tao Xu, Tingbo Hou, Yen-Cheng Liu, Zecheng He, Zijian He, Matt Feiszli, Peizhao Zhang, Sam Tsai, Yun Fu · Submission to ICLR 2026 · Rejected

TL;DR

Autoregressive (AR) models struggle with high-resolution image generation because discrete visual tokens scale quadratically with resolution, overloading Transformer context windows. Token-Shuffle solves this by leveraging the dimensional redundancy of visual tokens in multimodal LLMs, packing spatially local $s \times s$ visual tokens along the channel dimension before processing them in the Transformer. This simple, plug-and-play technique slashes sequence lengths by a factor of $s^2$ (a 75% reduction for $s=2$), enabling efficient training and inference for text-to-image generation up to $2048 \times 2048$ resolution.

What Problem Does This Paper Address?

While diffusion models dominate modern high-resolution image synthesis, autoregressive models (like LlamaGen, Chameleon, and EMU3) offer a unified "next-token prediction" framework that integrates cleanly with large language models. However, AR image generation requires representing images as grids of discrete tokens using a tokenizer (e.g., VQ-GAN).

A standard $16\times$ downsampling tokenizer converts a $1024 \times 1024$ image into 4,096 tokens, and a $2048 \times 2048$ image into 16,384 tokens. Because standard Transformer attention costs scale quadratically ($O(N^2)$), scaling AR models to high resolutions has been computationally prohibitive. Increasing tokenizer downsampling (e.g., $32\times$) degrades reconstruction quality, forcing previous AR systems to either sacrifice resolution or accept massive compute costs.

Methods

The authors build on a 2.7B decoder-only LLaMA backbone (3,072 hidden dimension, 20 layers) equipped with a discrete VQ-GAN codebook:

  • Exploiting Dimensional Redundancy: VQ-GAN codebook vectors are inherently low-dimensional (e.g., 256), whereas LLM hidden states are wide (3,072+). The authors prove empirically that visual embeddings can be compressed in channel dimension by up to $8\times$ with negligible impact on pretraining loss.
  • Token-Shuffle and Token-Unshuffle:
  • Input (Token-Shuffle): Before Transformer layers, an MLP projects token dimension from $d$ down to $d/s^2$. Spatially adjacent $s \times s$ tokens are then flattened and concatenated along the channel dimension back to dimension $d$. For a window size of $s=2$, the sequence length processed by the Transformer drops by $4\times$.
  • Output (Token-Unshuffle): The Transformer predicts the next fused token. Lightweight residual MLP blocks then unshuffle and expand each fused representation back into $s \times s$ individual visual tokens.
  • Causal Masking with Local Mutual Attention: By predicting an $s \times s$ patch in a single step, tokens within each local shuffle window can interact mutually through the MLP unshuffle blocks without breaking the causal masking applied across steps.
  • Half-Linear CFG Scheduler: Standard classifier-free guidance (CFG) applied uniformly across all steps can compound errors from static initial prompt tokens. The authors use a schedule that smoothly ramps the CFG scale linearly from 1.0 to 7.5 over the first half of generation, holding it steady thereafter.
  • Training Stabilization via z-loss: When training at $2048 \times 2048$, training loss and gradient norms frequently explode. Incorporating QK-Norm alongside z-loss (weight $10^{-5}$) eliminated this instability.
[s x s Visual Tokens] 
       │ 
       ▼
 [Token-Shuffle] ──► Dimension compress + spatial flatten ──► 1 Fused Token (dim d)
       │
       ▼
[Autoregressive Transformer] (Operates on 1/s² token count)
       │
       ▼
[Token-Unshuffle] ──► Unpack channels into s x s tokens ──► VQ-GAN Decoder

Datasets

  • Pretraining: Pretrained in three progressive stages ($512\times512 \rightarrow 1024\times1024 \rightarrow 2048\times2048$) on a licensed Shutterstock dataset following Emu, using long, descriptive captions generated via Llama 3. The 2048 stage was trained on ~300 billion tokens filtered to native resolutions $\ge 1024 \times 1024$.
  • Fine-Tuning: Fine-tuned on 1,500 curated, aesthetically high-quality images.
  • Evaluation:
  • GenAI-Bench: Evaluated across both "basic" and "hard" compositional prompts using VQAScore.
  • GenEval: Object-focused text-to-image alignment benchmark measuring object count, position, color, and attributes.
  • MSCOCO-val (5k images): Used for verifying VQ-GAN reconstruction quality (PSNR/SSIM/CLIP metrics).

Key Insights and Ideas

  • Pack channels, don't throw away tokens: Standard approaches to efficiency either downsample aggressively with an lossy tokenizer or drop tokens. Token-Shuffle instead redistributes spatial tokens into the LLM's oversized channel capacity, keeping full spatial information while bypassing the Transformer length bottleneck.
  • Better than higher tokenizer compression: Generating with an $8\times$ VQ-GAN tokenizer combined with Token-Shuffle ($s=2$) yields identical compute costs to a native $16\times$ VQ-GAN, but achieves significantly better PSNR, SSIM, and human-evaluated visual quality.
  • Mitigating AR drift with CFG scheduling: Unconditional prompts in AR pipelines fix the first few token logits, accumulating artifacts. Annealing CFG early in generation prevents these early drift artifacts while preserving prompt faithfulness later in the image.

Key Results

  • Resolution Milestone: Achieved direct autoregressive text-to-image synthesis at $2048 \times 2048$ resolution with high aesthetic coherence.
  • GenAI-Bench (Hard Prompts): The 2.7B Token-Shuffle model achieved a VQAScore of 0.77, substantially outperforming AR competitor LlamaGen (0.59) and diffusion baseline LDM (0.62), while also beating DALL-E 3 (0.70).
  • GenEval Benchmark: Achieved an overall score of 0.62, outperforming larger AR architectures including Chameleon 7B (0.39), EMU3-Gen 8B (0.54), and Janus 1.3B (0.61), matching SD3 2B (0.62).
  • Compute Savings: At $s=2$, training FLOPs and active sequence lengths are reduced by approximately $4\times$.

Limitations and Future Work

  • Structural Flaws: Like many AR models relying on causal raster order, it still occasionally produces anatomical and structural artifacts (e.g., distorted limbs or illogical object merges) compared to top-tier diffusion models.
  • Scalability to Larger Backbones: Validated at 2.7B parameters; evaluating Token-Shuffle on 7B, 30B, or larger foundation models remains future work.
  • Fixed Aspect Ratios: The current implementation focuses on square resolutions ($512^2, 1024^2, 2048^2$); extending the shuffling pipeline to dynamic aspect ratios and non-square patches is an open direction.

Summary updated

BibTeX
@misc{ma2025token,
  author = {Xu Ma and Peize Sun and Haoyu Ma and Hao Tang and Chih-Yao Ma and Jialiang Wang and Kunpeng Li and Xiaoliang Dai and Yujun Shi and Xuan Ju and Yushi Hu and Artsiom Sanakoyeu and Felix Juefei-Xu and Ji Hou and Junjiao Tian and Tao Xu and Tingbo Hou and Yen-Cheng Liu and Zecheng He and Zijian He and Matt Feiszli and Peizhao Zhang and Sam Tsai and Yun Fu},
  title = {{Token-Shuffle: Towards High-Resolution Image Generation with Autoregressive Models}},
  year = {2025},
  eprint = {2504.17789},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.17789},
}
Figure