NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

An Image is Worth 32 Tokens for Reconstruction and Generation

Qihang Yu, Mark Weber, Xueqing Deng, Xiaohui Shen, Daniel Cremers, Liang-Chieh Chen

TL;DR

TiTok (Transformer-based 1-Dimensional Tokenizer) reimagines image compression by abandoning traditional 2D grids in favor of a compact 1D sequence. By representing a high-resolution image with as few as 32 discrete tokens—a 64x reduction over standard methods—it achieves state-of-the-art generation quality while running up to 410x faster than leading diffusion models.

TiTok achieves highly detailed image reconstruction and generation using only 32 tokens, significantly outperforming the efficiency of standard 256-token VQGANs.

The Problem with 2D Grids

Most modern image generation pipelines, such as Stable Diffusion or MaskGIT, do not operate directly on pixels. Instead, they rely on a "tokenizer" to compress images into a smaller, more manageable latent space. Traditionally, tokenizers like VQGAN produce a 2D grid of latent codes. For instance, a $256 \times 256$ image might be compressed into a $16 \times 16$ grid, yielding 256 tokens.

However, this 2D structure is inherently redundant. Because adjacent image patches often share similar visual features, a fixed grid forces the model to expend its "token budget" on repetitive information. Furthermore, the computational cost of Transformers scales quadratically with sequence length; the more tokens a generator must process, the slower it becomes. The core challenge is finding a way to represent an image with far fewer tokens without sacrificing the fine details required for high-quality reconstruction and generation.

The TiTok Approach

To overcome these inefficiencies, the authors introduce TiTok, shifting the paradigm from 2D grid tokenization to 1D sequence tokenization.

  • 1D Latent Sequence: Unlike prior methods, TiTok utilizes a Vision Transformer (ViT) to encode an image into a flat 1D sequence of $K$ tokens, where $K$ can be as small as 32. This breaks the rigid spatial mapping that forces a specific token to correspond to a specific image patch.
  • ViT-Based Architecture: Both the encoder and decoder leverage the ViT architecture. The encoder processes image patches alongside a set of learnable "latent tokens." It then discards the patch information, retaining only the latent tokens as the final image representation.
  • Two-Stage Training: Training a 1D tokenizer from scratch is notoriously difficult. The authors employ a "proxy code" training strategy. In the first stage, TiTok learns to predict the discrete codes of a pre-trained, high-quality 2D tokenizer (like MaskGIT-VQGAN) rather than raw pixels. In the second stage, the decoder is fine-tuned to reconstruct actual pixels, ensuring high visual fidelity.
  • Vector Quantization (VQ): Similar to its predecessors, TiTok uses a codebook to convert continuous latent vectors into discrete IDs, making them compatible with large language model-style generators.

Key Insights

  • Breaking the Grid: By transitioning to a 1D sequence, each token can learn to represent global or semantic information rather than being locked to a specific spatial square. This enables the model to exploit regional redundancies much more effectively.
  • The "32 Token" Milestone: The research demonstrates that a mere 32 tokens are sufficient for reasonable image reconstruction. While increasing the token count (up to 128) improves fine detail, the marginal gains suggest that the semantic essence of a complex photo is remarkably compact.
  • Semantics vs. Pixels: As the number of tokens decreases, they become more semantically rich. The authors proved this via linear probing, showing that a simple classifier can predict an image's category more accurately from 32 TiTok tokens than from hundreds of standard VQGAN tokens.
  • Scaling the Tokenizer, Not the Latent: A crucial finding is that scaling up the size of the tokenizer model (e.g., using ViT-Large instead of ViT-Small) allows for a smaller latent representation without sacrificing output quality.

Results and Performance

Evaluated primarily on the ImageNet-1K benchmark, TiTok sets a new standard for the efficiency-quality trade-off in generative AI:

  • Generation Quality: On ImageNet $256 \times 256$, TiTok achieved a 1.97 gFID, significantly outperforming the MaskGIT baseline (6.18 gFID) while using 8x fewer tokens.
  • High-Resolution Dominance: At $512 \times 512$ resolution, TiTok outperformed the state-of-the-art diffusion model (DiT-XL/2) with a gFID of 2.13 vs. 3.04.
  • Massive Speedups: Because the generator processes only 32 or 64 tokens instead of thousands, generation is 410x faster than DiT-XL/2 at $512 \times 512$ resolution, and 254x faster than LDM-4 at $256 \times 256$ resolution.
  • Throughput: TiTok can generate over 100 samples per second on a single A100 GPU, a stark contrast to traditional diffusion models that often generate less than one sample per second.

Limitations and Future Work

While TiTok represents a significant breakthrough in efficiency, the authors note a few areas for future exploration:

  • Generator Specificity: Current results focus on Masked Transformer generators. The authors hypothesize that 1D tokenization could also benefit Diffusion or Autoregressive models, but these experiments remain for future work.
  • Training Complexity: The two-stage training process with proxy codes, while effective, adds complexity to the pipeline compared to standard pixel-reconstruction loss methods.
  • Modality Expansion: The current study focuses on static natural images. Extending this redundancy-aware 1D tokenization to video—where temporal redundancy is exceptionally high—is a highly promising next step.

Summary updated

BibTeX
@inproceedings{yu2024image,
  author = {Qihang Yu and Mark Weber and Xueqing Deng and Xiaohui Shen and Daniel Cremers and Liang-Chieh Chen},
  title = {{An Image is Worth 32 Tokens for Reconstruction and Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=tOXoQPRzPL},
}
Figure