Abstract: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 model around the RLM. Our model, RLM-Qwen3-8B, outperforms the underlying Qwen3-8B model by $28.3\%$ on average and even approaches the quality of vanilla GPT-5 on three long-context tasks. Code is available at this https URL.
| Comments: | 9 pages, 43 with Appendix |
| Subjects: | Artificial Intelligence (cs.AI); Computation and Language (cs.CL) |
| Cite as: | arXiv:2512.24601 [cs.AI] |
| (or arXiv:2512.24601v3 [cs.AI] for this version) | |
| https://doi.org/10.48550/arXiv.2512.24601 arXiv-issued DOI via DataCite |
Submission history
From: Alex Zhang [view email]
[v1]
Wed, 31 Dec 2025 03:43:41 UTC (7,933 KB)
[v2]
Wed, 28 Jan 2026 18:59:39 UTC (7,976 KB)
[v3]
Mon, 11 May 2026 15:26:31 UTC (10,181 KB)