Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

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

Tokens-to-token ViT trains vision transformers from scratch on ImageNet

  • Problem Vision transformers trail CNNs when trained from scratch on ImageNet. Plain fixed-size patch tokens miss local structure such as edges and lines, and the backbone wastes capacity.
  • Method T2T-ViT merges neighboring patch tokens over several passes, then uses a deep-narrow backbone.
  • Results T2T-ViT-14 reached 81.5% top-1 accuracy on ImageNet with 21.5M parameters and 4.8G MACs. ViT-S/16 reached 78.1% with 48.6M parameters and 10.1G MACs.

Why plain patch tokens limit ViT from scratch

ViT applies transformer layers to fixed-length patches of an image, treating each patch as a token and modeling the relations among all tokens globally.

The authors trace the gap to two properties of ViT. A hard split of the image gives tokens that cannot represent local structure such as edges and lines, so the model needs far more training samples. The attention backbone also carries redundant channels, which limits feature richness and makes training harder. To check this, the authors compared learned features of ViT-L/16 with those of ResNet50.

ResNet features build edges, lines and textures from the bottom layers upward, whereas ViT features model structure poorly, and many of its channels take a zero value.

Progressive tokenization with the T2T module

The T2T module replaces the single hard split with a loop of two steps, re-structurization and soft split, run several times so that each pass merges neighboring tokens into longer-range units. Each pass shortens the token sequence, so the final token count is fixed before the backbone sees it.

Re-structurization sends the current tokens T through a transformer layer, where the MSA and the MLP both include layer normalization, giving \( T^{\prime} = \mathrm{MLP}(\mathrm{MSA}(T)) \). The transformed tokens are then reorganized into a spatial grid, \( I = \mathrm{Reshape}(T^{\prime}) \), where \( T^{\prime} \in R^{l \times c} \), \( I \in R^{h \times w \times c} \) and \( l = h \times w \).

The soft split cuts the grid into k by k patches that overlap with overlap s and carry padding p, so each patch shares elements with its neighbors. The k minus s term acts like a convolution stride. The number of output tokens is \[ l_o = \left\lfloor \frac{h + 2p - k}{k - s + 1} \right\rfloor \times \left\lfloor \frac{w + 2p - k}{k - s + 1} \right\rfloor \], and each patch is flattened into a token of length \( c k^2 \).

Because these tokens are longer than the 16×16 patches of ViT, the T2T layers use a small channel dimension of 32 or 64 to limit MACs, and a Performer layer can replace the standard transformer layer when GPU memory is tight.

A deep-narrow backbone borrowed from CNN design

The authors adapted five CNN-derived designs to ViT: dense connections, deep-narrow versus shallow-wide layouts, channel attention, more heads in multi-head attention, and Ghost operations. Among these, a deep-narrow layout, with fewer channels per layer and more layers, reduced both model size and MACs while improving performance, and the SE channel attention helped less.

The T2T-ViT backbone takes the fixed-length tokens Tf from the T2T module, prepends a class token, adds a sinusoidal position embedding E, and runs b blocks of \( Tf_i = \mathrm{MLP}(\mathrm{MSA}(Tf_{i-1})) \). The prediction is \( y = fc(LN(Tf_b)) \), where LN is layer normalization and fc is a single fully connected layer over the class token, and the embedding \( E \in R^{(l+1) \times d} \) matches the token count and hidden dimension d.

How the model variants are sized

The T2T module uses two re-structurization steps and three soft splits with patch sizes 7, 3 and 3 and overlaps 3, 1 and 1, which reduces a 224×224 input to 14×14 tokens. The backbone uses hidden dimensions of 256 to 512 and MLP sizes of 512 to 1536, which is narrower than the ViT backbone.

ImageNet results against ViT and ResNets

Models were trained on the roughly 1.3 million training images of ImageNet and evaluated on its 50k validation images, using batch sizes of 512 or 1024 on 8 NVIDIA GPUs. Most runs use 224×224 inputs and 310 epochs with AdamW and cosine learning rate decay, with mixup and cutmix as augmentations for both CNNs and the transformer models.

The authors state that the T2T-ViT models cut parameters and MACs of vanilla ViT by about half while improving accuracy.

Across these pairs the authors report a gain of 1.4%-2.7% over ResNets of similar model size and MACs.

The authors conclude that visual transformers can outperform CNNs at several complexities on ImageNet when trained without JFT-300M pretraining. The scope of this claim is the ImageNet comparisons with the models and baselines given above.

Lite models against MobileNets

The lite variants use no efficient convolution or other special operations, and they are reduced only by lowering depth, hidden dimension and MLP ratio.

Transfer to CIFAR10 and CIFAR100

The pretrained T2T-ViT-14 and T2T-ViT-19 were fine-tuned for 60 epochs with SGD and cosine learning rate decay on CIFAR10 and CIFAR100.

The text describes fine-tuning only for these two T2T-ViT models, so the transfer result covers them and no other variant.

Which CNN designs transfer to ViT

The authors note that ResNeXt-style multi-head splitting had few effects on ViT and T2T-ViT, and that large head counts add GPU memory without benefit.

Ghost operations lowered accuracy by 2.9% on ResNet50, by 2.0% on T2T-ViT and by 4.4% on ViT, so on the T2T-ViT backbone the reduction in parameters and MACs came with a smaller accuracy cost than on ViT. The authors also report that T2T-ViT outperformed ViT in each of the five CNN-derived structures.

Ablations of the T2T module and the deep-narrow choice

That is a 2.7% decrease in top-1 accuracy relative to T2T-ViT-14, at similar model size and MACs, which the authors read as evidence that the deep-narrow layout matters for T2T-ViT.

Limitations

The MACs of T2T-ViT remain larger than those of MobileNets, which the authors attribute to the dense operations in transformers. The token count at the start of the T2T module is larger than the 16×16 case of ViT, which raises MACs and memory use and is the reason for the small channel dimensions and the optional Performer layer.

The 384×384 result was obtained only for T2T-ViT-14. Transfer was run only on CIFAR10 and CIFAR100, and only for T2T-ViT-14 and T2T-ViT-19. The main ResNet comparison relies on the retrained ResNet rows, and the published ResNet numbers are lower.

Paper info

Authors
Yuan, Li, Chen, Yunpeng, Wang, Tao, Yu, Weihao, Shi, Yujun, Jiang, Zihang, Tay, Francis EH, Feng, Jiashi, Yan, Shuicheng
Venue
arXiv · Preprint
First published
2021-1-28
Added
2026-11-12
Updated
2021-11-30
Version
v3
arXiv
2101.11986
Category
cs.CV
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Yuan, Li, Chen, Yunpeng, Wang, Tao, Yu, Weihao, Shi, Yujun, Jiang, Zihang, Tay, Francis EH, Feng, Jiashi, Yan, Shuicheng (2021). Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet. arXiv:2101.11986v3. https://arxiv.org/abs/2101.11986v3

BibTeX
@misc{li2021tokens,
  title = {{Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet}},
  author = {Yuan, Li and Chen, Yunpeng and Wang, Tao and Yu, Weihao and Shi, Yujun and Jiang, Zihang and Tay, Francis EH and Feng, Jiashi and Yan, Shuicheng},
  year = {2021},
  eprint = {2101.11986},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.11986v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up