UniMem: Complementary Episodic-to-Parametric Memory for Boundary-Agnostic Task Streams

Siyu Xia, Chenheng Zhang, Yanting Wu, Haoxuan Li, Jiajun Chai, Xiaohan Wang, Guojun Yin, Wei Lin, Zhouchen Lin, Haifeng Zhang, Jun WangarXiv 2026

TL;DR

UniMem is an autonomous memory management framework for LLM agents that solves the stability-plasticity dilemma in continuous, boundary-agnostic task streams. Inspired by the human brain's complementary learning systems, it routes rare or novel tasks to an external episodic buffer (RAG) and dynamically consolidates recurring patterns into expandable parametric memory blocks. This approach yields an average improvement of 4.0 Exact Match points across multiple backbone models without requiring explicit task labels.

What Problem Does This Paper Address?

When LLM agents are deployed in real-world scenarios, they must handle a continuous stream of diverse, evolving tasks. Crucially, these streams are often "boundary-agnostic"—meaning the model doesn't receive explicit labels or notifications when a task changes.

This setup triggers a classic trade-off known as the stability-plasticity dilemma:

  • External retrieval-based memory (like RAG) is highly plastic; it can instantly absorb new information without gradient updates. However, it fails to internalize recurring execution patterns and incurs significant inference-time latency and context-window overhead.
  • Parametric memory (like LoRA or prompt tuning) provides stable and efficient execution once a task is learned. However, it typically requires explicit task boundaries and fixed parameter budgets, making it prone to catastrophic forgetting or parameter collision in open-world streams.

UniMem addresses this challenge by autonomously balancing immediate adaptation with long-term knowledge consolidation.

The episodic-to-parametric conceptual workflow of UniMem.

Methods

UniMem operationalizes a self-routing episodic-to-parametric lifecycle inspired by how the human brain utilizes the hippocampus (for fast episodic storage) and the neocortex (for slow consolidation).

The architecture consists of three main components:

  1. Self-Routing Architecture: UniMem decouples task identification from task execution. It maintains a matrix of lightweight, learnable routing tokens alongside a calibrated novelty sentinel token ($e_{\text{NOVEL}}$).
  2. Streaming Episodic Buffering: When an incoming query matches the novelty sentinel or falls below a confidence threshold ($\tau_{\text{route}}$), it enters an external episodic buffer and is executed using standard RAG.
  3. Autonomous Parametric Consolidation: When the episodic buffer reaches capacity, UniMem triggers unsupervised task discovery. It uses Normalized Compression Distance (NCD) and HDBSCAN to cluster similar task patterns without relying on explicit labels. Validated clusters are then promoted into new parametric memory units (Procedural KV Memory blocks) via supervised fine-tuning (SFT), expanding the model's capacity on demand.
Figure 2: Architecture of UniMem. The left panel shows the overall self-routing architecture for assigning incoming queries to known-task memory units or the novelty pathway. On the right, the upper part illustrates routing-guided memory selection and execution, while the lower part shows episodic buffering and parametric consolidation during memory expansion.

Datasets

The authors evaluated UniMem on two main streaming setups:

  • Super-Natural Instructions (SNI): A generative benchmark scaled up to 100 diverse tasks to test long-horizon scalability. The authors simulated a long-tail distribution by restricting a subset of tasks to only 10 training instances, forcing them to remain episodic unless sufficient evidence accumulated.
  • SuperGLUE Mixed Stream: A blended sequence of six complex reasoning tasks (BoolQ, CB, RTE, COPA, MultiRC, WiC) presented as a single, boundary-agnostic stream to evaluate performance during implicit task transitions.

Key Insights and Ideas

  • Decoupling Routing from Execution: By separating where to route (routing tokens) from how to execute (procedural KV memory blocks), UniMem prevents parameter entanglement and representation interference, which typically degrade standard PEFT methods in streaming settings.
  • Compression-Based Clustering: Using NCD (which relies on gzip byte lengths) allows the system to measure procedural similarity directly from text structure without needing a pre-trained embedding space. This makes it highly sensitive to the structural, lexical, and syntactic patterns unique to specific prompt instructions.
  • Conservative Parameter Allocation: By keeping sparse or long-tail tasks in the episodic buffer, UniMem avoids premature parameter allocation, ensuring that network capacity is only spent on reliable, recurring patterns.

Key Results

  • Consistent Outperformance: UniMem consistently outperformed non-memory, external-memory, and parametric-memory baselines across three backbone models (LLaMA-3.2-3B, LLaMA-3.1-8B, and Qwen3-8B).
  • Generative Accuracy Gains: On the SNI benchmark, UniMem achieved an average gain of 4.0 Exact Match (EM) points over the best baselines. For instance, on LLaMA-3.2-3B with 100 tasks, UniMem scored 47.56% EM compared to TOKMEM's 40.54%.
  • Robust Routing Over Time: The routing mechanism maintained high accuracy over long horizons, staying above 85% accuracy even after scaling up to 100 tasks on the LLaMA-3.1-8B backbone.
Routing token accuracy on SNI streaming task sequences under increasing task scales.

Limitations and Future Work

  • Conservative Consolidation Thresholds: The current threshold-based strategy might be too conservative, keeping useful patterns in the episodic buffer for longer than necessary. Developing more adaptive consolidation criteria could optimize memory utilization in highly dynamic streams.
  • Pluggable Memory Modules: The framework currently instantiates parametric memory solely using Procedural KV Memory with a frozen backbone. Exploring how other parameter-efficient architectures (like dynamic LoRA adapters) fit into this lifecycle remains an open direction for future work.

Summary updated

BibTeX
@misc{xia2026unimem,
  author = {Siyu Xia and Chenheng Zhang and Yanting Wu and Haoxuan Li and Jiajun Chai and Xiaohan Wang and Guojun Yin and Wei Lin and Zhouchen Lin and Haifeng Zhang and Jun Wang},
  title = {{UniMem: Complementary Episodic-to-Parametric Memory for Boundary-Agnostic Task Streams}},
  year = {2026},
  eprint = {2607.26017},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.26017},
}
Figure