Source-linked AI summary
Choosing How to Remember: Adaptive Memory Structures for LLM Agents
Mingfei Lu, Mengjia Wu, Feng Liu, Jiawei Xu, Weikai Li, Haoyang Wang, Zhengdong Hu, Ying Ding, Yizhou Sun, Jie Lu, Yi Zhang
TL;DR
Long-horizon agent memory systems rely on fixed structures and lack conversation-adaptive structure selection, despite diverse interaction patterns. FluxMem combines complementary structures with adaptive selection and probabilistic fusion; experiments report consistent improvements on PERSONAMEM and LoCoMo.
Problem
Existing memory systems commonly use one fixed structure and do not adapt structure selection to interaction content, although long-horizon conversations have varied structural patterns.
Source: §1 · pp. 1–2Method
FluxMem combines complementary memory structures with interaction-feedback-based structure selection, a three-level hierarchy, and a Beta Mixture Model-based probabilistic fusion gate.
Source: §1 · p. 2, §3.2 · p. 5, §3.5 · p. 6Results
Takeaways & Limitations
The framework supports diverse reasoning demands through conversation-aware selection among linear, graph, and hierarchical memories.
Source: §5 · p. 9
Abstract
from arXiv · showhide
Memory is critical for enabling large language model (LLM) based agents to maintain coherent behavior over long-horizon interactions. However, existing agent memory systems suffer from two key gaps: they rely on a one-size-fits-all memory structure and do not model memory structure selection as a context-adaptive decision, limiting their ability to handle heterogeneous interaction patterns and resulting in suboptimal performance. We propose a unified framework, FluxMem, that enables adaptive memory organization for LLM agents. Our framework equips agents with multiple complementary memory structures. It explicitly learns to select among these structures based on interaction-level features, using offline supervision derived from downstream response quality and memory utilization. To support robust long-horizon memory evolution, we further introduce a three-level memory hierarchy and a Beta Mixture Model-based probabilistic gate for distribution-aware memory fusion, replacing brittle similarity thresholds. Experiments on two long-horizon benchmarks, PERSONAMEM and LoCoMo, demonstrate that our method achieves average improvements of 9.18% and 6.14%.
1. Introduction
Long-horizon agents must retain and retrieve information as user goals and contexts evolve, yet existing memory systems rely on fixed structures and do not adapt structure selection to conversations. FluxMem combines multiple memory structures, interaction-derived selection feedback, and probabilistic memory fusion.
- FluxMem makes structure selection an explicit, learnable decision optimized with offline interaction-derived feedback aligned to response quality and retrieval effectiveness.The feedback is obtained from the Multi-Session Chat dataset.Source: §1 · p. 2
- A Beta Mixture Model-based probabilistic gate models similarity-score distributions for memory integration instead of relying on fixed thresholds.The introduction says fixed thresholds can be sensitive to noise and unreliable when interaction distributions change.Source: §1 · p. 2
- FluxMem consistently outperforms existing memory systems in response accuracy and cross-turn consistency across long-horizon interaction tasks.Source: §1 · p. 2
- Existing systems rely on a single structure and omit feedback-driven selection, despite varied relational, temporal, and topical interaction patterns.The introduction also notes that structure choice remains fixed even across memory layers.Source: §1 · p. 2
- FluxMem equips agents with multiple complementary memory structures, each inducing distinct retrieval behaviors over the same interaction history.Source: §1 · p. 2
2. Related Work
The related work groups long-term agent memory into flat retrieval-based, explicitly structured, and policy-managed systems. It describes different trade-offs in reasoning support and adaptability across these approaches.
- Flat retrieval systems store salient facts, events, or summaries and use similarity search, but offer limited abstraction and relational reasoning.The passage notes this can hurt multi-hop inference or cross-context integration.Source: §2 · p. 2
- Explicitly structured systems use linked notes or graphs for richer reasoning, but often retain fixed structures or routing strategies.Source: §2 · p. 2
- Policy-managed systems use learned policies or OS-inspired mechanisms, yet most retain fixed structural biases or hand-crafted organization rules.Source: §2 · p. 3
3. Methodology
FluxMem combines a three-layer memory hierarchy, context-dependent organization of episodic units, and a Beta Mixture Model gate for memory fusion. Its selector adapts memory structure to interaction context, while the hierarchy separates recent context, episodic history, and consolidated semantic knowledge.
3.1. Formalizaion
- FluxMem frames long-horizon response generation as retrieving and fusing recent context with accumulated memories, then organizing episodic units according to conversational content.A staged write-and-consolidation pipeline balances fast access, structured episodic storage, and long-term semantic retention.Source: §3.1 · p. 3
3.2. Three-Layer Memory Hierarchy
- STIM buffers recent dialogue, MTEM groups related pages into episodic units, and LTSM consolidates durable semantic knowledge from high-utility sessions.STIM has a four-page capacity, with older pages transferred by recency-based LRU; MTEM prioritizes higher-utility units for LTSM consolidation.Source: §3.2 · pp. 3–5
3.3. Multi-Structure Organization and Retrieval
- FluxMem supports linear, graph, and hierarchical episodic structures, matching temporal, relational, and abstraction-aware retrieval needs, respectively.Linear retrieval emphasizes chronological content; graph retrieval is entity-centric, while hierarchical retrieval proceeds from coarse topics to finer content.Source: §3.3 · p. 5
3.4. Context-Aware Memory Structure Selection
- A lightweight selector uses interaction-level features—including scale, temporal signals, entity relations, and topic structure—to choose among the three memory structures as conversations evolve.The selected structure organizes MTEM episodic units and guides later retrieval.Source: §3.4 · pp. 5–6
- Offline supervision labels each training interaction with the structure yielding the highest reward, combining response quality and memory utilization, and trains the selector with cross-entropy.Source: §3.4 · pp. 5–6
3.5. Beta-Mixture-Gated Memory Fusion
- A two-component Beta Mixture Model gate evaluates normalized matching scores by compatibility regime and retains candidates using posterior probability rather than fixed similarity thresholds.Retained candidates merge into the most compatible episodic unit under the selected structure, or become a new unit; a minimum-keep safeguard limits over-filtering.Source: §3.5 · p. 6
4. Experiments
FluxMem is evaluated on PERSONAMEM and LoCoMo against several memory-system baselines, with experiments covering overall performance, component ablations, parameter sensitivity, and representative cases.
4.1.1. DATASETS
- The evaluation uses LoCoMo and PERSONAMEM, datasets designed to test long-horizon reasoning and memory in LLM agents.Source: §4.1.1 · p. 6
4.1.2. BASELINES
- FluxMem is compared with systems including LangMem, Mem0, ZEP, MemoryOS, A-Mem, O-mem, MemR3, MEMOS, and HippoRAG 2.Source: §4.1.2 · p. 6
4.1.3. IMPLEMENTATION DETAILS
- Experiments use GPT-4.1 at temperature 0 on 2×A100 GPUs, with a three-layer memory, BMM-gated MTEM fusion, and a three-way structure selector.The selector chooses among LINEAR, GRAPH, and HIERARCHICAL structures; retrieval combines dense encoding and BM25 via reciprocal rank fusion.Source: §4.1.3 · p. 6
4.1.4. EVALUATION METRICS
- PERSONAMEM is evaluated with accuracy, while LoCoMo uses F1, BLEU-1, ROUGE-L, ROUGE-1, ROUGE-2, and BERTScore.Source: §4.1.4 · pp. 6–7
4.2. Overall Performance
- 72.43% average accuracy on PERSONAMEM outperforms all baselines by +9.18%; FluxMem also leads average F1, BLEU-1, and ROUGE-L on LoCoMo.It performs especially well on preference-centric PERSONAMEM tasks and multi-hop, open, and single-hop LoCoMo reasoning.Source: Table 1 · p. 7, Table 2 · p. 7, §4.2 · p. 7
4.4. Analysis of Parameter Sensitivity
- τBMM = 0.5 gives peak PERSONAMEM accuracy and peak LoCoMo F1, BLEU-1, and ROUGE-L; increasing mmin consistently degrades both datasets.The reported stable setting is τBMM = 0.5 and mmin = 1.Source: Figure 3 · p. 7, §4.4 · p. 8
4.3. Ablation Studies
- Removing linear, graph, or hierarchical memory mainly harms temporal, relational, or abstraction-oriented queries, while removing BMM gating degrades performance across categories.All ablated variants underperform the full model on LoCoMo, with clear drops in multi-hop and open reasoning.Source: Table 3 · p. 8, Table 4 · p. 8, §4.3 · p. 8
4.5. Case Studies
- Case studies show linear memory preserving chronology, graph memory connecting cross-session relations, and hierarchical memory abstracting over topic drift.The examples retrieve the correct year, country, and horseback-riding activity, respectively.Source: §4.5 · pp. 8–9
5. Conclusion
FluxMem combines multiple memory structures with adaptive structure selection and BMM-based fusion for long-horizon interactions. Experiments on PERSONAMEM and LoCoMo demonstrate consistent improvements.
- FluxMem is a multi-structure conversational memory framework with adaptive structure selection for long-horizon interactions.Source: §5 · p. 9
- The framework integrates linear, graph, and hierarchical memories with conversation-aware selection and BMM-based fusion.Source: §5 · p. 9
- Experiments on PERSONAMEM and LoCoMo demonstrate consistent improvements.Source: §5 · p. 9
A.1. Datasets
The appendix describes LoCoMo and PERSONAMEM as benchmarks for long-horizon conversational memory and personalization, then outlines memory systems used as baselines.
A.1. Datasets
- LoCoMo evaluates long-term conversational memory across single-hop, multi-hop, temporal, open-domain, and adversarial questions.Multi-hop questions aggregate evidence across sessions; temporal questions test reasoning over time gaps.Source: §A.1 · p. 12
- PERSONAMEM evaluates dynamic user profiling and personalized responses as attributes and preferences evolve, including recall of user-shared facts.Its in-situ queries are grouped into seven categories.Source: §A.1 · pp. 12–13
A.2. Baselines
- Baselines span extraction-and-update memory in Mem0 (Chhikara et al., 2025), linked-note memory in A-MEM (Xu et al., 2025b), temporal graphs in ZEP (Rasmussen et al., 2025), and retrieval control in MemR3 (Du et al., 2025).O-Mem (Wang et al., 2025) adds active profiling with persona, working, and episodic memory components.Source: §A.2 · pp. 13–14
A.3. Evaluation Metrics
The appendix defines F1 and BLEU-1, then describes distribution-aware memory fusion and lightweight conversation-level features for selecting memory structures.
A.3. Evaluation Metrics
- F1 is the harmonic mean of precision and recall, while BLEU evaluates generated text using n-gram precision and a brevity penalty.Precision and recall are computed from true positives, false positives, and false negatives.Source: §A.3 · p. 14
B. Beta-Mixture Gating Model (BMM)
- The Beta-mixture gate models normalized matching scores as low- and high-compatibility regimes, then uses the high-component posterior to filter merge candidates.If fewer than the minimum number pass the posterior threshold, the top-scoring candidates are retained; the incoming item is merged into the most compatible retained session or stored as a new session.Source: B. Beta-Mixture Gating Model (BMM) · pp. 15–16
C.1. Feature Overview
- Structure selection uses compact interaction-level features designed to capture temporal dynamics, entity-centricity, and topic evolution.The features emphasize structural signals rather than fine-grained semantics, keeping the control layer lightweight.Source: §C.1 · p. 16, §C.2 · p. 16, Table 5 · p. 17
D. Structure Selector Training Pipeline
The training pipeline labels each interaction with the memory structure achieving the highest reward across candidate structures, then trains a supervised selector on those labels.
D. Structure Selector Training Pipeline
- For each conversation, the labeling pipeline evaluates every candidate structure under the same interaction context and computes a combined reward.The reward weights response-judge quality and memory utilization.Source: D. Structure Selector Training Pipeline · pp. 17–18
- The structure with the highest empirical reward becomes the target label, framing structure selection as supervised classification rather than online reinforcement learning.The stated motivation for offline supervision is to avoid instability, high variance, and additional interaction cost.Source: D. Structure Selector Training Pipeline · pp. 17–18
- A multilayer perceptron selector is trained on normalized features with cross-entropy and ADAM, with early stopping when validation performance stops improving.Training uses mini-batches and a fitted feature normalizer.Source: D. Structure Selector Training Pipeline · p. 18
E. Additional Experimental Results
On LoCoMo, FluxMem is reported to perform strongly across reasoning categories, with particularly strong results for multi-hop and single-hop questions.
E. Additional Experimental Results
- FluxMem consistently attains the highest ROUGE and BERTScore values on multi-hop and single-hop reasoning.The authors describe these improvements as particularly pronounced.Source: E. Additional Experimental Results · p. 19
- On open-domain questions, FluxMem substantially outperforms baselines in ROUGE-1.Source: E. Additional Experimental Results · p. 19
- FluxMem achieves the strongest and most balanced performance across all four LoCoMo reasoning categories.Table 6 reports category-wise ROUGE-1, ROUGE-2, and BERTScore results.Source: Table 6 · p. 19, E. Additional Experimental Results · p. 19
F. Memory Structure Implementations
The section describes three memory structures adapted from prior long-term-memory studies, rather than proposed in this work. They differ in how they organize and retrieve episodic sessions.
F. Memory Structure Implementations
- Linear memory appends episodes chronologically and retrieves mainly by recency or similarity, favoring temporal coherence when recent interactions matter most.Each memory unit is added sequentially.Source: F. Memory Structure Implementations · p. 19
- Graph memory links episodic sessions through semantic or entity relations, supporting multi-hop recall beyond temporal proximity.Edges can encode shared entities or high embedding similarity.Source: F. Memory Structure Implementations · p. 19
- Hierarchical memory groups sessions into higher-level abstractions and retrieves coarse-to-fine, improving scalability and abstraction.The structure can organize episodes as a tree of topics or summaries.Source: F. Memory Structure Implementations · p. 19
G. Computational Cost Analysis
FluxMem adds modest computation for memory selection and probabilistic fusion, with overhead reported as minor relative to LLM decoding. The appendices include case studies and prompts for several system tasks.
G. Computational Cost Analysis
- The selector runs once per interaction with constant-time cost, while BMM fusion scales linearly with retrieved MTEM candidates.Retrieval combines dense encoding with BM25 via reciprocal rank fusion; its cost is described as comparable to standard hybrid retrieval pipelines.Source: G. Computational Cost Analysis · pp. 19–20
H. Case Studies
- The case studies cover time-dependent queries, complex relations, and topic evolution.The cited figures label these three case-study topics.Source: Figure 4 · p. 20, Figure 5 · p. 21, Figure 6 · p. 22
G. Computational Cost Analysis
- FluxMem's added computation is minor relative to LLM decoding and does not significantly affect end-to-end latency.The reported overhead comes from structure selection and probabilistic gating, while enabling more adaptive and selective memory use.Source: G. Computational Cost Analysis · p. 20
I. LLM Prompts Design
- The prompt figures cover response generation, meta information, entity-relation extraction, hierarchical structure construction, and procedural extraction.The figures present prompts for these tasks.Source: Figure 7 · p. 23, Figure 8 · p. 23, Figure 9 · p. 24