Source-linked AI summary
A-MEM: Agentic Memory for LLM Agents
Wujiang Xu, Zujie Liang, Kai Mei, Hang Gao, Juntao Tan, Yongfeng Zhang
TL;DR
LLM agents need adaptable memory to use historical experiences, while existing systems rely on rigid storage and retrieval structures. A-MEM uses Zettelkasten-inspired notes, dynamic linking, and memory evolution, and reports superior improvements across six foundation models and existing baselines.
Problem
Existing LLM-agent memory systems provide basic storage and retrieval but rely on predefined structures and operations, limiting adaptability across diverse tasks.
Method
A-MEM dynamically organizes memories as enriched notes, links them through semantic similarities and shared attributes, and evolves existing memories as new experiences arrive.
Results
A-MEM demonstrates significant improvements over existing baselines across evaluations using six foundation models and six metrics.
Takeaways & Limitations
A-MEM provides an interconnected memory organization that adapts its contextual representations and relationships during ongoing interactions.
Takeaways & Limitations
Memory organization quality may vary with the underlying language model, and the current implementation focuses on text-based interactions.
Abstract
from arXiv · showhide
While large language model (LLM) agents can effectively use external tools for complex real-world tasks, they require memory systems to leverage historical experiences. Current memory systems enable basic storage and retrieval but lack sophisticated memory organization, despite recent attempts to incorporate graph databases. Moreover, these systems' fixed operations and structures limit their adaptability across diverse tasks. To address this limitation, this paper proposes a novel agentic memory system for LLM agents that can dynamically organize memories in an agentic way. Following the basic principles of the Zettelkasten method, we designed our memory system to create interconnected knowledge networks through dynamic indexing and linking. When a new memory is added, we generate a comprehensive note containing multiple structured attributes, including contextual descriptions, keywords, and tags. The system then analyzes historical memories to identify relevant connections, establishing links where meaningful similarities exist. Additionally, this process enables memory evolution - as new memories are integrated, they can trigger updates to the contextual representations and attributes of existing historical memories, allowing the memory network to continuously refine its understanding. Our approach combines the structured organization principles of Zettelkasten with the flexibility of agent-driven decision making, allowing for more adaptive and context-aware memory management. Empirical experiments on six foundation models show superior improvement against existing SOTA baselines. The source code for evaluating performance is available at https://github.com/WujiangXu/A-mem, while the source code of the agentic memory system is available at https://github.com/WujiangXu/A-mem-sys.
1 Introduction
LLM agents need memory systems to sustain long-term interaction, but existing systems rely on predefined structures and operations that limit adaptability. A-MEM introduces dynamically organized, evolving memory and reports improvements across six foundation models.
- LLM agents require memory systems to leverage historical experiences during long-term interaction with external environments.
- Existing systems depend on predefined storage structures, workflow storage points, retrieval timing, schemas, and relationships, limiting adaptation across scenarios.
- A-MEM dynamically structures memories without static operations by generating contextual descriptions, establishing connections, and evolving existing memories from new experiences.
- A-MEM was evaluated across six foundation models and six metrics, with reported significant improvements and T-SNE visualizations of memory organization.
2 Related Work
Prior memory and retrieval systems provide storage, retrieval, or structured organization, but fixed patterns and knowledge bases constrain generalization. A-MEM places agency in the evolution of memory structure itself, beyond retrieval-time decisions.
- Prior LLM-agent memory systems use comprehensive storage, dense retrieval, read-write structures, or cache-like prioritization of recent information.
- Rigid memory-writing and retrieval patterns are associated with poor generalization in new environments and limited long-term interaction effectiveness.
- RAG systems index documents, retrieve semantically relevant chunks, and augment prompts with retrieved context, with advanced variants optimizing retrieval stages.
- Unlike agentic RAG, which autonomously decides what and when to retrieve from static knowledge bases, A-MEM autonomously evolves memory structure, content, and relationships.
3 Methodolodgy
A-MEM constructs enriched atomic notes, links new memories to relevant historical notes through embedding retrieval and LLM analysis, evolves related memories, and retrieves connected context for current queries.
- A-MEM uses atomic notes and flexible linking to create a dynamic, self-evolving memory system without predetermined operations.
- Note Construction: Each note combines original content, timestamp, LLM-generated keywords, tags, contextual description, embedding, and linked memories.
- Note Construction: LLM-generated semantic components and dense vectors capture multiple memory aspects while supporting context-rich and efficient similarity matching.
- Link Generation: For a new note, embedding-based similarity retrieval selects top-k historical memories before LLM analysis determines meaningful links.
- Memory Evolution: After linking, A-MEM updates retrieved memories’ context, keywords, and tags when appropriate, enabling richer higher-order patterns over time.
- Memory Retrieval: For each current query, A-MEM computes an embedding, retrieves the k most relevant memories, and uses them to construct contextually appropriate prompts.
4 Experiment
A-MEM is evaluated on long-term conversational tasks across datasets, task categories, foundation models, metrics, ablations, retrieval settings, and memory scales. Results indicate improved performance, efficient memory processing, benefits from link generation and memory evolution, and a trade-off between retrieval breadth and processing efficiency.
- Dataset and Evaluation: The evaluation uses the long-context LoCoMo dataset, compares multiple memory baselines, and reports F1, BLEU-1, token length, ROUGE-L, ROUGE-2, METEOR, and SBERT Similarity.LoCoMo averages 9K-token dialogues spanning up to 35 sessions.
- Empirical Results: A-MEM consistently outperforms baselines for non-GPT models and achieves at least two times better performance on GPT-based Multi-Hop tasks requiring complex reasoning chains.The comparisons include LoCoMo, ReadAgent, MemoryBank, and MemGPT across LoCoMo task categories.
- Cost-Efficiency Analysis: Approximately 1,200 tokens per memory operation yields an 85-93% reduction versus baselines using 16,900 tokens, with costs below $0.0003 per operation.Average processing time is 5.4 seconds with GPT-4o-mini and 1.1 seconds with locally hosted Llama 3.2 1B.
- Ablation Study: Removing both link generation and memory evolution substantially degrades performance, especially on Multi-Hop and Open Domain tasks, while retaining link generation provides intermediate results.The ablation isolates the contributions of the two memory-update modules.
- Hyperparameter Analysis: Increasing retrieval k generally improves performance before gains plateau or slightly decline, indicating that moderate k values balance richer context against processing noise.The pattern is especially evident in Multi-Hop and Open Domain tasks and is consistent across evaluation categories.
- Memory Analysis: A-MEM produces more coherent t-SNE memory clusters than the baseline without link generation and memory evolution, indicating more organized memory embeddings.The organization is particularly evident in the central region of Dialogue 2.
5 Conclusions
The paper concludes that A-MEM dynamically organizes and evolves memories without predefined structures, using interconnected knowledge networks and continuous updates. Across six foundation models, it reports superior long-term conversational performance and visualization evidence of improved memory organization.
- Conclusions: A-MEM dynamically organizes and evolves memories without relying on predefined structures.Its design draws on Zettelkasten through dynamic indexing and linking mechanisms.
- Conclusions: Across six foundation models, A-MEM achieves superior performance to existing state-of-the-art baselines in long-term conversational tasks.Visualization analysis further supports the effectiveness of its memory organization approach.
6 Limitations
The paper identifies dependence on underlying language-model capabilities and limits the current implementation to text-based interactions.
- Limitations: Memory organization quality may vary with the underlying language model’s ability to generate descriptions and establish connections.Different LLMs may produce slightly different contextual descriptions or memory links.
- Limitations: The current implementation focuses on text-based interactions rather than multimodal information such as images or audio.Extending the system to multimodal inputs is identified as future work.
A.1 Detailed Baselines Introduction
The baselines represent distinct strategies for handling long-term or long-context information, including full-context prompting, segmentation and lookup, dynamic updating, and hierarchical context management.
- LoCoMo: LoCoMo provides question answering by placing the complete preceding conversation and questions into the prompt without a memory mechanism.This directly evaluates the foundation model’s reasoning capabilities.
- ReadAgent: ReadAgent segments content into episodes, summarizes pages into memory representations, and retrieves relevant information through interactive lookup.Its three-step process targets long-context document processing.
- MemoryBank: MemoryBank dynamically adjusts memory strength using the Ebbinghaus Forgetting Curve and progressively builds user portraits from interactions.It maintains and retrieves historical interactions while refining user-personality representations.
- MemGPT: MemGPT uses a dual-tier memory hierarchy with an immediate main context and an external context for information beyond the fixed context window.The architecture is modeled on operating-system memory hierarchies.
A.2 Evaluation Metric
The evaluation uses complementary metrics to assess answer accuracy, lexical overlap, sequence matching, and semantic similarity between generated and reference texts.
- Accuracy metrics: F1 balances precision and recall through their harmonic mean, supporting evaluation of answer accuracy and coverage.In span-based question answering, it assesses precise text-segment identification while maintaining comprehensive answer coverage.
- Lexical metrics: BLEU-1 evaluates unigram precision between generated answers and references, with a brevity penalty based on candidate and reference lengths.It is intended for generative QA where exact matching may be too strict.
- Overlap metrics: ROUGE-2 measures bigram overlap, whereas ROUGE-L measures the longest common subsequence between generated and reference texts.ROUGE-L emphasizes sequence matching, while ROUGE-2 captures local word order.
- Semantic metrics: METEOR scores aligned unigrams while accounting for synonyms and paraphrases, extending evaluation beyond exact lexical matches.This makes it suitable for assessing paraphrased answers in question answering.
- Semantic metrics: SBERT Similarity measures semantic similarity between texts using sentence embeddings, capturing meaning overlap when lexical overlap is low.The score is computed from the cosine similarity of the two SBERT embeddings.
A.3 Comparison Results
Across LoCoMo question-answering evaluations, A-MEM generally outperforms existing baselines, with especially strong gains on Multi-Hop reasoning and lower token usage.
- Non-GPT models: A-MEM consistently outperforms all baselines across ROUGE-2, ROUGE-L, METEOR, and SBERT for Qwen2.5 and Llama 3.2 models.The evaluation covers six foundation models and five question-answering categories.
- Multi-Hop results: 27.23 ROUGE-L: Qwen2.5-15b with A-MEM exceeds LoComo’s 4.68 and ReadAgent’s 2.81 in Multi-Hop tasks.The passage characterizes this as a nearly six-fold improvement over LoComo.
- GPT-based models: 44.27 ROUGE-L: GPT-4o-mini with A-MEM exceeds LoComo’s 18.09 in Multi-Hop tasks.The same comparison reports METEOR scores of 23.43 versus 7.61 and SBERT scores of 70.49 versus 52.30.
- Computational efficiency: 1,200-2,500 tokens: A-MEM requires fewer tokens than the 16,900 tokens reported for LoComo and MemGPT.The paper attributes this efficiency to interconnected memory networks and selective top-k retrieval.
A.4 Memory Analysis
Memory analysis indicates that A-MEM produces more organized and coherent memory embeddings than a base system without link generation and memory evolution.
- Embedding organization: A-MEM produces more coherent clustering patterns than the baseline across visualized long-term LoCoMo dialogues.The comparison uses A-MEM in blue and the baseline in red.
- Baseline comparison: The baseline memory embeddings appear more scattered, indicating less structural organization without link generation and memory evolution.A-MEM’s organization is especially evident through distinct central clusters in Dialogue 2.
- Mechanistic interpretation: The visualizations provide empirical support for contextual description generation and memory evolution as components of A-MEM’s structured organization.The paper connects these observations to autonomous maintenance of meaningful memory structures through linking and dynamic evolution.
A.5 Hyperparameters setting
The paper specifies retriever k values by category and model, preserves k=10 for models already reaching SOTA performance, and uses structured prompts for memory construction, linking, and evolution.
- Retriever settings: Retriever k values are selected across specific task categories and model choices, with the settings reported in Table 8.Models already achieving SOTA performance with k=10 retain that value without further tuning.
- Note construction: Note construction prompts the LLM to extract keywords, contextual elements, and categorical tags into a structured JSON note.The prompt requires at least three keywords and asks for domain, format, and type tags.
- Memory updates: Link-generation and memory-evolution prompts analyze new notes with nearest-neighbor memories to decide relationships and updates.These prompts support agentic decisions about whether memories should be evolved and what actions should be taken.
- Structured examples: The examples show A-MEM storing question-answer content together with contextual descriptions, keywords, and tags.One example records Dave’s photography hobby alongside its conversational context and classification tags.