Compressing Long Context into Answer-Aligned Memory Embeddings for LLM Inference

Md Mostafizer Rahman, Md Faizul Ibne Amin, Md. Shahajada Mia, Yutaka Watanobe, Fang Liu


Abstract
Large language model (LLM) inference is constrained by the quadratic scaling of self-attention and the linear scaling of the KV cache, increasing latency, energy consumption, and GPU memory demand as context length scales. Existing soft-compression methods either lack query-guided memory selection at inference time, train without answer-targeted supervision, or couple compression tightly to a specific decoder architecture. We propose a Context-to-Answer-Aligned Memory Compression (CMC) framework, which compresses long input contexts into compact Context Memory Embeddings (CMEs) aligned to any frozen decoder’s embedding space, reducing inference costs without modifying decoder weights. CMC introduces a two-tier KV cache that combines question-guided CME selection with a local context window, and trains the compressor with answer-targeted distillation from a frozen LLM. Experiments across nine encoder-decoder combinations and four QA benchmarks show that CMC consistently outperforms the baseline, achieving up to 7.3 EM and 4.0 F1 point gains on SQuAD, while reducing inference time and energy consumption by up to 20% and peak reserved GPU memory by up to 50% at 3,000 generation tokens. Ablation studies confirm that each architectural component and training objective contributes to the performance.
Anthology ID:
2026.findings-emnlp.1590
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
33852–33871
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.1590/
DOI:
Bibkey:
Cite (ACL):
Md Mostafizer Rahman, Md Faizul Ibne Amin, Md. Shahajada Mia, Yutaka Watanobe, and Fang Liu. 2026. Compressing Long Context into Answer-Aligned Memory Embeddings for LLM Inference. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 33852–33871, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Compressing Long Context into Answer-Aligned Memory Embeddings for LLM Inference (Rahman et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.1590.pdf