Teaching an Agent When to Ignore Its Own Memory: A Learned Routing Controller
Experience use is not a fixed pipeline: whether to invoke it, which form to use, and when to consolidate new guidance are three separate decisions that a lightweight controller updated online from task feedback can make per question.
On this page
Zhou runs the online quality of a coding-assistant product. The system he inherited has been running for six months: every time it solves a user problem it writes down what it did, and the next time a similar problem arrives it pulls out the closest few old notes, hands them back together with the new question, and answers by leaning on that past experience. Next week he must decide whether to make this automatic look-up the default for every single request. His current way of judging is simple: compare the overall success rate and keep whichever version gets more answers right. The trouble sits in that word overall. Feeding old notes back sometimes hurts a question, and sometimes doing nothing at all is better, yet one aggregate number flattens all of that away. This paper [1] takes apart something the default quietly glues together: whether to call up old experience, which kind to call up, and when to compress scattered cases into a reusable rule are three independent decisions, and a very small switch can learn to make them as feedback comes in.
The Default: Retrieve the Closest Old Cases for Every Question
Three terms need pinning down first. Experience memory is the ledger a system keeps of past attempts: the trajectory of each solved problem, the score it earned, and a few lessons extracted from success or failure, all stored for later lookup. Retrieval is the act of picking, by similarity, the few entries from that ledger that look closest to the current question, where similarity just means how alike two pieces of text are in meaning. Injection is handing the picked content back to the model together with the new question, and the prompt is the whole block of text the model can see and must answer from [1].
Most existing systems weld these three steps into one fixed pipeline: a question arrives, retrieve, inject, answer, then reflect a line and store it. OMCE [1] starts from the observation that this pipeline assumes experience is always useful and that more similarity means more usefulness, and neither assumption holds. The most semantically similar old record need not help the question at hand; and even when it does help, a concrete case carrying full execution detail may not transfer to a different kind of task, while a distilled general principle may have thrown away exactly the detail needed to execute. The authors keep the two kinds apart in an Episodic Memory of concrete trajectories and case-specific insights, and a Guidance Memory of transferable principles.
There is a further cost: turning cases into general rules itself spends compute, and makes the ledger grow without bound. So whether to use experience, which form to use, and whether to distill a new one on the spot are all squeezed into a single habit, and none is ever decided on its own. The paper treats this fixed pipeline as the thing to replace, arguing that scheduling experience is itself a learnable dimension of self-evolution rather than a constant [1]. That is why the abstract's phrase about neglecting when and how to deploy experience matters: the question is never whether experience exists, but when and in what shape it gets placed into the input.
Three Decisions and Four Actions
OMCE splits that knot into three decisions to be made together. Adaptive invocation asks whether old experience is needed at all, or whether the model should just answer empty-handed. Selective form asks, if it is needed, whether to reach for a concrete past case or a general principle. Learnable consolidation asks whether the concrete cases in hand are rich enough to justify distilling a new rule now and storing it for later, where distilling simply means compressing scattered specific cases into one transferable principle, like reducing several pages of notes to a single maxim [1].
These collapse into a choice among four actions. DIRECT answers with the original input and no experience at all. EPISODE injects the retrieved concrete cases. GUIDE injects the retrieved general principles. DISTILL first condenses the retrieved cases into one fresh principle, stores it, and then uses that as the reference for this question. Together the four actions cover every combination of whether to invoke, which form to use, and whether to consolidate something new, and the controller picks exactly one of them per question [1]. The paper stresses that this four-way choice is made by one controller that never reads the raw memory text and costs no extra large-model call, deciding from nothing more than a short vector of compressed retrieval signals.
| Action | What enters the prompt | Which decision it settles |
|---|---|---|
| DIRECT | Only the original question, no old experience | Decline to invoke experience |
| EPISODE | The retrieved concrete past cases | Invoke, choosing the case form |
| GUIDE | The retrieved general principles | Invoke, choosing the principle form |
| DISTILL | A fresh principle distilled from cases, stored, then injected | Invoke, and consolidate a new rule |
A Nine-Dimensional State and a Controller With No Extra Model Call
How does the controller pick? It never reads the whole ledger; it only sees a compressed nine-dimensional state. A vector here is just an ordered list of numbers: eight of them are normalized online against running mean and variance, meaning they are rescaled to a comparable range, and the ninth is a constant one, kept as a bias term for the linear model. The paper calls this the meta-state. The eight features fall into three groups. Relevance contributes two, from the retrieval scores of the two memory sources. Quality contributes four, from memory quality scores and their relevance-weighted counterparts. Diversity contributes two, specifically the balance between successful and failure-side episodic evidence and the normalized entropy of outcome types, where entropy is simply a number for how evenly those outcome types are mixed. The paper stresses that diversity here means diversity of outcomes, not semantic diversity among entries [1].
Each memory source contributes its three closest entries, a cap the paper writes as M equals 3. Case quality is scored by outcome: 1.0 for success, 0.5 for partial or unknown, 0.0 for failure, and partial outcomes count as half a failure with weight 0.5. The two diversity features are exposed only to the DISTILL action through an action-specific mask. The controller is a contextual bandit, a lightweight decision rule that looks only at the current question's cues, picks among a few options, and receives feedback only for the option it chose; each action gets a linear reward model plus an exploration term that keeps rarely chosen actions selectable. The crucial efficiency point is that action selection itself costs no extra large-model call, because four actions and a nine-dimensional state leave only small matrices and vectors [1].
After execution, the reward updates the sufficient statistics of the chosen action only, while a discount is applied to all action models so older evidence fades as the memory distribution shifts; the forgetting factor is 0.98. Two implementations are given. OMCE-TS uses Thompson Sampling, drawing one sample from each action's posterior over reward parameters before comparing, where a posterior is simply the current uncertain belief about what those parameters might be. OMCE-UCB uses a LinUCB-style optimistic upper bound, an optimistic ceiling on how good an action might be that also lifts rarely tried ones. Both share one configuration, fixed across every benchmark and every backbone with no further tuning, and that shared configuration was chosen on a random 100 of the 1,140 BigCodeBench tasks, which remain inside the final evaluation stream [1].
| Configuration item | Value | Meaning |
|---|---|---|
| Retrieval count M per source | 3 | Three closest entries from each memory |
| Meta-state dimension d | 9 | Eight features plus a constant bias |
| Forgetting factor | 0.98 | Older evidence is discounted by round |
| Ridge regularization lambda | 0.5 | Stabilizes the linear model inverse |
| LinUCB exploration alpha | 3.0 | Confidence interval width |
| Thompson sampling scale v squared | 0.25 | Spread of the sampling distribution |
| Maximum total attempts P | 4 | Up to three retries after the first answer |
Results: Eleven of Sixteen Settings, and Five to Sixty Times Fewer Tokens
The experiment pairs four online-adaptation benchmarks with four backbone models, sixteen configurations in total, with tasks arriving in one shared sequential stream: only after an instance is answered does the method see feedback and may update memory or controller. The benchmarks are BigCodeBench for code generation, SWE-bench Verified for repository-level issue resolution, MultiChallenge for realistic multi-turn conversation, and BBEH for advanced general reasoning; the backbones are GPT-5.2, DeepSeek-V3.2, DeepSeek-V4-pro, and Kimi-K2.5. The four streams contain 1,140, 500, 273, and 1,200 instances respectively. The primary metric is one-shot success rate, whether the current policy and accumulated experience solve an instance on the first attempt; methods with retries also report cumulative success within four total attempts [1].
The sharpest numbers come from MultiChallenge, where OMCE beats the best of ReasoningBank, ACE, and MemP on all four backbones by 13.5 to 20.5 points, and its weakest backbone there still sits at 67.4%, itself 10.7 points above the strongest baseline on any backbone. On SWE-bench Verified it leads the same three baselines on all four backbones by 1.8 to 10.0 points. Across the sixteen configurations OMCE takes the highest first-attempt success in eleven. On BBEH, GPT-5.2 reaches 53.3% against ACE's 52.4%, and trails by only 0.1 point on Kimi-K2.5; on BigCodeBench it wins only with GPT-5.2 and loses to MemP on the other three backbones [1].
| Benchmark (GPT-5.2) | Base LLM OSR / CSR | ACE OSR / CSR | OMCE-TS OSR / CSR | OMCE-UCB OSR / CSR |
|---|---|---|---|---|
| MultiChallenge | 52.8% / 70.1% | 48.7% / 71.4% | 67.4% / 97.1% | 66.3% / 95.6% |
| BBEH | 33.3% / 49.7% | 52.4% / 94.4% | 53.3% / 78.7% | 46.8% / 71.0% |
| BigCodeBench | 48.1% / 54.0% | 38.2% / 40.3% | 49.6% / 58.9% | 51.3% / 59.2% |
| SWE-bench Verified | 52.8% / 64.0% | 50.8% / 52.0% | 64.8% / 64.8% | 64.8% / 64.8% |
Efficiency is the other half of the result. Measured as average large-model tokens per task, OMCE uses 5.7 to 62.5 times fewer than ACE. The appendix breaks this down by benchmark: about 62.5 times on BigCodeBench, 32.5 on SWE-bench Verified, 5.7 on MultiChallenge, and 21.8 on BBEH. The reason is that ACE unconditionally injects its entire playbook every round, so the context keeps lengthening, whereas OMCE injects only the selected snippet. Base LLM and MemP are the cheapest in tokens because they skip test-time scaling entirely, but also the least accurate; OMCE sits between the extremes on every benchmark and backbone, more accurate than the cheap baselines and far cheaper than ACE [1].
Where the Gain Comes From: Routing, Not Memory
Three controlled comparisons separate the credit. First, fixed strategies: Fixed-EPISODE always injects concrete cases, and Fixed-GUIDE-and-DISTILL always reuses or distills principles. On GPT-5.2 the former beats the latter by 7.2 points on BBEH, 50.3% against 43.1%, while the order reverses on MultiChallenge, where the latter leads by 7.7 points, 63.7% against 56.0%, and flips once more on DeepSeek-V3.2 by 4.7 points. So which form of experience helps has no cross-task answer, and committing to one must lose somewhere. A hand-crafted rule with fixed thresholds, OMCE-HEU, does not rescue this: the learned controllers beat it by 0.8 to 7.7 points on all four benchmarks, widest on BBEH at 53.3% against 45.6%, and across the full grid the better learned variant wins on fourteen of sixteen pairs, with TS and UCB each beating it on eleven of the sixteen [1].
Second, memory content is pinned down: take the snapshot OMCE already built and vary only the routing rule. OMCE beats Always-Both, which reads both memory types on every task, by 3.6 to 16.0 points, and beats Random by 4.8 to 11.8, with higher cumulative success on all four. The telling cell is SWE-bench Verified: Always-Both reaches only 48.8%, below the 52.8% of the Base LLM with no memory at all, and on BigCodeBench it reaches 47.5% against 48.1%. On two of four benchmarks, then, indiscriminate retrieval is worse than retrieving nothing. Always-Both-and-Update, which runs the full online loop while still reading both memory types and updating after every task, likewise trails OMCE on all four benchmarks by 2.2 to 9.8 points [1].
Third, must the controller keep learning? Freezing it at the midpoint of each stream while memory keeps evolving costs first-attempt success on all four benchmarks by 5.5, 3.5, 1.8, and 0.6 points, closely tracking its leads over the best fixed policy of 3.7, 3.0, 1.7, and 0.4. One MultiChallenge case makes the routing concrete: a user says a conference is in June, then corrects it to July. A fixed pipeline retrieves cases that all insist on holding the earlier statement as a hard constraint, so the model clings to June. The controller reads the episodic side as weak or conflicting and routes to GUIDE, whose retrieved principle concerns detecting and reconciling contradictions, so the model picks up July and solves it [1]. The appendix adds three SWE-bench Verified cases: django-16560 avoids misleading guidance via DIRECT, django-13401 selects architectural guidance via GUIDE, and django-13809 distills a fresh principle from similar cases via DISTILL.
Where This Breaks Down
The paper states its claim narrowly, and the following limits are written by the authors rather than inferred here.
- Timely feedback is a precondition: OMCE updates its controller from per-task rewards, so in sparse or delayed-reward settings the bandit updates turn noisy, and an abrupt shift in task distribution can stale both the accumulated experience and the learned policy at once [1];
- Only the chosen action is observed: partial observability means the three unchosen routes get no counterfactual signal, so recovering from an early bad decision can be slow [1];
- Unbounded memory growth backfires: as entries pile up, retrieval can hit redundancy or semantic collisions, and the paper suggests explicit aging, eviction, memory auditing and pruning as future work;
- Coverage of the controlled studies is limited: the memory-use and controller-update comparisons were run only on GPT-5.2, while the routing comparison spans all four backbones, so whether the same effects hold elsewhere is untested;
- One small tuning overlap: the shared configuration was chosen on a random 100 of the 1,140 BigCodeBench tasks, and those 100 remain inside the final evaluation stream, with no further tuning on other benchmarks or backbones [1].
In one line: this applies when tasks arrive one after another, each returns a reliable right-or-wrong signal promptly, and you are willing to let the scheduler keep updating along the stream. If feedback arrives late, the task mix changes abruptly, or you have no per-item verdict at all, then it cannot help you, and solving where feedback comes from matters more than swapping in a cleverer controller [1].
