Overview
Unlock the power of near-infinite context with Recursive Language Models (RLMs)! This library provides a plug-and-play inference engine for RLMs, a groundbreaking paradigm that allows language models to programmatically interact with and recursively call themselves over vast amounts of input. Move beyond traditional completion calls to a dynamic rlm.completion interface, where the LM intelligently manages context as a variable in a REPL environment.
Key Features
- Recursive Inference: Enables LMs to decompose and recursively process inputs, effectively handling context lengths previously thought insurmountable.
- REPL Environment Integration: RLMs operate within a Read-Eval-Print Loop, allowing them to interact with code and launch sub-LM calls as functions.
- Flexible Sandbox Support: Choose from a variety of sandboxes, including
local(default),ipython,docker,modal,prime,daytona, ande2b, to tailor your execution environment for security and isolation. - Extensible Architecture: Designed for easy addition of new model providers (OpenAI, Anthropic, OpenRouter, etc.) and REPL environments.
- Training Environment: Includes a dedicated harness for training your own RLMs, integrating seamlessly with the
verifiersframework andprime-rl. - Debugging & Visualization: Optional logging capabilities allow for in-depth inspection of RLM trajectories, with a dedicated visualizer to explore code, sub-LM, and root-LM calls.
Typical Use Cases
RLMs represent a significant leap in how language models can be utilized, opening doors to more complex and nuanced applications. This library empowers developers to:
- Build Sophisticated Agents: Create agents capable of complex reasoning, planning, and execution by leveraging recursive self-calls.
- Process Long Documents: Analyze and synthesize information from lengthy texts that exceed standard context windows.
- Develop Advanced Reasoning Systems: Implement LMs that can break down problems, explore solutions through sub-calls, and iterate towards optimal outcomes.
- Experiment with Novel LM Architectures: Explore the future of language model design by adopting a "CodeAct" style harness where LMs have programmatic access to code environments and can treat sub-calls as functions.
- Train Custom RLMs: Develop specialized RLMs tailored for specific tasks or domains using the provided training infrastructure.
