Source-linked AI summary

MAGMA: A Multi-Graph based Agentic Memory Architecture for AI Agents

Dongming Jiang, Yi Li, Guanpeng Li, Bingzhe Li

arXiv:2601.03236v2cs.AI

TL;DR

Long-context reasoning is limited by finite-context memory and by existing systems’ reliance on monolithic, semantically driven retrieval that underrepresents relational structure. MAGMA addresses this with four disentangled relation graphs, policy-guided traversal, and decoupled memory evolution, and it consistently outperforms prior systems on LoCoMo and LongMemEval while reducing latency and token use.

  • Problem

    Existing systems struggle with persistent long-horizon reasoning because fixed contexts and monolithic, similarity-based memory stores inadequately represent temporal, causal, and entity relations.

  • Method

    MAGMA represents memories across semantic, temporal, causal, and entity graphs, retrieves them through intent-aware policy-guided traversal, and separates ingestion from asynchronous structural consolidation.

  • Results

    MAGMA consistently outperforms state-of-the-art memory systems on LoCoMo and LongMemEval while achieving lower retrieval latency and token consumption.

  • Takeaways & Limitations

    Disentangled relational memory and structured traversal provide a foundation for effective long-horizon reasoning with low inference-time latency.

  • Takeaways & Limitations

    Memory-graph quality depends on the reasoning fidelity of LLMs used for asynchronous consolidation, so erroneous or missing relations may propagate to retrieval.

Abstract

from arXiv · show

Memory-Augmented Generation (MAG) extends Large Language Models with external memory to support long-context reasoning, but existing approaches largely rely on semantic similarity over monolithic memory stores, entangling temporal, causal, and entity information. This design limits interpretability and alignment between query intent and retrieved evidence, leading to suboptimal reasoning accuracy. In this paper, we propose MAGMA, a multi-graph agentic memory architecture that represents each memory item across orthogonal semantic, temporal, causal, and entity graphs. MAGMA formulates retrieval as policy-guided traversal over these relational views, enabling query-adaptive selection and structured context construction. By decoupling memory representation from retrieval logic, MAGMA provides transparent reasoning paths and fine-grained control over retrieval. Experiments on LoCoMo and LongMemEval demonstrate that MAGMA consistently outperforms state-of-the-art agentic memory systems in long-horizon reasoning tasks.

1 Introduction

LLMs and existing memory-augmented systems struggle with persistent, structured long-horizon reasoning because memory is often retrieved from minimally structured stores using semantic or heuristic signals. MAGMA addresses this with orthogonal relational graphs, intent-aware traversal, dual-stream memory evolution, and benchmark gains with lower retrieval costs.

  • Motivation: Fixed-length contexts and attention degradation cause forgotten details, context decay, and inconsistent long-horizon reasoning in LLMs.These limitations include attention dilution, positional encoding limitations, and token interference.
  • Limitations of Existing Systems: Existing MAG systems commonly use monolithic repositories and semantic, recency, or heuristic retrieval, leaving temporal and causal relations underrepresented.Prior memory structures may organize interactions incrementally or narratively without explicitly modeling distinct relational dimensions.
  • MAGMA: MAGMA represents each memory item across semantic, temporal, causal, and entity graphs, creating a disentangled relational substrate for long-horizon reasoning.The architecture explicitly models heterogeneous relational structure in an agent’s experience.
  • MAGMA: An intent-aware query mechanism selects relational views, traverses them independently, and fuses subgraphs into compact, type-aligned generation context.This decouples memory representation from retrieval logic and supports transparent reasoning paths and fine-grained memory selection.
  • Retrieval: MAGMA’s adaptive traversal policy prunes irrelevant graph regions, enabling lower latency and reduced token usage.The policy routes retrieval according to query intent.
  • Memory Evolution: MAGMA’s dual-stream memory evolution separates latency-sensitive event ingestion from asynchronous structural consolidation, preserving responsiveness while refining relational structure.The mechanism decouples immediate writing from later structural updates.
  • Results: MAGMA consistently outperforms state-of-the-art agentic memory systems on LoCoMo and LongMemEval while reducing retrieval latency and token consumption.The reported comparison concerns long-context benchmarks and prior systems.

2 Background

