SwiftMem: Fast Agentic Memory via Query-aware Indexing
Anxin Tian, Yiming Li, Xing Li, Hui-Ling Zhen, Lei Chen, Xianzhi Yu, Zhenhua Dong, Mingxuan Yuan
TL;DR
SwiftMem tackles the latency bottleneck in memory-augmented LLMs by introducing a query-aware memory system with three synergistic components: a Temporal Index for time-based retrieval, a Semantic DAG-Tag Index for content-aware routing, and an Embedding co-consolidation mechanism to curb memory fragmentation and improve cache locality. The framework provides sub-linear retrieval, with time complexities such as $O(\log N_{mem})$ for explicit temporal queries and $O(k \cdot (\log |V| + D_{max}))$ for semantic tag routing, plus $O(|V|)$ consolidation. Empirical results on LoCoMo and LongMemEval show about a 47x faster search than state-of-the-art baselines while maintaining competitive accuracy (LLM scores around 0.70) and sub-15 ms search latency, supporting practical deployment of memory-augmented agents in long-term conversations. These findings highlight the practical impact of query-aware indexing for scalable, real-time agentic memory systems.
Abstract
Agentic memory systems have become critical for enabling LLM agents to maintain long-term context and retrieve relevant information efficiently. However, existing memory frameworks suffer from a fundamental limitation: they perform exhaustive retrieval across the entire storage layer regardless of query characteristics. This brute-force approach creates severe latency bottlenecks as memory grows, hindering real-time agent interactions. We propose SwiftMem, a query-aware agentic memory system that achieves sub-linear retrieval through specialized indexing over temporal and semantic dimensions. Our temporal index enables logarithmic-time range queries for time-sensitive retrieval, while the semantic DAG-Tag index maps queries to relevant topics through hierarchical tag structures. To address memory fragmentation during growth, we introduce an embedding-tag co-consolidation mechanism that reorganizes storage based on semantic clusters to improve cache locality. Experiments on LoCoMo and LongMemEval benchmarks demonstrate that SwiftMem achieves 47$\times$ faster search compared to state-of-the-art baselines while maintaining competitive accuracy, enabling practical deployment of memory-augmented LLM agents.
