AI summary · arXiv: 2404.15420v1 · cs.CL

XC-Cache: Cross-Attending to Cached Context for Efficient LLM Inference

João Monteiro, Étienne Marcotte, Pierre-André Noël, Valentina Zantedeschi, David Vázquez, Nicolas Chapados, Christopher Pal, Perouz Taslakian
Original paper · DOI 10.18653/v1/2024.findings-emnlp.896 Submitted to arXiv on 23 Apr. 2024 Published in Findings of the Association for Computational Linguistics: EMNLP 2024 (2024) License: CC BY 4.0

How to read this summary? Illustrated guide

The essentials

  • Study focuses on challenges of in-context learning (ICL) approaches and their use of prompting for decoder-only language model generation
  • Introduces models inspired by encoder-decoder architecture utilizing cross-attention to condition generation on reference text without prompts
  • Models outperform ICL methods, comparable to fine-tuned prompted LLMs, and reduce space footprint compared to standard KV caching
  • All models experience a decline in accuracy in out-of-distribution scenarios due to variations in writing style, document lengths, signal-to-noise ratio, and distracting content
  • Enhancing the robustness of context-conditional models is identified as a promising avenue for future research
  • Importance of ethical considerations in developing efficient learning models is emphasized

Key points written by AI: they may contain errors, check them against the paper.

AI-generated keywords: ICL Cross-Attention LLM Inference Efficient Learning Models Robustness

Read further

  • Comprehensive Summary
  • Layman's Summary
  • Blog article
  • Original abstract
The study "XC-Cache: Cross-Attending to Cached Context for Efficient LLM Inference" delves into the challenges of in-context learning (ICL) approaches and their use of prompting for decoder-only language model generation. To address the inefficiency of just-in-time processing and space constraints in caching transformer states, the research introduces models inspired by the encoder-decoder architecture that utilize cross-attention to condition generation on reference text without prompts. By leveraging pre-trained decoder-only models and training a small number of additional layers, these models outperform ICL methods, are comparable to fine-tuned prompted LLMs, and significantly reduce space footprint compared to standard KV caching. However, when evaluated in an out-of-distribution scenario where test datasets differ greatly from training data, all models experience a decline in accuracy. This discrepancy may be due to variations in writing style, document lengths, signal-to-noise ratio, and distracting content related to questions but not useful for answers. Therefore, enhancing the robustness of context-conditional models is identified as a promising avenue for future research. Furthermore,of AI research is acknowledged and the importance of ethical considerations in developing efficient learning models is emphasized. The proposed architecture allows for improved performance on unseen datasets while also highlighting opportunities for further advancements in model generalization and robustness.

Was this synthesis useful?

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

Figures and plots

Ask about a figure by number or use its question button to request visual analysis. Up to two figures and four image panels per question. Values read from plots are approximate; check the original data.

AI assistant instructions?

Tools for this paper

Explain it differently 1 free rewrite left today
Save to a collection Group papers in collections to compare them, chat with them and export them. Continue with Google Create a free account Log in

Advanced tools Premium

For researchers who follow a field closely: citation alerts, journal-club slides, version comparison and Zotero export. Discover Premium

Zotero Zotero guide
Citation alerts 14 papers already cite it: be emailed each new one. Citation alerts guide
Who works on it?

Among the 31 papers around this one, the name that comes back most: João Monteiro (3 papers)

3 more people sign several of them. The full map adds their institutions and approaches, from the papers of the last years.

Continue with Google Create a free account: your first map is free
Weekly letter The latest letter of its field, "Artificial intelligence this week" of 30 November 2026: Artificial intelligence this week: What the tests leave out · Receive one by email for free

Papers around this one

See them on a map

Ranked by how close their title and abstract are to this paper’s. Select some to read them together.

