All models

sequencer2d_m

An attention-free image classifier that mixes tokens with vertical and horizontal bidirectional LSTMs.

Image classification · 739 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 (16 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

Parameters
38.3M
Operations
739
Framework
PyTorch
Recurrent
No
Published
NeurIPS (arXiv 2022)
Cited by
75 (as of 26 October 2026)
Authors
Yuki Tatsunami, Masato Taki
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
m9140
Graph hash
e6bc0fc18820c4cb86c66ef68a51c9751a060c642618b43228787864a2e8b067
Skeleton hash
7bc3a7308eb9e3e74f5f74f7f29300461c6eca6c9c2f5c2003136077a5975ce3
Architecture hash
359f55ce4ced655e039676753fddfbe391a3c3a2233e5483a3a63b60b4cab19b
Diagram SHA-256
a95c5fd66afa13100acc84656d0e4724268482fa175c49b1d3517e1cc246b27a
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('sequencer2d_m', pretrained=False)

What it is

About this model's family

Sequencer is an image classifier that mixes information across the image with LSTMs instead of self-attention, a deliberately old tool pointed at a modern question. The question is what inductive bias vision really needs, now that ViT, MLP-Mixer and carefully redesigned CNNs all perform well. The macro-architecture follows ViTs, alternating token mixing with channel mixing, but the self-attention layer is replaced by one built from bidirectional LSTMs.

The captured members are the three Sequencer2D models, which use the paper's two-dimensional variant: the layer the authors call BiLSTM2D. Every column of the feature map is fed as a sequence through one shared vertical BiLSTM, every row through a shared horizontal one, and the two outputs are concatenated and fused by a point-wise fully connected layer. The authors credit Vision Permutator for the idea of handling the vertical and horizontal axes in parallel; it shortens the sequences and gives a spatially meaningful receptive field. A quirk to look for in the graph: non-overlapping patches are embedded, blocks are stacked with patch merging between stages, and the last block feeds a linear classifier through global average pooling. The three sizes, S, M and L, differ in depth: 18, 24 and 36 blocks, with the LSTM hidden dimension set to a quarter of the channel width.

Trained on ImageNet-1K alone, Sequencer2D-L reaches 84.6% top-1 with 54M parameters, and the authors report it outperforms Swin and ConvNeXt of comparable size. The trade-off is honest: recursion costs more FLOPs than other models, but peak memory grows more gently than attention's at high resolution, and accuracy holds up even when inference resolution is doubled. The closest ancestor the authors name is ReNet, a 4-way LSTM over non-overlapping patches; Sequencer differs in connecting its vertical and horizontal BiLSTMs in parallel rather than in series, and in training at ImageNet scale. They also claim a place in the MetaFormer lineage as the first MetaFormer realized with LSTM as the token mixer.

Key idea. Replacing self-attention with a BiLSTM2D token mixer, a pair of shared-weight bidirectional LSTMs run along the vertical and horizontal axes in parallel and fused point-wise, and showing it competes with ViT, Swin and ConvNeXt on ImageNet-1K. The memory case is explicit: BiLSTM2D carries cell states of size proportional to the image side, while an attention map grows with the square of the token count.

  • Sequencer
  • Sequencer2D
  • Deep LSTM for Image Classification
  • BiLSTM2D
  • LSTM vision
  • attention-free
  • image classification
  • ImageNet
  • sequencer2d_s
  • sequencer2d_m
  • sequencer2d_l

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

Cite the paper

@misc{tatsunami2023sequencerdeeplstmimage,
      title={Sequencer: Deep LSTM for Image Classification}, 
      author={Yuki Tatsunami and Masato Taki},
      year={2023},
      eprint={2205.01972},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2205.01972}, 
}