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 breaks the long-standing trade-off between visual understanding (CLIP) and generation (VQVAE) by revealing that their supposed "loss conflict" is actually a quantization bottleneck. By introducing multi-codebook quantization and attention-based token factorization, UniTok achieves state-of-the-art image reconstruction and zero-shot understanding within a single, unified discrete tokenizer.

What Problem Does This Paper Address?

Multimodal Large Language Models (MLLMs) like GPT-4o aim to seamlessly handle both understanding text/images and generating them. However, they are held back by a fundamental dilemma in visual tokenization. Models that understand images well typically use continuous features (like CLIP), which are difficult for language models to generate autoregressively. Conversely, models that generate images well use discrete tokenizers (like VQVAE), which discard the high-level semantic information needed for deep comprehension.

When researchers try to train a single tokenizer using both objectives (reconstruction loss + contrastive semantic loss), performance plummets. Previous literature blamed this on an inherent "loss conflict" between pixel-level details and high-level semantics. This paper challenges that assumption, demonstrating that the true culprit is the limited representational capacity of the discrete token space itself.

Figure 1: The major challenge in unified tokenizer training. CLIP supervision cannot be easily incorporated into VQVAE training – This provides only marginal improvements in understanding performance, while drastically degrading reconstruction FID.

Methods

UniTok unifies generation and understanding through a hybrid architecture (based on ViTamin-L) trained with joint VQVAE-based reconstruction and CLIP-based contrastive losses. To solve the quantization bottleneck, the authors introduce two key techniques:

  1. Multi-Codebook Quantization (MCQ): Instead of mapping a visual token to a single index in a massive monolithic codebook (which suffers from poor codebook utilization and "dead tokens"), MCQ splits each latent token vector into $n$ independent chunks. Each chunk is quantized using its own smaller sub-codebook. This exponentially scales the theoretical vocabulary size and increases the bottleneck dimension without optimization issues.
  2. Attention Projection: Standard tokenizers use simple linear or convolutional layers to compress token dimensions before quantization (factorization), which destroys semantic information. UniTok replaces these with adapted multi-head attention modules that use average pooling instead of concatenation, preserving rich semantics during channel compression.
Figure 2: An overview of UniTok. The tokenizer is trained to reconstruct the input image while aligning its discrete latent features with the text caption. For vector quantization, each visual token is split into multiple chunks, which then undergo code index lookup on corresponding sub-codebooks.

Datasets

  • Training: Pre-trained from scratch on DataComp-1B (1.28 billion image-text pairs) for the main model. An ablation variant was trained on OpenImages solely for reconstruction evaluation.
  • Evaluation:
  • Tokenizer Quality: ImageNet (reconstruction FID and zero-shot classification).
  • Understanding (VQA Benchmarks): VQAv2, GQA, TextVQA, POPE, MME, and MM-Vet.
  • Generation Benchmarks: GenAI-Bench and MJHQ-30K.

Key Insights and Ideas

  • The "Loss Conflict" is a Myth: The authors systematically isolated factorization, discretization, and joint supervision. They discovered that simply compressing the channels and mapping continuous vectors to a small discrete codebook causes the massive drop in understanding performance—not the addition of the reconstruction loss itself.
  • Divide-and-Conquer vs. Coarse-to-Fine: MCQ outperforms Residual Quantization (RQ). While RQ quantizes iteratively from coarse to fine details, MCQ splits the high-dimensional space into lower-dimensional subspaces. This reduces quantization loss by 15$\times$ to 45$\times$ because high-dimensional vector spaces are inherently sparse.
  • Semantic Regularization Aids Generation: Injecting CLIP-style semantic supervision actually structures the latent space better for autoregressive generation, making the model much less reliant on heavy classifier-free guidance (CFG) during image synthesis.
Figure 3: Roadmap from CLIP to UniTok. It is observed that major degradation in understanding performance comes from token factorization and discretization, rather than reconstruction supervision. The proposed multi-codebook quantization and attention projection effectively address this by scaling up the vocabulary size and bottleneck dimension. The VQA score is measured using the average score across the VQAv2, GQA, TextVQA, and POPE benchmarks. All tokenizers are trained from scratch on 512m image-text pairs from DataComp.

Key Results

  • State-of-the-Art Tokenization: On ImageNet, UniTok sets a new record for unified tokenizers with a reconstruction FID (rFID) of 0.38 and a zero-shot accuracy of 78.6%, even outperforming some continuous tokenizers.
  • CFG-Free Generation Leap: When integrated into the LlamaGen autoregressive generation framework, UniTok drops the generation FID (gFID) without classifier-free guidance from 14.6 down to 2.5 on ImageNet $256\times256$.
  • Downstream MLLM Excellence: Integrated into an MLLM framework, UniTok beats the discrete-tokenizer baseline (Liquid) by 5.5% on VQAv2, 9.2% on TextVQA, and 339 points on MME, narrowing the gap with continuous-only models.

Limitations and Future Work

The primary limitation acknowledged by the authors is computational resource constraints: UniTok was only trained for a single epoch on the DataComp dataset. While this was sufficient to prove the architecture's capabilities, it is insufficient for the CLIP-based semantic representation learning to fully converge. The authors anticipate that extending the training schedule will yield even stronger visual understanding performance.

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