Paper: 2603.20105 Authors: Amartya Roy, Rasul Tutunov, Xiaotong Ji, Matthieu Zimmer, Haitham Bou-Ammar Categories: cs.LG
Abstract
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 externalizing 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 analyze. This paper introduces λ-RLM, a framework for long-context reasoning that replaces freeform recursive code generation with a typed functional runtime grounded in λ-calculus.
Key Contributions
- Typed functional runtime: Replaces open-ended code generation with pre-verified combinators (SPLIT, MAP, FILTER, REDUCE) grounded in λ-calculus
- Formal guarantees: Provides termination, closed-form cost bounds, controlled accuracy scaling with recursion depth, and optimal partition rules
- Y-combinator for recursion: Uses fixed-point combinators to “tie the knot” of recursion without requiring LLMs to manage function names or global state
- Significant empirical gains: Outperforms standard RLM in 29 of 36 model-task comparisons, with up to +21.9 points accuracy improvement and 4.1× latency reduction
Methodology
λ-RLM separates semantic reasoning from structural control through three key design principles:
Prompt-as-Environment: Like RLM, λ-RLM externalizes the prompt as a variable in a programming environment, allowing the model to interact with it symbolically rather than consuming it directly.
Typed Combinator Library: Instead of generating arbitrary code, λ-RLM executes a compact library of pre-verified functional operators. The base language model is invoked only at the leaves of recursion on sub-prompts guaranteed to fit within its context window K.
Fixed-Point Recursion: Recursion is encoded as a fixed-point over the operator library using the Y-combinator. The planner enforces predictable execution with maximum depth d = ⌈log_k*(n/τ*)⌉, a pre-computed number of model calls, and deterministic composition at every level.
The framework provides formal operational semantics with β-reduction rules, proving termination under standard size-decreasing decomposition assumptions. This eliminates the runaway-execution failures common in open-ended REPL loops.
Results
Evaluated across four long-context reasoning tasks and nine base models with context lengths up to 128K:
Accuracy Improvements: λ-RLM wins in 81% of comparisons (29/36), with average accuracy gains of +21.9 points on weak models (8B/7B), +18.6 points on medium models (32B+), and +8.8 points on strong models (235B+).
Latency Reductions: Consistent speedups of 3.3× to 4.1× across model tiers, with the most structurally demanding benchmark (OOL-Pairs) achieving +28.6 points accuracy and 6.2× speedup.
Reliability: By constraining control flow to typed combinators, λ-RLM eliminates parsing errors, runtime crashes, and non-termination issues that plague open-ended recursive code generation.
Takeaways
- Typed symbolic control provides a more reliable and efficient foundation for long-context reasoning than open-ended recursive code generation
- The Y-combinator enables recursion without requiring LLMs to manage state, eliminating a major source of errors in agentic systems
- Separating semantic reasoning (what to understand) from structural control (how to decompose) improves both predictability and performance
- Formal guarantees on termination and cost bounds make λ-RLM suitable for production systems where reliability is critical
- The framework is model-agnostic and shows consistent improvements across weak, medium, and strong base models
论文: 2603.20105 作者: Amartya Roy, Rasul Tutunov, Xiaotong Ji, Matthieu Zimmer, Haitham Bou-Ammar 分类: cs.LG
摘要
大语言模型(LLM)越来越多地被用作通用推理器,但长输入仍然受到固定上下文窗口的瓶颈限制。递归语言模型(RLM)通过外部化提示并递归解决子问题来解决这个问题。然而,现有的RLM依赖于开放式的读取-求值-打印循环(REPL),其中模型生成任意控制代码,使得执行难以验证、预测和分析。本文介绍了λ-RLM,一个用基于λ演算的类型化函数运行时替代自由形式递归代码生成的长上下文推理框架。
主要贡献
- 类型化函数运行时(SPLIT、MAP、FILTER、REDUCE)替代开放式代码生成
- 形式化保证、闭式成本界限、随递归深度控制的准确率扩展和最优分区规则
- 用于递归的Y组合子”打结”递归,无需LLM管理函数名或全局状态
- 显著的实证收益,准确率提升高达+21.9点,延迟降低4.1倍
方法论
λ-RLM通过三个关键设计原则将语义推理与结构控制分离:
提示即环境
,λ-RLM将提示外部化为编程环境中的变量,允许模型以符号方式与其交互,而不是直接消费它。类型化组合子库
,而是执行一个紧凑的预验证函数运算符库。基础语言模型仅在递归的叶节点上被调用,处理保证适合其上下文窗口K的子提示。不动点递归
,使用Y组合子。规划器强制执行可预测的执行,最大深度d = ⌈log_k*(n/τ*)⌉,预计算的模型调用次数,以及每个级别的确定性组合。该框架提供了带有β归约规则的形式化操作语义,在标准的大小递减分解假设下证明了终止性。这消除了开放式REPL循环中常见的失控执行故障。
实验结果
在四个长上下文推理任务和九个基础模型(上下文长度高达128K)上进行评估:
准确率提升
%的比较中获胜(29/36),弱模型(8B/7B)平均准确率提升+21.9点,中等模型(32B+)提升+18.6点,强模型(235B+)提升+8.8点。延迟降低
.3倍至4.1倍的一致加速,最具结构挑战性的基准(OOL-Pairs)实现+28.6点准确率和6.2倍加速。可靠性
,λ-RLM消除了困扰开放式递归代码生成的解析错误、运行时崩溃和非终止问题。要点总结
- 类型化符号控制为长上下文推理提供了比开放式递归代码生成更可靠和高效的基础
- Y组合子实现了无需LLM管理状态的递归,消除了代理系统中的主要错误来源
- 将语义推理(理解什么)与结构控制(如何分解)分离提高了可预测性和性能
- 终止性和成本界限的形式化保证使λ-RLM适用于可靠性至关重要的生产系统
- 该框架与模型无关,在弱、中、强基础模型上显示出一致的改进