1. The problem: agents re-read everything
A coding or research agent accumulates messages, tool calls, logs and file contents, and at every step it reads all of them again. Long histories are expensive, and they can hurt accuracy: the relevant detail gets buried among irrelevant ones. Existing remedies fall into a few groups. Some truncate or summarize old context, which loses the original. Some keep the original and let the model page it back in, as in MemGPT, but then the model has to manage its own memory. Others use fixed rules to decide what is shown.
MoE-Context (arXiv:2611.24379), a short single-author paper by Vedant Navale, proposes a design that keeps everything but shows the model only what the current step needs. It then tests the pieces on a laptop and reports frankly where they work and where they do not.
2. The design
The context is split into blocks: a message, a reply, a tool call with its result, a file read. Each block gets a one-line note written by the model, such as "read login.py, 300 lines". Before each step, a decide pass asks of every block whether it is needed for the next step. Needed blocks are shown in full, the rest appear only as their notes, and some blocks, such as instructions, are always pinned. If the model later needs a hidden block it can recall it, and nothing is ever deleted.
The name borrows from Mixture of Experts, where a gate picks a few experts per input. Here the decide pass picks a few blocks per step. The decide pass reads full blocks, not notes, because a note like "read login.py" cannot reveal that a bug sits on line 140.
One model, one cache. The paper builds the variant in which the same model both decides and answers. A transformer stores the keys and values computed for every token it has read (the KV cache), so they need not be recomputed. MoE-Context reads each block into this cache once. Hiding a block sets its entries to zero in the attention mask, and token positions are kept, so the cached entries stay valid and nothing has to be re-read. Showing the block again is just another change of mask.
One subtlety follows from this, and the paper discusses it. Blocks are encoded in order, so a later block has already attended to earlier blocks, including ones that are hidden afterwards. Traces of a hidden block can therefore survive inside later blocks.
3. The decide pass and a probe written into the weights
For each block, the model sees only that block and the question "Is the content of block $i$ needed to answer this question? Answer yes or no." The score is read from the output logits at the last position, with no text generated. For a 1.7B model, these raw yes/no scores separate needed from unneeded blocks poorly.
To sharpen them, the paper fits a linear probe on labelled practice questions. It is Fisher's linear discriminant on the final hidden state $h$:
with class means $\mu$, shared covariance $\Sigma$ and a ridge term $\lambda$. The fit is closed-form, with no gradient updates. The probe is then written into two unused rows of the output layer, which the decide pass reads and the answer step is forbidden to produce. Ordinary answers therefore cannot change. This relates to work showing that behaviors correspond to directions in hidden states that can be read out or written into weights (Arditi et al.; Panickssery et al.). Writing into the real "yes" and "no" rows instead broke normal answers.
4. Results
The setup is Qwen3-1.7B (bf16, greedy decoding) on an 8 GB laptop GPU. Each layout has 16 blocks, about 3,450 tokens in total: 8 settings files of 30 key–value lines each, and 8 test logs. Each of the 120 questions asks for one value from one file.
| Test | Result (out of 120 unless noted) |
|---|---|
| Answer with everything shown | 93 |
| Answer with only the needed block shown (about 5× fewer tokens) | 119 |
| Decide pass ranks the needed block first, without / with probe | 81 / 111 |
| Pick top block, then answer, without / with probe | 80 / 110 |
| Keyword overlap picks the right block | 120 (answers 119) |
| Paraphrased questions (service named, file not): keyword / decide pass without / with probe | 120 / 76 / 103 |
| Probe on a different task (test-log questions), without / with probe | 61 / 16 |
| Log-probability of the hidden answer: visible / masked / deleted | about −11 / −54 / −51 |
| Recall prompting with everything visible | 44 |
Three findings stand out:
- Showing less helps this model. Showing only the needed block lifted accuracy from 93 to 119.
- Masking hides as well as deleting. The answer became as unlikely as if the block had been removed and the text re-encoded.
- The model's own selection is the bottleneck. Without the probe, letting it pick a block (80) is worse than showing everything (93). The probe helps on the task it was fitted to, but on a second kind of question it drops from 61 to 16, usually choosing a settings file instead of the right log. In the paper's words, the probe learned the training task, not relevance in general. Simple keyword overlap picks perfectly here, because every question names its target.
Recall prompting did not work at this scale either. When told that it could recall hidden blocks, the model asked for blocks far too often, even when the answer was already visible.
5. Two uses of cheap block switching
Because hiding and showing a block only changes the mask, two patterns become cheap.
- Undoing a failed attempt. With an earlier wrong attempt visible, the model copied the wrong value 26 times in 30 and answered correctly 3 times. With the attempt hidden, it copied the wrong value 5 times and answered correctly 16 times. All 5 remaining copies came from cases in which the model-written note for the failed attempt repeated the wrong value. Hiding the note as well removed every copy (0 of 30, 15 correct). The leak was through the note, not the masked cache. So notes for failed attempts should not restate their wrong outputs.
- Subagents without a new context. For two-part questions, one call that saw everything answered 4 of 30 correctly. Separate lookups that each saw one file answered 12 of 30, limited by single-lookup accuracy.
6. Cost and limits
Cost. Hosted APIs discount repeated prompt prefixes (prompt caching), and changing which blocks are visible breaks that discount. Let $N$ be the tokens in all blocks, $A$ the tokens shown in full, $S$ the tokens shown as notes, and $p_{\text{in}}$, $p_{\text{cache}}$, $p_c$ the prices of input, cached input and the decide pass. Then MoE-Context is cheaper only if
If cached input costs a tenth of normal input, the visible share must stay under about a tenth. The case for the design is therefore quality, not price, unless one runs one's own serving stack with the single-cache variant.
Limits stated in the paper.
- Scope: one small model, one synthetic task family, and 120 questions without error bars.
- Cost of the decide pass: it runs one forward pass per block, about one second per question here, so the paper makes no speed claim.
- Unsupported in practice: current serving stacks and public APIs do not expose attention masking of this kind.
- Code: available from the author on request.
7. What it shows, and what remains open
The paper establishes three things at small scale. Masking cached blocks is a faithful, cheap way to hide context. Removing irrelevant context helps a small model. And reversible block switching makes undo and subagent patterns easy, with a concrete lesson about leaky notes.
It does not yet show that a learned relevance judgment beats ordinary retrieval. The author names what a fair test needs: tasks where relevance is not visible in the words, such as finding the file that caused a failing test; a decide pass trained on many task types; comparisons with embedding retrievers; and larger models. This connects to T4: structured context management is a promising ingredient for long-running agents, but the evidence here concerns the mechanism, not the selection policy.
8. Relation to the R5 card
The first version of the R5 card described MoE-Context as a routing method that makes long-horizon agents work better and "directly addresses one of the biggest operational bottlenecks". That went well beyond this laptop-scale study, whose own conclusion is that the model's block selection does not yet beat keyword search. The card has been revised to describe the mechanism, the results and the open selection problem.