XRAPH/Research/Whitepaper

Bounded Working Memory for Long-Horizon Agents

Argues that long-running agents degrade through attention dilution rather than capacity exhaustion, which would explain why a larger context window does not help. Separates working memory, summarised history and graphed claims, and sets out the measurement that would settle the claim.

Type
Whitepaper
Year
2026
Status
Draft
Length
6 min read
Focus area
Agent Knowledge Distillation & Graphing

#Abstract

Long-running conversational agents degrade in a manner that resembles capacity exhaustion. This paper argues that attention dilution is the better explanation. This paper separates three concerns that a transcript conflates, describes a bounded relevance-scored working memory, and sets out the measurement that would settle the claim. That measurement has not been performed, which is stated plainly.

#Observed behaviour

An agent holding a full transcript performed acceptably for approximately eighty turns, after which answer quality declined in a way that is difficult to characterise. The failure was not fabrication and not loss of the current topic. Answers were consistent with material from several dozen turns earlier and irrelevant to the current question.

The intuitive response is to supply more context. The evidence points the other way: model performance depends on where relevant information sits within a long input and degrades when it is surrounded by material of similar surface relevance . Adding text increases the surrounding material.

#Four explanations, and why they are not equivalent

The behaviour above is compatible with several accounts, and they are routinely conflated because they produce similar symptoms. They imply different remedies, which is why separating them is worth the effort.

  1. Capacity exhaustion. The transcript approaches or exceeds the context window and material is truncated. Remedy: a larger window.
  2. Attention dilution. The relevant material is present but competes with a growing volume of superficially similar material. Remedy: less input, selected better.
  3. Positional effects. Relevant material sits in a region of the input the model attends to less reliably. Remedy: place important material at the boundaries, which is a prompt construction change rather than an architectural one.
  4. Instruction decay. The system instruction, given once at the start, competes with hundreds of turns of subsequent text and loses influence. Remedy: reassert instructions periodically.

The observed failure argues against the first. Degradation began well before the window was exhausted, and truncation would have produced loss of early material rather than the observed pattern of answers drawn from early material and irrelevant to the current question. That pattern is the signature of the second and the third: the old content is not merely present, it is winning.

The fourth is real and separable, and it was addressed independently by reasserting the active goal each turn. That change alone produced an improvement, which muddies the evidence for everything else and is reported here for that reason rather than in spite of it.

#A note on the human analogy

The term working memory is borrowed, and borrowing it carries a risk worth naming. Human working memory is a well studied construct with a bounded capacity for discrete items and a structure involving separable subsystems and central control . The resemblance to a bounded, relevance-scored store is real enough to make the name useful and is not evidence.

Transformer attention is not a capacity-limited buffer, and nothing about the architecture predicts a magical number . The bound in this construction is a chosen engineering parameter justified by its effects, not a discovered property, and any argument of the form "humans hold about seven items so agents should" would be an equivocation. The analogy is used to name a component and is doing no argumentative work.

#Three concerns, separated

Working memory. A bounded store of what is currently in play, with items scored for relevance against the active goal and decaying when unreferenced. The bound is a chosen parameter rather than a consequence of conversation length, so marginal cost per turn is independent of the agent's age.

Summarised history. The transcript persists and is not what is transmitted. Older segments compress. This is the least novel component and the one whose benefit is least disputed.

Distilled claims. Conclusions emitted at episode close as typed statements with retained provenance, written into a graph. This is what provides a contradiction surface, and it is treated in a companion note.

score(m,g)  =  αrel(m,g)  +  βeδΔt  +  γimp(m)\mathrm{score}(m, g) \;=\; \alpha \cdot \mathrm{rel}(m, g) \;+\; \beta \cdot e^{-\delta \Delta t} \;+\; \gamma \cdot \mathrm{imp}(m)
(1)
Retrieval score for a working memory item

The form follows the memory stream retrieval used in the generative agents architecture , with relevance to an explicit active goal rather than to the most recent observation.

#Relation to architectural approaches

Extending usable context has been attacked at the architecture level, by sparsifying attention so that longer inputs are tractable , by carrying recurrent state across segments , and by exploiting the observation that retaining a few initial tokens stabilises generation over very long streams . These change what a model can process.

The construction here changes what it is asked to process, and the two are complementary rather than competing. A model with an efficient long-context mechanism still benefits from not being handed six hundred turns of resolved conversation, and a bounded working memory still benefits from a model that handles its contents robustly. Systems that page between an active context and external storage occupy the same layer as this work and differ in that the paged unit remains raw text , whereas the items here are scored and typed.

