Skip to content
AI.info

Research

UniFlow: A Unified Pixel Flow Tokenizer for Visual Understanding and Generation

Overview Research area: Computer vision / multimodal machine learning, specifically unified visual tokenizers that serve both visual understanding (VQA, classification, segmentation, detection, depth)

arXiv
2510.10575
Published
2025-10-12
Authors
Zhengrong Yue, Haiyu Zhang, Xiangyu Zeng, Boyu Chen, Chenting Wang, Shaobin Zhuang, Lu Dong, Yi Wang, Limin Wang, Yali Wang

AI summary

Overview

  • Research area: Computer vision / multimodal machine learning, specifically unified visual tokenizers that serve both visual understanding (VQA, classification, segmentation, detection, depth) and visual generation (image synthesis, image reconstruction).
  • Technical level: Intermediate. The paper builds on vision transformers, self-distillation, and flow matching, but its core idea can be understood without deep mathematical background.
  • One-sentence scope: UniFlow is a single tokenizer that adapts any pretrained vision encoder with a lightweight patch-wise pixel flow decoder, aiming to remove the long-standing trade-off between semantic understanding and high-fidelity reconstruction.

What This Paper Is About

Most vision systems use one tokenizer for understanding tasks and a different one for generation tasks, and those two tokenizers optimize conflicting objectives: understanding needs high-level semantic abstraction, while generation needs low-level pixel detail. Existing unified tokenizers either add redundant dual encoders, freeze a semantic encoder and rely on a pretrained VAE decoder, or finetune a single encoder for both goals, and each approach sacrifices one side of the trade-off. UniFlow's goal is to unify both capabilities in one tokenizer while also improving training efficiency.

Key Contributions

  1. A generic unified tokenizer (UniFlow) that flexibly adapts any pretrained visual encoder, whether a standalone vision foundation model or the visual backbone of a multimodal LLM, using a concise reconstruction decoder. The paper reports adaptation in only 30 ImageNet training epochs.
  2. Layer-wise adaptive self-distillation, applied to a well-pretrained visual encoder, which preserves hierarchical semantic features for understanding while allowing the encoder to flexibly acquire fine-grained detail for generation. Distillation strength is set per layer using a hierarchical prior combined with an alignment penalty.
  3. A lightweight patch-wise pixel flow decoder that models a conditional flow directly in pixel space, bypassing the ceiling imposed by pretrained VAE decoders, avoiding multi-loss training (GAN, L1, L2, LPIPS), and enabling single-step decoding.
  4. Extensive evaluation across 13 benchmarks and 7 tasks covering visual question answering, image classification, semantic segmentation, depth estimation, object detection, image generation, and image reconstruction, demonstrating a claimed win-win outcome.

