
sequencer2d_m
Image classification739 ops38.3M params
An attention-free image classifier that mixes tokens with vertical and horizontal bidirectional LSTMs.
Image classification · 559 operations Checked
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.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
timm.create_model('sequencer2d_s', pretrained=False) 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.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@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},
}