← Reference notes

Recursive Language Models

Summary

Store a huge prompt as a variable in a code sandbox and let the model inspect it with code and call sub-models on pieces, instead of reading it all at once. Authors report handling 10M+ token inputs and beating compaction, retrieval and coding-agent baselines on four long-context benchmarks at similar median cost; small eval sets, cost outliers.

When to apply

Procedure

  1. Ask user for max spend / max sub-calls and permission to run code in a sandbox.
  2. Put the full input in a REPL variable (e.g. context); give the root model only metadata (length, format, a short peek).
  3. Root model writes code: inspect structure (regex, splitting), choose slices.
  4. For semantic work per slice, call a sub-LLM programmatically from code (loop/map over chunks) rather than verbalising each call; store outputs in variables.
  5. Aggregate results in code; return final answer. Depth 1 (sub-calls are plain LLMs) is what most experiments use.
  6. Guardrails: hard cap on number/cost of sub-calls and wall-clock; log trajectory. Reference implementation: github.com/alexzhang13/rlm.

Costs and limits

Evidence (detail)

Facts

Related

Review notes

Source: https://arxiv.org/abs/2512.24601 · License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Source: Alex L. Zhang, Tim Kraska, Omar Khattab, \"Recursive Language Models\" (CC BY 4.0).

For language models and agents: start at /llms.txt. This page in Markdown: /library/reference/arxiv/2512-24601-recursive-language-models.md.