Skip to content
AI360Xpert
Beta

VMamba Scans Four Ways for 2D

VMamba cross scans rows and columns both directions, so 2D locality survives linear state modeling for dense tasks.

Four directional scans keep 2D neighbors at linear cost
Four directional scans keep 2D neighbors at linear cost

Why Does This Exist?

Row-only scans separate vertical neighbors by a full row length. Masks then streak horizontally.

Cross scans fix adjacency. VMamba builds on vision mamba selection, serves semantic segmentation density, and aids object detection grids.

Think of It Like This

Plowing a field lengthwise plus crosswise

One pass plow leaves ridges. Cross plowing levels both ways with two linear passes.

Row scans are lengthwise, column scans crosswise. Where it stops: four passes cost four times one, just as SS2D trades speed for fairness.

How It Actually Works

Unfold map to four sequences: rows forward, rows backward, cols forward, cols backward. Run selective S6 per pass, reshape, sum plus gate. Hierarchical stages shrink like CNNs.

Worked example

28×28=78428 \times 28 = 784. Row neighbors distance 11, column neighbors distance 2828 in row order. Column scan makes column distance 11. Four passes each 784×64×2≈100784 \times 64 \times 2 \approx 100K mults total 401401K versus 7842×64≈39784^2 \times 64 \approx 39M attention, about 9898 times cheaper with 2D fairness.

Watch Out For

Summing passes without gating

Equal sums blur direction cues. Symptom: orientation errors on thin lines. Fix: keep the paper gating that weights passes per token.

The Quick Version

  • VMamba scans rows plus columns both ways and merges.
  • Four passes keep vertical plus horizontal neighbors close.
  • Fixture 401401K mults replace 3939M, 98 times cheaper.
  • Hierarchical stages suit dense heads.
  • Gate passes per token to keep direction cues.