Unifying visual understanding and generation requires representations that preserve both semantic information and fine-grained image details. Continuous tokenizers trained primarily for semantic alignment may omit fine-grained reconstruction details, whereas discrete tokenizers face information loss from codebook quantization. Conventional multi-codebook designs assign every token the same number of codewords regardless of local content. We instead view codewords as reusable visual primitives whose allocation and composition adapt to each token. We introduce PrimiTok, a compositional visual tokenizer that represents each visual token through adaptive allocation and weighted composition of learned codebook primitives. PrimiTok integrates two complementary components: Diverse Quantitative Primitives (DQP), which encourages diversity among sub-codebook centroids to reduce redundancy, and a Dynamic Primitive Allocator (DPA), which selects primitives according to token complexity. Embedding quantization error supervises how many primitives are selected from each sub-codebook, and DPA aggregates them with input-dependent weights. Joint reconstruction and image--text contrastive learning encourage the resulting representations to retain visual fidelity and semantic alignment. Experiments demonstrate improved reconstruction and semantic alignment over SOTA baselines, with further evaluations on multimodal understanding and visual generation.
Figures & tables
Figure 1: Tokenization Comparisons. CT trained primarily for semantic alignment may omit fine-grained reconstruction details and often rely on auxiliary models for high-quality image synthesis. DT can lose information through codebook quantization. PrimiTok adapts primitive allocation and composition, using reconstruction and image–text contrastive learning to preserve fidelity and semantics.
Figure 2: Framework Overview. PrimiTok consists of an image encoder, a text encoder, an image decoder, and two core components, Diverse Quantitative Primitives (DQP) and a Dynamic Primitive Allocator (DPA). (a) We train PrimiTok through joint image reconstruction and image–text contrastive learning. (b) DQP encourages centroid diversity across sub-codebooks to reduce redundancy. (c) DPA adapts primitive counts and composition weights to each token chunk. The quantized chunks are concatenated into the final image embedding.
Figure 3: Comparisons of Image Reconstruction between UniTok, QLIP, and PrimiTok. Here, rFID and PSNR are evaluated on ImageNet 50k validation. PrimiTok shows superior detail preservation and perceptual fidelity over the competitors, e.g. , text on the map (Row 2) and blackboard (Row 1) is notably clearer and more faithful to the inputs.
Method
Vision Encoder
LLM
Res.
POPE
GQA
TQA
MMV
MMB
MME-S
MME-P
Avg.
Understanding-only MLLMs
LLaVA-1.5
CLIP-L
Vicuna-7B
336
85.9
62.0
46.1
31.1
64.3
–
1510.7
–
Unified Tokenizers
VILA-U †
SigLIP-SO400M
Vicuna-7B
256
81.6
–
–
–
–
–
1311.6
–
UniTok †
ViTamin-L
Vicuna-7B
256
81.7
–
–
–
–
–
1448.0
–
SemHiTok †
SigLIP-L
Vicuna-7B
256
84.2
61.0
–
–
60.3
–
1400.6
–
Table 2: Multimodal understanding. Baseline results are taken from UniFlow [ 5 ] . † denotes the LLaVA-v1.5 training setting. MME-S denotes the sum of perception and cognition scores; MME-P denotes the perception score. Both MME scores are divided by 20 for Avg.
Method
CB
MSCOCO
ImageNet-1K
rFID
PSNR
SSIM
rFID
PSNR
SSIM
LlamaGen ‡
16K
8.40
20.28
0.55
2.47
20.65
0.54
Show-o
8K
9.26
20.90
0.59
3.50
21.34
0.59
Cosmos
64K
11.97
19.22
0.48
4.57
19.93
0.49
Open-MAGVIT2
262K
6.76
22.31
0.65
1.67
22.70
0.64
IBQ
262K
6.79
22.28
0.65
1.53
22.69
0.64
Table 3: Image reconstruction on MSCOCO 2017 and ImageNet-1K. CB denotes codebook size. † indicates CLIP-pretrained initialization; ‡ indicates an ImageNet-1K-pretrained tokenizer.
Tokenizer
rFID ↓
Generator
Type
#Params.
gFID ↓
IS ↑
SD-VAE [ 48 ]
0.61
DiT [ 51 ]
Diffusion-based
675M
9.62
121.5
SiT [ 52 ]
Diffusion-based
675M
8.61
131.7
Taming-VQGAN † [ 12 ]
2.19
LlamaGen ‡ [ 15 ]
Transformer-based
1.4B
14.65
86.3
RQ-VAE [ 14 ]
3.20
RQ-Transformer [ 14 ]
Transformer-based
3.8B
7.55
134.0
ViT-VQGAN [ 13 ]
1.28
VIM-Large [ 13 ]
Transformer-based
1.7B
4.17
–
MAGE [ 53 ]
–
MAGE-ViT [ 53 ]
Transformer-based
230M
6.93
195.8
Table 4: Visual generation on ImageNet-1K without classifier-free guidance. † VQGAN tokenizer from LlamaGen [ 15 ] . ‡ Generated at 384×384 and resized to 256×256 . ⋆ Visual encoder initialized with pretrained InternViT-300M weights; generated at 448×448 and resized to 256×256 [ 5 ] .
Method
Res.
Data
Image to Text
Text To Image
Flickr30K
MSCOCO
Flickr30K
MSCOCO
R@1
R@5
R@10
R@1
R@5
R@10
R@1
R@5
R@10
R@1
R@5
R@10
EVA02-B/16
224
Merged-2B
87.9
97.8
99.2
60.0
82.7
89.1
73.9
91.1
94.7
42.2
67.5
77.1
CLIP-L/14
224
WIT400M
86.4
97.3
99.4
57.1
80.1
87.2
67.9
88.9
93.3
35.4
60.4
71.0
QLIP†
256
DC-1B
80.4
94.0
97.0
50.6
74.1
82.2
61.8
84.5
89.9
32.9
57.2
67.6
UniTok
256
DC-1B
79.5
95.6
97.3
52.4
76.4
84.4
60.8
84.4
90.3
34.8
59.6
69.9
Table 5: Zero-Shot Retrieval on Flickr30K and MSCOCO 2014. † indicates initialization with pretrained CLIP weights. ∗ denotes our reproduction. Results show that randomly initialized PrimiTok outperforms UniTok and is even comparable to CLIP-initialized QLIP.
Figure 4: Content-Adaptive Primitive Allocation. Fixed-1 assigns one primitive per token chunk, whereas PrimiTok tends to allocate more primitives to regions containing fine details and salient image content. Brighter colors indicate larger primitive counts.
Setting
Accuracy
rFID ↓
PSNR ↑
SSIM ↑
LPIPS ↓
Warm-Up Training Strategy
w/o Warm-up
63.8
0.34
24.45
0.72
0.1206
w/ Warm-up
66.5
0.37
23.93
0.71
0.1410
Primitive Allocation
Fixed-1
65.8
0.41
23.57
0.69
0.1440
Fixed-60
63.9
0.39
23.61
0.68
0.1420
Table 6: Ablation Studies on the ImageNet-1K Validation Set. Bold denotes the default configuration.