Context windows have grown faster than the ability to use them. A model advertised at 200,000 tokens will accept 200,000 tokens, but accuracy on tasks that require locating and combining facts tends to fall long before the window is full. Chroma’s 2025 technical report on this effect, which popularised the term context rot, documents how performance on controlled retrieval and reasoning tasks degrades as input length grows, even when the task itself stays the same. The practical consequence is a gap between the advertised window and the effective window — the amount of text a model can actually reason over without losing the thread.
Recursive language models, introduced by Zhang, Kraska and Khattab at MIT CSAIL in 2025 and expanded in their 2026 NeurIPS paper, attack the problem from an unusual direction. They leave the attention mechanism alone and work with existing models through prompting, though the 2026 paper also fine-tunes a natively recursive 8B model; what they change is where the context lives. Instead of pushing a million tokens through the prompt, the corpus stays outside the model in a programming environment, and the model writes code to explore it, dispatching small sub-queries to fresh copies of itself when something needs to be read properly.
Why the effective window is shorter than the advertised one
Three things happen as a prompt grows. First, the signal-to-noise ratio drops: the relevant sentence is now surrounded by hundreds of thousands of plausible distractors, and attention has to discriminate between them. Second, very long inputs are rare in training data relative to short ones, so the model is working in a regime it has seen comparatively little of. Third, cost grows: prefill is compute-bound and the KV cache grows linearly with sequence length, so a million-token prompt is expensive before a single output token appears. We covered the memory and bandwidth side of that in serving LLMs on your own GPUs, and the architectural responses in hybrid attention for long-context models.
For anyone budgeting an AI project, the point is that a longer window does not buy proportionally more usable reasoning: the cost is predictable, the accuracy is not.
What the field tried first
- Bigger windows. Extending from 128K to a million or more tokens is an engineering achievement, but it makes each call more expensive and does not remove the degradation — it moves it further out.
- Summarisation. Compressing the corpus before the real query works when the task is thematic. It is lossy by construction: whatever the summariser discarded cannot be recovered later, and the summariser does not know what the question will be.
- Retrieval-augmented generation. Chunk, embed, retrieve the top matches. Excellent for lookup, weaker when the answer requires combining a dozen sections that are not individually similar to the query, or when the task is “check every clause”, which is a scan rather than a search.
Each handles one failure mode. None handles a task that is simultaneously long, dense and exhaustive.
Context as an environment
The recursive framing starts from a different premise: do not memorise the library, learn to navigate it. The full corpus is loaded into a sandboxed Python session as a variable. A root model never sees it. What the root model sees is a description of the environment — the variable exists, it is this long, here is a sample — and the ability to run code against it.
From there the root model behaves like an analyst with a shell. It can split, filter with regular expressions, count, group, sort and print small slices to inspect. When a step needs judgement rather than string matching, it calls a sub-model: a fresh call given only a slice of the text, sized well within its window, and a narrow instruction. The sub-model returns a short result, the root model collects the results and composes the answer. No single call carries the whole corpus, so no single call sits in the degraded regime.
A worked example
Suppose you have a contract set of roughly 500,000 tokens and the question is which clauses create uncapped liability.
- The documents are loaded into the environment. The root model queries their length and structure, not their content.
- It writes code to split the text into 200 sections of about 2,500 tokens each — 200 × 2,500 = 500,000 — and filters for the vocabulary of liability, indemnity and limitation.
- Say 20 sections survive the filter. Those 20 are dispatched to sub-models, one section each: 20 × 2,500 = 50,000 tokens of content actually read, and the largest prompt any model sees is about 2,500 tokens plus instructions.
- The root model receives 20 short findings, reconciles them and writes the analysis. If a finding is ambiguous, it can go back and inspect neighbouring sections.
Code for structure, models for semantics
The division of labour is the real lesson, and it generalises well beyond long documents. Keyword filters, deduplication, joins, counting and sorting are cheap, exact and auditable in code; a language model asked to do them at scale is slow, expensive and occasionally wrong. Deciding whether two differently worded clauses mean the same thing is exactly what a model is for, and no regular expression will get there.
A purely programmatic pass over a large collection is brittle on ambiguous items; a purely model-driven pass does not scale. The recursive pattern lets the orchestrator choose per item: handle the clear cases in code, escalate the unclear ones to a sub-model. It is also composable — retrieval and summarisation become tools the root model can call rather than competing architectures.
The costs you should plan for
- Latency. Several rounds of code generation, execution and sub-calls take longer than one direct query. On short, simple inputs the extra latency is harder to justify, so it should be triggered by input size or task type rather than used by default.
- Throughput profile. The workload becomes many small, bursty, parallelisable requests instead of one long one, which favours high-concurrency serving over raw single-stream speed.
- Code quality. The root model must write Python that runs. Models weak at code generation make poor orchestrators, and every generated snippet needs a sandbox with no network, no filesystem access beyond the data and a strict timeout.
- Depth control. Sub-models can in principle spawn their own sub-models, so an explicit depth and budget limit is needed to stop a single query fanning out unpredictably.
- Evaluation. You are testing a pipeline, not a prompt. The useful artefact is the execution trace: which sections were inspected, which were escalated, what each sub-call returned.
What this means for organisations building on their own data
If your hardest workloads are long — contract review, incident post-mortems across months of logs, due diligence over a document room, auditing a code base — the lever is probably not a model with a bigger window. It is restructuring the task so that no single call has to carry everything, then investing in the orchestration, the sandbox and the evaluation harness around it. Three questions are worth settling first: what fraction of the corpus genuinely needs semantic reading, what the escalation rule should be, and what latency the business will tolerate.
There is also a modelling question. Work on distilling recursive behaviour from a large code-capable teacher into a smaller student suggests that decomposing, inspecting and recursing can be trained rather than only prompted, which makes smaller self-hosted models more interesting for the orchestrator role. AMD Telecom trains and fine-tunes deep-learning models and large language models on its own in-house GPUs, and runs a big-data platform on the Hadoop ecosystem — Spark, Hive, Delta Lake, Kafka and Airflow.
If you are weighing up long-context work on your own data, our AI Model Training and AI Model Development services cover the training, fine-tuning and pipeline design this approach depends on. Contact us to discuss your use case.
