TokenFlow: Unified Image Tokenizer for Multimodal Understanding and Generation

Liao Qu, Huichao Zhang, Yiheng Liu, Xu Wang, Yi Jiang, Yiming Gao, Hu Ye, Daniel K. Du, Zehuan Yuan, Xinglong Wu

TL;DR

TokenFlow introduces a novel dual-codebook image tokenizer that successfully bridges the gap between multimodal understanding and generation. By decoupling semantic and pixel-level features while aligning them through a shared mapping mechanism, it enables discrete visual tokens to outperform established continuous-feature models like LLaVA-1.5 for the first time.

What Problem Does This Paper Address?

In the current landscape of multimodal AI, there is a fundamental "granularity divide." Models designed to understand images (like LLaVA) typically use continuous features from encoders like CLIP, which excel at high-level semantics but ignore fine-grained details. Conversely, models designed to generate images (like VQGAN-based autoregressive models) use discrete tokens optimized for pixel-perfect reconstruction, which often lack the semantic richness needed for complex reasoning.

Attempts to unify these tasks into a single "next-token prediction" framework—similar to how LLMs handle text—have historically faced a critical trade-off: a tokenizer optimized for reconstruction produces poor understanding results, and vice versa. The authors of TokenFlow ask: Can a single image tokenizer derive representations suitable for both multimodal understanding and generation?

Methods

The core innovation of TokenFlow is its dual-flow architecture and shared mapping strategy.

  • Dual Encoders & Codebooks: Instead of a single encoder, TokenFlow uses a semantic encoder (initialized with a pre-trained CLIP model) and a pixel encoder. These feed into two distinct codebooks: one for high-level semantic embeddings and one for low-level pixel details.
  • Shared Mapping: This is the "secret sauce." During quantization, the model doesn't just look for the closest pixel match. Instead, it finds a single index $i^*$ that minimizes the weighted sum of distances to both codebooks: $i^* = \arg \min_i (d_{sem,i} + w_{dis} \cdot d_{pix,i})$. This forces the model to learn a universal visual vocabulary where a single token represents both "what the object is" and "what it looks like."
  • Multi-Scale VQ (MSVQ): The architecture adopts a hierarchical approach, allowing for next-scale prediction which significantly speeds up the generation process compared to traditional flat tokenization.
  • Multi-Step Sampling: To address the "image collapse" and repetitive patterns common in autoregressive generation, the authors propose a progressive refinement strategy during inference, narrowing the sampling space across multiple steps to ensure global consistency.
Overview of the TokenFlow architecture showing the dual-encoder and shared mapping mechanism.

Datasets

  • Training: The tokenizer was trained on LAION and COYO-700M. For the generative model, a curated subset of 60M high-quality images was used.
  • Understanding Benchmarks: A comprehensive suite including SEEDBench, MMVet, POPE, VQAv2, GQA, TextVQA, MMMU, MMBench, and MME.
  • Generation Benchmarks: GenEval (for text-to-image alignment) and DPG-Bench.
  • Reconstruction: Evaluated on the ImageNet-1K validation set.

Key Insights and Ideas

  • Discrete can beat Continuous: The most significant finding is that discrete tokens—long thought to be inferior for perception due to quantization noise—can actually surpass the performance of continuous features. TokenFlow-XL (14B) achieved a 7.2% average improvement over LLaVA-1.5 13B.
  • The Power of Shared Mapping: By forcing semantic and pixel features to share an index, the model achieves much higher codebook utilization (>95%) even at massive scales (131k entries). Standard VQ tokenizers often suffer from "dead" entries where most of the codebook goes unused.
  • Decoupling is Essential: The visualization in Figure 4 demonstrates that while semantic tokenizers (VQKD) cluster by meaning and pixel tokenizers (VQGAN) cluster by color/texture, TokenFlow successfully clusters by both, enabling the "best of both worlds."
Visualization of image clustering showing how TokenFlow combines semantic and low-level similarity.

Key Results

TokenFlow establishes new state-of-the-art (SOTA) benchmarks across the board:

  • Multimodal Understanding: Surpassed LLaVA-1.5 13B across multiple benchmarks (see Figure 1). With a Qwen-2.5-14B backbone, it reached an average score of 67.4.
  • Image Generation: Achieved a GenEval score of 0.55, matching the performance of SDXL while using an autoregressive paradigm. It is significantly faster than other autoregressive models, requiring only 2.7 seconds to infer an image on a single A100.
  • Reconstruction: Achieved a strong FID of 0.63 at 384×384 resolution, demonstrating that the semantic focus does not come at the cost of visual fidelity.
Figure 1. Multimodal Understanding Results with TokenFlow. We demonstrate for the first time that discrete visual input can surpass LLaVA-1.5 13B in understanding performance, achieving a 7.2% average improvement.
Qualitative examples of high-quality 256x256 images generated by TokenFlow.

Limitations and Future Work

The authors acknowledge a remaining performance gap between their discrete tokenizer and its continuous "teacher" models (like SigLIP), though this gap narrows as resolution increases.

Future work will focus on:

  1. Text-Alignment Loss: Incorporating text-alignment directly into the tokenizer training to further boost understanding.
  2. Fully Unified Training: Moving beyond separate validation to joint training on interleaved vision-language data to create a truly seamless foundation model for both perception and creation.

Summary updated

BibTeX
@inproceedings{qu2025tokenflow,
  author = {Liao Qu and Huichao Zhang and Yiheng Liu and Xu Wang and Yi Jiang and Yiming Gao and Hu Ye and Daniel K. Du and Zehuan Yuan and Xinglong Wu},
  title = {{TokenFlow: Unified Image Tokenizer for Multimodal Understanding and Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00243},
}
Figure