ChunkAttention: Efficient Self-Attention with Prefix-Aware KV Cache and Two-Phase Partition

Auteurs : Lu Ye, Ze Tao, Yong Huang, Yang Li

Soumis à arXiv le 23 Fév. 2024
Licence : CC BY 4.0
Résumé scientifique

Self-attention is an essential component of large language models(LLMs) but a significant source of inference latency for long sequences. In multi-tenant LLMs serving scenarios, the compute and memory operation cost of self-attention can be optimized by using the probability that multiple LLM requests have shared system prompts in prefixes. In this paper, we introduce ChunkAttention, a prefix-aware self-attention module that can detect matching prompt prefixes across multiple requests and share their key/value tensors in memory at runtime to improve the memory utilization of KV cache. This is achieved by breaking monolithic key/value tensors into smaller chunks and structuring them into the auxiliary prefix tree. Consequently, on top of the prefix-tree based KV cache, we design an efficient self-attention kernel, where a two-phase partition algorithm is implemented to improve the data locality during self-attention computation in the presence of shared system prompts. Experiments show that ChunkAttention can speed up the self-attention kernel by 3.2-4.8$\times$ compared to the start-of-the-art implementation, with the length of the system prompt ranging from 1024 to 4096.

Les articles autour de lui, par date et par proximité

Plus haut, c’est plus proche de cet article ; à gauche, c’est plus ancien. Les traits relient les articles proches entre eux : les groupes de traits sont des sous-thèmes. Sélectionnez un point pour voir pourquoi il est là. Retour au résumé de cet article

Comment lire cette carte ? Guide illustré

Les articles les plus proches Les travaux antérieurs sur lesquels il s’appuie Les articles qui le citent

Les articles autour de celui-ci

Classés selon la proximité de leur titre et de leur résumé avec ceux de cet article. Sélectionnez-en pour les lire ensemble.

