MIT CSAIL researchers have introduced Recursive Language Models (RLMs), an innovative approach that lets large language models (LLMs) handle extremely long texts by treating prompts as an external environment. Instead of loading entire long prompts into the model’s limited context window, RLMs let the LLM programmatically explore, break down, and recursively analyze smaller text snippets through Python code. This method overcomes traditional context length limits and context degradation, enabling reliable processing of millions of tokens without retraining.
The framework treats lengthy context handling as a systems engineering challenge rather than simply expanding context windows or summarizing prior information. A “root” LLM oversees the process by generating code to extract relevant text chunks, while a “worker” LLM analyzes those snippets. This design allows enterprises to tackle complex, long-horizon tasks such as large-scale code analysis, extensive legal review, and multi-step reasoning that current models struggle with.
Tests on benchmarks involving millions of tokens demonstrated impressive improvements: the RLM approach powered by GPT-5 outperformed other agents significantly, maintaining performance even as input lengths grew beyond typical limits and reducing costs compared to summarization methods. While some challenges remain, such as occasional expensive compute bursts, this framework promises a practical tool for large-scale text processing in enterprise applications. The RLM codebase is openly available for experimentation on GitHub.