All models

maxvit_small_tf_512

A hybrid backbone whose block-plus-grid attention gives global context at every stage in linear time.

Image classification · 1,096 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 (25 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
MaxViT
Parameters
69.1M
Operations
1,096
Framework
PyTorch
Recurrent
No
Published
Lecture Notes in Computer Science (arXiv 2022)
Cited by
896 (as of 9 October 2026)
Authors
Zhengzhong Tu, Hossein Talebi, Han Zhang 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
m5755
Graph hash
7c645902a78ef234f7b36b3f4e6b45e3acde626d5e44e7df6ba5e26c359373cc
Skeleton hash
b11b5f30076061ee0b68fc8de3ebe6e7508ef4c77b322f2a280c9524c2383bbb
Architecture hash
8b768e586baf0b2b9ef5c2caac1b3c71b68409d70da0e0e90c1a62a0b51cf998
Diagram SHA-256
52f143bce93e3921593ae8d431292c5a62d3dae8e4b2db3a8ac30e6f137bf7e7
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('maxvit_small_tf_512', pretrained=False)

What it is

About this model's family

MaxViT is a hierarchical vision backbone that gets attention to see the whole image at every stage, including the early high-resolution ones, without paying the quadratic cost of full self-attention. Its authors frame the problem plainly: the lack of scalability of self-attention with respect to image size had kept Transformers out of state-of-the-art vision backbones. Their answer is multi-axis attention, two sparse forms of attention, blocked local and dilated global, that together allow global-local spatial interactions on arbitrary input resolutions with only linear complexity.

Look for the repeating unit in the graph: an MBConv block with squeeze-and-excitation, then block attention, then grid attention, each attention followed by a feed-forward network. Block attention partitions the feature map into non-overlapping windows and attends within each, which is local mixing. Grid attention instead overlays a fixed uniform grid on the whole map and attends among the pixels that share a grid position, which amounts to dilated, global mixing of tokens. Both use a window and grid size of 7, following Swin, so the local and global halves cost the same. The authors point out that this is a drop-in replacement for Swin's attention with exactly the same parameters and FLOPs, but with no masking, padding or cyclic shifting. The depthwise convolution inside MBConv doubles as a conditional position encoding, so you will find no explicit positional embedding layer.

The body has a two-convolution stem and four stages, each at half the resolution and double the channels of the one before, and the model is scaled by changing blocks per stage and channel width. The attention head size is 32 everywhere. On ImageNet-1K without extra data MaxViT reaches 86.5% top-1, and 88.7% with ImageNet-21K pre-training. The paper also uses MaxViT blocks for object detection, image aesthetic assessment and unconditional image generation; the captured members here are the classifiers only.

A note on provenance: timm's MaxViT is a from-scratch PyTorch implementation, done 99% from the paper with last-minute adjustments from the public code release. Members whose names carry _tf follow the TensorFlow release at 224, 384 or 512 pixels; those with _rw are the timm author's own configurations, which run a bit faster and lighter than the paper's. The rmlp members use a relative position MLP. One member, maxvit_t, comes from torchvision instead.

Key idea. Multi-axis self-attention (Max-SA): a single block that runs windowed block attention for local interactions and then grid attention for sparse global interactions, both in linear complexity, so global context is available from the first stage onward. Repeating one MBConv plus Max-SA block across a conventional four-stage hierarchy gives the MaxViT backbone.

  • MaxViT
  • Multi-Axis Vision Transformer
  • multi-axis attention
  • Max-SA
  • block attention
  • grid attention
  • MBConv
  • hybrid vision transformer
  • image classification
  • ImageNet
  • MaxViT-T
  • MaxViT-S
  • MaxViT-B
  • MaxViT-L
  • MaxViT-XL
  • maxvit_t

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

Cite the paper

@misc{tu2022maxvitmultiaxisvisiontransformer,
      title={MaxViT: Multi-Axis Vision Transformer}, 
      author={Zhengzhong Tu and Hossein Talebi and Han Zhang and Feng Yang and Peyman Milanfar and Alan Bovik and Yinxiao Li},
      year={2022},
      eprint={2204.01697},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2204.01697}, 
}