Lune

NeurIPS2024顶会

Reducing Transformer Key-Value Cache Size with Cross-Layer Attention

William Brandon, Mayank Mishra, Aniruddha Nrusimha, Rameswar Panda, Jonathan Ragan-Kelley

摘要

Key-value (KV) caching plays an essential role in accelerating decoding for transformer-based autoregressive large language models (LLMs). However, the amount of memory required to store the KV cache can become prohibitive at long sequence lengths and large batch sizes. Since the invention of the transformer, two of the most effective interventions discovered for reducing the size of the KV cache have been Multi-Query Attention (MQA) and its generalization, Grouped-Query Attention (GQA). MQA and GQA both modify the design of the attention block so that multiple query heads can share a single key/value head, reducing the number of distinct key/value heads by a large factor while only minimally degrading accuracy. In this paper, we show that it is possible to take Multi-Query Attention a step further by also sharing key and value heads between adjacent layers, yielding a new attention design we call Cross-Layer Attention (CLA). With CLA, we find that it is possible to reduce the size of the KV cache by another 2x while maintaining nearly the same accuracy as unmodified MQA. In experiments training 1B- and 3B-parameter models from scratch, we demonstrate that CLA provides a Pareto improvement over the memory/accuracy tradeoffs which are possible with traditional MQA, enabling inference with longer sequence lengths and larger batch sizes than would otherwise be possible

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 47 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inference 引用了 H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inference 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation 引用了 H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
  • Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation 引用了 Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper47

  1. Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth ApproachJonas Geiping, Sean McLeish, Neel Jain, John Kirchenbauer 等NeurIPS 2025 · 431 次引用
  2. Mooncake: Trading More Storage for Less Computation - A KVCache-centric Architecture for Serving LLM ChatbotRuoyu Qin, Zheming Li, Weiran He, Jialei Cui 等FAST 2025 · 337 次引用
  3. Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level ComputationSangmin Bae, Yujin Kim, Reza Bayat, Sungnyun Kim 等NeurIPS 2025 · 143 次引用
  4. ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM InferenceXiang Liu, Zhenheng Tang, Peijie Dong, Zeyu Li 等NeurIPS 2025 · 71 次引用
  5. Cache-to-Cache: Direct Semantic Communication Between Large Language ModelsTianyu Fu, Zihan Min, Hanling Zhang, Jichao Yan 等ICLR 2026 · 59 次引用

它引用的 Paper16

  1. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
  2. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
  3. FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 次引用
  4. Improving Language Models by Retrieving from Trillions of TokensSebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai 等ICML 2022 · 1,629 次引用
  5. H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen 等NeurIPS 2023 · 1,003 次引用

相关 Paper

  1. Align Attention Heads Before Merging Them: An Effective Way for Converting MHA to GQAQingyun Jin, Xiaohui Song, Feng Zhou, Zengchang QinEMNLP Findings 2025 · 1 次引用
  2. DHA: Learning Decoupled-Head Attention from Transformer Checkpoints via Adaptive Heads FusionYilong Chen, Linhao Zhang, Junyuan Shang, Zhenyu Zhang 等NeurIPS 2024 · 12 次引用
  3. Reconstructing KV Caches with Cross-Layer Fusion for Enhanced TransformersHongzhan Lin, Zhiqi Bai, Xinmiao Zhang, Siran Yang 等ICLR 2026 · 5 次引用
  4. Cost-Optimal Grouped-Query Attention for Long-Context ModelingYingfa Chen, Yutong Wu, Chenyang Song, Zhen Leng Thai 等EMNLP 2025
  5. Latent-Condensed Transformer for Efficient Long Context ModelingZeng You, Yaofo Chen, Qiuwu Chen, Ying Sun 等ACL 2026
黄昏的海面,两侧是细线勾勒的悬崖