Recursive Language Models

Alex L. Zhang, Tim Kraska, Omar Khattab
12/31/2025
cs.AIcs.CL

Official code: alexzhang13/rlm (5,647 stars, MIT, last commit 2026-04-27). 4 more implementations below.

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 scaffolds across four diverse long-context tasks while having comparable cost. At a small scale, we post-train the first natively recursive language model. 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 https://github.com/alexzhang13/rlm.

View on arXivView PDF

Code Implementations(5)

alexzhang13/rlmOfficial100%
MIT

General plug-and-play inference library for Recursive Language Models (RLMs), supporting various sandboxes.

5,647905Python, MakefileDec 20, 20255 months agoMIT
avbiswas/fast-rlmCommunity65%

Recursive Language Models (https://arxiv.org/abs/2512.24601)

47763Shell, PythonFeb 22, 20267 months ago
rlmrlms

Recursive Language Models (RLMs) unofficial implementation (trial). https://arxiv.org/abs/2512.24601

10PythonJan 11, 20269 months ago
MIT

Multi-agent orchestration plugin for Claude Code. Coordinate agent teams with shared tasks, messaging, and 7 patterns including RLM (arXiv:2512.24601) for large-file analysis beyond context limits.

151MDX, JavaScriptFeb 10, 20266 months agoMIT
agent-coordinationagent-teamsai-agentsanthropicchunked-analysis+12 more
MIT

A Simplified Recursive Language Models (RLMs) based on arXiv:2512.24601, (src/rlm.py)

10Python, DockerfileJan 14, 20269 months agoMIT

Similar Papers

Cite this paper

@article{zhang2025recursive,
  title  = {Recursive Language Models},
  author = {Alex L. Zhang and Tim Kraska and Omar Khattab},
  year   = {2025},
  eprint = {2512.24601},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.24601v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2512.24601.svg)](https://codeofpaper.com/paper/2512.24601)

Discussion