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

众智归一:LLMs 在最后一个 token 上解决心算,信息从其他 token 传递而来

All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens

University of California, Santa Cruz(加州大学圣克鲁兹分校);George Mason University(乔治·马歇尔大学);Datadog AI Research(Datadog人工智能研究)

Siddarth Mamidanna, Daking Rai, Ziyu Yao, Yilun Zhou

AI总结:

本文通过消融和注意力分析,发现LLMs在心算任务中仅依赖最后一个token在深层进行计算,并识别出充分且必要的“众智归一”子图,该子图可跨模型迁移。

摘要:

大型语言模型(LLMs)在众多计算任务上展现出熟练能力,但其内部工作机制仍不清楚。理论上,因果自注意力与多层感知机层的结合使得每个 token 都能基于所有先前 token 访问和计算信息。在实践中,这种操作在多大程度上存在?本文针对心算任务(即通过下一 token 预测直接进行数学计算,无需显式推理),分三步探究该问题:在初始层中抑制特定于输入 token 的计算,在接下来几层中限制跨 token 位置的信息传递路径,并在剩余层中强制所有计算发生在最后一个 token 上。通过提出的两种技术——上下文感知均值消融(CAMA)和基于注意力的窥探(ABP),我们在多种心算任务上识别出一个高精度的“众智归一”子图(AF1),其中有意义的计算发生得很晚(就层深度而言),且仅发生在最后一个 token 上,该 token 在少数特定的中间层接收其他 token 的信息。在多种模型和算术表达式上的实验表明,该子图对于模型的高性能是充分且必要的,可跨不同模型迁移,并适用于多种输入风格。对不同 CAMA 和 ABP 变体的消融实验揭示了它们相对于其他方法的独特优势,这可能具有独立的研究价值。

英文摘要:

Large language models (LLMs) demonstrate proficiency across numerous computational tasks, yet their inner workings remain unclear. In theory, the combination of causal self-attention and multilayer perceptron layers allows every token to access and compute information based on all preceding tokens. In practice, to what extent are such operations present? In this paper, on mental math tasks (i.e., direct math calculation via next-token prediction without explicit reasoning), we investigate this question in three steps: inhibiting input-specific token computations in the initial layers, restricting the routes of information transfer across token positions in the next few layers, and forcing all computation to happen at the last token in the remaining layers. With two proposed techniques, Context-Aware Mean Ablation (CAMA) and Attention-Based Peeking (ABP), we identify an All-for-One subgraph (AF1) with high accuracy on a wide variety of mental math tasks, where meaningful computation occurs very late (in terms of layer depth) and only at the last token, which receives information of other tokens in few specific middle layers. Experiments on a variety of models and arithmetic expressions show that this subgraph is sufficient and necessary for high model performance, transfers across different models, and works on a variety of input styles. Ablations on different CAMA and ABP alternatives reveal their unique advantages over other methods, which may be of independent interest.

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

↑