SeDeM: Selective Decompression of Hidden-State Memories for Long-Context Question Answering

Maryam Haghifam, Jason Cong, Yizhou SunarXiv 2026

TL;DR

SeDeM (Selective Decompression of Hidden-State Memories) is a novel framework for long-context question answering that decouples compact memory storage from decoder conditioning. By storing context as compressed hidden-state blocks, selecting only the query-relevant blocks, and decompressing them back into decoder-compatible states, SeDeM achieves superior QA accuracy and significantly lower latency compared to existing context-compression methods.

What Problem Does This Paper Address?

As large language models (LLMs) handle increasingly massive context windows, they face a dual challenge: efficiency and reliability. Mechanically, processing long inputs is incredibly expensive because self-attention during the "prefill" stage scales quadratically with sequence length, and the key-value (KV) cache balloons over time. Behaviorally, LLMs often suffer from the "lost in the middle" phenomenon, failing to retrieve and use evidence if it isn't at the very beginning or end of a prompt.

To fix this, researchers use context compression. Hard compression prunes discrete tokens, which can discard vital nuance. Soft compression condenses text into continuous "memory tokens." However, most soft-compression methods force the LLM to act as both the compressor and the decoder input, which can overwrite local information across layers. Furthermore, these highly compressed memory slots are fed directly into the decoder, forcing them to simultaneously store source information and act as effective decoder-conditioning states—a dual role that degrades performance at high compression ratios.

Methods

SeDeM introduces a two-stage approach that separates memory storage from decoder conditioning:

  1. Query-Independent Memory Construction: The long context is divided into segments. A frozen LLM encoder extracts hidden states from an intermediate layer ($\ell_{ext}$). These states are locally mean-pooled and projected via a shared linear layer into compact memory blocks, forming a global "Memory Bank."
  2. Query-Conditioned Memory Use: When a question is asked, a ColBERT-style late-interaction Top-$K$ Selector scores the memory blocks against the query. Only the top-$K$ most relevant blocks are passed to a Decompressor (a shared two-layer MLP). The decompressor expands these blocks back into full-sized hidden states, which are then injected directly into an intermediate decoder layer ($\ell_{inj}$) to generate the answer.
Figure 1: Overview of SeDeM. The model stores long-context information in a compact memory bank, selects query-relevant blocks, selectively decompresses them into decoder-compatible hidden states, and injects the re- constructed states into the decoder for answer generation. The extraction layer ℓext and the injection layer ℓinj need not be equal.

Training Strategy

  • Stage 1 (Reconstruction Pretraining): Trains the compressor and decompressor on a general corpus (SlimPajama) using a combination of context-window next-token reconstruction, directional hidden-state alignment, and token-distribution distillation from a raw-context teacher model.
  • Stage 2 (Task-Specific Training): Activates the selection module and trains the entire pipeline on downstream QA datasets using block-level evidence supervision (InfoNCE + margin loss) alongside standard QA generation loss via lightweight LoRA adapters.

Datasets

The authors evaluated SeDeM on four long-context question-answering benchmarks:

  • HotpotQA-Distractor: A 2-hop reasoning dataset with a mix of gold and distractor paragraphs.
  • 2WikiMultiHopQA: A complex multi-hop QA dataset.
  • MuSiQue: A challenging 2–4 hop QA dataset requiring deep compositionality.
  • QASPER: A long-document QA dataset based on scientific papers.

They also tested long-context scaling behavior using the RULER benchmark (qa_2 task) at lengths of 4K, 8K, and 16K tokens.

Key Insights and Ideas

  • Decompression is Essential: The paper's core "aha moment" is that forcing an LLM to decode directly from compressed memory slots hurts performance. Controlled ablations showed that expanding memories back into decoder-compatible hidden states yields substantially higher QA accuracy.
  • Intermediate Layer Injection Avoids Mismatch: Instead of feeding memory tokens into the very first layer of the decoder, SeDeM injects decompressed states into an intermediate layer. This bypasses the lower decoder layers, preventing the synthetic memory representations from being distorted before they reach the layers responsible for generation.
  • Cross-Model Flexibility: Because the framework relies on projections and MLPs, it supports cross-model usage. The authors successfully demonstrated a setup where a smaller, cheaper 1B model acts as the encoder/compressor, and a larger 3B model acts as the decoder.

Key Results

SeDeM consistently outperformed standard soft-compression baselines (like ICAE, HMT, and 500xCompressor) across both 1B and 3B Llama-3.2 backbone configurations.

Table 1: Main long-context QA results. We report token-level F1 and ROUGE-L; higher is better. Category labels denote full-context references (Ref.), hard prompt compression (Hard), soft memory compression (Soft), selective soft memory compression (Sel. Soft), and KV-cache or activation compression (KV/Act.). The cross-model row uses a 1B encoder and a 3B decoder.
  • Surpassing Full-Context Fine-Tuning: With a 3B backbone, SeDeM actually beat full-context fine-tuning on three out of four datasets (2WikiMHQA, QASPER, and HotpotQA), proving that filtering out irrelevant context can be better than letting the model look at everything.
  • Inference Efficiency: Compared to ICAE, SeDeM achieved a 1.74× to 2.46× reduction in online Time-to-First-Token (TTFT) and a 1.08× to 1.10× increase in decoding throughput. This is because the decoder only processes the query and the $K$ selected blocks, rather than the entire compressed context.
  • Mitigating Rank Collapse: Effective-rank analysis showed that SeDeM retains a significantly higher normalized effective rank than ICAE (78.7% vs 52.3% on average), indicating that its memory slots suffer far less from representation collapse.

Limitations and Future Work

  • Supervision Dependency: The Top-$K$ selector relies on block-level evidence labels during training. While the authors showed that distant supervision (using answer strings) can work, performance drops slightly. Moving toward fully self-supervised selection is an open goal.
  • Performance Decay at Scale: While SeDeM handles longer contexts better than ICAE on the RULER benchmark, its performance still degrades as context scales from 4K to 16K tokens. It is not entirely length-invariant.
  • Task Scope: The framework was primarily optimized and evaluated for retrieval-heavy QA tasks. Broad-coverage tasks like text summarization will likely require different selection or aggregation strategies.

Summary updated

Abstract

Long-context inference with large language models (LLMs) is costly: self-attention during prefill scales quadratically with sequence length, and the key-value (KV) cache grows with the number of processed tokens. Larger context windows also do not ensure reliable evidence use. Context compression reduces this cost, but many soft-compression methods use LLMs as compressors and rely on compact memory tokens both to preserve information and to condition the decoder. We propose SeDeM, a selective decompression framework that decouples compact memory storage from decoder conditioning. SeDeM stores context as compact hidden-state memory blocks, selects query-relevant blocks, and decompresses only the selected blocks for decoder conditioning. Thus, the decoder avoids both full-context processing and direct generation from highly compressed memory slots. On four long-context QA benchmarks, SeDeM achieves higher QA scores than the compression baselines in our main comparison in both 1B and 3B same-backbone settings, and with the 3B backbone exceeds full-context fine-tuning on three datasets. SeDeM also provides favorable quality--efficiency trade-offs, achieving 1.74--2.46$\times$ lower online time-to-first-token and 1.08--1.10$\times$ higher autoregressive decoding throughput relative to ICAE while maintaining strong answer quality.
BibTeX
@misc{haghifam2026sedem,
  author = {Maryam Haghifam and Jason Cong and Yizhou Sun},
  title = {{SeDeM: Selective Decompression of Hidden-State Memories for Long-Context Question Answering}},
  year = {2026},
  eprint = {2608.00311},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.00311},
}
Figure