Closest papers

  1. Very close Broader context Cites this paper
    KV-Kaizen: Learning Context-Adaptive Cache Compression Choices
    João Monteiro, Louis Béthune, A. Filippova et al. · 2026 · cited 1 time · Not summarized yet

    KV-Kaizen learns context-dependent cache configurations to compress KV memory, whereas XC-Cache conditions generation on cached reference text through cross-attention.

    Abstract

    As the context size of text processed with an LLM grows, the size of KV caches can outstrip the memory allocated for the original model weights. This impacts LLM throughput negatively, since decoding is memory-bound and decode cost grows with cache size. Recent work alleviates this bottleneck by discarding the least relevant tokens. Eviction introduces a tension, since a one-off decision to discard content may prove detrimental later. Instead, we focus on alternative choices that can lead to cache compression without evicting tokens. We achieve this by learning a selector that is able to produce, based on context, a per-layer cache configuration towards an overall compression budget. The sel…

  2. Very close Another approach to the problem
    SeDeM: Selective Decompression of Hidden-State Memories for Long-Context Question Answering
    Maryam Haghifam, Jason Cong, Yi-Zhou Sun · 2026 · cited 1 time · Not summarized yet

    SeDeM stores compact hidden-state blocks and selectively decompresses query-relevant ones for long-context QA, rather than using XC-Cache's cross-attention to cached context.

    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 …

  3. Very close Same question
    Exploring Fine-Tuning for In-Context Retrieval and Efficient KV-Caching in Long-Context Language Models
    F. Molfese, Momchil Hardalov, Rexhina Blloshmi et al. · 2026 · Conference of the European Chapter of the Association for Computational Linguistics · cited 1 time · Not summarized yet

    This study tests how fine-tuning affects long-context retrieval and KV-cache robustness, while XC-Cache evaluates conditional generation from reference context with reduced cache storage.

    Abstract

    With context windows of millions of tokens, Long-Context Language Models (LCLMs) can encode entire document collections, offering a strong alternative to conventional retrieval-augmented generation (RAG). However, it remains unclear whether fine-tuning strategies can improve long-context performance and translate to greater robustness under KV-cache compression techniques. In this work, we investigate which training strategies most effectively enhance LCLMs'ability to identify and use relevant information, as well as enhancing their robustness under KV-cache compression. Our experiments show substantial in-domain improvements, achieving gains of up to +20 points over the base model. However,…

  4. Close Same question
    Eliciting In-context Retrieval and Reasoning for Long-context Large Language Models
    Yifu Qiu, Varun Embar, Yi-Zhe Zhang et al. · 2025 · Annual Meeting of the Association for Computational Linguistics · cited 15 times · Not summarized yet

    This work evaluates retrieval and reasoning over long contexts, while XC-Cache tests question answering conditioned on reference text.

    Abstract

    Recent advancements in long-context language models (LCLMs) promise to transform Retrieval-Augmented Generation (RAG) by simplifying pipelines. With their expanded context windows, LCLMs can process entire knowledge bases and perform retrieval and reasoning directly -- a capability we define as In-Context Retrieval and Reasoning (ICR^2). However, existing benchmarks like LOFT often overestimate LCLM performance by providing overly simplified contexts. To address this, we introduce ICR^2, a benchmark that evaluates LCLMs in more realistic scenarios by including confounding passages retrieved with strong retrievers. We then propose three methods to enhance LCLM performance: (1) retrieve-then-g…

  5. Close Broader context
    Lag-Relative Sparse Attention In Long Context Training
    Manlai Liang, Wanyi Huang, Man-Di Liu et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 1 time · Not summarized yet

    This work trains sparse attention for long-context use and addresses KV memory costs, while XC-Cache reduces cache storage by conditioning through cross-attention.

    Abstract

    Large Language Models (LLMs) have made significant strides in natural language processing and generation, yet their ability to handle long-context input remains constrained by the quadratic complexity of attention computation and linear-increasing key-value memory footprint. To reduce computational costs and memory, key-value cache compression techniques are commonly applied at inference time, but this often leads to severe performance degradation, as models are not trained to handle compressed context. Although there are more sophisticated compression methods, they are typically unsuitable for post-training because of their incompatibility with gradient-based optimization or high computatio…

  6. Close Another approach to the problem
    In-context Autoencoder for Context Compression in a Large Language Model
    Tao Ge, Jing Hu, Xun Wang et al. · 2023 · Computation and Language · cited 240 times · AI summary available

    ICAE compresses context into learned memory slots for a decoder, while XC-Cache uses added cross-attention layers to condition generation on cached reference text.

    Abstract

    We propose the In-context Autoencoder (ICAE) for context compression in a large language model (LLM). The ICAE has two modules: a learnable encoder adapted with LoRA from an LLM for compressing a long context into a limited number of memory slots, and a fixed decoder which is the target LLM that can condition on the memory slots for various purposes. We first pretrain the ICAE using both autoencoding and language modeling objectives on massive text data, enabling it to generate memory slots that accurately and comprehensively represent the original context. Then, we fine-tune the pretrained ICAE on a small amount of instruct data to enhance its interaction with various prompts for producing …

  7. Close Broader context
    Retrospective Sparse Attention for Efficient Long-Context Generation
    S. Choi, Beomseok Kang, Dongwon Jo et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 4 times · Not summarized yet

    RetroAttention updates KV caches to manage attention errors during long generation, while XC-Cache avoids standard large KV caches for reference context.

    Abstract

    Large Language Models (LLMs) are increasingly deployed in long-context tasks such as reasoning, code generation, and multi-turn dialogue. However, inference over extended contexts is bottlenecked by the Key-Value (KV) cache, whose memory footprint grows linearly with sequence length and dominates latency at each decoding step. While recent KV cache compression methods identify and load important few tokens, they focus predominantly on input contexts and fail to address the cumulative attention errors that arise during long decoding. In this paper, we introduce RetroAttention, a novel KV cache update technique that retrospectively revises past attention outputs using newly arrived KV entries …

  8. Close Broader context
    AttnCache: Accelerating Self-Attention Inference for LLM Prefill via Attention Cache
    Dinghong Song, Yuan Feng, Yiwei Wang et al. · 2025 · arXiv.org · preprint, not peer reviewed · cited 2 times · Not summarized yet

    AttnCache reuses similar attention maps to speed prefill-only workloads, while XC-Cache uses cross-attention to reduce the cost of conditioning on reference text.

    Abstract

    Large Language Models (LLMs) are widely used in generative applications such as chatting, code generation, and reasoning. However, many realworld workloads such as classification, question answering, recommendation, and text embedding rely solely on the prefill stage of inference, where the model encodes input sequences without performing autoregressive decoding. In these prefill only scenarios, the self-attention computation becomes the primary performance bottleneck due to its quadratic complexity with respect to sequence length. In this paper, we observe that semantically different sentences often produce similar attention maps across layers and heads. Building on this insight, we propose…

