# SimpleMem: Efficient Lifelong Memory for LLM Agents
[](https://aiming-lab.github.io/SimpleMem-Page)
[](https://arxiv.org/abs/2601.02553)
[](https://github.com/aiming-lab/SimpleMem)
[](LICENSE)
---
## ๐ฅ News
- **[01/08/2026]** We've set up a Discord server and WeChat group to make it easier to collaborate and exchange ideas on this project. Welcome to join the Group to share your thoughts, ask questions, or contribute your ideas! ๐ฅ Join our [Discord](https://discord.gg/86gKQ8AW) and [WeChat Group](fig/wechat_logo.jpg) Now!
- **[01/05/2026]** SimpleMem paper was released on [arXiv](https://arxiv.org/abs/2601.02553)!
---
## ๐ Table of Contents
- [๐ Overview](#-overview)
- [๐ฏ Key Contributions](#-key-contributions)
- [๐ Performance Highlights](#-performance-highlights)
- [๐ฆ Installation](#-installation)
- [โก Quick Start](#-quick-start)
- [๐ Evaluation](#-evaluation)
- [๐ File Structure](#-file-structure)
- [๐ Citation](#-citation)
- [๐ License](#-license)
- [๐ Acknowledgments](#-acknowledgments)
---
## ๐ Overview

*SimpleMem achieves superior F1 score (43.24%) with minimal token cost (~550), occupying the ideal top-left position.*
**SimpleMem** addresses the fundamental challenge of **efficient long-term memory for LLM agents** through a three-stage pipeline grounded in **Semantic Lossless Compression**. Unlike existing systems that either passively accumulate redundant context or rely on expensive iterative reasoning loops, SimpleMem maximizes **information density** and **token utilization** through:
|
### ๐ Stage 1
**Semantic Structured Compression**
Entropy-based filtering and de-linearization of dialogue into self-contained atomic facts
|
### ๐๏ธ Stage 2
**Structured Indexing**
Asynchronous evolution from fragmented atoms to higher-order molecular insights
|
### ๐ฏ Stage 3
**Adaptive Retrieval**
Complexity-aware pruning across semantic, lexical, and symbolic layers
|
*The SimpleMem Architecture: A three-stage pipeline for efficient lifelong memory through semantic lossless compression*
---
### ๐ Performance Comparison
**Speed Comparison Demo**
*SimpleMem vs. Baseline: Real-time speed comparison demonstration*
**LoCoMo-10 Benchmark Results (GPT-4.1-mini)**
| Model | โฑ๏ธ Construction Time | ๐ Retrieval Time | โก Total Time | ๐ฏ Average F1 |
|:------|:--------------------:|:-----------------:|:-------------:|:-------------:|
| A-Mem | 5140.5s | 796.7s | 5937.2s | 32.58% |
| LightMem | 97.8s | 577.1s | 675.9s | 24.63% |
| Mem0 | 1350.9s | 583.4s | 1934.3s | 34.20% |
| **SimpleMem** โญ | **92.6s** | **388.3s** | **480.9s** | **43.24%** |
> **๐ก Key Advantages:**
> - ๐ **Highest F1 Score**: 43.24% (+26.4% vs. Mem0, +75.6% vs. LightMem)
> - โก **Fastest Retrieval**: 388.3s (32.7% faster than LightMem, 51.3% faster than Mem0)
> - ๐ **Fastest End-to-End**: 480.9s total processing time (12.5ร faster than A-Mem)
---
## ๐ฏ Key Contributions
### 1๏ธโฃ Semantic Lossless Compression Pipeline
SimpleMem transforms raw, ambiguous dialogue streams into **atomic entries** โ self-contained facts with resolved coreferences and absolute timestamps. This **write-time disambiguation** eliminates downstream reasoning overhead.
**โจ Example Transformation:**
```diff
- Input: "He'll meet Bob tomorrow at 2pm" [โ relative, ambiguous]
+ Output: "Alice will meet Bob at Starbucks on 2025-11-16T14:00:00" [โ
absolute, atomic]
```
---
### 2๏ธโฃ Structured Multi-View Indexing
Memory is indexed across three **structured dimensions** for robust, multi-granular retrieval:
| ๐ Layer | ๐ Type | ๐ฏ Purpose | ๐ ๏ธ Implementation |
|---------|---------|------------|-------------------|
| **Semantic** | Dense | Conceptual similarity | Vector embeddings (1024-d) |
| **Lexical** | Sparse | Exact term matching | BM25-style keyword index |
| **Symbolic** | Metadata | Structured filtering | Timestamps, entities, persons |
---
### 3๏ธโฃ Complexity-Aware Adaptive Retrieval
Instead of fixed-depth retrieval, SimpleMem dynamically estimates **query complexity** ($C_q$) to modulate retrieval depth:
$$k_{dyn} = \lfloor k_{base} \cdot (1 + \delta \cdot C_q) \rfloor$$
|
**๐น Low Complexity Queries**
- Retrieve minimal molecular headers
- ~100 tokens
- Fast response time
|
**๐ธ High Complexity Queries**
- Expand to detailed atomic contexts
- ~1000 tokens
- Comprehensive coverage
|
**๐ Result**: 43.24% F1 score with **30ร fewer tokens** than full-context methods.
---
## ๐ Performance Highlights
### ๐ Benchmark Results (LoCoMo)
๐ฌ High-Capability Models (GPT-4.1-mini)
| Task Type | SimpleMem F1 | Mem0 F1 | Improvement |
|:----------|:------------:|:-------:|:-----------:|
| **MultiHop** | 43.46% | 30.14% | **+43.8%** |
| **Temporal** | 58.62% | 48.91% | **+19.9%** |
| **SingleHop** | 51.12% | 41.3% | **+23.8%** |
โ๏ธ Efficient Models (Qwen2.5-1.5B)
| Metric | SimpleMem | Mem0 | Notes |
|:-------|:---------:|:----:|:------|
| **Average F1** | 25.23% | 23.77% | Competitive with 99ร smaller model |
---
## ๐ฆ Installation
### ๐ Requirements
- ๐ Python 3.10
- ๐ OpenAI-compatible API (OpenAI, Qwen, Azure OpenAI, etc.)
### ๐ ๏ธ Setup
```bash
# ๐ฅ Clone repository
git clone https://github.com/aiming-lab/SimpleMem.git
cd SimpleMem
# ๐ฆ Install dependencies
pip install -r requirements.txt
# โ๏ธ Configure API settings
cp config.py.example config.py
# Edit config.py with your API key and preferences
```
### โ๏ธ Configuration Example
```python
# config.py
OPENAI_API_KEY = "your-api-key"
OPENAI_BASE_URL = None # or custom endpoint for Qwen/Azure
LLM_MODEL = "gpt-4.1-mini"
EMBEDDING_MODEL = "Qwen/Qwen3-Embedding-0.6B" # State-of-the-art retrieval
```
---
## โก Quick Start
### ๐ Basic Usage
```python
from main import SimpleMemSystem
# ๐ Initialize system
system = SimpleMemSystem(clear_db=True)
# ๐ฌ Add dialogues (Stage 1: Semantic Structured Compression)
system.add_dialogue("Alice", "Bob, let's meet at Starbucks tomorrow at 2pm", "2025-11-15T14:30:00")
system.add_dialogue("Bob", "Sure, I'll bring the market analysis report", "2025-11-15T14:31:00")
# โ
Finalize atomic encoding
system.finalize()
# ๐ Query with adaptive retrieval (Stage 3: Adaptive Query-Aware Retrieval)
answer = system.ask("When and where will Alice and Bob meet?")
print(answer)
# Output: "16 November 2025 at 2:00 PM at Starbucks"
```
---
### ๐ Advanced: Parallel Processing
For large-scale dialogue processing, enable parallel mode:
```python
system = SimpleMemSystem(
clear_db=True,
enable_parallel_processing=True, # โก Parallel memory building
max_parallel_workers=8,
enable_parallel_retrieval=True, # ๐ Parallel query execution
max_retrieval_workers=4
)
```
> **๐ก Pro Tip**: Parallel processing significantly reduces latency for batch operations!
---
## ๐ Evaluation
### ๐งช Run Benchmark Tests
```bash
# ๐ฏ Full LoCoMo benchmark
python test_locomo10.py
# ๐ Subset evaluation (5 samples)
python test_locomo10.py --num-samples 5
# ๐พ Custom output file
python test_locomo10.py --result-file my_results.json
```
---
### ๐ฌ Reproduce Paper Results
Use the exact configurations in `config.py`:
- **๐ High-capability**: GPT-4.1-mini, Qwen3-Plus
- **โ๏ธ Efficient**: Qwen2.5-1.5B, Qwen2.5-3B
- **๐ Embedding**: Qwen3-Embedding-0.6B (1024-d)
---
## ๐ Citation
If you use SimpleMem in your research, please cite:
```bibtex
@article{simplemem2025,
title={SimpleMem: Efficient Lifelong Memory for LLM Agents},
author={Liu, Jiaqi and Su, Yaofeng and Xia, Peng and Zhou, Yiyang and Han, Siwei and Zheng, Zeyu and Xie, Cihang and Ding, Mingyu and Yao, Huaxiu},
journal={arXiv preprint arXiv:2601.02553},
year={2025},
url={https://github.com/aiming-lab/SimpleMem}
}
```
---
## ๐ License
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
---
## ๐ Acknowledgments
We would like to thank the following projects and teams:
- ๐ **Embedding Model**: [Qwen3-Embedding](https://github.com/QwenLM/Qwen) - State-of-the-art retrieval performance
- ๐๏ธ **Vector Database**: [LanceDB](https://lancedb.com/) - High-performance columnar storage
- ๐ **Benchmark**: [LoCoMo](https://github.com/snap-research/locomo) - Long-context memory evaluation framework