arXiv:2512.02677cs.AI2025-12AAAI

解决大模型在深层嵌套逻辑任务中的推理泛化难题

Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks

  • 提出循环定位替换框架,分解递归问题为可处理子结构
  • 在布尔代数等3个领域验证,深度超出训练范围时仍保持稳定性能
  • 揭示标准Transformer无法模拟栈行为是核心瓶颈,适合研究递归推理的学者

大型语言模型在诸多任务中表现卓越,但在处理需要解析嵌套层次结构的递归推理问题时仍面临显著挑战。本文聚焦此前未被充分研究的‘深度泛化’问题——即模型对训练中未见过的嵌套层数的适应能力。实验发现,即使在长序列上表现良好,标准Transformer架构在处理更深的嵌套结构(如括号层级或命题逻辑嵌套)时性能急剧下降,根源在于其缺乏类似栈的行为以追踪多层依赖关系。为此,我们设计了一种新的循环定位-替换流水线,由定位器识别可求解子表达式,替换器在保持整体结构的同时评估这些组件。我们在布尔代数、递归算术和命题逻辑三个可控深度的领域进行评估,结果表明该方法能有效缓解分布外深度下的性能衰减。

原文摘要 · Abstract (English)

Large language models have demonstrated remarkable capabilities across many tasks, yet face significant challenges when dealing with recursive reasoning problems, those requiring the resolution of nested hierarchical structures. While prior research has extensively studied length generalization (a model's ability to handle longer sequences than seen during training), we investigate a distinct and underexplored limitation: depth generalization. Here, depth refers to the number of nested levels in a hierarchical problem, such as the layers of parentheses in a mathematical expression or the nesting of logical clauses in a Boolean formula. Our work reveals that standard transformer architectures struggle with problems involving deeper recursion than encountered during training, even when they perform well on longer but non-nested sequences. This limitation stems from their inability to maintain stack-like behavior, the capacity to track and resolve multiple levels of nested dependencies. Through systematic analysis, we demonstrate how this architectural constraint leads to rapid performance decay as the depth of the recursion increases. To address this challenge, we develop a novel looped locate-and-replace pipeline that decomposes recursive problems into manageable subcomponents. The approach employs two specialized models: a locator that identifies solvable subexpressions and a replacer that evaluates these components while preserving the overall structure. We evaluated this method in three carefully designed domains: Boolean algebra, recursive arithmetic, and propositional logic, each with a controllable depth of recursion. We show that our method effectively alleviates the performance decay when tested on out-of-distribution recursion depth.

递归推理深度泛化Transformer缺陷逻辑任务

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