Memory Systems Survey
Introduction
Memory is the cornerstone of intelligence. Without memory, agents cannot learn from experience, maintain conversational coherence, or behave consistently in complex tasks. This section starts from psychological models of human memory to establish a conceptual framework for agent memory systems.
Human Memory Models
The Atkinson-Shiffrin Model (Multi-Store Model)
In 1968, Atkinson and Shiffrin proposed the classic multi-store model, dividing human memory into three stages:
- Sensory Memory: Extremely short duration (<1 second), large capacity but rapid decay
- Short-Term Memory: Limited capacity (7 plus or minus 2 items), lasts about 20-30 seconds
- Long-Term Memory: Nearly unlimited capacity, can persist for years or even a lifetime
graph LR
A[External Stimuli] --> B[Sensory Memory<br/>< 1 second]
B -->|Attention| C[Short-Term Memory<br/>7±2 items<br/>20-30 seconds]
B -->|Unattended| D[Forgetting]
C -->|Encoding/Rehearsal| E[Long-Term Memory<br/>Unlimited capacity<br/>Persistent storage]
C -->|Unrehearsed| D
E -->|Retrieval| C
Baddeley's Working Memory Model
Baddeley (1974, 2000) extended the concept of short-term memory, proposing that working memory contains:
- Central Executive: Attention control and coordination
- Phonological Loop: Temporary storage of verbal information
- Visuospatial Sketchpad: Visual and spatial information processing
- Episodic Buffer: Integration of multimodal information
Tulving's Long-Term Memory Classification
- Episodic Memory: Personal experiences and events
- Semantic Memory: General knowledge and facts
- Procedural Memory: Skills and operational procedures
From Human Memory to Agent Memory
Mapping Relationships
| Human Memory | Agent Memory | Implementation |
|---|---|---|
| Sensory memory | Input buffer | Raw input (user messages, API returns) |
| Short-term/Working memory | Context window | LLM's context window (4K-128K tokens) |
| Long-term - Episodic | Conversation history/Experience store | Historical interactions stored in vector databases |
| Long-term - Semantic | Knowledge base | Knowledge graphs, structured databases |
| Long-term - Procedural | Learned workflows | Stored prompt templates, tool call patterns |
Core Challenges of Agent Memory
- Capacity limitations: Context window is finite; cannot remember everything
- Retrieval efficiency: How to quickly find relevant memories
- Memory updates: How to handle outdated or contradictory information
- Importance assessment: Which information is worth long-term storage
Agent Memory Architecture
graph TB
subgraph Input Layer
U[User Input] --> WM
T[Tool Returns] --> WM
E[Environment Observations] --> WM
end
subgraph Working Memory
WM[Context Window]
end
subgraph Long-Term Memory
WM -->|Store| VDB[(Vector Database<br/>Episodic Memory)]
WM -->|Store| KG[(Knowledge Graph<br/>Semantic Memory)]
WM -->|Store| PM[(Workflow Library<br/>Procedural Memory)]
end
subgraph Retrieval
VDB -->|Similarity Search| R[Retrieval Module]
KG -->|Structured Query| R
PM -->|Pattern Matching| R
R -->|Inject into Context| WM
end
WM --> LLM[LLM Reasoning]
LLM --> OUT[Output/Action]
Memory Type Details
By Time Span
| Type | Time Span | Manifestation in Agents |
|---|---|---|
| Immediate memory | Current turn | Information in current prompt |
| Short-term memory | Current session | Conversation history (within session) |
| Medium-term memory | Cross-session | User preferences, task progress |
| Long-term memory | Permanent | Knowledge base, learned skills |
By Content Type
- Factual memory: Specific information the user tells the agent ("My name is...")
- Procedural memory: Operational patterns the agent has learned ("For this type of problem, first...")
- Meta-memory: Memory about memory itself ("This information was discussed before")
Evaluation Metrics for Memory Systems
- Recall: Can relevant memories be retrieved?
- Precision: Are retrieved memories relevant?
- Latency: Retrieval speed
- Consistency: Are memories free of contradictions?
- Freshness: Does it reflect the most current information?
Chapter Structure
This chapter explores every aspect of agent memory systems in depth:
- Working Memory and Context Management - Efficient utilization of the context window
- Long-Term Memory and Vector Databases - Persistent storage and retrieval
- RAG-Augmented Memory - Complete retrieval-augmented generation pipeline
- Episodic and Semantic Memory - Design of different memory types
- Memory Architecture Design - Comprehensive architecture and frontier approaches
References
- Atkinson, R. C., & Shiffrin, R. M. (1968). "Human memory: A proposed system and its control processes"
- Baddeley, A. (2000). "The episodic buffer: A new component of working memory?"
- Tulving, E. (1972). "Episodic and semantic memory"
- Sumers, T. R., et al. (2023). "Cognitive Architectures for Language Agents"
- Zhang, Z., et al. (2024). "A Survey on the Memory Mechanism of Large Language Model based Agents"