FoundationVision/UniTok

[NeurIPS 2025 Spotlight] A Unified Tokenizer for Visual Generation and Understanding

530

stars

8

commits

Python

primary language

Nov 14, 2025

updated

foundationvision.github.io/UniTok/
autoregressive-models
generative
generative-ai
generative-model
image-generation
image-tokenizer
large-language-models
text-to-image
tokenizer
Browse cluster: Diffusion Models & Image Generation

README

UniTok

UniTok: A Unified Tokenizer
for Visual Generation and Understanding

Chuofan Ma1,2 · Yi Jiang2† · Junfeng Wu2,3 · Jihan Yang1
Xin Yu1 · Zehuan Yuan2* · Bingyue Peng2 · Xiaojuan Qi1†*

1HKU   2ByteDance   3HUST
†project lead   *corresponding author

Paper PDF Project Page

This repo implements UniTok, a unified visual tokenizer well-suited for both generation and understanding tasks. It is compatiable with autoregressive generative models (e.g. LlamaGen), multimodal understanding models (e.g. LLaVA), and unified MLLMs (e.g. Chameleon and Liquid).

teaser

Built upon UniTok, we construct an MLLM capable of both multimodal generation and understanding with the Liquid framework, which sets a new state-of-the-art among unified autoregressive MLLMs.

teaser

News

2025-09-18: UniTok is accepted at NeurIPS 2025 as a spotlight.

2025-05-19: We find UniTok favors generation without classifier-free-guidance -- it reduces gFID (without cfg) from 14.6 to 2.51 on ImageNet 256x256 using LlamaGen-XXL as the generator. Please refer to the updated EVAL.md for more details.

2025-04-15: The gradio demo of UniTok MLLM is available on Huggingface now!

2025-04-02: A new checkpoint of UniTok is released, which has better downstream task performance by replacing the causal attention projection layer with full attention. The model weights of our unified MLLM are also available on Huggingface now!

2025-02-28: Paper, code, model, and project page for UniTok are all released.

Performance

Method#TokensrFID ↓Accuracy
VQVAE Model
VQ-GAN2564.98--
RQ-VAE2561.30--
VAR6800.90--
CLIP Model
CLIP256--76.2
SigLIP256--80.5
ViTamin256--81.2
Unified Model
TokenFlow †6801.37--
VILA-U †2561.8073.3
UniTok2560.4170.8
UniTok †2560.3878.6

† indicates the model uses pretrained CLIP weights for initialization. Although CLIP weight initialization boosts ImageNet zero-shot accuracy, we notice that random initialization leads to better downstream understanding performance. We thus release the model checkpoint of UniTok that is trained from scratch.

Model Weights

ModelRes.#TokenCode ShaperFIDCheckpoint
UniTok-Large25625616 $\times$ 16 $\times$ 80.41Download

Usage

Requirements

  • Python ≥ 3.10
  • PyTorch ≥ 2.3.1

Installation

git clone https://github.com/FoundationVision/UniTok.git
cd UniTok
pip install -r requirements.txt

Inference

Please download the checkpoint and fill in the ckpt_path.

python inference.py \
    --ckpt_path /path/to/unitok_tokenizer.pth \
    --src_img /path/to/test_img --rec_img /path/to/rec_img

Training

Configure nnodes, nproc_per_node, node_rank, master_addr, master_port in launch.sh and run:

bash launch.sh \
    --output_dir '/path/to/save/checkpoints/' \
    --train_data '/path/to/datacomp/shards/{00000000..00140146}.tar' \
    --imagenet_val '/path/to/imagenet_val/' \
    --fid_eval_src '/path/to/imagenet_reference_batch' \
    --fid_eval_dst '/path/to/save/imagenet_reconstructed_batch'

Note: For more hyper-parameter configurations, please check utils/config.py.

Unified MLLM

We show that UniTok significantly boosts the performance of unified MLLMs.

Visual Understanding Performance on VQA Benchmarks.

MethodLLMRes.VQAv2GQATextVQAPOPEMMEMM-Vet
Show-oPhi-1.5-1.3B25659.348.7-73.8948-
LiquidGemma-7B51271.358.442.481.11119-
VILA-ULlama-2-7B25675.358.348.383.9133627.7
UniTokLlama-2-7B25676.861.151.683.2144833.9

Visual Generation Performance on GenAI-Bench.

MethodTypeCountDifferCompareLogicalOverall
NegateUniversal
Show-oDiscrete Diff.0.700.620.710.510.650.60
VILA-UAutoregressive0.700.710.740.530.660.64
LiquidAutoregressive0.760.730.740.460.740.65
UniTokAutoregressive0.760.790.740.460.730.67

Please refer to EVAL.md for more details.

Evaluation

We also benchmark UniTok in terms of both understanding performance using the LLaVA framework and generation performance using the LLamaGen framework. Please refer to EVAL.md for more details.

Acknowledgement

UniTok is built upon the awesome works VAR, DataComp, Liquid, LLaVA, LlamaGen, and ViTamin.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you find this project useful, please consider citing:

@article{unitok,
  title={UniTok: A Unified Tokenizer for Visual Generation and Understanding},
  author={Ma, Chuofan and Jiang, Yi and Wu, Junfeng and Yang, Jihan and Yu, Xin and Yuan, Zehuan and Peng, Bingyue and Qi, Xiaojuan},
  journal={arXiv preprint arXiv:2502.20321},
  year={2025}
}

Contributors

machuofan

7 commits

enjoyyi00

1 commits

FoundationVision/UniTok