The claim is therefore modest. Nothing here is a contribution to how models handle long inputs. It is a claim about what an application should put in front of them, and it would remain relevant if context windows grew by another order of magnitude, since the dilution account predicts that a larger window filled with the same undifferentiated transcript does not help.

#Why the prompt is the wrong unit

A secondary argument. Agent behaviour is commonly configured through a single long system prompt. Such an artefact cannot be tested, no contributor can identify which passage is load bearing, and a change intended to fix one behaviour reliably alters another.

Prompt structure demonstrably changes behaviour , which is exactly why an unstructured prompt is unmanageable. Decomposing configuration into skills, traits, behaviours, cognitive style, communication style and perception allows each to be versioned and evaluated separately.

#Observed effects

  • Token expenditure per turn ceased to scale with conversation length.
  • Contradiction became detectable, because comparing claims is a query.
  • The specific drift toward previously resolved material was no longer observed.
  • No improvement in single-turn reasoning quality, which the construction does not address.

#The measurement this paper does not report

The claim is that degradation past a few hundred turns is attention dilution rather than capacity exhaustion. The experiment that would settle it is a fixed long-horizon task, executed by the same underlying model at several context window sizes, with and without bounded working memory, scored per turn against a held-out rubric.

The prediction distinguishing the two explanations is specific: under the capacity account, degradation should recede as the window grows. Under the dilution account, a larger window with unbounded transcript should not help and may hurt, while a bounded memory at any window size should not degrade.

This experiment has not been run. Until it is, the construction is supported by mechanism and by operational observation rather than by controlled measurement, and the paper should be read on that basis.

#Further limitations

Relevance scoring depends on an explicit representation of the active goal, which is not always available and is itself model-produced. When the goal representation is wrong, the memory selects confidently for the wrong thing, and the failure is harder to diagnose than the one it replaced, because the transcript no longer shows what was omitted.

Decay parameters were chosen by inspection rather than fitted. The three coefficients in the scoring function interact, and no sensitivity analysis was performed, so it is entirely possible that the observed improvement is robust to their values or that it depends on them delicately. I do not know which.

The observed effects are confounded, as noted above. Bounded memory, goal reassertion and history summarisation were introduced over the same period on a live system, and the improvement is attributed to the combination. Attributing it to any one component would not be supportable.

Finally, the architecture inherits the underlying model's propensity to produce ungrounded statements, which bounded memory does not address and is not intended to . A smaller, better selected context does not make a model more truthful about what is in it.

References

  1. [1]Nelson F. Liu et al., Lost in the Middle: How Language Models Use Long Contexts, Transactions of the Association for Computational Linguistics, vol. 12, pp. 157-173, 2024doi:10.1162/tacl_a_00638
  2. [2]George A. Miller, The Magical Number Seven, Plus or Minus Two: Some Limits on Our Capacity for Processing Information, Psychological Review, vol. 63, no. 2, pp. 81-97, 1956doi:10.1037/h0043158
  3. [3]Alan D. Baddeley, Graham Hitch, Working Memory, Psychology of Learning and Motivation, vol. 8, pp. 47-89, 1974doi:10.1016/S0079-7421(08)60452-1
  4. [4]Ashish Vaswani et al., Attention Is All You Need, Advances in Neural Information Processing Systems (NeurIPS), 2017
  5. [5]Joon Sung Park et al., Generative Agents: Interactive Simulacra of Human Behavior, ACM Symposium on User Interface Software and Technology (UIST), 2023doi:10.1145/3586183.3606763
  6. [6]Iz Beltagy, Matthew E. Peters, Arman Cohan, Longformer: The Long-Document Transformer, arXiv:2004.05150, 2020https://arxiv.org/abs/2004.05150
  7. [7]Zihang Dai et al., Transformer-XL: Attentive Language Models beyond a Fixed-Length Context, Annual Meeting of the Association for Computational Linguistics (ACL), 2019doi:10.18653/v1/P19-1285
  8. [8]Guangxuan Xiao et al., Efficient Streaming Language Models with Attention Sinks, International Conference on Learning Representations (ICLR), 2024
  9. [9]Charles Packer et al., MemGPT: Towards LLMs as Operating Systems, arXiv:2310.08560, 2023https://arxiv.org/abs/2310.08560
  10. [10]Jason Wei et al., Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, Advances in Neural Information Processing Systems (NeurIPS), 2022
  11. [11]Tom B. Brown et al., Language Models are Few-Shot Learners, Advances in Neural Information Processing Systems (NeurIPS), 2020
  12. [12]Ziwei Ji et al., Survey of Hallucination in Natural Language Generation, ACM Computing Surveys, vol. 55, no. 12, 2023doi:10.1145/3571730