ActiveMem: Dynamic Latent Memory Trees for Long-Horizon Agents
Organizations: Tsinghua University · Huawei Noah’s Ark Lab
Abstract
Large Language Model (LLM) agents increasingly rely on external memory to support long-horizon reasoning and decision making. Existing memory systems typically retrieve historical trajectories or summaries as independent context fragments, overlooking the procedural dependencies underlying multi-step execution. As memory scales, such flat retrieval introduces context fragmentation and cross-task interference, leading to structurally inconsistent reasoning trajectories. We propose ActiveMem, a hierarchical memory framework that recursively organizes agent experiences into dependency-aware latent execution trees. ActiveMem abstracts trajectories into reusable subtask nodes while explicitly preserving execution transitions, enabling coherent reasoning-path retrieval conditioned on the current execution state. To support continual adaptation, ActiveMem further learns dynamic memory expansion, retrieval, and pruning policies through reinforcement learning. Experiments across various agent benchmarks demonstrate that ActiveMem consistently improves task completion, reasoning stability, and memory efficiency over existing memory-based agents. Moreover, ActiveMem enables compact open-weight models to achieve competitive performance with substantially larger proprietary systems.
Figures & tables
| Backbone | Method | ALFWorld | TriviaQA | PopQA | KodCode | BigCodeBench | GPQA | GSM8K | MATH |
| SmolLM3-3B | Vanilla | 18.96 | 10.47 | 8.23 | 37.05 | 35.96 | 9.35 | 47.63 | 16.22 |
| CoT | 17.60 | 12.88 | 9.95 | 38.45 | 39.42 | 20.70 | 58.91 | 56.33 | |
| SFT | 32.36 | 55.25 | 37.22 | 59.25 | 40.79 | 19.70 | 63.48 | 45.65 | |
| GRPO | 55.35 | 65.88 | 45.16 | 68.48 | 72.44 | 22.73 | 80.03 | 61.23 | |
| REINFORCE | 53.13 | 63.20 | 46.81 | 65.53 | 67.14 | 23.44 | 82.03 | 58.75 | |
| REINFORCE++ | 53.95 | 63.20 | 44.10 | 65.90 | 68.80 | 22.73 | 81.50 | 59.89 |
| Method | ALFWorld | TriviaQA | PopQA | KodCode | BigCodeBench | GPQA | GSM8K | MATH |
| ActiveMem | 95.57 | 87.46 | 73.20 | 83.42 | 84.39 | 54.49 | 94.81 | 92.76 |
| w/o Tree Action Head | 89.88 | 81.93 | 67.80 | 80.95 | 79.46 | 48.53 | 86.41 | 89.83 |
| w/o Merge/Delete | 93.11 | 84.24 | 71.24 | 81.54 | 83.64 | 52.13 | 88.02 | 87.11 |
| w/o Hierarchical Advantage | 90.74 | 83.25 | 69.93 | 82.46 | 81.35 | 50.98 | 86.74 | 90.86 |
| w/o Latent Injection | 88.96 | 81.67 | 66.81 | 81.92 | 78.44 | 51.76 | 85.98 | 87.35 |
| w/o HLMT | 83.25 | 78.64 | 58.92 | 73.41 | 69.88 | 44.53 | 82.47 | 86.39 |
| Model | 2-Objective | 8-Objective | 16-Objective | |||||||||
| EM | F1 | Peak ( ) | Time (s) | EM | F1 | Peak ( ) | Time (s) | EM | F1 | Peak ( ) | Time (s) | |
| Qwen2.5-14B-Inst | 0.732 | 0.902 | 15.6 0.19 | 5.49 0.16 | 1.55 | 1.87 | 44.7 0.37 | 16.2 0.27 | 0.567 | 0.703 | 38.4 0.71 | 29.7 0.75 |
| Qwen2.5-7B-Inst | 0.268 | 0.366 | 19.6 0.33 | 4.60 0.08 | 0.87 | 1.10 | 49.5 0.40 | 13.9 0.18 | 0.165 | 0.213 | 43.3 0.62 | 15.5 0.23 |
| Qwen2.5-7B-Inst (A-MEM) | 0.286 | 0.371 | 14.1 0.10 | 24.6 0.51 | 1.13 | 1.43 | 18.6 0.10 | 53.7 1.26 | 0.730 | 0.961 | 18.8 0.14 | 91.2 2.44 |
| Qwen2.5-7B-Inst (truncate) | 0.262 | 0.336 | 8.28 0.06 | 5.89 0.16 | 0.97 | 1.23 | 11.8 0.10 | 11.9 0.20 | 0.396 | 0.497 | 13.3 0.16 | 22.1 0.60 |
| Search-R1 | 0.452 | 0.531 | 13.0 0.08 | 4.09 0.23 | 0.064 | 0.08 | 24.7 0.19 | 4.25 0.16 | 0.009 | 0.011 | 20.9 0.03 | 4.75 0.18 |
| Settings | Hyperparameters |
| Training (SFT) | train_batch_size = 4 |
| learning_rate = 1e-5 | |
| epochs = 2 | |
| warmup_ratio = 0.1 | |
| optim = adamw_torch | |
| schedular = cosine |
| Method | ALFWorld | TrivialQA | PopQA | KodCode | BigCodeBench | GPQA | GSM8K | MATH |
| Vanilla | 22.54 | 32.10 | 16.08 | 24.55 | 40.35 | 11.62 | 39.51 | 36.63 |
| CoT | 18.30 | 28.67 | 18.39 | 32.32 | 38.59 | 15.67 | 56.79 | 45.22 |
| SFT | 36.57 | 63.84 | 39.20 | 55.83 | 37.72 | 11.11 | 54.83 | 38.84 |
| GRPO | 43.55 | 68.21 | 43.15 | 62.11 | 70.34 | 15.65 | 68.10 | 47.42 |
| REINFORCE | 43.25 | 66.50 | 41.87 | 60.20 | 67.80 | 12.50 | 67.40 | 46.89 |
| REINFORCE++ | 43.66 | 66.90 | 44.69 | 63.33 | 69.50 | 13.80 | 69.04 | 47.33 |
| Trained On | Method | AQuA | GPQA | GSM8K | KodCode |
| Vanilla | 41.34 | 11.62 | 39.51 | 24.55 | |
| AQuA | SFT | 42.52 | 16.67 | 42.10 | 18.20 |
| ExpeL | 41.73 | 12.67 | 40.16 | 16.30 | |
| MemGen | 43.31 | 19.70 | 39.80 | 19.55 | |
| ActiveMem | 47.10 | 22.51 | 51.28 | 24.38 | |
| GPQA | SFT | 38.55 | 17.17 | 45.74 | 18.50 |
| Model | 2-Objective | 8-Objective | 16-Objective | |||||||||
| EM | F1 | Peak ( ) | Time (s) | EM | F1 | Peak ( ) | Time (s) | EM | F1 | Peak ( ) | Time (s) | |
| Qwen2.5-14B-Inst | 0.732 | 0.902 | 15.6 0.19 | 5.49 0.16 | 1.55 | 1.87 | 44.7 0.37 | 16.2 0.27 | 0.567 | 0.703 | 38.4 0.71 | 29.7 0.75 |
| Qwen2.5-7B-Inst | 0.268 | 0.366 | 19.6 0.33 | 4.60 0.08 | 0.87 | 1.10 | 49.5 0.40 | 13.9 0.18 | 0.165 | 0.213 | 43.3 0.62 | 15.5 0.23 |
| Qwen2.5-7B-Inst (A-MEM) | 0.286 | 0.371 | 14.1 0.10 | 24.6 0.51 | 1.13 | 1.43 | 18.6 0.10 | 53.7 1.26 | 0.730 | 0.961 | 18.8 0.14 | 91.2 2.44 |
| Qwen2.5-7B-Inst (truncate) | 0.262 | 0.336 | 8.28 0.06 | 5.89 0.16 | 0.97 | 1.23 | 11.8 0.10 | 11.9 0.20 | 0.396 | 0.497 | 13.3 0.16 | 22.1 0.60 |
| Search-R1 | 0.452 | 0.531 | 13.0 0.08 | 4.09 0.23 | 0.064 | 0.08 | 24.7 0.19 | 4.25 0.16 | 0.009 | 0.011 | 20.9 0.03 | 4.75 0.18 |
| Model | Avg Final Reward | Peak Token ( ) | Dependency ( ) | Inference Time Per Traj (s) |
| GPT-4o | 25.48 | N/A | ||
| GPT-4o (truncate) | 13.82 | N/A | ||
| GPT-4o (A-MEM) | 24.50 | N/A | ||
| Qwen2.5-7B-Instruct | 18.42 | |||
| Qwen2.5-14B-Instruct | 12.34 | |||
| Agent-FLAN-7B | 40.35 |
| Environment | System | EM | F1 | Peak Token ( ) | Dependency ( ) | Inference Time |
| Wiki RAG | Qwen2.5-7B-Inst (truncate) | 0.287 | 0.382 | |||
| Qwen2.5-7B-Inst (A-MEM) | 0.246 | 0.373 | ||||
| Qwen2.5-7B-Inst | 0.269 | 0.390 | ||||
| Qwen2.5-14B-Inst | 0.422 | 0.534 | ||||
| Search-R1 | 0.445 | 0.516 | ||||
| DeepResearcher | 0.419 | 0.503 |
| Agent | BrowseComp | BrowseComp-ZH | WideSearch | GAIA |
| Proprietary Agents | ||||
| Claude-4-Sonnet ( Anthropic 2025 ) | 14.7 | 22.5 | 62.0 | 68.3 |
| Claude-4-Opus ( Anthropic 2025 ) | 18.8 | 37.4 | - | - |
| OpenAI-o4-mini ( OpenAI 2025b ) | 28.3 | 44.3 | - | - |
| OpenAI-o3 ( OpenAI 2025b ) | 49.7 | 58.1 | 60.0 | 70.5 |
| OpenAI Deep Research ( OpenAI 2025a ) | 51.5 | 42.9 | - | 67.4 |
LLM Agent Memory
Large language model agent memory lets agents retain, organize, retrieve, and update information across interactions and long-running tasks.
See all 357 papers