All models

tiny_vit_21m_384

A small hierarchical vision transformer for image classification, pretrained by distillation from a large teacher.

Image classification · 384 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (22 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
TinyViT
Parameters
21.2M
Operations
384
Framework
PyTorch
Recurrent
No
Published
Lecture Notes in Computer Science (arXiv 2022)
Cited by
404 (as of 9 October 2026)
Authors
Kan Wu, Jinnian Zhang, Houwen Peng and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m10547
Graph hash
44d4f7a345832962218f10f871f4c7ffc850969eeaf3e1c06393e1318cd158be
Skeleton hash
30cb93efa5ee06531069ac965cac614c6025bcdc9dd2bc8db10c5378b71590da
Architecture hash
a6fb3dd5782164389136e30c5a11a06e1a58d4cf2cf0aef12b32709b71c5070d
Diagram SHA-256
c953a1e3f0445bf2177f6bbe1f2cd94cc0203fc4d938f5c1c80c60cc2bf6b78c
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

timm.create_model('tiny_vit_21m_384', pretrained=False)

What it is

For this 384 by 384 version of TinyViT-21M, the paper enlarges the attention windows of the four stages to {12, 12, 24, 12}.

About this model's family

TinyViT is a family of small image classifiers built on vision transformers and pretrained on large-scale datasets with a fast distillation framework. The paper's motivation is that most vision transformer models have so many parameters that they are hard to use on devices with limited resources. Its central idea is to transfer knowledge from large pretrained models to small ones during pretraining, so the small models also benefit from massive pretraining data. To keep that affordable, the teacher's outputs (logits) are sparsified and stored on disk in advance, so the teacher does not run while the student trains.

The network has four stages with a gradual reduction in resolution, similar to Swin and LeViT. Stage 1 and the downsampling blocks use MBConv convolution blocks, on the reasoning that convolutions in early layers learn low-level representation efficiently. The last three stages are transformer blocks that use window attention to reduce computational cost.

The paper reports 84.8% top-1 accuracy on ImageNet-1k for the 21M-parameter TinyViT after distilled pretraining on ImageNet-21k. On COCO object detection it reports an AP of 50.2 for TinyViT-21M, 2.1 points above Swin-T.

Key idea. The paper introduced a fast knowledge distillation method for pretraining small vision transformers and showed that small models can also benefit from massive pretraining data under a large teacher.

  • tinyvit
  • tiny vit
  • tiny_vit
  • tiny vision transformer
  • small vision transformer
  • pretraining distillation
  • knowledge distillation
  • image classification
  • imagenet-21k

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{wu2022tinyvitfastpretrainingdistillation,
      title={TinyViT: Fast Pretraining Distillation for Small Vision Transformers}, 
      author={Kan Wu and Jinnian Zhang and Houwen Peng and Mengchen Liu and Bin Xiao and Jianlong Fu and Lu Yuan},
      year={2022},
      eprint={2207.10666},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2207.10666}, 
}