概要
RLM は再帰的なプログラミング手法で標準的な LLM 呼び出しを置き換え、ほぼ無限のコンテキストを処理できます。このライブラリは拡張可能な推論エンジンとトレーニング環境を提供し、API およびローカル LLM をサポートし、Docker や Modal などの複数のサンドボックス環境を統合して分離された実行を実現します。
README プレビュー
\n---\n\n\nRecursive Language Models (RLMs)\n\n\n\n Full Paper •\n Blogpost •\n Documentation •\n RLM Minimal\n\n\n\n \n \n \n \n \n \n\n\n\n \n \n \n\n\n## Overview\nRecursive Language Models (RLMs) are a task-agnostic inference paradigm for language models (LMs) to handle near-infinite length contexts by enabling the LM to *programmatically* examine, decompose, and recursively call itself over its input. RLMs replace the canonical `llm.completion(prompt, model)` call with a `rlm.completion(prompt, model)` call, acting as a "language model". RLMs offload the context as a variable in a REPL environment that the LM can interact with and launch sub-LM calls inside of.\n\nRLMs are a bet on future "language model" design choices. We argue for a [CodeAct](https://arxiv.org/abs/2402.01030)-style harness (i.e. all language models should have access to a code environment) with sub-(R)LM calls as functions in code, and context / prompts as objects in code. RLMs explicitly defer code execution with sub-calls as functions to the language model itself, which is incredibly flexible and lends itself well to scale if trained correctly. We want to move away from the JSON tool-calling standard for both sub-agents and generic tool calls. The naming comes from the fact that such a system is itself a "language model" (a probabilistic mapping from text to text) that builds around and relies on recursive sub-LLM calls.\n\nThis repository provides both an extensible inference engine and training environment for using RLMs around standard API-based and local LLMs. The initial experiments and idea were proposed in a [blogpost](https://alexzhang13.github.io/blog/2025/rlm/) in 2025, with expanded results in an [arXiv preprint](https://arxiv.org/abs/2512.24601).\n\nWe now also include a [verifiers](https://github.com/PrimeIntellect-ai/verifiers) training environment based on Prime Intellect's [prime-rl](https://github.com/PrimeIntellect-ai/prime-rl) in the `training/` folder
FAQ (2)
トラブル対応なぜ `pip install rlms` を実行すると v0.0.1a1 がインストールされ、Python 3.10 で `ModuleNotFoundError: No module named 'rlm'` というエラーで失敗するのですか?
rlms 0.1.0 は Python >= 3.11 を必要としますが、古い 0.0.1a1 のスタブには Python バージョンの制約がありません。そのため Python 3.10 では、pip は互換性のないスタブにフォールバックし、成功したと報告します。Python 3.11 以降を使用してインストールしてください:
python3.11 -m venv .venv
source .venv/bin/activate # Windows の場合: .venv\Scripts\activate
pip uninstall -y rlms
pip install rlms
pip show rlms # Version: 0.1.0 と表示される必要があります
python -c "from rlm import RLM"
Python 3.10 では、pip install rlms==0.1.0 は No matching distribution found というエラーで失敗します。0.0.1a1 にはバージョン文字列しか含まれていないため、使用すべきではありません。パッケージのメンテナーは、0.0.1a1 を yank するか、Python 3.10 互換のバージョンをリリースすることで、このサイレントフォールバックを解消できます。
トラブル対応rlm_query_batchedで独立したRLMサブクエリを並列に実行するにはどうすればよいですか?
PR #136 を含むリリースにアップグレードしてください。そのバージョンでは、rlm_query_batched が上限付きの ThreadPoolExecutor を使用して、2 つ以上の独立した子 RLM 呼び出しを自動的に並行実行し、結果を元の送信順序で返します。これにより、N 個の I/O バウンドなサブコールの実時間が、設定された同時実行数の制限の範囲内で、約 N × T から約 T に短縮されます。複数のプロンプトを指定して rlm_query_batched を呼び出す以外に、コードの変更は必要ありません。