Context Memorization for Efficient Long Context Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Okoshi, Yasuyuki, Chen, Hao Mark, Lu, Guanxi, Fan, Hongxiang, Motomura, Masato, Fujiki, Daichi
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917507936288768
author Okoshi, Yasuyuki
Chen, Hao Mark
Lu, Guanxi
Fan, Hongxiang
Motomura, Masato
Fujiki, Daichi
author_facet Okoshi, Yasuyuki
Chen, Hao Mark
Lu, Guanxi
Fan, Hongxiang
Motomura, Masato
Fujiki, Daichi
contents Modern large language model (LLM) applications increasingly rely on long conditioning prefixes to control model behavior at inference time. While prefix-augmented inference is effective, it incurs two structural limitations: i) the prefix's influence fades as generation proceeds, and ii) attention computation over the prefix scales linearly with its length. Existing approaches either keep the prefix in attention while compressing it, or internalize it into model parameters through gradient-based training. The former still attends to the prefix at inference, while the latter is training-intensive and ill-suited to prefix updates. To address these issues, we propose attention-state memory, a training-free approach that externalizes the prefix into a lightweight, lookup-based memory of precomputed attention states between prefix and query tokens. On ManyICLBench with LLaMA-3.1-8B, our method improves accuracy over in-context learning at 1K-8K memory budgets while reducing attention latency by 1.36x at 8K, and surpasses full-attention RAG performance on NBA benchmark using only 20% of its memory footprint.
format Preprint
id arxiv_https___arxiv_org_abs_2605_18226
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Context Memorization for Efficient Long Context Generation
Okoshi, Yasuyuki
Chen, Hao Mark
Lu, Guanxi
Fan, Hongxiang
Motomura, Masato
Fujiki, Daichi
Computation and Language
Artificial Intelligence
Modern large language model (LLM) applications increasingly rely on long conditioning prefixes to control model behavior at inference time. While prefix-augmented inference is effective, it incurs two structural limitations: i) the prefix's influence fades as generation proceeds, and ii) attention computation over the prefix scales linearly with its length. Existing approaches either keep the prefix in attention while compressing it, or internalize it into model parameters through gradient-based training. The former still attends to the prefix at inference, while the latter is training-intensive and ill-suited to prefix updates. To address these issues, we propose attention-state memory, a training-free approach that externalizes the prefix into a lightweight, lookup-based memory of precomputed attention states between prefix and query tokens. On ManyICLBench with LLaMA-3.1-8B, our method improves accuracy over in-context learning at 1K-8K memory budgets while reducing attention latency by 1.36x at 8K, and surpasses full-attention RAG performance on NBA benchmark using only 20% of its memory footprint.
title Context Memorization for Efficient Long Context Generation
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2605.18226