MemDefrag: Latent Memory Defragmentation for Large Language Models
Not on the map. Why?
Abstract (arXiv)
Latent memory, which stores past knowledge fragments as per-layer hidden states, has emerged as a promising paradigm (e.g., MemoryLLM and M+) for long-term memory in large language models (LLMs). However, the paradigm suffers from significant performance degradation during memory updates, due to positional encoding misalignment and the absence of any tracing mechanism to distinguish target memory fragments from irrelevant ones. To discover such a tracing mechanism, we probe the layer-wise attention density over stored memory fragments, and find that a small set of middle transformer layers consistently concentrates the highest density on the target fragment - exposing an inherent tracing signal. In light of this, we propose MemDefrag, a training-free and model-agnostic framework that (1) uses a middle-layer tracing signal to conduct memory defragmentation (rank, reorder, and filter memories), and (2) applies an informativeness-guided proportional forgetting mechanism once capacity is exceeded. Experiments show that MemDefrag substantially outperforms MemoryLLM and M+ on knowledge retention (e.g., 43.0% vs. 17.4%/17.6% after 50 memory updates) and long-context benchmarks, and generalizes well across various LLMs and latent-memory variants. The code is available at github.com/ryehr/MemDefrag.
Key facts. No citing papers in the map yet (data through 13 Oct 2026). Builds on 23 of its 41 references that are in the map. First posted on arXiv 7 Jul 2026.
Builds on
23 of 41 references.
References · 23
- 2024The Llama 3 Herd of Modelscited by 14,486
- 2019BERTScore: Evaluating Text Generation with BERTcited by 5,480
- 2016Overcoming catastrophic forgetting in neural networkscited by 4,753
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,133
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,412
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,386
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,354
- 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,042
- 2023Steering Language Models With Activation Engineeringcited by 873
- 2024SnapKV: LLM Knows What You are Looking for Before Generationcited by 856
- 2024A Survey on the Memory Mechanism of Large Language Model based Agentscited by 625
- 2024Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inferencecited by 489
11 more
- 2024LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compressioncited by 344
- 2025Layer by Layer: Uncovering Hidden Representations in Language Modelscited by 298
- 2025Memory in the Age of AI Agentscited by 291
- 2024Cost-Efficient Large Language Model Serving for Multi-turn Conversations with CachedAttentioncited by 160
- 2025Key-value memory in the braincited by 23
- 2025Pre-training Limited Memory Language Models with Internal and External Knowledgecited by 12
- 2026NextMem: Towards Latent Factual Memory for LLM-based Agentscited by 11
- 2025RePo: Language Models with Context Re-Positioningcited by 4
- 2026Time is Not a Label: Continuous Phase Rotation for Temporal Knowledge Graphs and Agentic Memorycited by 3
- 2025SeqPE: Transformer with Sequential Position Encodingcited by 2
- 2026Semantic Chunking and the Entropy of Natural Languagecited by 1
Built on by
Not cited yet.