Skip to content

MemDefrag: Latent Memory Defragmentation for Large Language Models

Jul 2026 · 0 citations · 42 references
Computer Science

TL;DR

MemDefrag, a training-free and model-agnostic framework that uses a middle-layer tracing signal to conduct memory defragmentation (rank, reorder, and filter memories), and applies an informativeness-guided proportional forgetting mechanism once capacity is exceeded, is proposed.

Abstract

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.

View source

Similar papers

Conference Open access 2026

Octopus: Gated Selective Attention for Memory-Bounded Long-Context Inference in Large Language Models

O CTOPUS is proposed, a framework that confers fixed-memory inference onto pretrained Transform-ers without the information loss of linearization and outperforms state-of-the-art linearized baselines on the GSM8K benchmark, demonstrating that learned sparse retention serves as an effective regular-izer for long-horizon...

C. Nguyen, Ryan A. Rossi, L. Van et al. · 0 citations
Preprint Aug 2026

Proteus: Incremental Memory Activation for Long-Context Sequence Modeling

This work instantiates a new paradigm of incremental memory activation, where the effective capacity of memory is progressively expanded as the context grows, and applies this paradigm to state-of-the-art models, observing consistent improvements on standard language modeling and reasoning, as well as on long-context r...

Reza Bayat, Ali Behrouz, V. Mirrokni et al. · 1 citation
Preprint Aug 2026

MemTrapBench: Benchmarking Cognitive Traps in LLM Memory Use

This work identifies memory-induced cognitive traps: even faithfully recorded and semantically relevant memories can distort model reasoning or beliefs and degrade current task performance, and proposes AdaptiveMem, a simple yet effective inference-time method that instructs LLMs to avoid memory traps.

Mengru Wang, Haozhe Luo, Zhen-Qiang Xu et al. · 0 citations
Jul 2026

TransMem: Transforming Hidden States into Memory for Large Language Models

TransMem is proposed, a lightweight inference-time parametric memory module that transforms sparse historical hidden states from a frozen LLM backbone into reusable memory representations and introduces evidence-conditioned self-distillation to learn transferable memory utilization rather than task-specific knowledge.

Haodong Lei, Junming Liu, Yirong Chen et al. · 0 citations
Review Jul 2026

Memory for Large Language Models

A systematic, architecture-centric taxonomy of memory in LLMs is presented, characterizes memory along three orthogonal axes: representation, update dynamics, and persistence, effectively bridging disparate architectural paradigms.

Sining Zhoubian, Dan Zhang, Evgeny Kharlamov et al. · 1 citation
Conference Open access 2026

LaCo: Layer-wise Compensation for Pruned Large Language Models

Pruning is essential for the efficient deployment of Large Language Models (LLMs); however, it causes severe performance degradation due to the structural distortion induced by sparsity. Existing recovery strategies, such as LoRA, predominantly employ global fine-tuning, often overlooking the mechanistic root of this d...

Yingen Liu, Fan Wu, Xuyan Pan et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Sep 24, 2026

Estimating suicide risk from text

A new language-processing tool could help identify the highest-risk individuals from natural language, enabling swifter interventions.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.