Unlock Infinite Context. Transform LLMs from "information sponges" into orchestrators that use code and parallel delegation to solve complex, data-heavy tasks.
Traditional LLMs suffer from Context Rot—as the context window fills, performance degrades, costs skyrocket, and details are lost.
The Recursive Language Model (RLM) flips this paradigm. Instead of cramming data into the model, the RLM uses Python as extended memory and Parallel Delegation to process gigabytes of data while keeping the main orchestrator's context lean and sharp.
| Feature | Description | Potential |
|---|---|---|
| 🛡️ Zero-Rot Context | The main model never sees raw data; it writes code to slice, search, and retrieve only what is needed. | Process million-token documents with 8k tokens of context. |
| 💾 Persistent REPL State | Python variables act as the LLM's RAM, persisting across multiple thought iterations. | Build complex datasets incrementally without losing state. |
| 🚀 Parallel Delegation | Spawn a "Sub-LLM Orchestra" via llm_batch() to process data chunks in parallel. |
10x-100x speedup for large-scale summarization or analysis. |
| 🎨 Diffusion Answers | Answers are built iteratively, refined across turns until a "ready" flag is set. | High-fidelity, self-verified, and fact-checked outputs. |
graph TD
User([User Prompt]) --> Main[Main RLM Controller]
subgraph "Recursive Loop"
Main -- "1. Reasoning" --> Code[Python Code Generation]
Code -- "2. Execute" --> REPL[Python REPL / RAM]
REPL -- "3. Parallel Tasks" --> SubLLMs[llm_batch: Sub-LLM Workers]
SubLLMs -- "4. Results" --> REPL
REPL -- "5. Truncated Output" --> Main
end
REPL -- "6. Final State" --> Answer[Verified Final Answer]
- Python 3.9+
- An API Key (OpenRouter, Together AI, or OpenAI)
# Clone and navigate
cd backend
# Install dependencies
pip install -r requirements.txtCreate a .env file in the backend directory:
OPENAI_API_BASE=https://openrouter.ai/api/v1
OPENAI_API_KEY=your_key_here
OPENAI_MODEL_NAME=meta-llama/llama-3.1-70b-instruct# Start Backend
python main.py
# Launch Frontend
# Open frontend/index.html in any browser-
Context-Slicing Summary:
- Input: A massive 50MB log file or book.
- Prompt: "Summarize the key events in this data by chunking it into 20 parts and processing them in parallel."
-
Scientific Data Analysis:
- Prompt: "Scan the input_data, calculate the mean and standard deviation of all numeric values found, and plot the distribution using numpy."
-
Iterative Code Refinement:
- Prompt: "Write a complex parser for this custom data format. Test it against the first 5 entries. If it fails, fix the code and try again until it's 100% accurate."
| Aspect | Traditional Long-Context | Recursive Language Model (RLM) |
|---|---|---|
| Data Handling | Load everything into context | Access programmatically via code |
| Memory | Attention-based (decays) | Python variables (persistent) |
| Scaling | Larger context window (Expensive) | Parallel sub-LLM delegation (Scalable) |
| Truthfulness | Single-pass prediction | Multi-turn iterative verification |
- PydanticAI: For clean, typed agentic workflows.
- FastAPI: High-performance backend routing.
- Python REPL: Secure evaluation sandbox.
- Modern HTML/CSS: Glassmorphic dark-mode frontend.
Built with ❤️ for the future of agentic AI.
