arXiv:2510.09340cs.AIcs.CL2025-10被引 1

探究大模型如何做逻辑推理,发现两种不同思考方式的机制差异。

Deductive Logic in Language Models: Horizontal vs Vertical Reasoning

  • 区分横向与纵向推理:前者逐步生成,后者层间隐式推演。
  • 有思维链指导时,模型学会规则推理而非数据捷径。
  • 适合研究模型逻辑机制或提升推理能力的工程师参考。

近期语言模型展现出显著的逻辑推理能力,但其背后的推理机制仍不清晰。本文研究从零训练的小型Transformer模型在多步演绎任务上的表现,重点对比横向推理(中间步骤自回归生成)与纵向推理(推理在输出前的层间隐式完成)的区别。通过两个合成任务——符号链的逻辑蕴含关系判断和二叉树根到叶的导航——进行分析。机制可解释性研究表明,思维链(Chain-of-Thought)监督使模型学习规则推理而非统计捷径。在横向设置中,浅层仅含注意力的模型发展出可解释的规则补全、规则链式与决策电路,主要由类似归纳头的机制实现。我们引入截断伪逆方法解码查询、键、值所携带的信息。在纵向推理中,思维链更像课程学习,帮助模型逐步掌握复杂推理模式;无思维链时,模型易记忆或利用数据偏差。结果为Transformer实现演绎推理提供了底层解释,并揭示思维链在不同推理路径中的异质作用。

原文摘要 · Abstract (English)

Recent language models exhibit significant logical reasoning abilities, yet the mechanisms supporting deductive inference remain poorly understood. This paper studies small transformer-based language models trained from scratch on multi-step deductive tasks, focusing on the distinction between horizontal reasoning, where intermediate steps are generated autoregressively, and vertical reasoning, where inference unfolds implicitly across layers before the first output token is produced. We analyze two synthetic tasks: logical consequence over chains of symbolic implications and root-to-leaf navigation in binary trees. Mechanistic interpretability reveals that Chain-of-Thought supervision enables models to learn rule-based inference rather than statistical shortcuts. In the horizontal setting, a shallow attention-only model develops interpretable circuits for rule completion, rule chaining, and final decision making, largely implemented through induction-head-like mechanisms. We further introduce a truncated pseudoinverse method to decode the information carried by queries, keys, and values. For vertical reasoning, Chain-of-Thought appears to act less as explicit step-by-step guidance and more as a form of curriculum learning, helping the model acquire increasingly complex reasoning patterns. Without Chain-of-Thought, models tend to memorize or exploit dataset biases. These results provide a low-level account of how transformers can implement deductive reasoning and suggest how Chain-of-Thought may serve different functions in horizontal and vertical reasoning.

逻辑推理思维链可解释性

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