arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.02874cs.AI
收藏

Retrievit: Transformer、状态空间模型和混合架构的上下文检索能力

Retrievit: In-context Retrieval Capabilities of Transformers, State Space Models, and Hybrid Architectures

University of Edinburgh(爱丁堡大学);Heriot-Watt University(赫瑞斯泰特大学)

Georgios Pantazopoulos, Malvina Nikandrou, Ioannis Konstas, Alessandro Suglia

AI总结:

研究Transformer、状态空间模型(SSM)及其混合架构在上下文检索任务中的性能,发现混合模型在数据效率和泛化上优于SSM且接近或超越Transformer,但Transformer在位置检索上仍占优。

摘要:

Transformer在上下文检索方面表现出色,但随序列长度呈二次复杂度,而状态空间模型(SSM)提供高效的线性时间处理,但检索能力有限。我们研究结合Transformer和SSM的混合架构是否能在两个合成上下文检索任务上实现两全其美。第一个任务,n-gram检索,要求模型再现输入序列中查询后的n-gram。第二个任务,位置检索,向模型提供查询令牌,要求其执行两跳查找:首先定位序列中的对应元素,然后输出其位置索引。在受控条件下,我们评估了Transformer、SSM和混合架构的数据效率、长度泛化、对域外训练样本的鲁棒性以及学习到的表示。我们发现,对于需要从输入上下文中精确信息检索的任务,混合模型在数据效率和外推方面优于SSM,并达到或超过Transformer。然而,Transformer在位置检索任务中保持优势。通过表示分析,我们发现基于SSM的模型发展了位置感知嵌入,其中表示相邻位置的令牌在嵌入空间中成为邻居,形成可解释的结构。这一特性在Transformer中缺失,因为因果注意力足以获取位置关联,而位置编码的引入放大了这种行为,导致数据效率提升。另一方面,SSM逐步更新其内部表示且无位置编码,因此需要学习这些关联。我们的发现揭示了Transformer、SSM和混合模型在学习位置关联方面的根本差异。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