Les articles les plus proches

  1. Très proche Cite cet article
    Multi-Segment Attention: Enabling Efficient KV-Cache Management for Faster Large Language Model Serving
    Chunan Shi, Yi-Lei Chen, Yilin Chen et al. · 2026 · arXiv.org · preprint, non relu par les pairs · cité 3 fois · Pas encore résumé
    Résumé scientifique

    Large Language Model (LLM) inference relies on key-value (KV) caches to avoid redundant attention computation. While approximate KV cache retention techniques reduce memory usage by sacrificing model accuracy, lossless approaches instead evict KV cache blocks from GPU memory and reconstruct them on demand to preserve exact outputs. Existing lossless KV cache management systems primarily base eviction decisions on access frequency or positional heuristics, without considering how different KV cache blocks affect the execution efficiency of GPU attention kernels. In this paper, we propose AsymCache, a computation-latency-aware KV cache management system for LLM inference that explicitly aligns…

  2. Très proche
    CompactAttention: Accelerating Chunked Prefill with Block-Union KV Selection
    Jiwon Song, Dongwon Jo, Beomseok Kang et al. · 2026 · arXiv.org · preprint, non relu par les pairs · Pas encore résumé
    Résumé scientifique

    Chunked prefill has become a widely adopted serving strategy for long-context large language models, but efficient attention computation in this regime remains challenging. Existing sparse attention methods are primarily designed for one-shot prefill and do not translate efficiently to chunked prefill: block-sparse kernels lose efficiency when the query length is limited by the chunk size, while fine-grained pattern search becomes costly when repeated over the accumulated KV cache at every chunk. QUOKA, a recent method that directly targets chunked prefill, avoids sparse-kernel overhead but relies on query-subsampled, token-level KV selection, which can miss query-specific KV entries and int…

  3. Très proche Cite cet article
    Cost-Efficient Large Language Model Serving for Multi-turn Conversations with CachedAttention
    Bin Gao, Zhuo-Min He, Puru Sharma et al. · 2024 · USENIX Annual Technical Conference · cité 301 fois · Pas encore résumé
    Résumé scientifique

    Interacting with humans through multi-turn conversations is a fundamental feature of large language models (LLMs). However, existing LLM serving engines executing multi-turn conversations are inefficient due to the need to repeatedly compute the key-value (KV) caches of historical tokens, incurring high serving costs. To address the problem, this paper proposes CachedAttention, a new attention mechanism that enables reuse of KV caches across multi-turn conversations, significantly reducing the repetitive computation overheads. CachedAttention maintains a hierarchical KV caching system that leverages cost-effective memory/storage mediums to save KV caches for all requests. To reduce KV cache …

  4. Très proche
    Inference-Friendly Models With MixAttention
    Shashank Rajput, Ying Sheng, Sean Owen et al. · 2024 · ENLSP · cité 6 fois · Pas encore résumé
    Résumé scientifique

    The size of the key-value (KV) cache plays a critical role in determining both the maximum context length and the number of concurrent requests supported during inference in modern language models. The KV cache size grows proportionally with the number of attention heads and the tokens processed, leading to increased memory consumption and slower inference for long inputs. In this work, we explore the use of MixAttention, a model architecture modification closely related to a blog published by Character.AI. MixAttention combines sliding window attention, where only a small subset of recent tokens is stored in the KV cache, with KV cache sharing across layers. Our experiments demonstrate that…

  5. Très proche
    Dispenser: Hierarchical KV Cache Management for Efficient LLM Generative Inference
    Beiquan Cao, Kai-Gui Bian, Guo-Jie Luo et al. · 2025 · International Conference on Parallel and Distributed Systems · Pas encore résumé
    Résumé scientifique

    As context windows expands, Large Language Models (LLMs) are being more capable of handling long-context tasks. However, long-context inference is hindered by high latency and memory usage due to the linearly growing Key-Value (KV) cache. Prior work has shown that a dynamic subset of the KV cache dominates attention outcomes and selectively loads these subsets instead of the full cache. These methods partition the KV cache into segments (block-wise and token-wise) and identify critical ones for recall. However, for block-wise ones, their recall accuracy is often compromised by semantic inconsistencies among consecutive tokens, and for token-wise ones, they suffer from inefficiency in memory …

  6. Très proche Cite cet article
    AttnCache: Accelerating Self-Attention Inference for LLM Prefill via Attention Cache
    Dinghong Song, Yuan Feng, Yiwei Wang et al. · 2025 · arXiv.org · preprint, non relu par les pairs · cité 2 fois · Pas encore résumé
    Résumé scientifique

    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…

  7. Très proche
    SqueezeAttention: 2D Management of KV-Cache in LLM Inference via Layer-wise Optimal Budget
    Zi-Hao Wang, Bin Cui, Shaoduo Gan · 2024 · International Conference on Learning Representations · cité 25 fois · Pas encore résumé
    Résumé scientifique

    Optimizing the Key-Value (KV) cache of the Large Language Model (LLM) has been considered critical to saving the cost of inference. Most of the existing KV-cache compression algorithms attempted to sparsify the sequence of tokens by taking advantage of the different importance of tokens. However, most of these methods treat all layers equally, allocating the same KV budget to each layer. This approach is suboptimal, as some layers may be less sensitive to input tokens yet still receive the same budget as others. In this work, we found that by identifying the importance of attention layers, we could optimize the KV-cache jointly from two dimensions, i.e., sequence-wise and layer-wise. Based o…

  8. Proche
    Coverage-Driven KV Cache Eviction for Efficient and Improved Inference of LLM
    Shuvendu Roy, Meng-Yao Zhai, Hossein Hajimirsadeghi et al. · 2026 · arXiv.org · preprint, non relu par les pairs · cité 2 fois · Pas encore résumé
    Résumé scientifique

    Large language models (LLMs) excel at complex tasks like question answering and summarization, thanks to their ability to handle long-context inputs. However, deploying LLMs is costly, not only due to the high computational demands of quadratic complexity of self-attention and auto-regressive generation, but also because of the significant memory overhead required for storing the key-value (KV) cache during inference. To reduce the memory cost, existing KV-cache eviction strategies leverage the sparsity in attention to selectively store a subset of tokens. While reducing the memory footprint, such approaches show a considerable drop in performance, especially in tasks that require long-conte…

