arXiv(opens in a new tab)cs.CLAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.22215

Dual-Layer Agentic Memory with Fast Write Routing and Slow Consolidation

Wenzhi Li, Dong Nie, Rui Lan, Tongtong Lyu, Peiyao Wang, Lingzi Hong, Weihang Pan, Boyuan Pan, Yao Hu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Wenzhi Li

Zhejiang University

Dong Nie

Independent Researcher

Tongtong Lyu

Xiaohongshu

Rui Lan

Xiaohongshu

Peiyao Wang

Independent Researcher

Lingzi Hong

University of North Texas

Weihang Pan ∗^{*}

Zhejiang University

Binbin Lin

Zhejiang University

Boyuan Pan

Xiaohongshu

Yao Hu

Xiaohongshu

Abstract

Large language model (LLM) agents operate in dynamic environments where knowledge continuously evolves. Existing memory systems typically treat external memory as a monotonically growing repository, inevitably leading to retrieval degradation and increasing computational costs over time. We argue that the core challenge is not retrieval alone, but managing the knowledge lifecycle: deciding what to externalize, update, or ultimately internalize. Inspired by Complementary Learning Systems (CLS) theory in neuroscience, we propose Dual-Layer Agentic Memory, a framework that shifts memory management to the write phase through cost-aware epistemic routing and periodic parametric consolidation. Incoming information is categorized as non-write, write-new, or write-update, and routed through a small-to-large model cascade that minimizes routing overhead while filtering redundant memories. A subsequent write-back phase selectively consolidates high-value external memories into model parameters via supervised fine-tuning. Experiments demonstrate the dual efficiency of our approach: a 1.7B/8B cascade prunes up to 68% of redundant external memory while escalating fewer than 50% of inputs, yet retains over 98% of the downstream QA Exact Match (EM) achieved by an exhaustive retention baseline. We further show that periodic consolidation successfully internalizes external knowledge, allowing the router to adaptively suppress redundant writes as the model's epistemic boundaries evolve. Overall, our framework presents a unified paradigm for agent memory: selective externalization followed by selective internalization. Code and dataset will be released upon acceptance.

1 Introduction

Large language model (LLM) agents are increasingly deployed in long-horizon, dynamic environments such as multi-session dialogue, autonomous research, personal assistants, and continual decision-making systems. In these settings, knowledge evolves over time rather than remaining static. An agent may repeatedly encounter information that is already captured by its parameters, genuinely novel facts that lie beyond its current parametric memory, or updates that directly conflict with stale internal beliefs. For example, an assistant may accumulate many user interaction logs that are redundant or outdated, while failing to preserve a newly stated user preference or revise a

∗^{*}Corresponding author. Email: panweihang@zju.edu.cn

Preprint.

previously incorrect assumption. As a result, effective memory management is essential for persistent and coherent reasoning in agent systems.

Most existing approaches tackle this challenge by equipping agents with explicit external memory mechanisms, typically implemented through retrieval-augmented generation (RAG) [1], memory logs [2], hierarchical buffers [3], or structured external memory. These systems improve persistence beyond the context window, but they usually treat external memory as an unconditional log into which observations are monotonically appended [2]. Because filtering mechanisms operate primarily in the read phase—relying on downstream queries to condition retrieval—systems cannot proactively reject redundant information at the source. This design leads to a fundamental storage–performance trade-off: as external memory grows, retrieval becomes noisier, more expensive, and more latency-sensitive.

A different line of work attempts to bypass retrieval by directly incorporating new knowledge into model parameters through knowledge editing [4, 5] or continual learning [6]. While this enables fast retrieval-free access, it comes with its own limitations: parameter updates are computationally expensive and prone to interference or catastrophic forgetting. More importantly, both retrieval-heavy and parametric-only approaches implicitly assume a fixed storage substrate. Knowledge is either externalized or internalized, but is rarely treated as something that should be dynamically allocated, revised, and migrated across memory substrates over time.

We argue that this view is fundamentally incomplete. Rather than deferring filtering decisions to a query-driven read phase, the core challenge is managing knowledge across its full lifecycle the moment it enters the system. When a new fact arrives, the agent should immediately evaluate it against its parametric memory to decide whether the fact is redundant, whether it must be written into external memory, and whether it should later be consolidated into model parameters. In particular, external memory should not serve as a permanent dumping ground. Instead, it should function as a selective and temporary store for knowledge that is either missing from parametric memory or in conflict with stale internal beliefs.

