Recursive Language Models

Watch how RLMs decompose and recursively interact with context through a REPL environment — enabling near-infinite context processing without degradation.

Based on research by Alex Zhang & Omar Khattab

input.py
Tokens: ~350 Chars: 1,247
rlm_execution.log
🔄

Click "Run RLM Query" to see
recursive decomposition in action

How Recursive Language Models Work

1

Context as Variable

Instead of flooding the LLM with the entire context, RLMs store it as a Python variable that can be programmatically accessed and manipulated.

2

REPL Environment

The root LLM operates in a Python REPL, writing code cells to peek at, grep, and partition the context as needed.

3

Recursive Calls

When analysis is needed, the root LLM spawns child RLM calls with smaller context chunks, avoiding "context rot" degradation.

4

Final Answer

Results bubble up through the recursion tree. The root LLM aggregates findings and outputs FINAL(answer) when complete.