Memory-Augmented Generation extends models with evolving external memory to address fixed-context limitations, but prior systems often emphasize associative similarity over mechanistic dependencies. MAGMA organizes memory and processing into graph-based, multi-layer components for structured retrieval and reasoning.

  • Background: Long-term agentic interactions expose fixed-context limitations that produce fragmented memory and weakened narrative coherence.The paper places Memory-Augmented Generation after context-window extension and retrieval-augmented generation in this progression.
  • Memory-Augmented Generation: MAG maintains a time-variant memory that evolves through feedback: retrieved information augments the prompt, and model output is written back to refine memory.This distinguishes MAG from static retrieval-augmented generation.
  • Related Approaches: Prior memory methods include evolving chains of thought, interconnected note networks, and knowledge graphs for capturing dependencies.Examples include TiM, A-MEM, GraphRAG, and Zep.
  • MAGMA Architecture: MAGMA’s architecture combines an intent-aware router, adaptive topological retrieval, a context synthesizer, relation graphs, and a vector database.These components organize query processing and the data-structure substrate.
  • Background: Prior work often models associative proximity rather than mechanistic dependency, so it can retrieve what happened while struggling to reason about why.The passage links this missing causal structure to reduced accuracy in complex reasoning tasks.

3 MAGMA Design

MAGMA combines a unified multigraph memory substrate with an intent-aware query process and separate fast and slow memory-update paths. Retrieval selects and traverses relational views adaptively, then orders and serializes the resulting subgraph into narrative context.

  • System Organization: The architecture separates query execution from memory evolution through a synchronous query process and dual-stream fast and slow update paths.Synaptic Ingestion handles latency-sensitive operations, while Asynchronous Consolidation performs compute-intensive reasoning to deepen the memory structure.
  • Data Structure: MAGMA organizes memory as a time-variant directed multigraph whose nodes represent events and whose edges encode heterogeneous relations.The node hierarchy spans atomic events to episodic groupings.
  • Data Structure: Each event node combines content, timestamp, dense vector representation, and structured metadata for hybrid retrieval.Metadata can include entity references, temporal cues, and contextual descriptors.
  • Data Structure: Four orthogonal relation graphs represent temporal, causal, semantic, and entity connections.Temporal edges encode chronological order; causal edges support entailment-based “Why” queries; semantic edges connect similar events; entity edges preserve object identity across timelines.
  • Query Process: The query layer decomposes queries into intent, temporal, semantic, and lexical signals before identifying graph-entry anchor nodes.Intent types include WHY, WHEN, and ENTITY; temporal parsing can define a hard filtering window, while dense embeddings and sparse keywords support hybrid anchor retrieval.
  • Query Process: Adaptive traversal uses intent-specific structural weights and semantic similarity to score neighbors, retaining the top-k nodes under beam, depth, and budget constraints.The pipeline initializes anchors through hybrid retrieval, applies cumulative-score decay during heuristic beam search, and stops when the retrieval budget is reached.
  • Query Process: MAGMA orders retrieved nodes according to query logic and serializes them with provenance into a compact narrative context.Temporal queries sort by timestamp, causal queries topologically order causes before effects, and each node includes timestamp, content, and reference ID.

4 Experiments

MAGMA is evaluated against established memory baselines on LoCoMo and LongMemEval, showing stronger accuracy, efficient retrieval, and complementary contributions from adaptive traversal and multiple relation types.

  • Overall Comparison: MAGMA achieves a 0.7 LLM-as-a-Judge score on LoCoMo, exceeding Full Context (0.481), A-MEM (0.58), MemoryOS (0.553), and Nemori (0.59).The reported relative margins over these baselines range from 18.6% to 45.5%.
  • Generalization Study: On LongMemEval, MAGMA reaches 61.2% average accuracy, outperforming Full-context (55.0%) and Nemori (56.2%) under contexts exceeding 100k tokens.The benchmark evaluates retention and retrieval over ultra-long interaction histories.
  • Generalization Study: MAGMA reduces query token usage by more than 95%, achieving 83.9% accuracy with 0.7k–4.2k tokens versus Full-context’s 89.3% with over 100k tokens.The result indicates a favorable efficiency–granularity trade-off for long-context interaction histories.
  • System Efficiency: MAGMA records the lowest query latency at 1.47s, about 40% faster than A-MEM, while using 3.37k tokens per query.The reported efficiency is attributed to early pruning of irrelevant subgraphs and background indexing through the dual-stream architecture.
  • Ablation Study: Removing the Adaptive Policy lowers the Judge score from 0.700 to 0.637, the largest ablation drop, while removing Causal Links or the Temporal Backbone yields scores of 0.644 and 0.647.Entity Links produce a smaller decline from 0.700 to 0.666, indicating distinct contributions from routing, causal structure, temporal ordering, and entity continuity.
  • Ablation Study: No single relation type recovers MAGMA’s full reasoning capability: all single-graph variants remain below 0.60 overall, although Causal Only reaches 0.590 and Temporal Only reaches 0.620 on temporal questions.The findings support combining complementary relational views with adaptive traversal.

