Toward a Theory of Hierarchical Memory for Language Agents
Organizations: University of Alberta · York University
Abstract
Many recent long-context and agentic systems address context-length limitations by adding hierarchical memory: they extract atomic units from raw data, build multi-level representatives by grouping and compression, and traverse this structure to retrieve content under a token budget. Despite recurring implementations, there is no shared formalism for comparing design choices. We propose a unifying theory in terms of three operators. Extraction () maps raw data to atomic information units; coarsening () partitions units and assigns a representative to each group; and traversal () selects which units to include in context given a query and budget. We identify a self-sufficiency spectrum for the representative function and show how it constrains viable retrieval strategies (a coarsening-traversal coupling). Finally, we instantiate the decomposition on eleven existing systems spanning document hierarchies, conversational memory, and agent execution traces, showcasing its generality.
Figures & tables
| System | Type | ; (SS) | ||
|---|---|---|---|---|
| RAPTOR | D | 100-tok chunks | UMAP+GMM; LLM summary (high) | collapsed / top-down |
| GraphRAG | D | entity/rel extract | Leiden; community report (high) | global / entity fan-out |
| xMemory | D | episode boundaries | guided split/merge; fact distill (mid) | top-down + expand |
| H-MEM | D | episode + profile | LLM 4-level; domain labels (low) | top-down FAISS |
| SimpleMem | D | window + density | online synthesis; consolidated (high) | multi-view parallel |
| Mastra’s OM | D | token threshold | all-in-one; Reflector (high) | full log |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| System | Affinity | Partition method |
|---|---|---|
| RAPTOR | UMAP + GMM | |
| GraphRAG | connectivity in | Leiden community detection |
| H-MEM | LLM-judged domain co-membership | LLM 4-level classification |
| xMemory | cosine + sparsity-semantic score | guided split/merge |
| SimpleMem | semantic + temporal proximity | online LLM synthesis |
| Mastra’s OM | temporal contiguity | token-count threshold |
LLM Agent Memory
Large language model agent memory lets agents retain, organize, retrieve, and update information across interactions and long-running tasks.
See all 373 papers