--- license: mit language: - en tags: - reproduction - long-context - evaluation - recursive-language-models - oolong task_categories: - question-answering --- # RLM × OOLONG — a negative reproduction, and the fix that came out of it A reproduction of [Recursive Language Models](https://alexzhang13.github.io/blog/2025/rlm/) (Zhang & Khattab, 2025) on [OOLONG-synth](https://huggingface.co/datasets/oolongbench/oolong-synth), run entirely through the Claude Code CLI with Claude Haiku 4.5 as both root and recursive model. Two results, and the second only exists because the first failed. **1. The method did not reproduce.** Wrapping Haiku in an RLM made it *worse* than reading the same context straight through: **0.269 vs 0.428** on OOLONG-131k. **2. Chasing that failure produced something that works.** On a 957,493-char corpus, a 4B model on a 6GB laptop GPU reached the correct answer where the recursive harness failed four times and Claude Opus was 2/3 and self-inconsistent. The fix was not a bigger model. It was removing the model from the steps it kept getting wrong. ## Results OOLONG-synth, `context_len = 131072`, scored with the **official** harness (`abertsch72/oolong`, `synth_process_response`, ported verbatim — note it is not plain exact match: numeric answers get partial credit `0.75**|gold-pred|`). | arm | n | score | exact | cost/query | root calls/query | |---|---:|---:|---:|---:|---:| | Haiku 4.5, direct | 27 | **0.428** | 0.407 | $0.17 | 1.0 | | RLM(Haiku 4.5) | 32 | **0.269** | 0.250 | $0.19 | 4.4 | | Sonnet 4.6, direct | 1 | 1.000 | 1.000 | $0.51 | 1.0 | Zero harness errors in both main arms. Costs are computed from raw token counts at list prices, not from the CLI's own accounting. The Sonnet row is a single example and is reported only for scale. **Do not read anything into it.** ## Why RLM lost The tell is **4.4 root calls per query**. The paper's method presumes a root model strong enough to plan a chunk-and-aggregate strategy and execute it in a REPL. Haiku mostly does not: - On some rows it emits `FINAL(...)` after a *single* call, having never executed any REPL code — a pure guess over a context it never looked at. - On others it gives up mid-loop (`"I need to examine the context more carefully"`) and never produces a final answer. - Only one row in the sample ran a genuine recursive decomposition (59 sub-calls). Both arms win only the comparison-shaped tasks (`more/less common`), which do not require exact counting. The failure is **model capability, not the harness**. The implication is narrow and worth stating plainly: RLM buys context *length*; it does not buy the planning ability needed to use it. Pairing a capable root model with cheap recursive calls (the paper's own BrowseComp setup) is untested here and is the obvious next experiment. ## Reproducing Tested end-to-end with Claude Haiku 4.5 via the Claude Code CLI. ```bash pip install -r requirements.txt # cheap model, recursive python run.py --mode rlm --model haiku --context-len 131072 -n 32 # same model, read straight through python run.py --mode baseline --model haiku --context-len 131072 -n 32 python summarize.py ``` The loader pulls only the rows it needs: OOLONG-synth is 12 GB, but shards are grouped by `context_len`, so a Parquet predicate prunes whole row groups. Runs are resumable and refuse to mix configurations. Subscription rate limits abort the run rather than being scored — a quota failure recorded as `0` would fabricate a number no model produced, which is exactly what the first run of this experiment did before it was fixed. ## `rlm-ask`: the practical use The negative result above is conditional, and the condition matters. Measured on a local 4B (`gemma4:e4b` via Ollama), same model both arms: | context | arm | result | time | |---|---|---|---| | 158,686 chars (~49.6k tok) | direct, one shot | **empty / wrong** — clipped to 16,387 tok | 160s | | 158,686 chars | **recursive** | **correct** | 60s | | 112,731 chars, 2,490 rows | recursive | **`Refused: 1240`** — right label *and* right count | 181s | So: - **Context fits the window** → do not use RLM. It adds error (0.269 vs 0.428). - **Context exceeds the window** → RLM is the only arm that answers at all. A direct call truncates silently and answers from the fragment it saw. `rlm_ask.py` packages exactly that case as a shell tool, so a coding agent can hand off bulk reading and keep its own context free: ```bash python rlm_ask.py --file huge.log --query "Which error appears most often?" ``` `skill/rlm-ask/` is a Claude Code skill wrapping it. Note it is deliberately a **tool the agent calls**, not a model the agent talks to: Claude Code drives on `tool_use` blocks, and the RLM loop emits prose, so putting RLM behind the model endpoint would break tool calling outright. ## The fix: stop asking the model to aggregate Four attempts on the 957,493-char corpus, all with the same 4B: | attempt | sub-calls | answer | |---|---:|---| | 1 | 7 | prose, having read about a third | | 2 | 11 | `Spatial` — right arithmetic, truncated label | | 3 | 65 | `Counterfactual` — swept everything, well-formed, wrong | | 4 | 72 | `Status: beta, Status: delta, Status: gamma, Status: alpha` | Attempt 4 is the diagnosis: asked to *select* a minimum, it *listed the candidates*. A 4B can count rows in a fragment. It cannot reliably plan a traversal and then do arithmetic across 65 partial results — and nothing about that arithmetic requires a language model. `ctxstream/` (C++17, zero third-party dependencies) treats the corpus like a video stream: the segment plan is computed in code before any model call, N segments are in flight at once, the model sees one fragment and emits `keynumber` (never prose), and aggregation is a loop. 17 segments · failed=0 · records=611 · unparsed_lines=3 · keys=15 · 641s Category: Spatial Relationship <- gold, correct | | answer | correct | cost | |---|---|:---:|---:| | Claude Opus 4.8 [1m], one call, 439,742 tok | varies by run | 2/3 | $4.79 | | 4B + ctxstream, RTX 3060 6GB | `Spatial Relationship` | yes | $0.00 | A directory input builds a symbol/include graph first and segments along it, since cutting code every N characters splits functions and separates calls from definitions. ```bash cd ctxstream && cmake -S . -B build && cmake --build build -j ./build/test_ctxstream # 61 checks, no GPU, no network, no tokens ``` ## VRAM, measured on the 6GB card | num_ctx | resident | fits 5.5GB usable | |---:|---:|:---:| | 32,768 | 3.3 GB | yes — the direct ceiling | | 65,536 | 10.4 GB | no | Streaming 261,226 tokens through that card peaks at **4.23–4.54 GB** across four runs: an 8x context multiple at constant VRAM, because the corpus never enters the KV cache. Switching KV to q4_0 changed nothing, so the cliff is not the KV cache. ## What is *not* here - **No model weights.** Nothing was fine-tuned. This is a harness, a tool, and results. `rlm-ask` runs on whatever Ollama model you already have. - **No Terminal-Bench numbers.** `tbench/` is included but has **never produced a passing run**. Treat it as unvalidated code. - **ctxstream has not been run at the full 262,144-token scale yet** — the correct result above is on a 957,493-char corpus. - The 262k-token OOLONG slice was not run. ## Attribution MIT. Contains derivative work, both MIT and credited in `LICENSE`: - `rlm_haiku/` forks [alexzhang13/rlm-minimal](https://github.com/alexzhang13/rlm-minimal) (© 2025 az) - `bench/oolong.py` ports the scorer from [abertsch72/oolong](https://github.com/abertsch72/oolong) (© 2025 Amanda Bertsch) ```bibtex @article{zhang2025rlm, title = "Recursive Language Models", author = "Zhang, Alex and Khattab, Omar", year = "2025", url = "https://alexzhang13.github.io/blog/2025/rlm/" } @article{bertsch2025oolong, title = "Oolong: Evaluating Long Context Reasoning and Aggregation Capabilities", author = "Bertsch, Amanda and others", year = "2025", journal = "arXiv:2511.02817" } ```