Papers › Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet

Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet

28 Jan 2021ICCV 2021 10arXiv:2101.11986archive 2025-07-28

Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, Shuicheng Yan

Transformers, which are popular for language modeling, have been explored for solving vision tasks recently, e.g., the Vision Transformer (ViT) for image classification. The ViT model splits each image into a sequence of tokens with fixed length and then applies multiple Transformer layers to model their global relation for classification. However, ViT achieves inferior performance to CNNs when trained from scratch on a midsize dataset like ImageNet. We find it is because: 1) the simple tokenization of input images fails to model the important local structure such as edges and lines among neighboring pixels, leading to low training sample efficiency; 2) the redundant attention backbone design of ViT leads to limited feature richness for fixed computation budgets and limited training samples. To overcome such limitations, we propose a new Tokens-To-Token Vision Transformer (T2T-ViT), which incorporates 1) a layer-wise Tokens-to-Token (T2T) transformation to progressively structurize the image to tokens by recursively aggregating neighboring Tokens into one Token (Tokens-to-Token), such that local structure represented by surrounding tokens can be modeled and tokens length can be reduced; 2) an efficient backbone with a deep-narrow structure for vision transformer motivated by CNN architecture design after empirical study. Notably, T2T-ViT reduces the parameter count and MACs of vanilla ViT by half, while achieving more than 3.0% improvement when trained from scratch on ImageNet. It also outperforms ResNets and achieves comparable performance with MobileNets by directly training on ImageNet. For example, T2T-ViT with comparable size to ResNet50 (21.5M parameters) can achieve 83.3% top1 accuracy in image resolution 384×384 on ImageNet. (Code: https://github.com/yitu-opensource/T2T-ViT)

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2101.11986")

Code

Syntology Ran 21 of 26 code samples harvested from 6 repositories linked to this paper; 5 have no recorded run. Of those that ran: 1 ran · honoured contract; 20 ran with no contract checked.

By repository: official repository: 6 samples from 1 repository, 4 ran; community (archive-listed): 20 samples from 5 repositories, 17 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

13 repositories listed; official and paper-mentioned ones first.

yitu-opensource/T2T-ViT officialmentioned in papermentioned on GitHubpytorch report
KaenChan/ProbFace mentioned on GitHubtf report
Shaunlipy/T2T_VIT mentioned on GitHubpytorch report
ahmedelmahy/myownvit mentioned on GitHubpytorch report
tianhai123/vit-pytorch mentioned on GitHubpytorch report
ttt496/vit-pytorch mentioned on GitHubpytorch report
zhl98/T2T_paddle mentioned on GitHubpaddle report
PaddlePaddle/PASSL paddleApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

26 samples harvested; 21 ran; 1 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
20ran
5unverified

Licence: 8 of the 26 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 6 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Attention yitu-opensource/T2T-ViT/models/t2t_vit.py official repository ran licence not identified · pointer only · bb63e3aa0e13762e · report
T2T_module yitu-opensource/T2T-ViT/models/t2t_vit.py official repository ran fingerprinted licence not identified · pointer only · 5284a1760a5fa238 · report
Token_performer yitu-opensource/T2T-ViT/models/t2t_vit.py official repository ran licence not identified · pointer only · 755008532b287d3b · report
Token_transformer yitu-opensource/T2T-ViT/models/t2t_vit.py official repository ran licence not identified · pointer only · 2ec03ab6d47405ef · report
Block yitu-opensource/T2T-ViT/models/t2t_vit.py official repository unverified licence not identified · pointer only · 4e7b29e9c82cf102 · report
T2T_ViT yitu-opensource/T2T-ViT/models/t2t_vit.py official repository unverified licence not identified · pointer only · cd6a8b763f979637 · report
Attention ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 26b673d7f271bb3d · report
Attention conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · c5be8ba345dd9a2b · report
Attention tianhai123/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 6f1ffa7354716396 · report
FeedForward ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · c17d96c99b861de1 · report
FeedForward conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · b261477eb5f9d3a4 · report
PreNorm ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 005532cda6b215dd · report
PreNorm conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · da6e96393b45305a · report
RearrangeImage ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran fingerprinted MIT (permissive) · c0c9235b40027a60 · report
RearrangeUnfoldTransformer conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · e21b062fec33b4d7 · report
T2TViT ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran MIT (permissive) · f8c201eeb0cfec0a · report
T2TViT conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 55d063282d6be0d2 · report
T2TViT ahmedelmahy/myownvit/vit_pytorch/t2t.py community (archive-listed) ran fingerprinted MIT (permissive) · 7e22b681466bb3b8 · report
T2T_module Shaunlipy/T2T_VIT/models/t2t_vit.py community (archive-listed) ran fingerprinted licence not identified · pointer only · ee29036e4296eef5 · report
Transformer ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 517882a6d04b7940 · report
Transformer conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 3b4d51835157c831 · report
Transformer tianhai123/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · 6f5a43d0a77a9794 · report
conv_output_size ttt496/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · 2160b3abdb219b68 · report
IdentityLayer conceptofmind/Token-to-Token-ViT-flax/t2t.py community (archive-listed) unverified MIT (permissive) · e38ae21b52d727dd · report
T2TViT tianhai123/vit-pytorch/vit_pytorch/t2t.py community (archive-listed) unverified MIT (permissive) · 2ecf8983d7a2547b · report
T2T_ViT Shaunlipy/T2T_VIT/models/t2t_vit.py community (archive-listed) unverified licence not identified · pointer only · 7e2445af0025404a · report

Tasks

Image ClassificationLanguage ModelingLanguage Modellingimage-classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification ImageNet T2T-ViT-14|384 GFLOPs 34.2 #436 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-14|384 Top 1 Accuracy 83.3% #436 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-24 GFLOPs 30 #525 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-24 Number of params 64.4M #525 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-24 Top 1 Accuracy 82.6% #525 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-24 GFLOPs 27.6 #548 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-24 Top 1 Accuracy 82.3% #548 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-19 GFLOPs 19.6 #562 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-19 Number of params 39.2M #562 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViTt-19 Top 1 Accuracy 82.2% #562 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-19 GFLOPs 17.0 #593 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-19 Top 1 Accuracy 81.9% #593 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-14 GFLOPs 9.6 #636 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-14 Number of params 21.5M #636 of 1060 Archive leaderboard report
Image Classification ImageNet T2T-ViT-14 Top 1 Accuracy 81.5% #636 of 1060 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

1x1 ConvolutionAbsolute Position EncodingsAdamAttentionAverage PoolingBPEBatch NormalizationConvolutionDense ConnectionsDepthwise ConvolutionDepthwise Separable ConvolutionDropoutGhost BottleneckGhost ModuleGhostNetGlobal Average PoolingLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPointwise ConvolutionPosition-Wise Feed-Forward LayerReLUResidual ConnectionSigmoid ActivationSoftmaxSqueeze-and-Excitation BlockT2T-ViTTransformerVision Transformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections