arXiv:2505.23653cs.LG2025-05NeurIPS被引 17

揭秘大模型如何无意识完成多步推理

How do Transformers Learn Implicit Reasoning?

  • 从零训练变换器,在符号环境中追踪推理发展轨迹
  • 三阶段学习:记忆→同类泛化→跨类泛化,第二跳依赖查询结构暴露
  • 提出两种诊断工具,揭示隐层语义聚类与推理能力的关联

近期研究表明,大语言模型(LLMs)可隐式执行多跳推理——在不显式说明中间步骤的情况下给出正确答案,但其内在机制仍不清晰。本文通过在受控符号环境中从零训练变换器,研究此类隐式推理的形成过程。分析揭示了三个发展阶段:早期记忆、分布内泛化,最终实现跨分布泛化。我们发现,使用原子三元组并非必需,但能加速学习;第二跳泛化依赖于对特定组合结构的查询级暴露。为解释这些行为,我们引入两种诊断工具:跨查询语义修补法,用于识别可复用的中间表示;基于余弦的表征透镜,揭示成功推理与隐藏空间中的余弦聚类相关。该聚类现象为训练过程中观察到的行为动态提供了统一解释,将表征结构与推理能力联系起来。研究为理解大模型中隐式多跳推理的可解释性提供了新视角,有助于阐明复杂推理过程的内部演化,并为提升模型透明性提供路径。

原文摘要 · Abstract (English)

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.

大模型推理隐式推理可解释性变换器

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