Abstract
TokenFlow introduces a unified image tokenizer that bridges the gap between multimodal understanding and high-quality image generation. By employing a dual-codebook architecture with shared mapping, TokenFlow decouples high-level semantics from low-level pixel details while maintaining perfect alignment through a single set of discrete tokens. Experimental results demonstrate that TokenFlow-XL (14B) outperforms existing continuous-feature models in perception tasks while achieving state-of-the-art performance in autoregressive image generation, comparable to diffusion-based models like SDXL.
Introduction
In the development of Multimodal Large Language Models (MLLMs), a significant "representation divide" has persisted between perception and creation. Understanding tasks require high-level semantic features to identify objects and context, whereas generation tasks demand fine-grained, low-level details to reconstruct sharp, textured images. Historically, models have favored one over the other: continuous features (e.g., CLIP) excel at understanding but struggle with generation, while discrete Vector Quantization (VQ) tokens often lack the semantic depth necessary for complex reasoning. TokenFlow addresses this by asking whether a single tokenizer can derive representations suitable for both domains.
The TokenFlow Architecture
The core innovation of TokenFlow is its Dual-Flow Architecture, which avoids the compromise of forcing a single encoder to capture disparate feature types. Instead, it utilizes two specialized encoders:
- Semantic Encoder ($E_{sem}$): Initialized with a pre-trained CLIP model to provide robust semantic priors.
- Pixel Encoder ($E_{pix}$): Optimized to capture spatial structures and intricate textural details.
These flows are unified via a Shared Mapping mechanism. During quantization, the model identifies a single index within a dual codebook that minimizes the weighted distance for both semantic and pixel features. Consequently, every token in the vocabulary serves as a dual-pointer to both a semantic embedding and a pixel embedding. This allows the LLM to process meaning while the decoder uses the same token to render precise visual details.
To further enhance visual coherence, TokenFlow employs a Multi-step Sampling strategy during inference. This approach mitigates "image collapse"—a common issue in autoregressive models—by using an initial sampling pass followed by a refinement pass with a narrowed search space.
Experimental Results
Multimodal Understanding
TokenFlow-XL (14B) was evaluated against a comprehensive suite of benchmarks, including SEEDBench, MMVet, and MME. Remarkably, it surpassed LLaVA-1.5 13B—a strong continuous-feature baseline—by an average of 7.2% across these tasks. This demonstrates that discrete visual tokens, when properly aligned with semantic priors, can match or exceed the performance of continuous representations.
Image Generation and Reconstruction
In generation tasks, TokenFlow achieved a GenEval score of 0.55, placing it at the state-of-the-art for autoregressive models and making it competitive with diffusion-based systems like SDXL. The model also demonstrated exceptional reconstruction capabilities, achieving a Frechet Inception Distance (FID) of 0.63 on the ImageNet-1K validation set at 384×384 resolution.
Key Insights and Scalability
TokenFlow exhibits exceptional scalability, maintaining over 95% codebook utilization even with vocabularies exceeding 130,000 entries. This prevents the "codebook collapse" common in many VQ models. Furthermore, the next-scale prediction paradigm (similar to VAR) ensures high efficiency, allowing the model to generate an image in approximately 2.7 seconds on a single A100 GPU.
Conclusion
TokenFlow successfully bridges the gap between seeing and creating by unifying semantic and pixel-level representations into a single discrete token space. By decoupling the underlying embeddings while sharing a common address, the model achieves superior performance in both perception and generation. Future work may extend this dual-codebook approach to other modalities, such as video and audio, or integrate specialized codebooks for depth and surface normal estimation.
Summary updated