All models

swin_v2_b

Swin Transformer reworked with post-norm, cosine attention and log-spaced bias to scale up.

Image classification · 1,793 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 (27 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
Swin V2
Parameters
87.9M
Operations
1,793
Framework
PyTorch
Recurrent
No
Published
CVPR (arXiv 2021)
Cited by
2,415 (as of 9 October 2026)
Authors
Ze Liu, Han Hu, Yutong Lin and others
License
BSD-3-Clause
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
m10426
Graph hash
a356cf11f74b51f5b22d5ee56f7309007074383e58ddeb8fb61ee751ca8ae433
Skeleton hash
929d2f961cd344c37692d9ca614e55d6737a54844ada51a7500765d6db4d0ebd
Architecture hash
ffe7ddf19fd2dd4c7c30fb84f700e6212e0007c41b30f359f4e60d82b5a1a03e
Diagram SHA-256
444b97cceaba03c98a7d877b6681ea98c36f9bc7fc8b8e6571278674ea1468e3
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

SwinV2-S and SwinV2-B use 96 and 128 channels with blocks {2, 2, 18, 2}.

About this model's family

Swin Transformer V2 is the adapted version of the original Swin Transformer, reworked so that both model capacity and window resolution can be scaled up. The underlying Swin idea is to bring visual priors such as hierarchy, locality and translation invariance into a vanilla Transformer encoder, so the block keeps its modeling power while suiting many visual tasks. The motivation is that scaling up language models had been incredibly successful. The scaling up of vision models, by contrast, had been lagging behind.

The first two changes target training stability: a residual-post-norm method combined with cosine attention. Post-norm normalizes the output of each residual block before it merges back into the main branch, so the amplitude of the main branch does not accumulate as the network gets deeper. Scaled cosine attention makes the computation independent of the amplitude of block inputs, so attention values are less likely to fall into extremes. The third change, a log-spaced continuous position bias (Log-CPB), generates bias values for arbitrary coordinate ranges by applying a small meta network to log-spaced coordinates, so a model pre-trained at low resolution can move to larger windows. Alongside the architecture, the paper uses the self-supervised SimMIM method to reduce its need for vast labeled images.

With these techniques the authors trained a 3 billion-parameter Swin Transformer V2 model. It set new performance records on ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation and Kinetics-400 video action classification. The members traced here are torchvision's swin_v2_t, swin_v2_s and swin_v2_b builders, which all rely on the same SwinTransformer base class. The paper keeps the stage, block and channel settings of the original Swin Transformer for its four standard configurations. SwinV2-T uses C = 96 first-stage channels with blocks {2, 2, 6, 2}. SwinV2-S and SwinV2-B use 96 and 128 channels with blocks {2, 2, 18, 2}. Without fine-tuning, enlarging the window from 8 to 24 leaves accuracy at 78.9% versus 81.8%, where the original approach degrades from 81.7% to 68.7%.

Key idea. Swin Transformer V2 adds res-post-norm and scaled cosine attention to make the model easier to scale up in capacity, plus a log-spaced continuous relative position bias so it transfers more effectively across window resolutions.

  • swin transformer v2
  • swin v2
  • swinv2
  • swin_v2_t
  • swin_v2_s
  • swin_v2_b
  • hierarchical vision transformer
  • image classification
  • backbone
  • torchvision

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

Cite the paper

@misc{liu2022swintransformerv2scaling,
      title={Swin Transformer V2: Scaling Up Capacity and Resolution}, 
      author={Ze Liu and Han Hu and Yutong Lin and Zhuliang Yao and Zhenda Xie and Yixuan Wei and Jia Ning and Yue Cao and Zheng Zhang and Li Dong and Furu Wei and Baining Guo},
      year={2022},
      eprint={2111.09883},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2111.09883}, 
}