All models

sequencer2d_s

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

Image classification · 559 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 (20 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
27.7M
Operations
559
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
m9141
Graph hash
7dbf6d3de11ea881fadebf1045cff26f06a29aa742a69dc86c40ca46947f5296
Skeleton hash
798b92a074a56e88c66ee84a5dee60ea6795e5fd8e56ed4bce40c860c2b6c36c
Architecture hash
51c911419c17b9669d5d5298b7e35acb21285b0ef304fc262cbe00d377bf0581
Diagram SHA-256
f8e4ed7de590010f36010901ca48164a05423fefd544b5a83555bd0177a5e4df
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_s', 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}, 
}