All models

DeepViT

A vision transformer that mixes attention maps across heads (Re-attention) so deeper models keep improving.

Image classification · 527 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 (19 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

Parameters
27.3M
Operations
527
Framework
PyTorch
Recurrent
No
Published
2021
Cited by
868 (as of 27 November 2026)
Authors
Daquan Zhou, Bingyi Kang, Xiaojie Jin and others
License
MIT
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
m16025
Graph hash
969e5e2ba0af891c6688cf80eba7801a4467f5899d651f69ce7483fff8c880c6
Skeleton hash
e2bb912bf0988ac0ca90067ec6b056f142a7f3ef0134a61a465e482fd11f9473
Architecture hash
10e1c8f0df3801229ee0e159ae02255d81851e8f8a3271f9e1b9c90589f6a32f
Diagram SHA-256
292f8c725343b45c04e80749b7b780748ed113b2f9ad1d9faf7128a57dce7140
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This model is DeepViT-S, which the paper bases on a ViT with 16 transformer blocks and defines with 5 re-attention blocks.

DeepViT is a vision transformer for image classification, designed so that adding more transformer blocks keeps improving accuracy. The paper shows that, unlike convolutional networks that improve when more layers are stacked, the performance of vision transformers saturates fast when they are made deeper. It traces the difficulty to what it calls attention collapse: as the transformer goes deeper, the attention maps gradually become similar and even much the same after certain layers.

The proposed method, named Re-attention, re-generates the attention maps to increase their diversity at different layers. A learnable transformation matrix mixes the attention maps of the different heads into new ones before they are multiplied with the values. For a deep ViT with 32 transformer blocks, the paper reports that Top-1 classification accuracy on ImageNet improves by 1.6%.

Two variants are defined, DeepViT-S and DeepViT-L, based on ViTs with 16 and 32 transformer blocks. Re-attention is not applied in every block: the paper defines DeepViT-S with 5 re-attention blocks and DeepViT-L with 12. The official implementation is based on the timm library.

Key idea. The paper identifies attention collapse in deep vision transformers and proposes Re-attention, which re-generates attention maps to increase their diversity across layers.

  • DeepViT
  • Deep Vision Transformer
  • Re-attention
  • re-attention vit
  • deeper vision transformer
  • attention collapse
  • DeepViT-S
  • image classification

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

Cite the paper

@misc{zhou2021deepvitdeepervisiontransformer,
      title={DeepViT: Towards Deeper Vision Transformer}, 
      author={Daquan Zhou and Bingyi Kang and Xiaojie Jin and Linjie Yang and Xiaochen Lian and Zihang Jiang and Qibin Hou and Jiashi Feng},
      year={2021},
      eprint={2103.11886},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2103.11886}, 
}