---
title: "MIT's Open-Source RLM Library Lets AI Tackle Infinite Contexts With Recursion"
subtitle: "MIT OASYS lab releases rlm, an open-source Python library that lets any LLM recursively call itself to process inputs of virtually unlimited length"
url: "https://alphasignal.ai/news/mit-s-open-source-rlm-library-lets-ai-tackle-infinite-contexts-with-recursion"
author: "AlphaSignal Newsroom"
author_url: "https://alphasignal.ai/editorial-team"
company: "AlphaSignal"
company_url: "https://alphasignal.ai/company/alphasignal"
published: "2026-06-06T20:18:53.000Z"
updated: "2026-06-23T19:12:03.597Z"
type: "Repo"
topics:
  - "Open Source"
  - "Reasoning"
subtopics:
  - "Test Time Compute"
upvotes: 238
source_url: "https://github.com/alexzhang13/rlm"
comments: 0
truncated: true
---

# MIT's Open-Source RLM Library Lets AI Tackle Infinite Contexts With Recursion

> MIT OASYS lab releases rlm, an open-source Python library that lets any LLM recursively call itself to process inputs of virtually unlimited length

Context windows are a hard ceiling that every LLM application eventually hits. The MIT OASYS lab's answer is not a bigger window , it's a different abstraction entirely. They've released [alexzhang13/rlm](https://github.com/alexzhang13/rlm), an open-source Python inference library that wraps any LLM in a recursive execution loop, letting the model programmatically inspect, decompose, and delegate over arbitrarily long inputs. The repo has already crossed 5,000 stars and 840 forks, and the idea is spreading fast.

## The core idea: prompts as objects, not tokens

RLMs are a task-agnostic inference paradigm that enables LMs to handle near-infinite length contexts by programmatically examining, decomposing, and recursively calling themselves over their input. They replace the canonical `llm.completion(prompt, model)` call with an `rlm.completion(prompt, model)` call, offloading the context as a variable in a REPL environment that the LM can interact with and launch sub-LM calls inside of.

The mental model shift is significant. In a normal LLM call, the prompt is text inside the model's temporary memory. In an RLM, the prompt is an object , it can be indexed, split, transformed, and passed by reference through a program. The root model is no longer asked to memorize everything; it is asked to decide how to inspect and delegate.

Frontier LLMs suffer from "context rot" where performance degrades on long inputs, and existing compaction methods lose critical details needed for information-dense tasks. The RLM library is a direct attack on that problem, and it works with models you already have access to.

![Line graphs comparing GPT-5 and RLM(GPT-5) performance across long-context tasks, showing performance degradation in GPT-5 versus maintained performance with RLM](https://github.com/alexzhang13/rlm/raw/main/media/paper_preview.png)

## What the library actually gives you

The repository provides an extensible inference engine for using RLMs around standard API-based and local LLMs. It's installable in one line and designed to be a drop-in replacement for standard completion calls:

```
pip install rlms
```

From there, usage is straightforward:

_Preview only. Full text requires an AlphaSignal Pro account._

## Sources

- [alexzhang13/rlm — GitHub Repository](https://github.com/alexzhang13/rlm)
- [Recursive Language Models — arXiv:2512.24601](https://arxiv.org/abs/2512.24601)
- [Recursive Language Models — Official Blog Post](https://alexzhang13.github.io/blog/2025/rlm/)
- [How the Recursive Language Model (RLM) Works](https://jameshwade.github.io/dsprrr/articles/how-rlm-works.html)
- [Reinforcing Recursive Language Models — alphaXiv Blog](https://www.alphaxiv.org/blog/reinforcement-learning-for-rlms)
