arXiv:2603.02874cs.AI2026-03被引 1

混合模型结合Transformer与状态空间模型,在上下文检索中实现高效且精准的性能。

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

  • 融合Transformer与状态空间模型,兼顾检索精度与计算效率。
  • 在短序列任务中,混合模型数据效率优于状态空间模型,接近Transformer水平。
  • 适合关注长序列检索效率与可扩展性的研究人员。

Transformer在上下文检索中表现优异,但序列长度增加时复杂度呈二次增长;状态空间模型(SSMs)虽具线性时间效率,但检索能力有限。本文在两个合成检索任务上评估了混合架构:一是重现查询后n-gram的任务,二是要求进行两跳定位的位置检索任务。在控制条件下,对比了数据效率、长度泛化能力、对域外训练样本的鲁棒性及学习表征。结果表明,混合模型在需精确信息检索的任务中,数据效率和外推能力优于SSMs,媲美或超越Transformer。然而,对于位置检索任务,Transformer仍具优势。通过表征分析发现,基于SSM的模型生成具有局部感知的嵌入,相邻位置的词元在嵌入空间中相互邻近,形成可解释结构;而Transformer因因果注意力和位置编码,天然具备位置关联建模能力,提升数据效率。研究表明,三类模型在位置关联学习机制上存在根本差异。

原文摘要 · Abstract (English)

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.

模型混合上下文检索状态空间模型位置编码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。