Skip to content
AI360Xpert
Beta

MaxViT Splits Attention Into Grids

MaxViT alternates blocked local attention with dilated grid attention, so every layer sees detail and far layout at linear cost.

Blocked windows handle detail while dilated grids connect far cells at window cost
Blocked windows handle detail while dilated grids connect far cells at window cost

Why Does This Exist?

Window attention is cheap but blind beyond its pane. Full attention sees all but costs quadratic maps.

MaxViT gets both. It builds on convolutional layers, serves image classification backbones, and feeds object detection pyramids.

Think of It Like This

Neighbors then district reps

Each street meets locally, then one rep per street meets on a city grid. Local needs settle fast and city patterns still spread.

Blocks are streets, grids are rep meetings. Where it stops: reps compress detail, just as grid attention samples sparsely.

How It Actually Works

Each MaxViT block has MBConv, blocked attention, then grid attention. Blocked splits H×WH \times W into P×PP \times P windows (P=7P = 7) with 4949 tokens each. Grid samples every GG-th cell into G×GG \times G groups, linking far spots. Both cost linear in pixels.

Worked example

56×56=313656 \times 56 = 3136 tokens split into (56/7)2=64(56/7)^2 = 64 windows of 4949. Blocked pairs are 64×492=64×2401=153,66464 \times 49^2 = 64 \times 2401 = 153{,}664. Grid with G=8G = 8 makes 6464 groups of 4949 for the same 153,664153{,}664. Sum 307,328307{,}328 versus full 9.89.8M, about 3232 times cheaper with global reach.

Watch Out For

Using tiny windows that starve the grid

Window 44 fragments textures and grid links carry too little. Symptom: noisy small maps. Fix: keep 77 or 88 windows as in the paper before tuning grids.

The Quick Version

  • MaxViT alternates blocked local and dilated grid attention plus MBConv.
  • Blocked handles 4949-token detail, grid links far cells.
  • Fixture 307307K pairs replace 9.89.8M, about 32 times cheaper.
  • Both steps stay linear in pixel count.
  • Keep windows near 7 to protect texture.