Main Findings

  • Understanding beat larger models with fewer parameters and less data: The 7B UniFlow-XL surpasses the 14B TokenFlow-XL by 6.05% on average understanding benchmarks, despite being trained with 40% less data. UniFlow-XL reaches POPE 89.81, GQA 65.86, TextVQA 81.59, MMVet 54.0, MMBench 83.50, MME-S 2063.0, MME-P 1513.7, for an average of 79.09, compared with TokenFlow-XL's average of 73.04.
  • The LLaVA-v1.5-setting variants are the strongest among unified tokenizers: UniFlow-LV with InternViT-300M and Vicuna-7B reaches POPE 88.97 and MME-P 1505.1, the highest in that group; the DFN-CLIP-L, SigLIP2-SO400M, and DINOv2-L variants score averages of 65.02, 67.87, and 58.92 respectively.
  • Reconstruction is state of the art among unified tokenizers and competitive with generative-only tokenizers: On 256×256 ImageNet-1K, UniFlow with InternViT reaches PSNR 33.23, SSIM 0.96, and rFID 0.26, beating UniTok (rFID 0.41) by 0.15 and SD-VAE by 0.41 in rFID. On MS-COCO 2017 it reaches PSNR 32.48, SSIM 0.95, rFID 1.88. On MS-COCO, UniTok is not listed, so no direct comparison is reported there.
  • Reconstruction holds at each teacher's native resolution: UniFlow with InternViT at 448 reaches PSNR 32.48, SSIM 0.95, rFID 0.28, versus SD-VAE-XL at 448 with PSNR 27.49, SSIM 0.7747, rFID 0.51. At 224, UniFlow (CLIP) reaches 29.01 / 0.91 / 0.36 versus SD-VAE-XL's 25.72 / 0.75 / 0.90.
  • Text-to-image generation improves over a strong baseline and a larger competitor: A 0.6B UniFlow model trained on ImageNet at 256 resolution reaches GenEval 0.65 and DPG-Bench 84.76, versus SANA-0.6B (0.64 / 84.30) and the 7B TokenFlow (0.55 / 73.38).
  • Guidance-free generation improves: With MAR-L as the generator at 479M parameters, UniFlow achieves gFID 2.45 without CFG and IS 228.0, compared with MAR-VAE's gFID 2.60 and IS 221.4. With CFG, UniFlow reports gFID 1.85 and IS 290.0, while MAR-VAE reports 1.78 and 296.0.
  • Strong transfer to visual-centric tasks with a frozen encoder: Linear probing on ImageNet-1K gives 82.6% top-1 accuracy with a ViT-L backbone, above MoCo v3 by 4.5% and MAE by 6.8%. Object detection on COCO reaches 59.2 AP, outperforming MAE by +1.7 and BEiT by +3.0. Depth estimation on NYU-Depth-v2 reaches RMSE 0.324, outperforming DPT-Hybrid by +10.2%. Semantic segmentation on ADE20K reaches 55.4 mIoU, surpassing MAE by +1.8 and BEiT by +2.1.
  • Adaptive distillation is the best balancing act: With adaptive distillation (β = 2), UniFlow reports PSNR 33.23, rFID 0.26, MME-P 1513.7. Final-layer-only distillation gives better reconstruction (PSNR 33.41, rFID 0.25) but much worse understanding (MME-P 1435.6); uniform distillation gives better understanding (MME-P 1518.2) but worse reconstruction (PSNR 30.77, rFID 0.45); progressive weighting (β = 0) gives 31.91 / 0.38 / 1495.3.
  • Loss balance reveals the trade-off: With λd:λf of 1:0 only MME-P is reported (1478.6); 10²:1 gives MME-P 1521.4 with PSNR 26.57 and rFID 0.62; 1:1 gives 1513.7 / 32.48 / 0.26; 1:10² gives 1453.0 / 32.88 / 0.22; 0:1 gives MME-P 817.2 with PSNR 33.69 and rFID 0.19. The paper states the balanced setting gains 35.1 MME-P points over the distillation-only baseline.
  • Decoder design is the largest single lever: A plain pixel decoder (D_pixel) gives PSNR 25.12, SSIM 0.7245, rFID 1.89. A latent flow decoder gives 26.48 / 0.7362 / 0.72. A pixel flow decoder gives 30.15 / 0.9124 / 0.51, and adding global transformer blocks gives 33.23 / 0.9636 / 0.26.
  • Qualitative evidence for retained semantics: t-SNE plots show UniFlow's feature space forms class clusters comparable to InternViT while SD-VAE XL does not, and PCA visualizations indicate UniFlow preserves clearer object contours. In one fine-grained VQA example, LLaVA-v1.5 with InternViT misidentifies a cat as a dog, while LLaVA-v1.5 with UniFlow answers correctly.

Methodology in Plain English

The system is an autoencoder with two parts: a unified encoder and a lightweight flow-based decoder.

The encoder starts from an already-strong pretrained vision model (the paper uses DFN-CLIP ViT-L/14-224, SigLIP2 ViT-L/16-256, DINOv2 ViT-L/14-378, and InternViT-300M/14-448 taken from InternVL3-2B-Instruct). Instead of finetuning it purely for reconstruction, which would damage its semantics, the researchers keep a frozen copy of the same model as a teacher and train the student to match it layer by layer. Crucially, the strength of this matching varies per layer: a base weight increases with depth (deeper layers matter more for semantics), and this is modulated by an alignment penalty that measures how far the student's tokens have drifted from the teacher's at that layer. A temperature parameter β controls how much weight poorly aligned layers receive; β = 2 is the default.

For generation, instead of decoding through a pretrained VAE, the decoder learns a velocity field directly in pixel space using Rectified Flow. A pixel patch is linearly interpolated between the real patch and Gaussian noise at a random time t, and the network predicts the constant velocity (noise minus the real patch), giving a simple mean-squared-error objective. Because decoding is done patch by patch, tokens cannot see each other, which creates "grid artifacts"; the authors counter this with six global transformer blocks that mix information across all tokens and produce globally coherent condition tokens, followed by an MLP head. The paper uses latent dimension d̂ = 64 and adds position embeddings before the transformer blocks.

Training combines the distillation loss and the flow loss with weights λd and λf. All variants are trained for 30 epochs with global batch size 512 at a fixed learning rate of 2e-4, and all reported reconstruction results use one-step Euler inference.

