From Long Context to Selective Memory:A Survey of Memory-Centric Compression for Large Language Models
Organizations: USTB
Abstract
Long-context capability has become essential for large language models (LLMs) to handle complex tasks, yet continuously expanding the context window does not remove the computational, storage, and information-selection pressures incurred at inference time. Existing work on prompt compression, KV-cache management, efficient serving, retrieval augmentation, and agent memory is usually discussed in isolation, leaving the flow of information between storage and computation insufficiently understood. This survey reframes long-context compression as a memory-management problem for allocating inference-time resources. We distinguish compute-active memory, which directly participates in model computation, from compute-inactive memory, which lies outside the computation path but can be stored, retrieved, updated, or forgotten, and we characterize offloaded KV caches, persistent prefix caches, and precomputed KV states as intermediate states on the activation path. On this basis, we formulate writing, offloading, recall, retrieval-and-injection, materialization, eviction, consolidation, and forgetting as state transitions within an information lifecycle, and introduce a budgeted cost model that places these operations in a single cost account. The resulting framework unifies short-term context compression, long-term memory management, and the transitions between them, and shows that the central challenge is not merely reducing information volume but deciding which information should participate in costly inference, when, and in what form. We further summarize evaluation dimensions, benchmark gaps, and open challenges, and argue that future research should move from static, pointwise compression toward dynamic, governable, lifecycle-aware memory management.
Figures & tables
| Survey | Organizing perspective | KV / serving | Long-term / agent memory | Explicit cost model | State transition / injection | Relation to this survey |
|---|---|---|---|---|---|---|
| Long-context LLM surveys ( Liu et al., 2025a ; Liu et al., 2025b ) | Architecture, infrastructure, training, evaluation | ● | ○ | ◐ | ○ | Background on long-context modeling (Sec. 2 ) |
| Prompt compression ( Li et al., 2025c ) | Hard / soft prompt compression | ○ | ○ | ◐ | ○ | Admission control for active memory (Secs. 4.1 – 4.2 ) |
| KV-cache management ( Li et al., 2024a ) | Token / model / system level | ● | ○ | ◐ | ○ | System-level basis (Secs. 4.3 – 4.5 , 6.3 ) |
| Agent memory mechanisms ( Zhang et al., 2024b ) | Memory sources, forms, operations | ○ | ● | ○ | ◐ | Writing and maintenance of external memory (Sec. 5 ) |
| From Human Memory to AI Memory ( Wu et al., 2025b ) | Object form time | ◐ | ● | ○ | ○ | Cognitive analogy; we adopt a cost view |
| Cognitive Memory in LLMs ( Shan et al., 2025 ) | Sensory / short-term / long-term | ◐ | ● | ○ | ◐ | Covers KV memory without modeling transition cost |
| Operator | Transition | Typical representation change | Representative methods | Main cost / risk | Section |
|---|---|---|---|---|---|
| Write / externalize | A I (copy) | Text summaries, structured facts, or embeddings | MemoryBank ( Zhong et al., 2023 ) , Mem0 ( Chhikara et al., 2025 ) , A-MEM ( Xu et al., 2025b ) | Extraction and indexing cost; erroneous or sensitive content may be fixed | 5.1 – 5.2 |
| Offload | A S | KV KV (optionally quantized or low-rank) | InfiniGen ( Lee et al., 2024 ) , ShadowKV ( Sun et al., 2025a ) | Host–device bandwidth and storage | 6.3 |
| Recall | S A | KV KV | InfiniGen ( Lee et al., 2024 ) , RetrievalAttention ( Liu et al., 2024b ) , MagicPIG ( Chen et al., 2025 ) | Retrieval precision and transfer latency | 6.3 |
| Retrieve-and-inject | I A | Text / structure text, latent, or KV | RAG ( Lewis et al., 2020 ) , LongLLMLingua ( Jiang et al., 2024 ) , HippoRAG ( Jimenez Gutierrez et al., 2024 ) | Retrieval, compression, and re-prefill cost | 5.3 , 6.1 – 6.2 |
| Materialize | I S | Text KV or latent | Prefix-cache precomputation, TurboRAG ( Lu et al., 2024 ) , Cartridges ( Eyuboglu et al., 2025 ) | Offline compute and storage; tied to model version | 6.3 |
| Evict | A | — | H2O ( Zhang et al., 2023 ) , SnapKV ( Li et al., 2024b ) , StreamingLLM ( Xiao et al., 2024b ) | Irrecoverable information loss | 4.3 |
| Method | Operator | Repr. | Selection signal / mechanism | Training | Access | Reuse |
| Compute-active memory (Section 4 ) | ||||||
| Selective Context | A A (prune) | Text | Self-information of lexical units | None | Black-box | – |
| LLMLingua / LongLLMLingua | A A (prune) | Text | Small-LM perplexity under a budget; question-aware variant | None | Black-box | – |
| Gist Tokens | A A (encode) | Latent | Learned gist tokens | Fine-tune | White-box | ✓ |
| AutoCompressors | A A (encode) | Latent | Segment-wise summary vectors | Fine-tune | White-box | ✓ |
| Activation Beacon | A A (encode) | KV | Learned activation compression | Fine-tune | White-box | – |
| Benchmark | Setting | Localization | Multi-evid. reasoning | Cross-session memory | Update / conflict | Compression-aware | Agent / tool | Cost report |
|---|---|---|---|---|---|---|---|---|
| NIAH / Passkey ( Yu et al., 2025b ; Munkhdalai et al., 2024 ) | Synthetic long sequences | ● | ○ | ○ | ○ | ○ | ○ | ○ |
| RULER ( Hsieh et al., 2024 ) | Controlled lengths | ● | ◐ | ○ | ○ | ○ | ○ | ○ |
| NoLiMa ( Modarressi et al., 2025 ) | Non-literal matching | ● | ◐ | ○ | ○ | ○ | ○ | ○ |
| BABILong ( Kuratov et al., 2024 ) | Facts in distractor text | ◐ | ● | ○ | ○ | ○ | ○ | ○ |
| LongBench / v2 ( Bai et al., 2024a ; Bai et al., 2024b ) | Natural long documents | ◐ | ● | ○ | ○ | ○ | ○ | ○ |
| InfiniteBench ( Zhang et al., 2024a ) | Beyond 100K tokens | ◐ | ● | ○ | ○ | ○ | ○ | ○ |
LLM Context Management
Large language model context management studies how to select, compress, retrieve, and organize information within bounded model inputs.
See all 250 papers