arXiv:2603.20105cs.LGcs.AI2026-03被引 3

用函数式编程解决大模型长文本推理的失控问题

The $\mathbf{Y}$-Combinator for LLMs: Solving Long-Context Rot with $λ$-Calculus

  • 用λ演算构建有类型控制流,替代自由生成代码
  • 实测准确率最高提升21.9点,延迟降低4.1倍
  • 适合需要可靠推理的工业级应用

大模型在长文本推理中受限于固定上下文窗口。递归语言模型(RLMs)通过外部化提示并递归求解子问题来突破限制,但依赖开放式的读-求值-打印循环(REPL),导致执行难以验证、预测和分析。本文提出λ-RLM,一种基于λ演算的有类型函数式运行时框架,用预验证的组合子库替代自由生成的递归代码,仅在有限叶节点使用神经推断,将递归推理转化为具有明确控制流的结构化程序。实验表明,λ-RLM在四个长文本推理任务上,九个基线模型中29/36组合表现优于标准RLM,平均准确率提升最高达21.9点,延迟减少最多4.1倍,并具备终止性、成本上界、精度随深度可控等形式化保证。完整实现已开源。

原文摘要 · Abstract (English)

LLMs are increasingly used as general-purpose reasoners, but long inputs remain bottlenecked by a fixed context window. Recursive Language Models (RLMs) address this by externalising the prompt and recursively solving subproblems. Yet existing RLMs depend on an open-ended read-eval-print loop (REPL) in which the model generates arbitrary control code, making execution difficult to verify, predict, and analyse. We introduce $λ$-RLM, a framework for long-context reasoning that replaces free-form recursive code generation with a typed functional runtime grounded in $λ$-calculus. It executes a compact library of pre-verified combinators and uses neural inference only on bounded leaf subproblems, turning recursive reasoning into a structured functional program with explicit control flow. We show that $λ$-RLM admits formal guarantees absent from standard RLMs, including termination, closed-form cost bounds, controlled accuracy scaling with recursion depth, and an optimal partition rule under a simple cost model. Empirically, across four long-context reasoning tasks and nine base models, $λ$-RLM outperforms standard RLM in 29 of 36 model-task comparisons, improves average accuracy by up to +21.9 points across model tiers, and reduces latency by up to 4.1x. These results show that typed symbolic control yields a more reliable and efficient foundation for long-context reasoning than open-ended recursive code generation. The complete implementation of $λ$-RLM, is open-sourced for the community at: https://github.com/lambda-calculus-LLM/lambda-RLM.

长文本推理函数式编程可验证推理

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