5 Conclusion

MAGMA combines disentangled semantic, temporal, causal, and entity relations with policy-guided retrieval for long-horizon reasoning. Results on LoCoMo and LongMemEval report stronger performance together with lower inference-time latency and efficiency gains under ultra-long contexts.

  • Conclusion: MAGMA models semantic, temporal, causal, and entity relations in a unified yet disentangled memory substrate.This architecture is presented as the paper’s central memory design.
  • Conclusion: MAGMA formulates retrieval as policy-guided graph traversal and decouples memory ingestion from asynchronous structural consolidation.The design targets effective long-horizon reasoning while maintaining low inference-time latency.
  • Conclusion: Experiments on LoCoMo and LongMemEval report that MAGMA outperforms state-of-the-art memory systems while achieving substantial efficiency gains under ultra-long contexts.The conclusion summarizes both reasoning effectiveness and systems efficiency.

6 Limitations

MAGMA’s limitations concern dependence on LLM-based memory-graph construction, added storage and engineering overhead, and evaluation concentrated on conversational and agentic benchmarks. Despite these constraints, the reported experiments indicate strong performance in long-horizon reasoning.

  • Memory-graph quality depends on the reasoning fidelity of the underlying LLMs used during asynchronous consolidation.Structured prompts and conservative thresholds reduce spurious links, but extraction errors and hallucinations may still produce erroneous or missing relations that propagate to retrieval.
  • Even under these constraints, MAGMA substantially outperforms traditional baselines, including full-context approaches, in long-horizon reasoning tasks.
  • Maintaining multiple relational views and dual-stream processing introduces higher implementation and memory overhead than flat, vector-only memory.This overhead may limit applicability in highly resource-constrained environments.
  • MAGMA and other agentic memory systems are primarily evaluated on LoCoMo and LongMemEval-style long-context conversational and agentic benchmarks.These benchmarks stress temporal and causal reasoning but do not cover the full range of settings where agentic memory may be required.
  • Extending MAGMA to multimodal agents or environments with heterogeneous observation streams may require additional adaptation and calibration.Broader evaluation settings remain identified as a future research direction.

B System Implementation Details

MAGMA’s implementation combines empirically selected configuration, intent-adaptive scoring, specialized prompts, structured event extraction, adaptive question answering, and semantic LLM-based evaluation.

  • Adaptive Scoring dynamically shifts λ weights according to detected query intent.
  • Table 6 reports MAGMA’s hyperparameters, including intent-specific traversal weights and global structural-semantic balance parameters.The traversal weights correspond to wTq, while λ1 and λ2 control structural alignment versus semantic affinity in Eq. 5.
  • MAGMA uses three prompt types optimized for distinct cognitive tasks within the memory pipeline.Generation instructions are appended dynamically based on Router classifications such as Multi-hop, Temporal, and Open-domain.
  • The Event Extractor enforces a strict JSON schema to extract entities, topics, relationships, semantic facts, dates, and speaker-attributed summaries.The schema is designed to preserve structured metadata for downstream graph construction.
  • Adaptive QA answers using only retrieved context and can return “Information not found” when the answer is absent.Dynamic instructions specialize behavior for multi-hop, temporal, open-domain, and single-hop queries.
  • A Judge LLM scores candidate answers against references on a continuous 0.0–1.0 semantic-fidelity scale.The rubric distinguishes exact alignment, substantial correctness, and partial matches using entities, temporal markers, and causal relationships.

D Baseline Configurations

