Manuscript Offprint

arXiv:2611.02361

Agent Memory as Rate-Limited Filtering: Explicit State Outlasts Long Context Beyond a Reader-Dependent Horizon

Tianhao Guo, Chongyao Guo

Abstract

Can a language model that reads the full history of an access log say whether a service may act now? On an executable benchmark of grants, withdrawals, reinstatements, expiries, groups and change windows under a known policy, scored on pairs of histories that differ only in the order or one field of the deciding events, open models of 7 to 32 billion parameters fall from 72 to 86 percent after eight or sixteen events to 48 to 55 percent after 256, while reasoning-trained 32B models reading the current state reach 96 and 98 percent. A reasoning model of 120 billion parameters trails the state by four and seven points at 256 and 512 events and by about ten at 1,024, so the length beyond which explicit state outlasts long context grows with the reader. We treat agent memory as recursive filtering. The decision depends on the history only through a state whose size is set by the number of tracked keys. A store holding fewer component records than the state forgets on a time scale set by its capacity, and a reader model predicts its accuracy within 0.02 on average in a registered test. Retaining log lines without regard to time order errs with probability approaching one half, a bound that is attained. A filter in which a model parses each line and an explicit rule applies the updates answers 80 to 89 percent at 256 events and beats relevance retrieval, model-kept ledgers, a reimplementation of StateMem and the Mem0 library. A retriever that selects at query time the lines the queried state depends on matches it at 256 events on the first domain, so what decides is selection by the state's dependencies, which the filter performs when writing, without the query. Applying parsed updates themselves, the models fall to 58 and 59 percent. A frozen replication on a second domain with fresh wording reproduces the horizon.

1 Introduction

Agent memory is usually built as text compression. A summary is rewritten as events arrive, a retriever pulls passages back in, or a scoring rule decides which raw records survive a budget [22, 47, 49, 76]. Each design asks how to keep the most informative text. Few ask what the downstream decision depends on, and those that do treat memory as a one-shot partition of independent contexts [79] rather than as a state updated over time.

For a large class of agent tasks the answer is a state. Whether a service may write to a database depends on the last effective grant or withdrawal for that pair, on the rank of the sources that issued them, on whether a grant has expired, on group membership and on whether a change window is open. The history matters only through this state. Signal processing has a name for maintaining such a quantity recursively under a resource limit: filtering. Information theory has the matching question: how many bits per step a filter needs before estimation fails [42, 43, 60].

This paper takes the filtering view literally and tests it.

Long context does not track state. We build an executable benchmark in which every answer is produced by replaying events through a state machine (Section 3). Episodes come in pairs that share background, positions and wording and differ only in the order or one field of the decisive events, so that the correct answers swap. Given the full log, Qwen2.5-14B-Instruct reaches a balanced accuracy of 0.83 after 8 events and 0.48 after 256 events. Its ranking accuracy (AUC) falls monotonically from 0.85 to 0.53 across six horizons. Qwen2.5-7B follows the same curve one step lower, phi-4, from a different family, falls from 0.90 to 0.68, and Qwen2.5-32B falls from 0.96 at 16 events to 0.65 at 256. Long inputs are known to hurt reasoning and the retrieval of overwritten values [12, 31, 66], and long-horizon memory benchmarks report losses on knowledge updates [62, 72]. The paired design adds two things. Each pair isolates one order or field change with everything else held fixed, and the margin lets us separate a shift of the decision threshold from a loss of discrimination. Both are present, and at 256 events the 7B and 14B Qwen readers no longer discriminate at all. The failure is asymmetric. Prohibitions survive, reinstatements do not: in the restore family (grant, withdrawal, later reconfirmation) the 14B model refuses 11 of the 19 cases that should be approved at 64 events and the 7B model 15 of 19, and an alarm-worded withdrawal aimed at a different service is enough to make the 7B model refuse the service that holds a valid grant.

