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

解释语言模型中算子优先级的潜在结构

Interpreting the Latent Structure of Operator Precedence in Language Models

Algoverse AI Research(Algoverse AI研究)

Dharunish Yugeswardeenoo, Harshil Nukala, Ved Shah, Cole Blondin, Sean O Brien, Vasu Sharma, Kevin Zhu

AI总结:

本研究通过LLaMA 3.2-3B模型探究LLMs内部表示是否编码算子优先级,发现中间计算存在于残差流且优先级被线性编码,并提出部分嵌入交换技术修改算子优先级。

摘要:

大型语言模型(LLMs)已展现出令人印象深刻的推理能力,但在算术任务上依然面临困难。先前的工作大多关注输出或提示策略,留下了模型进行算术计算的内部结构这一开放问题。在本研究中,我们调查LLMs是否通过开源的指令微调LLaMA 3.2-3B模型在其内部表示中编码了算子优先级。我们构建了一个包含三个操作数和两个算子的算术表达式数据集,并改变了括号的顺序和位置。利用该数据集,我们追踪中间结果是否出现在指令微调LLaMA 3.2-3B模型的残差流中。我们应用了如logit lens、线性分类探针和UMAP几何可视化等可解释性技术。我们的结果显示,中间计算存在于残差流中,特别是在MLP块之后。我们还发现,模型在注意力层之后的每个算子的嵌入中线性编码了优先级。我们引入了部分嵌入交换技术,该技术通过交换算子之间高影响力的嵌入维度来修改算子优先级。

英文摘要:

Large Language Models (LLMs) have demonstrated impressive reasoning capabilities but continue to struggle with arithmetic tasks. Prior works largely focus on outputs or prompting strategies, leaving the open question of the internal structure through which models do arithmetic computation. In this work, we investigate whether LLMs encode operator precedence in their internal representations via the open-source instruction-tuned LLaMA 3.2-3B model. We constructed a dataset of arithmetic expressions with three operands and two operators, varying the order and placement of parentheses. Using this dataset, we trace whether intermediate results appear in the residual stream of the instruction-tuned LLaMA 3.2-3B model. We apply interpretability techniques such as logit lens, linear classification probes, and UMAP geometric visualization. Our results show that intermediate computations are present in the residual stream, particularly after MLP blocks. We also find that the model linearly encodes precedence in each operator's embeddings post attention layer. We introduce partial embedding swap, a technique that modifies operator precedence by exchanging high-impact embedding dimensions between operators.

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

↑