The experiments standardize models, evaluation, and baseline settings while comparing MAGMA with full-context and retrieval-based alternatives across LoCoMo query categories and scenarios.

  • The Full Context baseline feeds the entire conversation history directly into the LLM context window, up to 128k tokens.It serves as a brute-force reference for native long-context capabilities without external retrieval.
  • Retrieval-based baselines use their official default hyperparameters and storage settings to represent standard out-of-the-box performance.Examples include AMem, Nemori, and MemoryOS.
  • All systems use OpenAI’s gpt-4o-mini for retrieval reasoning and response generation.This controls performance variance caused by different foundation models.
  • All outputs are evaluated with the identical gpt-4o-mini LLM-as-a-Judge framework at temperature=0.0.
  • Evaluation covers all five cognitive categories of the full LoCoMo benchmark.Table 7 reports the distribution of query types, while Table 8 compares MAGMA with AMEM, Nemori, and MemoryOS in three scenarios.

E.1 Illustrative Walkthrough: From Memory Construction to Retrieval

The Melanie walkthrough shows how MAGMA converts conversational facts into complementary relational views and selects different graph views according to each query’s reasoning need.

  • The example tracks Melanie’s violin and clarinet mentions alongside references to her son, two children, and a hike done yesterday.
  • During construction, MAGMA segments utterances into event nodes and places them along a temporal backbone.It adds semantic links, entity-centric links for recurring people, and normalized temporal attributes for relative expressions.
  • The resulting memory is a multi-view graph rather than a flat list of text snippets.The same conversation history can therefore be accessed through different relational structures.
  • For instrument queries, MAGMA emphasizes entity and semantic views to aggregate Melanie’s violin and clarinet mentions.
  • For child-count queries, retrieval centers on Melanie’s local entity neighborhood, while hike-date queries rely primarily on the temporal view.
  • The walkthrough’s central intuition is that query-time retrieval activates different complementary relational views according to the reasoning need.

E.2 Detailed Analysis

MAGMA addresses distinct reasoning failures through graph-based retrieval tailored to entities, multi-hop relations, and temporal grounding. Its case studies contrast these structured operations with baseline information loss, surface extraction, and timestamp confusion.

  • Information Loss: MAGMA’s entity-centric neighborhood retrieval preserves disjoint facts such as Melanie playing violin and starting clarinet.The approach aggregates diverse natural-language predicates rather than relying on rigid schemas or surface-level matching.
  • Case Study Overview: Table 8 compares MAGMA with baselines across recall, multi-hop reasoning, and temporal grounding cases.Red indicates hallucinations or partial failures, while teal indicates correct reasoning derived from graph traversal.
  • Multi-Hop Reasoning: For “How many children?”, MAGMA reframes answer generation as graph traversal over Melanie’s connected person entities.This contrasts with baselines that extract the explicit phrase “two children” without performing cross-context reasoning.
  • Temporal Grounding: MAGMA normalizes relative dates during graph construction, storing the hiking event as date="2023-10-19".This makes retrieval exact and avoids the ambiguity that led baselines to hallucinate or use the conversation timestamp.

F Metric Validation Analysis

The paper validates LLM-based judging through granular failure analysis on seven representative test cases. Table 10 provides the quantitative breakdown used to compare this evaluation choice with traditional lexical metrics.

  • Evaluation Design: The analysis uses seven representative test cases to examine evaluation behavior.The cases support a granular failure analysis of the proposed judging approach.
  • Quantitative Analysis: Table 10 supplies the quantitative breakdown for the failure analysis.The table is used to validate the choice of an LLM-based Judge over traditional lexical metrics.
  • Metric Validation: The validation compares an LLM-based Judge with traditional lexical metrics.This comparison is framed as an assessment of the evaluation method rather than a memory-retrieval experiment.

F.1 Rationale for Semantic Scoring

The analysis argues that lexical metrics can misjudge semantic validity, rewarding contradictory answers and penalizing valid rephrasings. An LLM-Judge instead assigns scores aligned with factual correctness and semantic equivalence in the reported cases.

  • False Rewards: Lexical metrics can reward incorrect answers when they share surface-level tokens.The paper identifies this as the “False Rewards” or hallucination problem.
  • False Penalties: F1 and BLEU scores drop to 0.000 for semantically identical answers using different time notation or synonyms.These cases illustrate the paper’s “False Penalties” or phrasing problem.
  • Semantic Scoring: The LLM-Judge assigns 0.0 to factual errors and 1.0 to semantic matches in the reported analysis.Table 10 presents seven controlled cases comparing these judgments with calculated F1 and BLEU-1 scores.
Loading 2601.03236v2…