arXiv:2505.15105cs.CLcs.AI2025-05被引 6

对比Transformer与状态空间模型的机制,发现它们处理记忆的方式截然不同。

Mechanistic evaluation of Transformers and state space models

  • 通过因果干预分析模型如何在上下文中存储键值关联
  • 只有Transformer和Based SSM能有效实现上下文归纳,其他SSM依赖最后一层计算
  • Mamba通过短卷积实现归纳,而非传统状态空间结构

状态空间模型(SSMs)作为语言建模的高效替代方案,虽在性能上接近二次注意力Transformer,但在从上下文中回忆基础信息方面表现不一。尽管合成任务如关联回忆(AR)可揭示这一缺陷,但行为指标难以说明其背后的机制原因。为此,我们对AR任务进行实验,发现仅Transformer和Based SSM完全成功,Mamba与DeltaNet次之,而H3与Hyena则失败。进一步通过因果干预分析,发现Transformer与Based SSM通过归纳机制在上下文中存储键值关联;而其他SSM仅在最后一层用单层计算该关联。深入研究Mamba发现其确实实现了归纳,但并非通过状态空间结构,而是借助短卷积。在新提出的层级检索任务Associative Treecall(ATR)中,所有架构均采用与AR相同的机制。此外,若移除短卷积,Mamba可在ATR上学习类似注意力的归纳机制。这些结果表明,相似准确率背后可能存在实质性差异,强调了机制评估的重要性。

原文摘要 · Abstract (English)

State space models (SSMs) for language modelling promise an efficient and performant alternative to quadratic-attention Transformers, yet show variable performance on recalling basic information from the context. While performance on synthetic tasks like Associative Recall (AR) can point to this deficiency, behavioural metrics provide little information as to \textit{why} -- on a mechanistic level -- certain architectures fail and others succeed. To address this, we conduct experiments on AR, and find that only Transformers and Based SSM models fully succeed at AR, with Mamba and DeltaNet close behind, while the other SSMs (H3, Hyena) fail. We then use causal interventions to explain why. We find that Transformers and Based learn to store key-value associations in-context using induction. By contrast, the SSMs seem to compute these associations only at the last state using a single layer. We further investigate the mechanism underlying the success of Mamba, and find novel evidence that Mamba \textit{does} implement induction: not via the SSM, but instead via short convolutions. Further experiments on a new hierarchical retrieval task, Associative Treecall (ATR), show that all architectures learn the same mechanism as they did for AR. Furthermore, we show that Mamba can learn Attention-like induction on ATR when short convolutions are removed. These results reveal that architectures with similar accuracy may still have substantive differences, motivating the adoption of mechanistic evaluations.

状态空间模型机制分析注意力机制归纳推理

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