arxiv-2512-24601 SRC-0083 · paper

Recursive Language Models

Alex L. Zhang, Tim Kraska, Omar Khattab

Created: 2025-12-31 · Ingested: 2026-09-14

https://arxiv.org/abs/2512.24601(opens in a new tab)

We study allowing large language models (LLMs) to process arbitrarily long prompts through the lens of inference-time scaling. We propose Recursive Language Models (RLMs), a general inference paradigm that treats long prompts as part of an external environment and allows the LLM to programmatically examine, decompose, and recursively call itself over snippets of the prompt. We find that RLMs can successfully process inputs up to two orders of magnitude beyond model context windows and, even for shorter prompts, dramatically outperform the quality of vanilla frontier LLMs and common long-context and coding scaffolds (e.g., on GPT-5 by a median across the evaluated benchmarks of $26\%$ against compaction, $130\%$ against CodeAct with sub-calls, and $13\%$ against Claude Code) across four diverse long-context tasks while having comparable cost. At a small scale, we post-train the first mode…

In brief

Putting a long prompt in a Python REPL as a variable, and letting the model write code that slices it and calls itself on the slices, beats feeding the prompt to the model directly, including at lengths that fit in the window. Recursive Language Models (RLMs) treat the prompt as environment rather than context.

The setup: GPT-5 (with GPT-5-mini sub-calls), Qwen3-Coder-480B-A35B, and Claude Opus 4.1, across LongBench-v2 CodeQA, BrowseComp-Plus (1K docs, 6M-11M tokens), OOLONG, and a new quadratic-complexity OOLONG-Pairs, versus CodeAct+BM25, CodeAct+sub-calls, a compaction agent, OpenCode, and Claude Code.

On GPT-5, RLM at depth=1 scores 62.0 on CodeQA, 91.3 on BrowseComp-Plus, 56.0 on OOLONG, and 58.0 F1 on OOLONG-Pairs, where base GPT-5 and Qwen3-Coder both score 0.1. Median gains: 26% over compaction, 130% over CodeAct with sub-calls, 13% over Claude Code, at $0.99 average cost versus a $1.50-$2.75 extrapolated ingestion cost. Fine-tuning Qwen3-8B on 1,000 trajectories from an unrelated domain gives a median 28.3% gain.

Evidence is measured with cost reported per method, and depth=0 versus depth=1-3 ablations isolate the REPL from the recursion. Benchmark sets are small (50, 150, 50, 20 instances), no variance across seeds is given, and the effect reverses for Qwen3-Coder, where deeper recursion propagates syntax errors and depth=0 wins on CodeQA.

If you are hitting context rot, the offloading trick is worth trying before the summarizer.

Written from the abstract by claude-opus-5 on 2026-09-15, with every figure checked against it. Not a substitute for the paper.

Referenced by

Claims in this catalog that draw on this source, and whether as support or counterpoint.

No claims cite this yet.