SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.20321 · NeurIPS · 2025

UniTok: A Unified Tokenizer for Visual Generation and Understanding

Xin Yu, Xiaojuan Qi, Yi Jiang, Zehuan Yuan, Jihan Yang, Chuofan Ma, Junfeng Wu, Bingyue Peng

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (9 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2502.20321.json · badge: /api/ran/2502.20321.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
FoundationVision/UniTok canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
foundationvision/unitok community
Papers with Code archive
10 ran · 3 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
AttnProjection Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("134e8fce743a76a0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AttnProjection: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from functools import partial
from timm.models.layers import get_norm_layer

torch.manual_seed(0)

ARGS = {
    'in_dim': 4,
    'out_dim': 8,
    'num_heads': 2,
    'norm_layer': nn.LayerNorm,
    'mlp_ratio': 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttnProjection — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AttnProjection output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GeGluMlp Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("1d52d9cc8d6405fe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, GeGluMlp: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from functools import partial
from timm.models.layers import get_norm_layer

torch.manual_seed(0)

ARGS = {
    'in_features': 4,
    'hidden_features': 8,
    'act_layer': None,
    'drop': 0.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GeGluMlp — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GeGluMlp output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
InvMbConvLNBlock Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("925747adc8e48ca7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, InvMbConvLNBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math
from functools import partial
from timm.layers.norm_act import _create_act
from timm.models._manipulate import checkpoint_seq, named_apply
from timm.models.layers import DropPath
from timm.models.layers import create_conv2d, get_norm_act_layer, get_norm_layer, make_divisible

torch.manual_seed(0)

ARGS = {
    'in_chs': 4,
    'out_chs': 8,
    'stride': 1,
    'drop_path': 0.1,
    'kernel_size': 3,
    'norm_layer': 'layernorm2d',
    'norm_eps': 1e-6,
    'act_layer': 'gelu',
    'expand_ratio': 4.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type InvMbConvLNBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a InvMbConvLNBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
InvStem Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("04d969cadbc4e6f5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, InvStem: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from functools import partial
from timm.models.layers import get_norm_act_layer

torch.manual_seed(0)

ARGS = {
    'in_chs': 3,
    'out_chs': 64,
    'act_layer': 'gelu',
    'norm_layer': 'layernorm2d',
    'norm_eps': 1e-6,
    'bias': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type InvStem — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a InvStem output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
NormalizedEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("c7585f75fa769b15")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, NormalizedEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'num_embeddings': 10,
    'embedding_dim': 4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NormalizedEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a NormalizedEmbedding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PlainAttention Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("329e243c3200b380")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PlainAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_dim": 8,
    "out_dim": 4,
    "num_heads": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PlainAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PlainAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Upsample2d Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("aadb57a18aa01718")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Upsample2d: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'dim_out': 8
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Upsample2d — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Upsample2d output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("150dd2792a2bcac8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, VectorQuantizer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

# The function signature for VectorQuantizer.__init__ is:
# def __init__(self, vocab_size: int, vocab_width: int, beta: float=0.25, use_entropy_loss=False, entropy_temp=0.01):

ARGS = {
    'vocab_size': 8,
    'vocab_width': 4,
    'beta': 0.25,
    'use_entropy_loss': False,
    'entropy_temp': 0.01,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VectorQuantizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VectorQuantizer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
VectorQuantizerM Ran
ran on a synthesized input · constructed an object; no result was computed
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("3ce435874422947f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, VectorQuantizerM: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The VectorQuantizerM class needs:
# - vocab_size: int
# - vocab_width: int
# - beta: float (default 0.25)
# - use_entropy_loss: bool (default False)
# - entropy_temp: float (default 0.01)
# - num_codebooks: int (default 16)

ARGS = {
    'vocab_size': 64,
    'vocab_width': 16,
    'beta': 0.25,
    'use_entropy_loss': False,
    'entropy_temp': 0.01,
    'num_codebooks': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VectorQuantizerM — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VectorQuantizerM output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
creat_optimizer Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from thu-ml/GFT
pointer only · get_code("ba65976c1d96a7cb")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_cosine_scheduler Ran
ran; our contract draft was wrong, not the code
FoundationVision/UniTok/eval/llamagen/autoregressive/train/train_c2i.py
code served (permissive licence) · get_code("a8580707adda13dd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned LambdaLR. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Create a simple model
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = optim.SGD(model.parameters(), lr=0.0001)

# Define arguments
ARGS = {
    "optimizer": optimizer,
    "num_training_steps": 1000,
    "num_cycles": 0.5,
    "last_epoch": -1,
    "base_lr": 0.0001,
    "end_lr": 0.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_entropy_loss Ran
ran; our contract draft was wrong, not the code
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("b9ad16069d39de05")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# latent_embed: tensor of shape (batch_size, embedding_dim)
# Used in: square().sum(dim=1, keepdim=True), addmm_ with codebook_embed.T
latent_embed = torch.randn(2, 4)

# codebook_embed: tensor of shape (codebook_size, embedding_dim)
# Used in: square().sum(dim=1, keepdim=False), .T for transpose in addmm_
codebook_embed = torch.randn(3, 4)

# inv_entropy_tau: scalar (inverse temperature)
# Used in: mul_ operation on logits
inv_entropy_tau = 1.0

ARGS = {
    "latent_embed": latent_embed,
    "codebook_embed": codebook_embed,
    "inv_entropy_tau": inv_entropy_tau,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
UniTok Not yet run
unverified (harvested, no recorded run)
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("0201eaaed93053b2")
How it ran

no invocation recorded.

ViTaminDecoder Not yet run
unverified (harvested, no recorded run)
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("694e2f6925e2eea4")
How it ran

no invocation recorded.

_init_conv Not yet run
unverified (harvested, no recorded run)
foundationvision/unitok/models/unitok.py
code served (permissive licence) · get_code("a0df8fea0fc36b20")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
creat_optimizer 4 other papers
3 dated earlier, 1 later
2410.09347 (2024-10)
Toward Guidance-Free AR Visual Generation via Condition Contrastive Alignment
2411.06070 (2024-11)
GFT: Graph Foundation Model with Transferable Tree Vocabulary
2501.15420 (2025-01)
Visual Generation Without Guidance
and 1 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Visual generative and understanding models typically rely on distinct tokenizers to process images, presenting a key challenge for unifying them within a single framework. Recent studies attempt to address this by connecting the training of VQVAE (for autoregressive generation) and CLIP (for understanding) to build a unified tokenizer. However, directly combining these training objectives has been observed to cause severe loss conflicts. In this paper, we show that reconstruction and semantic supervision do not inherently conflict. Instead, the underlying bottleneck stems from limited representational capacity of discrete token space. Building on these insights, we introduce UniTok, a unified tokenizer featuring a novel multi-codebook quantization mechanism that effectively scales up the vocabulary size and bottleneck dimension. In terms of final performance, UniTok sets a new record of 0.38 rFID and 78.6% zero-shot accuracy on ImageNet. Besides, UniTok can be seamlessly integrated into MLLMs to unlock native visual generation capability, without compromising the understanding performance. Additionally, we show that UniTok favors cfg-free generation, reducing gFID from 14.6 to 2.5 on ImageNet 256×256 benchmark. GitHub: https://github.com/FoundationVision/UniTok. VQVAE+CLIP UniTok (Ours) Reconstruction and Understanding Performance Figure 1: The major challenge in unified tokenizer training. CLIP supervision cannot be easily incorporated into VQVAE training -This provides only marginal improvements in understanding performance, while drastically degrading reconstruction FID.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2502.20321")
get_code_for_paper("2502.20321")
have("2502.20321")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2502.20321.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2502.20321.svg)](https://syntology.ai/paper/2502.20321)

Connect an agent — have() is free.