arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2505.23653cs.LG
收藏

Transformer 如何学习隐式推理?

How do Transformers Learn Implicit Reasoning?

DCST, BNRist(中国清华大学人工智能研究院);KIRC, Institute for Artificial Intelligence, Tsinghua University, China

Jiaran Ye, Zijun Yao, Zhidian Huang, Liangming Pan, Jinxin Liu, Yushi Bai, Amy Xin, Weichuan Liu, Xiaoyin Che, Lei Hou, Juanzi Li

AI总结:

本文通过受控符号环境训练 Transformer,揭示隐式多跳推理经历记忆、分布内泛化和跨分布泛化三阶段,并提出两种诊断工具证明表示聚类与推理能力相关,为 LLM 隐式推理的可解释性提供新见解。

摘要:

近期研究表明,大型语言模型(LLMs)能够隐式地执行多跳推理——即在不显式表达中间步骤的情况下产生正确答案——但其底层机制仍未被充分理解。本文通过在受控的符号环境中从头训练 Transformer,研究这种隐式推理是如何出现的。我们的分析揭示了一个三阶段的发展轨迹:早期记忆、随后是分布内泛化,最终实现跨分布泛化。我们发现,使用原子三元组进行训练并非必要,但能加速学习;而第二跳泛化依赖于在查询层面接触到特定的组合结构。为了解释这些行为,我们引入了两种诊断工具:跨查询语义修补(cross-query semantic patching),用于识别语义上可复用的中间表示;以及基于余弦的表示透镜(cosine-based representational lens),揭示成功的推理与隐藏空间中的余弦基聚类相关。这种聚类现象反过来为训练过程中观察到的行为动态提供了一致的解释,将表示结构与推理能力联系起来。这些发现为 LLMs 中隐式多跳推理的可解释性提供了新的见解,有助于阐明复杂推理过程如何在内部展开,并为提升此类模型的透明度提供了途径。

英文摘要:

Recent work suggests that large language models (LLMs) can perform multi-hop reasoning implicitly -- producing correct answers without explicitly verbalizing intermediate steps -- but the underlying mechanisms remain poorly understood. In this paper, we study how such implicit reasoning emerges by training transformers from scratch in a controlled symbolic environment. Our analysis reveals a three-stage developmental trajectory: early memorization, followed by in-distribution generalization, and eventually cross-distribution generalization. We find that training with atomic triples is not necessary but accelerates learning, and that second-hop generalization relies on query-level exposure to specific compositional structures. To interpret these behaviors, we introduce two diagnostic tools: cross-query semantic patching, which identifies semantically reusable intermediate representations, and a cosine-based representational lens, which reveals that successful reasoning correlates with the cosine-base clustering in hidden space. This clustering phenomenon in turn provides a coherent explanation for the behavioral dynamics observed across training, linking representational structure to reasoning capability. These findings provide new insights into the interpretability of implicit multi-hop reasoning in LLMs, helping to clarify how complex reasoning processes unfold internally and offering pathways to enhance the transparency of such models.

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

↑