State restores the signal. The same model, given only the current state recovered by replay, ranks correctly with AUC between 0.95 and 0.99 at every horizon, and phi-4 between 0.98 and 0.99 with a balanced accuracy that shows no detectable dependence on the horizon (Section 4.2). For the Qwen readers a calibration offset remains, and it grows with the number of state lines, not with the number of events. Showing the raw log alongside the state pulls the model back toward its long-context behaviour.

The horizon moves with the reader. Stronger readers push the failure out but do not remove it. Before running them we registered how their results would change our claims (Section 4.6). gpt-oss-120b, a reasoning model of 120 billion parameters, reads the 256-event log at 0.95, and the state built from parsed events leads it by only +0.04, short of the registered margin. At 1,024 events its reading falls to 0.87 while the state stays at 0.99, a lead of +0.12 ([0.07, 0.17]) at about one twentieth of the tokens; with a second sampling seed the lead is +0.09 ([0.04, 0.13]), and at 512 events it is +0.07. Qwen2.5-72B is already at 0.72 against 0.94 at 256 events, and QwQ-32B, at 0.85 on 256-event logs, answers 0.52 on 1,024. By the rule we fixed in advance, the claim is therefore conditional on length. We define a reader's operational horizon as the shortest log length at which the state beats the log by the registered margin (Section 4.6); for gpt-oss-120b it lies at about 1,024 events. Below it a strong reader can use the log as its memory, at a cost that grows with the log. Beyond it the state keeps its accuracy at a cost set by the number of tracked keys. No theorem of this paper limits a reader that sees the whole ordered log, since exact replay of the log is sufficient (Section 2); the horizon is a measured property of readers.

Length more than same-key interference. A factorial design on chain counterfactuals varies the number of events on the queried key, the number of events on other keys and the total length independently. Raising the updates of the queried key from 3 to 17 moves AUC by +0.007 and -0.015 for Qwen 14B and Qwen 7B, with intervals of about ±0.05 around these values, while more events on other keys and a longer log each cost 0.07 to 0.13 with intervals that exclude zero (Section 4.1). Within the tested range the point estimates for the queried key are near zero and its intervals reach about 0.07 AUC, so the ordering is an upper bound, not an absence. Most of the loss comes from dilution by everything else, which is exactly what a filter removes. Same-key interference is not absent, since a short view of the key's own events still misleads the 14B reader in Section 4.3.

The filtering view predicts which memories can work. The decision-relevant statistic has a description length set by the number of tracked keys. A recursive filter that stores it needs a rate independent of the horizon when leases are bounded, and no memory below that rate can answer all queries (Section 2). A memory that retains raw events by any score computed without regard to order, whether lexical relevance, salience or a model's judgment of each line, cannot know which events have been superseded. On reordered histories its error is at least 12−b/(m−1)\frac{1}{2} - b/(m-1) for a budget of b lines and m events on the key, and this bound is attained. Keeping the last applied event of each state component is exact for a reader that applies the policy. Controlled chains confirm the separation and both retention results with an exact reader, and a slot-aware reader of a random subset of withdrawals attains the bound (Section 4.3), and a rate sweep shows that the budget needed by state memory tracks the size of the state (Section 4.9).

Models do not maintain the filter on request. Asked to keep a ledger of the current state, rewritten every 16 events within a token budget, Qwen2.5-14B reaches chance after 256 events. It does not run out of space. Its final ledgers use 171 of 256 tokens and mention the queried key in 8 of 80 streams, because the writer drops components it judges inactive and a dropped component never returns (Section 4.4). Yet the same model parses 35,743 of 35,744 event lines correctly when shown one line at a time. A filter built from these parses and an explicit transition rule answers 0.80 at 256 events with the Qwen reader, 0.84 with phi-4 and 0.89 with Qwen2.5-32B. The strongest competitor in which the model reads the log, a reasoning trace of up to 4096 tokens, reaches 0.64 and 0.73, and retrieval at most 0.68 (Section 4.5). Handing the model the same parsed updates and asking it to apply them to a state table drops it to 0.59 and 0.58, and our re-implementation of Mem0-style fact editing ends at 0.59 and 0.54. A table kept by code, which the model may overwrite but not delete from, closes about half of the remaining gap for one reader. The model can read events. It loses components when it rewrites its own record, and even a table it cannot delete from answers below the rule, and for the Qwen reader, the more of the transition the memory executes, the better the result. Asked to write the transition code itself, a 32B code model succeeds on a simple second domain and fails on the rank rule of this one, while its failure on reinstatement traces to a gap in our update format. A frontier coding agent given the same policy text writes a rule that agrees with replay once that gap is closed, a change we made after seeing its result.

