All models

shvit_s3

A memory-efficient vision transformer with a 16x16 stem, three stages and single-head partial-channel attention.

Image classification · 433 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 (31 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
shvit
Parameters
14.2M
Operations
433
Framework
PyTorch
Recurrent
No
Published
CVPR (arXiv 2024)
Cited by
181 (as of 9 October 2026)
Authors
Seokju Yun, Youngmin Ro
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
m9186
Graph hash
8579662814e692ac7c5a57d421eb70a0b441e213256db5ca911923a74eb12438
Skeleton hash
a96150acbd932661e2eb0126303c8f5e28bbb4fa86ed50b2f000c8e28d54328e
Architecture hash
7dcb67e4450de4a9419e540eae8074e002e7e6fc06578dff7cd8e9f8f57b0662
Diagram SHA-256
fe6f7d8c5a1b98d43841aeadd62c7c5953b12903987a6d17b3ee078d16e3dbf7
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('shvit_s3', pretrained=False)

What it is

About this model's family

SHViT, the Single-Head Vision Transformer, is an efficient vision transformer built around removing computational redundancy at all design levels in a memory-efficient manner. Where conventional efficient ViTs use 4 by 4 patch embeddings and a 4-stage structure, SHViT adopts a 16 by 16 patchify stem and a 3-stage design. The authors find that a larger-stride patchify stem reduces memory access costs and stays competitive by leveraging token representations with reduced spatial redundancy from the early stages.

At the micro level, Single-Head Self-Attention applies an attention layer with a single head on only a part of the input channels and leaves the remaining channels untouched. The partial ratio r defaults to 1/4.67. This removes the redundancy of the multi-head mechanism and reduces memory access cost by processing partial channels. A SHViT block has three parts: a depthwise convolution for local feature aggregation, the SHSA layer for modeling global contexts, and a feed-forward network. The first stage uses no SHSA layer at all, following the finding that early-stage attention can be substituted with convolutions.

Layer Normalization is used only for the SHSA layer, with Batch Normalization elsewhere so it can be merged into adjacent convolution or linear layers. Four variants, S1 to S4, differ in depth and width, and all four are captured here. SHViT-S4 reaches 79.4% top-1 on ImageNet at 14283 images per second on an Nvidia A100 GPU and 509 images per second on an Intel Xeon Gold 5218R CPU.

Key idea. SHViT-S4 is 3.3x, 8.1x and 2.4x faster than MobileViTv2 x1.0 on GPU, CPU and iPhone 12 while being 1.3% more accurate, by using single-head attention on partial channels and a 16 by 16 stem with three stages.

  • shvit
  • single-head vision transformer
  • single head attention
  • shsa
  • shvit_s1
  • shvit_s2
  • shvit_s3
  • shvit_s4
  • efficient vit
  • mobile vit
  • 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{yun2024shvitsingleheadvisiontransformer,
      title={SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design}, 
      author={Seokju Yun and Youngmin Ro},
      year={2024},
      eprint={2401.16456},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2401.16456}, 
}