arXiv:2511.23239cs.LGstat.ML2025-11NeurIPS被引 1

解析Transformer如何学习环上随机游走,揭示其可解释的注意力机制。

Towards Understanding Transformers in Learning Random Walks

论文配图:Towards Understanding Transformers in Learning Random Walks
图 1 · 摘自论文原文
  • 用梯度下降训练单层Transformer预测环上随机游走。
  • 训练后模型达到最优预测精度,注意力聚焦前一状态。
  • 首次证明理论条件紧致,适合研究模型可解释性者阅读。

Transformer在序列建模中表现优异,但其理论理解仍不充分。本文研究Transformer在学习环上随机游走这一经典统计模型时的能力与可解释性。理论上证明:经梯度下降训练后,单层Transformer可实现最优预测准确率。分析显示,训练后的模型具备可解释性:软最大注意力充当令牌选择器,聚焦于直接父状态;值矩阵则基于该状态执行一步概率转移以预测下一位置。我们还发现,某些未被理论覆盖的边界情况确实导致失败,表明理论条件是紧致的。实验验证了这些结论。研究揭示,在小初始化下,梯度下降在某些简单任务中仍可能无法收敛到良好解。

原文摘要 · Abstract (English)

Transformers have proven highly effective across various applications, especially in handling sequential data such as natural languages and time series. However, transformer models often lack clear interpretability, and the success of transformers has not been well understood in theory. In this paper, we study the capability and interpretability of transformers in learning a family of classic statistical models, namely random walks on circles. We theoretically demonstrate that, after training with gradient descent, a one-layer transformer model can achieve optimal accuracy in predicting random walks. Importantly, our analysis reveals that the trained model is interpretable: the trained softmax attention serves as a token selector, focusing on the direct parent state; subsequently, the value matrix executes a one-step probability transition to predict the location of the next state based on this parent state. We also show that certain edge cases not covered by our theory are indeed failure cases, demonstrating that our theoretical conditions are tight. By investigating these success and failure cases, it is revealed that gradient descent with small initialization may fail or struggle to converge to a good solution in certain simple tasks even beyond random walks. Experiments are conducted to support our theoretical findings.

Transformer可解释性随机游走

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