IN THIS BREAKDOWN · 10 SECTIONS
You can read 23% of this breakdown.
The paper in one minute
Models now accept hundreds of thousands of tokens, but accepting is not using. Quality drops as inputs grow, and it drops fastest on tasks where the answer depends on most of the input. GPT-5 finds a single needle in a million tokens, but on OOLONG-Pairs, where the answer depends on comparing pairs of lines across the whole input, it scored an F1 of 0.1. The usual fix for long agent histories, compaction (summarizing older context), assumes some details can safely be forgotten.
MIT CSAIL proposes Recursive Language Models (RLMs). Do not put the long prompt in the model's context at all. Put it in a variable inside a Python REPL. The root model is told only the prompt's length and a short preview, and how to reach it. It then writes code: peek at a section, split the input into chunks, loop over them calling a model (or another RLM) on each slice, collect results in variables, and finally set an answer variable. From outside, it behaves like a language model, string in, string out, with no practical limit on input or output length.
With GPT-5 and Qwen3-Coder on four long-context tasks, RLMs beat the base models, compaction agents, retrieval-equipped coding agents and Claude Code, often by double digits, at comparable average cost. They handled inputs above 10 million tokens. The authors also fine-tuned Qwen3-8B on 1,000 RLM trajectories and improved it by a median 28%.
The appendix of things that did not work is as useful as the results: the same prompt behaved differently across models, one model tried to make thousands of sub-calls, and sequential sub-calls made everything slow.
Research notes: the problem, approach and results
on OOLONG-Pairs, GPT-5 alone against GPT-5 as a depth-1 recursive model
inputs handled, far beyond GPT-5's 272K-token window
of training that improved an 8B model as a recursive model by a median 28%
Even million-token models degrade as inputs grow, especially on tasks where the answer depends on nearly every line, and summarizing old context throws away detail.
Load the prompt into a Python environment as a variable. The model sees only metadata, writes code to inspect and split it, and calls itself recursively on slices, storing results in variables.
Strong results at 10M+ tokens and large gains even within the window, at comparable average cost, with high cost variance and new failure modes.
Why it matters to an FDE
Customers bring long inputs: a year of support tickets, a full codebase, every contract in a data room. "The model has a million-token window" is not a plan. This paper gives you a better question and a different architecture.
Ask how the task scales with the input. Finding one fact is constant work regardless of length; the authors' S-NIAH task. Labeling and counting every line is linear work. Comparing pairs of items is quadratic. The more the work grows with the input, the earlier a model's context breaks down. A request like "find every pair of contracts with conflicting renewal terms" is quadratic, and no context window will save it.
Treat the data as an environment. RAG pulls snippets into the window; agents fill the window with tool outputs; compaction shrinks the window. All three keep the window as the bottleneck. RLMs move the data out entirely and let code decide what each model call sees. That is a familiar pattern for engineers: map over chunks, store intermediate results, reduce.
Budget for variance and guardrails. Average costs were comparable to the alternatives, but the spread was wide; in some cells the standard deviation exceeded the mean. A model writing loops that call models can make thousands of calls. Production versions need hard limits on sub-calls, depth and spend, a sandboxed execution environment, and logging of every trajectory.
Understand the mechanism. Try it on a real problem.
Unlock this breakdown and 49 more papers.
Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.
6 months · One payment · No auto-renewal
- ◇1 architecture diagram
- </>1 runnable code experiment
- ▦3 results tables
- ?5 interview questions with answers
- 03Key takeaways
The ideas to keep, the three design choices, task complexity and the misreadings to avoid
Free account - 04How it works
The algorithm, the environment, recursion depth and the trained 8B model, with a diagram
Premium - 05The numbers that matter
Results and costs by method, model and depth, with the variance that averages hide
Premium - 06Try it yourself
A minimal recursive model on a counting task a context window cannot do, with a sub-call budget
Premium - 07Where it breaks
The limits the authors list, including the negative results appendix
Premium - 08Using it on a deployment
When to use the pattern, and how to make it safe to run
Premium - 09Interview angles
Five questions this paper prepares you for, with answer hints
Premium - 10Read next
Where to go from here on this site
Premium
