Retrievit: In-context Retrieval Capabilities of Transformers, State Space Models, and Hybrid Architectures
Not on the map. Why?
Abstract (arXiv)
Transformers excel at in-context retrieval but suffer from quadratic complexity with sequence length, while State Space Models (SSMs) offer efficient linear-time processing but have limited retrieval capabilities. We investigate whether hybrid architectures combining Transformers and SSMs can achieve the best of both worlds on two synthetic in-context retrieval tasks. The first task, n-gram retrieval, requires the model to reproduce an n-gram that succeeds the query within the input sequence. The second task, position retrieval, presents the model with a query token and requires it to perform a two-hop lookup: first locating the corresponding element in the sequence, and then outputting its positional index. Under controlled conditions, we assess data efficiency, length generalization, robustness to out of domain training examples, and learned representations across Transformers, SSMs, and hybrid architectures. We find that hybrid models outperform SSMs and match or exceed Transformers in terms of data efficiency and extrapolation for tasks that require precise information retrieval from the input context. However, Transformers maintain superiority in position retrieval tasks. Through representation analysis, we discover that SSM-based models develop locality-aware embeddings where tokens representing adjacent positions become neighbors in embedding space, forming interpretable structures. This property is absent in Transformers as causal attention is sufficient for acquiring positional associations, and the introduction of positional encoding amplifies this behavior, leading to improvement in data efficiency. SSMs on the other hand update their internal representations incrementally and without positional encodings, are required to learn these associations. Our findings reveal fundamental differences in how Transformers and SSMs, and hybrid models learn positional associations.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 47 of its 54 references that are in the map. First posted on arXiv 3 Mar 2026.
Builds on
47 of 54 references.
References · 47
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2023RT-2: Vision-Language-Action Models Transfer Web Knowledge to Robotic Controlcited by 2,993
- 2024OpenVLA: An Open-Source Vision-Language-Action Modelcited by 2,777
35 more
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,424
- 2020Reformer: The Efficient Transformercited by 1,658
- 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,283
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2021Multimodal Few-Shot Learning with Frozen Language Modelscited by 657
- 2014Neural Turing Machinescited by 630
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2024SeeClick: Harnessing GUI Grounding for Advanced Visual GUI Agentscited by 553
- 2024TinyVLA: Towards Fast, Data-Efficient Vision-Language-Action Models for Robotic Manipulationcited by 331
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 302
- 2019Compositionality decomposed: how do neural networks generalise?cited by 264
- 2024Griffin: Mixing Gated Linear Recurrences with Local Attention for Efficient Language Modelscited by 232
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 208
- 2023Zoology: Measuring and Improving Recall in Efficient Language Modelscited by 188
- 2024The Illusion of State in State-Space Modelscited by 181
- 2022It's Raw! Audio Generation with State-Space Modelscited by 171
- 2024Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modelingcited by 167
- 2016Using Fast Weights to Attend to the Recent Pastcited by 161
- 2024Zamba: A Compact 7B SSM Hybrid Modelcited by 118
- 2023PoSE: Efficient Context Window Extension of LLMs via Positional Skip-wise Trainingcited by 109
- 2024Hymba: A Hybrid-head Architecture for Small Language Modelscited by 95
- 2025Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Modelscited by 88
- 2024In-Context Language Learning: Architectures and Algorithmscited by 86
- 2024Theoretical Foundations of Deep Selective State-Space Modelscited by 73
- 2024RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrievalcited by 62
- 2024Jamba-1.5: Hybrid Transformer-Mamba Models at Scalecited by 48
- 2020The EOS Decision and Length Extrapolationcited by 46
- 2024Is Mamba Capable of In-Context Learning?cited by 45
- 2024Understanding Factual Recall in Transformers via Associative Memoriescited by 45
- 2022Temporal Sentence Grounding in Videos: A Survey and Future Directionscited by 37
- 2019Location Attention for Extrapolation to Longer Sequencescited by 33
- 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 30
- 2017The Galactic Dependencies Treebanks: Getting More Data by Synthesizing New Languagescited by 19
- 2024Shaking Up VLMs: Comparing Transformers and Structured State Space Models for Vision & Language Modelingcited by 6
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2026Retrieval-Aware Distillation for Transformer-SSM Hybrids
- 2025Understanding the Skill Gap in Recurrent Language Models: The Role of the Gather-and-Aggregate Mechanism
- 2025Mechanistic evaluation of Transformers and state space models
- 2024State Space Models are Strong Text Rerankers
- 2026Long-Context Modeling via GSS-Transformer Hybrid Architecture with Learnable Mixing
- 2025A Comparative Analysis of Contextual Representation Flow in State-Space and Transformer Architectures
- 2026Tevatron-Elastic: A Unified Abstraction for Training Elastic Retrievers and Rerankers
- 2025Overcoming Long-Context Limitations of State-Space Models via Context-Dependent Sparse Attention