What decides is selection by the state's dependencies. A filter whose store is smaller than the state forgets, at a rate the theory predicts within 0.02 of measured accuracy on average, and the published design closest to ours, StateMem, stays at or near chance on the priority family because its model resolves supersession by recency. The Mem0 library retrieves by similarity to the query, without preferring the latest line, and is at or below chance on most families. A retriever that keeps the whole log and, once the query is known, selects the lines the queried state depends on reads as well as the filter at 256 events on the first domain. The advantage of the filter is therefore not that it compresses the log but that it selects by the state's dependencies when it writes, before any query is known, with storage bounded by the state (Sections 4.5 and 4.10).

Contributions.

  1. A tight bound for order-oblivious retention. On histories that differ only in the order of two events, any rule that retains bb log lines chosen without regard to their time order, such as lexical, embedding or per-line salience scores on text stripped of time stamps, gives every reader an error of at least 12−b/(m−1)\frac{1}{2}-b/(m-1) averaged over wording, where mm is the number of events on the queried key. The error tends to one half when b=o(m)b=o(m), the bound is attained, keeping the last applied event of each state component is exact with a budget set by the number of components, and scorers that read the log in context are covered only up to an empirically estimated slack (Section 2).

  2. A noisy-parser analysis and a buildable filter. Per-event parsing errors are forgotten at the next applied event of one rank and persist behind blocked events of higher rank, a simulation from calibrated per-line error rates ranks parsers of 0.5 to 14 billion parameters with a rank correlation of 0.83 although their errors are not independent, and a calibrated confusion correction, whether line by line or sequential, brings the 0.5B and 1.5B parsers to the error of the 3B parser. A filter that parses each line with a model and applies an explicit rule beats relevance retrieval, model-maintained ledgers, fact stores, a reimplementation of StateMem and the Mem0 library when read by the same model, beats reasoning over the full log for reasoning-trained readers and, after multiplicity adjustment, for one of two instruction-tuned readers, and beats the best code-kept ledger protocol significantly for one of two readers. A retriever that selects at query time the lines the queried state depends on matches it at 256 events, which locates the advantage in selection by state dependencies rather than in compression (Sections 2 and 4.5 to 4.7).

  3. An executable benchmark with paired counterfactual streams, a replay oracle, a paraphrased variant and a pre-registered reader-validity protocol (Section 3).

  4. Measurements across eight readers of horizon decay and its causes, of a reader-dependent horizon up to 1,024 events, of state-based reading, of retention against the bounds, of recursive memories under a budget including model-maintained ledgers, and of the token cost of state in natural and compact encodings (Section 4).

  5. The cost of state in three units. In bits it is a classical instantiation, with thresholds far below every budget tested. In components the reader can decode, a calibrated component-eviction model of the reader predicts, in a registered test, how accuracy falls when the reader sees only part of the state, within 0.03 on average. For a bounded store that forgets what it evicts, the same model with the store's own error gives a retention horizon set by capacity and insertion rate (Sections 2 and 4.10). In reader tokens, the two renderings we tested cost about twenty tokens per component, and building the state costs one parser call per event (Section 4.11).

All hypotheses, thresholds and seed ranges were written before the corresponding runs. The pre-registration log is reproduced in Section G.

References (80)