Block-Attention for Efficient Prefilling
Dongyang Ma, Yan Wang, Tian Lan
摘要
We introduce Block-attention, an attention mechanism designed to address the increased inference latency and cost in Retrieval-Augmented Generation (RAG) scenarios. Traditional approaches often encode the entire context in an autoregressive manner. Instead, Block-attention divides retrieved documents into discrete blocks, with each block independently calculating key-value (KV) states except for the final block. In RAG scenarios, by defining each passage as a block, Block-attention enables us to reuse the KV states of passages that have been seen before, thereby significantly reducing the latency and the computation overhead during inference. The implementation of Block-attention involves block segmentation, position re-encoding, and fine-tuning the LLM to adapt to the Block-attention mechanism. Experiments on 11 diverse benchmarks, including RAG, ICL, and general domains, demonstrate that after block fine-tuning, the Block-attention model not only achieves performance comparable to that of fullattention models, but can also seamlessly switch between the block and full attention modes without any performance loss. Notably, Block-attention significantly reduces the time to first token (TTFT) and floating point operations (FLOPs) to a very low level. It only takes 45 ms to output the first token for an input sequence with a total length of 32K. Compared to the full-attention models, the TTFT and corresponding FLOPs are reduced by 98.7% and 99.8%, respectively. Additionally, in Appendix A, we elaborate on how Block-attention is applied in Game AI scenario and the substantial potential benefits it entails. We strongly suggest researchers in the gaming field not to overlook this section. 1 1 Codes, datasets and model weights have been publicly available at https://github.com/ TemporaryLoRA/Block-attention .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- VMoBA: Mixture-of-Block Attention for Video Diffusion Models 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- C2KV: Compressed and Composable KV Cache Reuse for Efficient LLM Inference 引用了 TurboRAG: Accelerating Retrieval-Augmented Generation with Precomputed KV Caches for Chunked Text
- C2KV: Compressed and Composable KV Cache Reuse for Efficient LLM Inference 引用了 SGLang: Efficient Execution of Structured Language Model Programs
- Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- Graph-KV: Breaking Sequence via Injecting Structural Biases into Large Language Models 引用了 SGLang: Efficient Execution of Structured Language Model Programs
- SGLang: Efficient Execution of Structured Language Model Programs 引用了 Measuring Massive Multitask Language Understanding
- SGLang: Efficient Execution of Structured Language Model Programs 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- From Prefix Cache to Fusion RAG Cache: Accelerating LLM Inference in Retrieval-Augmented Generation 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
- From Prefix Cache to Fusion RAG Cache: Accelerating LLM Inference in Retrieval-Augmented Generation 引用了 TurboRAG: Accelerating Retrieval-Augmented Generation with Precomputed KV Caches for Chunked Text
引用它的顶会 Paper9
- VMoBA: Mixture-of-Block Attention for Video Diffusion ModelsJianzong Wu, Liang Hou, Haotian Yang, Ye Tian 等ICLR 2026 · 36 次引用
- Graph-KV: Breaking Sequence via Injecting Structural Biases into Large Language ModelsHaoyu Wang, Peihao Wang, Mufei Li, Shikun Liu 等NeurIPS 2025 · 6 次引用
- From Prefix Cache to Fusion RAG Cache: Accelerating LLM Inference in Retrieval-Augmented GenerationJiahao Wang, Weiyu Xie, Mingxing Zhang, Boxin Zhang 等SIGMOD 2026 · 4 次引用
- C2KV: Compressed and Composable KV Cache Reuse for Efficient LLM InferenceChuheng Du, Junyi Chen, Hanlin Tang, Kan Liu 等KDD 2026 · 3 次引用
- TurboRAG: Accelerating Retrieval-Augmented Generation with Precomputed KV Caches for Chunked TextSongshuo Lu, Hua Wang, Yutian Rong, Zhi Chen 等EMNLP 2025 · 2 次引用
它引用的 Paper21
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou 等ICLR 2021 · 7,905 次引用
- Toolformer: Language Models Can Teach Themselves to Use ToolsTimo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu 等NeurIPS 2023 · 5,989 次引用
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
- Self-RAG: Learning to Retrieve, Generate, and Critique through Self-ReflectionAkari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil 等ICLR 2024 · 1,798 次引用
- SGLang: Efficient Execution of Structured Language Model ProgramsLianmin Zheng, Liangsheng Yin, Zhiqiang Xie, Chuyue Sun 等NeurIPS 2024 · 1,586 次引用
相关 Paper
- LazyAttention: Efficient Retrieval-Augmented Generation with Deferred Positional EncodingHaocheng Xia, Mihir Pamnani, Hanxi Fang, Supawit Chockchowwat 等ICML 2026
- Accelerating Inference of Retrieval-Augmented Generation via Sparse Context SelectionYun Zhu, Jia-Chen Gu, Caitlin Sikora, Ho Ko 等ICLR 2025
- Sparse Attention Across Multiple-Context KV CacheZiyi Cao, Qingyi Si, Jingbin Zhang, Bingquan LiuAAAI 2026 · 3 次引用
- ProphetKV: User-Query-Driven Selective Recomputation for Efficient KV Cache Reuse in Retrieval-Augmented GenerationShihao Wang, Jiahao Chen, Yanqi Pan, Hao Huang 等ICML 2026 · 4 次引用
- DepCache: A KV Cache Management Framework for GraphRAG with Dependency AttentionHao Yuan, Xin Ai, Qiange Wang, Peizheng Li 等SIGMOD 2026 · 2 次引用
