SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2601.03955 · 2026

ResTok: Learning Hierarchical Residuals in 1D Visual Tokenizers for Autoregressive Image Generation

Kun Gai, Huan Yang, Xu Zhang, Ming Lu, Zhan Ma, Cheng Da

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 18 functions out of this paper's own repositories and ran 10 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
Kwai-Kolors/ResTok — 10 of 18
FunctionStatusWhere it lives
Attention Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("dc0b1a5e1598b3db")
BaseModel Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("331849d453e4a146")
EmbedND Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("e5a6cad693b52a50")
EmbedNDHybrid2DMaker Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("f92ea3569a8d2a16")
EmbedNDHybridMulti2DMaker Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("df7e4e4587a3a993")
VectorQuantizer Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("ae6827aeaa6c2f91")
build_hierarchical_causal_mask Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("9b90fac7ef321810")
multi_level_1d_features_to_2d_maps_avg Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("8d096c594b535eea")
rope Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("17724d4203fa5863")
sample_multi_level_1d_tokens Ran Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("88f9ed95e47dbf7d")
DownsamplingBlock Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("fb1dd34f22935870")
ResTok Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("666149bd0f290f52")
ResTokDecoder Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("6b02763c63ccc2bf")
ResTokEncoder Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("51c9fbe126e5f0be")
ResTokTransformerBlock Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("6d4d68d101ba1d9f")
TransformerBlock Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("031fee67ad484ab8")
apply_rope Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("3444bbcc9065f707")
apply_rope_single Not yet run Kwai-Kolors/ResTok/modeling/restok.py
code served (permissive licence) · get_code("2fa3d7da1cf96e21")

Repositories linked to this paper

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

Abstract

Existing 1D visual tokenizers for autoregressive (AR) generation largely follow the design principles of language modeling, as they are built directly upon transformers whose priors originate in language, yielding single-hierarchy latent tokens and treating visual data as flat sequential token streams. However, this language-like formulation overlooks key properties of vision, particularly the hierarchical and residual network designs that have long been essential for convergence and efficiency in visual models. To bring "vision" back to vision, we propose the Residual Tokenizer (ResTok), a 1D visual tokenizer that builds hierarchical residuals for both image tokens and latent tokens. The hierarchical representations obtained through progressively merging enable cross-level feature fusion at each layer, substantially enhancing representational capacity. Meanwhile, the semantic residuals between hierarchies prevent information overlap, yielding more concentrated latent distributions that are easier for AR modeling. Cross-level bindings consequently emerge without any explicit constraints. To accelerate the generation process, we further introduce a hierarchical AR generator that substantially reduces sampling steps by predicting an entire level of latent tokens at once rather than generating them strictly token-by-token. Extensive experiments demonstrate that restoring hierarchical residual priors in visual tokenization significantly improves AR image generation, achieving a gFID of 2.34 on ImageNet-256 with only 9 sampling steps. Code is available at https://github.com/Kwai-Kolors/ResTok.

For agents

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

get_harvested_code_for_paper("2601.03955")
get_code_for_paper("2601.03955")
have("2601.03955")

Connect an agent — have() is free.