Prior work it builds on

  1. Close Same method, another problem
    Long-Context Language Modeling with Parallel Context Encoding
    Howard Yen, Tianyu Gao, Danqi Chen · 2024 · Annual Meeting of the Association for Computational Linguistics · cited 106 times · Not summarized yet

    CEPE extends decoder-only models with a small encoder and cross-attention to use long inputs, the mechanism XC-Cache applies to cached reference context.

    Abstract

    Extending large language models (LLMs) to process longer inputs is crucial for a wide range of applications. However, the substantial computational cost of transformers and limited generalization of positional encoding restrict the size of their context window. We introduce Context Expansion with Parallel Encoding (CEPE), a framework that can be applied to any existing decoder-only LLMs to extend their context window. CEPE employs a small encoder to process long inputs chunk by chunk, enabling the frozen decoder to utilize additional contexts via cross-attention. CEPE is efficient, generalizable, and versatile: trained with 8K-token documents, it extends the context window of LLAMA-2 to 128K…

  2. Close Groundwork for this paper
    Lost in the Middle: How Language Models Use Long Contexts
    Nelson F. Liu, Kevin Lin, John Hewitt et al. · 2023 · Computation and Language · cited 5,788 times · AI summary available

    Lost in the Middle measures how relevant information position and context length affect question answering and retrieval, motivating XC-Cache's efficient use of reference context.

    Abstract

    While recent language models have the ability to take long contexts as input, relatively little is known about how well they use longer context. We analyze language model performance on two tasks that require identifying relevant information within their input contexts: multi-document question answering and key-value retrieval. We find that performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly degrades when models must access relevant information in the middle of long contexts. Furthermore, performance substantially decreases as the input context grows longer, even for explicitly long-context models. Our analysis provide…

  3. Close Broader context
    Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference
    Piotr Nawrot, Adrian La'ncucki, Marcin Chochowski et al. · 2024 · International Conference on Machine Learning · cited 145 times · Not summarized yet

    DMC compresses KV caches with learned per-head and per-layer ratios, whereas XC-Cache conditions on reference text using compact cross-attention caches.

    Abstract

    Transformers have emerged as the backbone of large language models (LLMs). However, generation remains inefficient due to the need to store in memory a cache of key-value representations for past tokens, whose size scales linearly with the input sequence length and batch size. As a solution, we propose Dynamic Memory Compression (DMC), a method for online key-value cache compression at inference time. Most importantly, the model learns to apply different compression ratios in different heads and layers. We retrofit pre-trained LLMs such as Llama 2 (7B, 13B and 70B) into DMC Transformers, achieving up to 7x throughput increase during auto-regressive inference on an NVIDIA H100 GPU. DMC is app…

  4. Close Broader context
    Keyformer: KV Cache Reduction through Key Tokens Selection for Efficient Generative Inference
    Muhammad Adnan, Akhil Arunkumar, Gaurav Jain et al. · 2024 · Conference on Machine Learning and Systems · cited 181 times · Not summarized yet

    Keyformer reduces KV memory by selecting key tokens for generation, whereas XC-Cache replaces standard prompt-based conditioning with cross-attention to cached context.

    Abstract

    Transformers have emerged as the underpinning architecture for Large Language Models (LLMs). In generative language models, the inference process involves two primary phases: prompt processing and token generation. Token generation, which constitutes the majority of the computational workload, primarily entails vector-matrix multiplications and interactions with the Key-Value (KV) Cache. This phase is constrained by memory bandwidth due to the overhead of transferring weights and KV cache values from the memory system to the computing units. This memory bottleneck becomes particularly pronounced in applications that require long-context and extensive text generation, both of which are increa…

  5. Related Same method, another problem A method it uses
    LLM2Vec: Large Language Models Are Secretly Powerful Text Encoders
    Parishad BehnamGhader, Vaibhav Adlakha, Marius Mosbach et al. · 2024 · arXiv.org · preprint, not peer reviewed · cited 613 times · AI summary available

    LLM2Vec adapts pretrained decoder-only models by adding training objectives and changing attention, while XC-Cache adds trainable cross-attention layers to pretrained decoders.

    Abstract

    Large decoder-only language models (LLMs) are the state-of-the-art models on most of today's NLP tasks and benchmarks. Yet, the community is only slowly adopting these models for text embedding tasks, which require rich contextualized representations. In this work, we introduce LLM2Vec, a simple unsupervised approach that can transform any decoder-only LLM into a strong text encoder. LLM2Vec consists of three simple steps: 1) enabling bidirectional attention, 2) masked next token prediction, and 3) unsupervised contrastive learning. We demonstrate the effectiveness of LLM2Vec by applying it to 4 popular LLMs ranging from 1.3B to 8B parameters and evaluate the transformed models on English wo…