[NeurIPS 2025 Spotlight] A Unified Tokenizer for Visual Generation and Understanding

530

stars

8

commits

Python

primary language

Nov 14, 2025

updated

foundationvision.github.io/UniTok/
autoregressive-models
generative
generative-ai
generative-model
image-generation
image-tokenizer
large-language-models
text-to-image
tokenizer
Browse cluster: Diffusion Models & Image Generation

README

UniTok

UniTok: A Unified Tokenizer
for Visual Generation and Understanding

Chuofan Ma1,2 · Yi Jiang2† · Junfeng Wu2,3 · Jihan Yang1
Xin Yu1 · Zehuan Yuan2* · Bingyue Peng2 · Xiaojuan Qi1†*

1HKU   2ByteDance   3HUST
†project lead   *corresponding author

Paper PDF Project Page

This repo implements UniTok, a unified visual tokenizer well-suited for both generation and understanding tasks. It is compatiable with autoregressive generative models (e.g. LlamaGen), multimodal understanding models (e.g. LLaVA), and unified MLLMs (e.g. Chameleon and Liquid).

teaser

Built upon UniTok, we construct an MLLM capable of both multimodal generation and understanding with the Liquid framework, which sets a new state-of-the-art among unified autoregressive MLLMs.

teaser

News

2025-09-18: UniTok is accepted at NeurIPS 2025 as a spotlight.

2025-05-19: We find UniTok favors generation without classifier-free-guidance -- it reduces gFID (without cfg) from 14.6 to 2.51 on ImageNet 256x256 using LlamaGen-XXL as the generator. Please refer to the updated EVAL.md for more details.

2025-04-15: The gradio demo of UniTok MLLM is available on Huggingface now!

2025-04-02: A new checkpoint of UniTok is released, which has better downstream task performance by replacing the causal attention projection layer with full attention. The model weights of our unified MLLM are also available on Huggingface now!

2025-02-28: Paper, code, model, and project page for UniTok are all released.

Performance

Method#TokensrFID ↓Accuracy
VQVAE Model
VQ-GAN2564.98--
RQ-VAE2561.30--
VAR6800.90--
CLIP Model
CLIP256--76.2
SigLIP256--80.5
ViTamin256--81.2
Unified Model
TokenFlow †6801.37--
VILA-U †2561.8073.3
UniTok2560.4170.8
UniTok †2560.3878.6

† indicates the model uses pretrained CLIP weights for initialization. Although CLIP weight initialization boosts ImageNet zero-shot accuracy, we notice that random initialization leads to better downstream understanding performance. We thus release the model checkpoint of UniTok that is trained from scratch.

Model Weights

ModelRes.#TokenCode ShaperFIDCheckpoint
UniTok-Large25625616 $\times$ 16 $\times$ 80.41Download

Usage

Requirements

  • Python ≥ 3.10
  • PyTorch ≥ 2.3.1

Installation

git clone https://github.com/FoundationVision/UniTok.git
cd UniTok
pip install -r requirements.txt

Inference

Please download the checkpoint and fill in the ckpt_path.

python inference.py \
    --ckpt_path /path/to/unitok_tokenizer.pth \
    --src_img /path/to/test_img --rec_img /path/to/rec_img

Training

Configure nnodes, nproc_per_node, node_rank, master_addr, master_port in launch.sh and run:

bash launch.sh \
    --output_dir '/path/to/save/checkpoints/' \
    --train_data '/path/to/datacomp/shards/{00000000..00140146}.tar' \
    --imagenet_val '/path/to/imagenet_val/' \
    --fid_eval_src '/path/to/imagenet_reference_batch' \
    --fid_eval_dst '/path/to/save/imagenet_reconstructed_batch'

Note: For more hyper-parameter configurations, please check utils/config.py.

Unified MLLM

We show that UniTok significantly boosts the performance of unified MLLMs.

Visual Understanding Performance on VQA Benchmarks.

MethodLLMRes.VQAv2GQATextVQAPOPEMMEMM-Vet
Show-oPhi-1.5-1.3B25659.348.7-73.8948-
LiquidGemma-7B51271.358.442.481.11119-
VILA-ULlama-2-7B25675.358.348.383.9133627.7
UniTokLlama-2-7B25676.861.151.683.2144833.9

Visual Generation Performance on GenAI-Bench.

MethodTypeCountDifferCompareLogicalOverall
NegateUniversal
Show-oDiscrete Diff.0.700.620.710.510.650.60
VILA-UAutoregressive0.700.710.740.530.660.64
LiquidAutoregressive0.760.730.740.460.740.65
UniTokAutoregressive0.760.790.740.460.730.67

Please refer to EVAL.md for more details.

Evaluation

We also benchmark UniTok in terms of both understanding performance using the LLaVA framework and generation performance using the LLamaGen framework. Please refer to EVAL.md for more details.

Acknowledgement

UniTok is built upon the awesome works VAR, DataComp, Liquid, LLaVA, LlamaGen, and ViTamin.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you find this project useful, please consider citing:

@article{unitok,
  title={UniTok: A Unified Tokenizer for Visual Generation and Understanding},
  author={Ma, Chuofan and Jiang, Yi and Wu, Junfeng and Yang, Jihan and Yu, Xin and Yuan, Zehuan and Peng, Bingyue and Qi, Xiaojuan},
  journal={arXiv preprint arXiv:2502.20321},
  year={2025}
}

Contributors

machuofan

7 commits

enjoyyi00

1 commits

Languages

Python

96.3%

Shell

2.5%