This perspective is naturally connected to memory mechanisms in neuroscience. Complementary learning systems (CLS) theory [7] posits that biological memory relies on two interacting subsystems: a fast-learning hippocampus capable of rapidly encoding novel experiences, and a slower neocortex that gradually consolidates stable knowledge into long-term representations, typically via offline replay during sleep. From this perspective, external memory acts as the fast, editable hippocampal buffer for novel or conflict-prone information, while parametric memory serves as the slower, stable cortical substrate. Inspired by this analogy, we formulate agent memory as a dual-layer knowledge lifecycle problem consisting of fast write routing and slow consolidation (analogous to sleep-dependent memory replay).

Concretely, we propose a dual-layer system with two types of memory and two forms of decisions. At the carrier layer, the agent maintains parametric memory for stable, compressed, low-cost knowledge and external memory for dynamic, editable, high-risk facts. At the decision layer, we separate fast write routing from slow write-back (the consolidation mechanism). We conceptualize every incoming piece of knowledge through an operational taxonomy of three classes: non-write, write-new, and write-update. Here, non-write denotes knowledge already safely answerable from parametric memory, write-new denotes knowledge missing from parametric memory, and write-update denotes knowledge for which the model produces a non-refusal but incorrect answer, indicating stale or conflicting internal knowledge. To manage admission efficiently, the write router bypasses explicit three-way classification and directly optimizes a continuous storage-performance trade-off through a binary admission decision: write or discard. Here, write and discard are router-level actions used for cost-aware decision-making, while the precise handling of novel versus stale facts is deferred to the subsequent consolidation stage.

A central systems contribution of our framework is that write routing is implemented as a small-to-large cascade. Instead of relying on a large model for every routing decision, we use a lightweight model to perform cheap front-end screening and resolve easy cases early, while only uncertain or ambiguous knowledge items are escalated to a stronger model. This design is crucial because write routing is itself a resource-allocation problem: if the router always requires the large model, then routing becomes too expensive to justify. The cascade therefore optimizes not only memory usage, but also the computational cost of the routing policy itself.

Figure

Figure 1: Comparison of agent memory paradigms. (a) Pure external memory: Monotonically appending facts to an external database often leads to memory bloat and degrades retrieval precision. (b) Pure parametric memory: Directly incorporating continuous updates into model weights is computationally expensive and susceptible to catastrophic forgetting. (c) Dual-Layer Agentic Memory (ours): We formulate memory as a knowledge lifecycle. A cost-aware cascade router (Fast Write Routing) filters incoming facts, escalating uncertain items to maintain a compact external memory. Retained external memories are periodically internalized via supervised fine-tuning (Slow Consolidation). This process updates the model's parametric knowledge, shifting its epistemic boundaries to reduce future reliance on external memory.

To operationalize this formulation, we construct a behavioral labeling pipeline over raw (knowledge, query, answer) triples. For each triple, we compare zero-shot answering against answering with explicit memory support. If the model answers correctly zero-shot, the corresponding knowledge is labeled as non-write; if the model fails zero-shot but succeeds with memory, it is write-worthy. We further distinguish write-new from write-update based on whether the zero-shot failure manifests as an explicit refusal or a confident but incorrect answer. These labels allow us to train and evaluate write routers using model behavior rather than abstract semantic judgments.

Finally, we study write-back as the slow half of the lifecycle by converting selected write-new and write-update memories into fine-tuning supervision and testing whether previously retrieval-dependent facts become internally answerable. In this sense, our framework is not only about selective storage, but also about selective internalization: the agent first externalizes only high-value knowledge, and later consolidates stable, validated memories back into parametric memory to reduce future dependence on retrieval. Because the write router operates directly on the model's hidden states and uncertainty profiles, it naturally senses this consolidation; once a fact is internalized, its shifted internal representations prompt the router to discard future encounters of the same knowledge, effectively closing the knowledge lifecycle loop.

Our contributions are summarized as follows:

• We formulate agent memory as a dual-layer knowledge lifecycle system that unifies external memory, parametric memory, fast write routing, and slow consolidation.

• We introduce an operational memory taxonomy (non-write, write-new, write-update) together with a cost-aware small-to-large routing cascade that frames memory admission as an accuracy–efficiency optimization problem.

• We propose a periodic write-back consolidation mechanism that enables knowledge internalization and adaptive epistemic shift, progressively reducing reliance on external memory as parametric knowledge evolves.

• We construct an online streaming evaluation benchmark that decouples write-time admission from read-time retrieval, showing that selective externalization and consolidation mitigate memory bloat while closely matching exhaustive-memory performance.

References (28)