Data used includes the 1.2M ImageNet-1K training set for tokenizer adaptation, the ImageNet-50K validation set and MS-COCO 2017 validation set for reconstruction, Pretrain-558K and Instruction-665K for multimodal understanding, and an approximately 6M subset of LLaVA-OneVision for UniFlow-XL. For text-to-image, a Multimodal Diffusion Transformer was initialized from SANA-0.6B using a two-stage strategy from DC-Gen, with a UniFlow(SigLIP2)-f16c32 tokenizer whose latent space was aligned using DINOv2. For class-conditional generation, MAR-L was trained on ImageNet-1K with UniFlow(InternViT), generating at 448 resolution and resizing to 256 for evaluation. Experiments ran on A800 GPUs with PyTorch; the exact number of GPUs is not reported.

Why This Matters

  • Impact on research: The paper targets a structural bottleneck in unified multimodal models. If one tokenizer can serve both understanding and generation without degrading either, the standard practice of maintaining separate visual front-ends, or paying for redundant dual encoders and multi-stage training, becomes unnecessary. The reported result that a 7B model beats a 14B model on understanding suggests the approach may also shift scaling assumptions for unified systems.
  • Real-world applications:
    • Multimodal assistants that must both answer detailed questions about an image and generate or edit images, using one visual front-end.
    • High-fidelity image and video compression, where the tokenizer's reconstruction quality (rFID, PSNR, SSIM) directly determines fidelity.
    • Medical, industrial, or satellite imaging pipelines that need precise dense prediction (segmentation, depth) and image synthesis from the same representation.
    • Content creation tools that need to reason about a reference image and produce new images grounded in it.
  • Industry relevance: Because UniFlow is presented as a general adaptation paradigm that fits any pretrained encoder, whether a standalone vision foundation model or the visual backbone of an existing multimodal LLM, it can be layered onto models companies already have. The 30-epoch ImageNet adaptation budget and single-step decoding reduce the compute and latency cost that usually accompanies diffusion-based tokenizers.

Future Directions

  • Scaling beyond the studied configurations: The paper evaluates encoders ranging from ViT-L variants to InternViT-300M and a 7B MLLM, but does not report results with much larger vision backbones or larger generative generators beyond MAR-L at 479M and the 0.6B MMDiT.
  • Efficiency accounting: Training cost, inference latency numbers, and GPU counts are not reported, so the practical efficiency advantage relative to dual-encoder or VAE-based pipelines remains to be quantified.
  • Resolving the remaining trade-off: The loss-balance ablation shows understanding and reconstruction still pull against each other (MME-P 1521.4 at PSNR 26.57 versus MME-P 817.2 at PSNR 33.69), so the frontier of this balance is not closed.
  • Generalization of the distillation scheme: The default β = 2 and the layer-wise weighting formula are studied mainly on the four listed teachers; whether the same hyperparameters transfer to other encoder families or architectures is not established.
  • Video and broader modalities: The paper reports only image reconstruction and generation at 256 and 448 resolutions; extension to temporal or multi-frame data is not addressed.

Target Audience

Researchers and engineers working on multimodal large language models, unified vision tokenizers, vision foundation models, and diffusion or flow-matching generative models. It is also relevant to practitioners who need one visual representation to serve both discriminative and generative downstream tasks, and to readers interested in self-distillation strategies for preserving pretrained encoder semantics. Readers without background in vision transformers or flow matching will need to consult the cited prior work for the underlying methods.

Authors’ abstract

Tokenizer is a crucial component for both visual understanding and generation. To advance toward the ultimate goal of universal modeling, recent research has focused on developing a unified tokenizer. However, existing tokenizers face a significant performance trade-off between understanding and generation, stemming from the inherent conflict between high-level semantic abstraction and low-level pixel reconstruction. To tackle this challenge, we propose a generic and unified tokenizer, namely UniFlow, by flexibly adapting any visual encoder with a concise reconstruction decoder. Specifically, we introduce layer-wise adaptive self-distillation applied to the well-pretrained visual encoders, which enables UniFlow to simultaneously inherit the strong semantic features for visual understanding and flexibly adapt to model fine-grained details for visual generation. Moreover, we propose a lightweight patch-wise pixel flow decoder, which efficiently achieves high-fidelity pixel reconstruction by modeling a conditional flow from the noisy state back to the patch-wise pixel domain. By leveraging the semantic features as visual conditions for the decoder, we effectively alleviate the training conflicts between understanding and generation. Furthermore, the patch-wise learning strategy simplifies the data distribution, thereby improving training efficiency. Extensive experiments across 13 challenging benchmarks spanning 7 widely studied visual understanding and generation tasks demonstrate that UniFlow achieves a win-win outcome. For instance, our 7B UniFlow-XL not only surpasses the 14B TokenFlow-XL by 6.05% on average understanding benchmarks, but also achieves a competitive results in both visual reconstruction and generation, surpassing UniTok by 0.15 in rFID and 0.09 in gFID (without guidance), respectively.

Read the original paper