UniTok: a Unified Tokenizer for Visual Generation and Understanding

Chuofan Ma, Yi Jiang, Junfeng Wu, Jihan Yang, Xin Yu, Zehuan Yuan, Bingyue Peng, Xiaojuan Qi

TL;DR

UniTok is a unified visual tokenizer that masters both image generation and semantic understanding within a single framework. By introducing a novel multi-codebook quantization mechanism, it overcomes the "representational bottleneck" of discrete tokens, achieving a record-breaking 0.38 rFID and 78.6% zero-shot accuracy on ImageNet.

The Tokenizer Divide

In the world of Multimodal Large Language Models (MLLMs), there has long been a "tokenizer divide." Models designed to understand images (like CLIP) typically use continuous features, while models designed to generate images (like VQVAE) rely on discrete tokens.

When researchers attempt to combine these into a single "unified" tokenizer, they usually hit a wall: adding semantic supervision (CLIP-style) tends to drastically degrade reconstruction quality (VQVAE-style). Previously, this was blamed on "loss conflict"—the assumption that pixel-level reconstruction and high-level semantics simply do not mix. This paper challenges that assumption, arguing that the real culprit is not the loss functions, but the limited representational capacity of the discrete token space itself.

Comparison of VQVAE, VQVAE+CLIP, and UniTok architectures alongside their reconstruction (rFID) and understanding (VQA) performance.

The UniTok Solution

The authors introduce UniTok, which utilizes two primary innovations to expand the capacity of discrete tokens and resolve the apparent loss conflict:

  1. Multi-Codebook Quantization (MCQ): Instead of trying to map a high-dimensional image feature to a single entry in one massive codebook, UniTok splits the feature into several "chunks." Each chunk is quantized using its own smaller sub-codebook. This "divide-and-conquer" strategy exponentially increases the theoretical vocabulary size (e.g., from $2^{14}$ to $2^{56}$ combinations) without the optimization headaches of a giant monolithic codebook.
  2. Attention Projection: Traditional tokenizers use simple linear layers to compress features before quantization. UniTok replaces these with adapted multi-head attention modules. This allows the model to preserve rich semantic information even when compressing the feature dimension (e.g., from 768-d down to 64-d).

The model is trained using a joint objective: a VQVAE-based reconstruction loss to keep the pixels sharp, and an image-text contrastive loss to keep the semantics meaningful.

Key Insights and Results

UniTok was trained on DataComp-1B (1.28 billion image-text pairs) and evaluated across a wide array of generation and understanding benchmarks, yielding several major insights:

  • The "Loss Conflict" is a Myth: As shown in the performance charts, reconstruction and semantic supervision do not inherently fight each other. When the token space is large enough (via MCQ), both metrics can thrive simultaneously.
  • State-of-the-Art Reconstruction: UniTok achieved a 0.38 rFID on ImageNet, outperforming even the continuous VAE used in Stable Diffusion v2.1.
  • Strong Understanding: It reached 78.6% zero-shot accuracy on ImageNet, rivaling dedicated understanding models like CLIP.
  • Superior MLLM Integration: When plugged into a Llama-2-7B backbone, UniTok outperformed other unified baselines (like Liquid and VILA-U) across multiple VQA benchmarks, including a massive 339-point lead on the MME perception score.
  • CFG-Free Generation: One of the most striking findings is that adding semantic supervision structures the latent space so well that the model can generate high-quality images without Classifier-Free Guidance (CFG). In class-conditional generation, UniTok reduced the generation FID (gFID) from 14.6 to 2.5 when guidance was removed, saving significant computational overhead.

Limitations and Future Work

The authors acknowledge that due to limited computational resources, UniTok was only trained for one epoch. They believe that extending the training schedule would further improve the semantic representation. Additionally, while UniTok significantly narrows the gap between discrete and continuous tokenizers for understanding, a small performance gap still exists compared to the very best continuous models. Future work may focus on further scaling the codebook architecture or exploring more sophisticated attention mechanisms for token factorization.

Summary updated

BibTeX
@inproceedings{ma2025unitok,
  author = {Chuofan Ma and Yi Jiang and Junfeng Wu and Jihan Yang and Xin Yu and Zehuan Yuan and BINGYUE PENG and XIAOJUAN QI},
  title = {{UniTok: a Unified Tokenizer for Visual Generation and Understanding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=f6aOPkGE8L},
}
Figure