All models

maxvit_tiny_rw_256

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

Image classification · 1,128 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 (17 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
29.1M
Operations
1,128
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
m5760
Graph hash
23db10ad8dfd17bb0f24c35129a901862d7d38b51e6258209d8a21725244939f
Skeleton hash
bfce60ea283f0c97e00e8c35014ac764d853426b7c8fa8ff64cd34fd05b132ef
Architecture hash
1d79b7010fb1e01bc164348460149f5a1b7dfc22c66fad07572676acbabfaf59
Diagram SHA-256
fd73481d1b035c1f7b27237aae71d9e338256a384ad8b5a431fe2eb372aa3dfa
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_tiny_rw_256', pretrained=False)

What it is

This is one of the timm author's own _rw configurations rather than a paper configuration.

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}, 
}