Shunted Self-Attention (Shunted Transformer)
An image classifier whose attention layers merge tokens at several scales within one layer.
Image classification · 644 operations Checked
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
- Task
- Image classification
- Parameters
- 11.6M
- Operations
- 644
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2022
- Cited by
- 360 (as of 26 October 2026)
- Authors
- Sucheng Ren, Daquan Zhou, Shengfeng He and others
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m20393
- Graph hash
- 099f487017d9c5510a0f8d51a6156f4821902b73ea0832111a72549a18847f3b
- Skeleton hash
- 57b96b70c88810802483b86f739046eba02ccd30036453b42b6699d153ea9332
- Architecture hash
- 79983e9f4c409886279718c29e2e88abf9c01beebfa439b23529775af7f05b7a
- Diagram SHA-256
- 1a48a6729d5b00743dbcbab844ee1223cd7b1612bf267cac04ec8c9a51d9580a
- 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
Shunted Transformer is an image model built on shunted self-attention (SSA), an attention layer that works at several scales at once. The paper starts from the observation that Vision Transformer models give every token in a layer a similar receptive field, which limits how well one layer handles objects of different sizes.
Before computing the attention matrix, SSA merges some tokens to represent larger objects and keeps others to preserve fine detail. Within one layer, the keys and values have different lengths in different attention heads. The merging also reduces the number of tokens and the computational cost. The network has four stages, each holding several Shunted Transformer blocks. In the feed-forward layers, a depth-wise convolution adds local detail.
This model is the tiny variant, which the paper reports as performing similarly to DeiT-S on ImageNet with half the parameters and computation cost. For its base model, the paper reports 84.0% Top-1 accuracy on ImageNet.
Key idea. Shunted self-attention merges tokens at different rates across the heads of one attention layer, so a single layer relates objects of different sizes at lower cost.
- shunted transformer
- shunted self-attention
- ssa
- shunted-t
- multi-scale token aggregation
- multi-scale attention
- 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{ren2022shuntedselfattentionmultiscaletoken,
title={Shunted Self-Attention via Multi-Scale Token Aggregation},
author={Sucheng Ren and Daquan Zhou and Shengfeng He and Jiashi Feng and Xinchao Wang},
year={2022},
eprint={2111.15193},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2111.15193},
}