Papers that cite it

  1. Close Review Uses this paper in depth
    A Survey on Large Language Model Acceleration based on KV Cache Management
    Hao-Yang Li, Yiming Li, An-Xin Tian et al. · 2024 · Trans. Mach. Learn. Res. · cited 182 times · Not summarized yet

    This survey reviews KV-cache management for LLM acceleration, including the cache-memory problem that XC-Cache addresses through a different conditioning architecture.

    Abstract

    Large Language Models (LLMs) have revolutionized a wide range of domains such as natural language processing, computer vision, and multi-modal tasks due to their ability to comprehend context and perform logical reasoning. However, the computational and memory demands of LLMs, particularly during inference, pose significant challenges when scaling them to real-world, long-context, and real-time applications. Key-Value (KV) cache management has emerged as a critical optimization technique for accelerating LLM inference by reducing redundant computations and improving memory utilization. This survey provides a comprehensive overview of KV cache management strategies for LLM acceleration, categ…

  2. Close Broader context
    Efficient Prompt Compression with Evaluator Heads for Long-Context Transformer Inference
    WeiZhi Fei, Xue-Yan Niu, Guo-Qing Xie et al. · 2025 · Neural Information Processing Systems · cited 15 times · Not summarized yet

    EHPC selects important prompt tokens without training to reduce long-context inference costs, while XC-Cache uses trainable cross-attention to condition on cached reference text.

    Abstract

    Although applications involving long-context inputs are crucial for the effective utilization of large language models (LLMs), they also result in increased computational costs and reduced performance. To address this challenge, we propose an efficient, training-free prompt compression method that retains key information within compressed prompts. We identify specific attention heads in transformer-based LLMs, which we designate as evaluator heads, that are capable of selecting tokens in long inputs that are most significant for inference. Building on this discovery, we develop EHPC, an Evaluator Head-based Prompt Compression method, which enables LLMs to rapidly"skim through"input prompts b…

  3. Close Same question
    Cache the Encoder Within:Compact, Reusable Memory across LLM Queries
    Han-Lin Liu, Chun-Yu Liu, Chao-Fan Lin et al. · 2026 · Not summarized yet

    EncBank compactly stores reusable document-encoder outputs for repeated queries, addressing XC-Cache's concern with the storage cost of cached context.

    Abstract

    Repeated queries over shared documents incur redundant encoding, while caching model states introduces persistent storage costs. Building on CoMem's intermediate-state interface, EncBank treats a pretrained LLM's lower layers as a reusable document encoder and compactly stores their outputs for an adapted upper-layer reader. A self-distilled suffix adapter is shared across storage precisions within each backbone, without quantization-specific retraining. Across five benchmark suites on three Qwen backbones spanning different sizes and full-attention and hybrid architectures, 4-bit storage keeps each reported benchmark aggregate within one score point of native-precision EncBank. In a fixed Q…

  4. Close Broader context
    Stochastic KV Routing: Enabling Adaptive Depth-Wise Cache Sharing
    A. Filippova, D. Grangier, Marco Cuturi et al. · 2026 · arXiv.org · preprint, not peer reviewed · cited 4 times · Not summarized yet

    Stochastic KV Routing reduces cache memory through cross-layer sharing, while XC-Cache reduces reference-context storage using added cross-attention layers.

    Abstract

    Serving transformer language models with high throughput requires caching Key-Values (KVs) to avoid redundant computation during autoregressive generation. The memory footprint of KV caching is significant and heavily impacts serving costs. This work proposes to lessen these memory requirements. While recent work has largely addressed KV cache reduction via compression and eviction along the temporal axis, we argue that the \emph{depth} dimension offers an orthogonal and robust avenue for optimization. Although prior research suggests that a full cache for every layer is redundant, implementing cross-layer cache sharing remains a practical challenge; existing methods typically suffer from re…

  5. Related Another approach to the problem
    TurboRAG: Accelerating Retrieval-Augmented Generation with Precomputed KV Caches for Chunked Text
    Song-Shuo Lu, Hua Wang, Yu Rong et al. · 2024 · Conference on Empirical Methods in Natural Language Processing · cited 90 times · Not summarized yet

    TurboRAG precomputes and retrieves document KV caches to reduce RAG prefill latency, whereas XC-Cache uses cross-attention to condition generation on reference text.

    Abstract

    Current Retrieval-Augmented Generation (RAG) systems concatenate and process numerous retrieved document chunks for prefill which requires a large volume of computation, therefore leading to significant latency in time-to-first-token (TTFT). To reduce the computation overhead as well as TTFT, we introduce TurboRAG, a novel RAG system that redesigns the inference paradigm of the current RAG system by first pre-computing and storing the key-value (KV) caches of documents offline, and then directly retrieving the saved KV cache for prefill. Hence, online computation of KV caches is eliminated during inference. In addition, we provide a number of insights into the mask matrix and positional embe…

How are these papers found?

We compare the title and abstract of this paper with those of every paper summarized on this site, and with the papers Semantic Scholar recommends, those it cites and those citing it (for a much-cited paper, its most recent citations and, from OpenAlex, the most cited ones). Among the prior work and the follow-ups, the papers that use each other in depth, a method it uses and the much-cited follow-ups come a little higher. The levels (very close, close, related) come from the similarity of the texts, not from a judgment of quality; * marks a paper without an abstract, compared by its title. The sentence under a paper is written by an AI from the two abstracts: check it in the papers. A paper marked not relevant by three readers leaves the list.

Updated on 31 October 2026.

The illustrated guide to the papers around a paper

The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.