Les travaux antérieurs sur lesquels il s’appuie

  1. Proche Utilisé en profondeur par cet article Une méthode qu’il utilise
    FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
    Tri Dao · 2023 · Machine Learning · cité 3 584 fois · Pas encore résumé
    Résumé scientifique

    Scaling Transformers to longer sequence lengths has been a major problem in the last several years, promising to improve performance in language modeling and high-resolution image understanding, as well as to unlock new applications in code, audio, and video generation. The attention layer is the main bottleneck in scaling to longer sequences, as its runtime and memory increase quadratically in the sequence length. FlashAttention exploits the asymmetric GPU memory hierarchy to bring significant memory saving (linear instead of quadratic) and runtime speedup (2-4$\times$ compared to optimized baselines), with no approximation. However, FlashAttention is still not nearly as fast as optimized m…

  2. Proche Utilisé en profondeur par cet article Une méthode qu’il utilise
    FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
    Tri Dao, Daniel Y. Fu, Stefano Ermon et al. · 2022 · Machine Learning · cité 5 749 fois · Résumé IA disponible
    Résumé scientifique

    Transformers are slow and memory-hungry on long sequences, since the time and memory complexity of self-attention are quadratic in sequence length. Approximate attention methods have attempted to address this problem by trading off model quality to reduce the compute complexity, but often do not achieve wall-clock speedup. We argue that a missing principle is making attention algorithms IO-aware -- accounting for reads and writes between levels of GPU memory. We propose FlashAttention, an IO-aware exact attention algorithm that uses tiling to reduce the number of memory reads/writes between GPU high bandwidth memory (HBM) and GPU on-chip SRAM. We analyze the IO complexity of FlashAttention, …

  3. Apparenté
    S3: Increasing GPU Utilization during Generative Inference for Higher Throughput
    Yunho Jin, Chun-Feng Wu, D. Brooks et al. · 2023 · Neural Information Processing Systems · cité 154 fois · Pas encore résumé
    Résumé scientifique

    Generating texts with a large language model (LLM) consumes massive amounts of memory. Apart from the already-large model parameters, the key/value (KV) cache that holds information about previous tokens in a sequence can grow to be even larger than the model itself. This problem is exacerbated in one of the current LLM serving frameworks which reserves the maximum sequence length of memory for the KV cache to guarantee generating a complete sequence as they do not know the output sequence length. This restricts us to use a smaller batch size leading to lower GPU utilization and above all, lower throughput. We argue that designing a system with a priori knowledge of the output sequence can m…

  4. Apparenté Utilisé en profondeur par cet article
    DeepSpeed- Inference: Enabling Efficient Inference of Transformer Models at Unprecedented Scale
    Reza Yazdani Aminabadi, Samyam Rajbhandari, A. Awan et al. · 2022 · International Conference for High Performance Computing, Networking, Storage and Analysis · cité 739 fois · Pas encore résumé
    Résumé scientifique

    The landscape of transformer model inference is increasingly diverse in model size, model characteristics, latency and throughput requirements, hardware requirements, etc. With such diversity, designing a versatile inference system is challenging. DeepSpeed-Inference addresses these challenges by (1) a multi-GPU inference solution to minimize latency while maximizing throughput for both dense and sparse transformers when the model fits in aggregate GPU memory, and (2) a heterogeneous inference solution that leverages CPU/NVMe/GPU memory to enable high-throughput inference for models larger than aggregate GPU memory. DeepSpeed-Inference reduces latency by 6.4× and increases throughput by 1.5 …

  5. Apparenté
    Lost in the Middle: How Language Models Use Long Contexts
    Nelson F. Liu, Kevin Lin, John Hewitt et al. · 2023 · Transactions of the Association for Computational Linguistics · cité 5 796 fois · Résumé IA disponible
    Résumé scientifique

    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 the performance of language models on two tasks that require identifying relevant information in their input contexts: multi-document question answering and key-value retrieval. We find that performance can degrade significantly when changing the position of relevant information, indicating that current language models do not robustly make use of information in long input contexts. In particular, we observe that performance is often highest when relevant information occurs at the beginning or end of the input context, and significantly de…

