All models

maxvit_tiny_tf_224

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
30.9M
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
m5761
Graph hash
19546d7a9b50a9bcf5651544928d80b2cbb7bc93e8e73cce69141f9bd10b6fc7
Skeleton hash
d3f32cae83bd1a490752e85cf881dcfa4074bd9b48258116f9fffcd6236ff1e1
Architecture hash
13bece7e8e5ee0a1bca9b73f912bd3b48195770a7dc224c6042720b23dc37d51
Diagram SHA-256
88316ba7e22ca5160d0a33294c1dfdfd63bdbb28a9f6ae8fccce577bdf9ea36e
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_tf_224', 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}, 
}