Les articles qui le citent

  1. Proche Utilise cet article en profondeur
    HotPrefix: Hotness-Aware KV Cache Scheduling for Efficient Prefix Sharing in LLM Inference Systems
    Yuhang Li, Rong Gu, Cheng-Ying Huan et al. · 2025 · Proc. ACM Manag. Data · cité 25 fois · Pas encore résumé
    Résumé scientifique

    Prompt engineering techniques are widely used to enhance the generation quality of large language models (LLMs). However, the long prompts significantly increase inference latency and reduce inference throughput. Since many prompts share common prefixes, prefix sharing has been proposed to reuse shared prefix KV caches during inference. Nevertheless, the large number of prefix KV caches and the limited GPU memory capacity make it impractical to store all prefix KV caches in GPU memory. This limitation necessitates the use of external memory storage strategies, which often suffer from high I/O overhead and frequent cache misses with traditional approaches. To address these challenges, this pa…

  2. Proche Utilise cet article en profondeur
    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. · cité 182 fois · Pas encore résumé
    Résumé scientifique

    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…

  3. Proche Utilise cet article en profondeur
    Towards Efficient Large Language Model Serving: A Survey on System-Aware KV Cache Optimization
    Jiantong Jiang, Pei-Yu Yang, Rui Zhang et al. · 2026 · Annual Meeting of the Association for Computational Linguistics · cité 27 fois · Pas encore résumé
    Résumé scientifique

    Despite the rapid advancements of large language models (LLMs), LLM serving systems remain memory-intensive and costly. The key-value (KV) cache, which stores KV tensors during autoregressive decoding, is crucial for enabling low-latency, high-throughput LLM inference serving. In this survey, we focus on system-aware KV infrastructure for serving LLMs (abbreviated as sKis). We revisit recent work from a system behavior perspective, organizing existing efforts into three dimensions: execution and scheduling (temporal), placement and migration (spatial), and representation and retention (structural). Furthermore, we analyze cross-behavior co-design affinity and behavior-objective links, highli…

  4. Proche
    Not All Heads Matter: A Head-Level KV Cache Compression Method with Integrated Retrieval and Reasoning
    Yu Fu, Ze-Fan Cai, Abedelkadir Asi et al. · 2024 · International Conference on Learning Representations · cité 122 fois · Pas encore résumé
    Résumé scientifique

    Key-Value (KV) caching is a common technique to enhance the computational efficiency of Large Language Models (LLMs), but its memory overhead grows rapidly with input length. Prior work has shown that not all tokens are equally important for text generation, proposing layer-level KV cache compression to selectively retain key information. Recognizing the distinct roles of attention heads in generation, we propose HeadKV, a head-level KV cache compression method, and HeadKV-R2, which leverages a novel contextual reasoning ability estimation for compression. Our approach operates at the level of individual heads, estimating their importance for contextual QA tasks that require both retrieval a…

  5. Proche Utilise cet article en profondeur
    DeFT: Decoding with Flash Tree-attention for Efficient Tree-structured LLM Inference
    Jinwei Yao, Kaiqi Chen, Kexun Zhang et al. · 2024 · International Conference on Learning Representations · cité 23 fois · Pas encore résumé
    Résumé scientifique

    Large language models (LLMs) are increasingly employed for complex tasks that process multiple generation calls in a tree structure with shared prefixes of tokens, including few-shot prompting, multi-step reasoning, speculative decoding, etc. However, existing inference systems for tree-based applications are inefficient due to improper partitioning of queries and KV cache during attention calculation. This leads to two main issues: (1) a lack of memory access (IO) reuse for KV cache of shared prefixes, and (2) poor load balancing.As a result, there is redundant KV cache IO between GPU global memory and shared memory, along with low GPU utilization. To address these challenges, we propose De…

Comment ces articles sont-ils trouvés ?

Nous comparons le titre et le résumé de cet article avec ceux de tous les articles résumés sur ce site, et avec les articles que Semantic Scholar recommande, ceux qu’il cite et ceux qui le citent (pour un article très cité, ses citations les plus récentes et, depuis OpenAlex, les plus citées). Parmi les travaux antérieurs et les suites, les articles qui s’utilisent en profondeur, une méthode qu’il utilise et les suites très citées remontent un peu. Les niveaux (très proche, proche, apparenté) viennent de la similarité des textes, pas d’un jugement de qualité ; * signale un article sans résumé, comparé par son titre. La phrase sous un article est écrite par une IA à partir des deux résumés : vérifiez-la dans les articles. Un article jugé hors sujet par trois lecteurs quitte la liste.

Mis à jour le 2 novembre 2026.

Le guide illustré des articles autour d’un article