Skip to main content
QUICK REVIEW

[论文解读] FlashPrefill: Instantaneous Pattern Discovery and Thresholding for Ultra-Fast Long-Context Prefilling

Qihang Fan, Huaibo Huang|arXiv (Cornell University)|Mar 6, 2026
Topic ModelingComputer Science被引用 0
一句话总结

FlashPrefill 引入即时模式发现与基于最大值的动态阈值化,以在大型语言模型的长上下文预填充中实现加速,在 256k 序列上获得高达 27.78x 的加速,且精度损失极小。

ABSTRACT

Long-context modeling is a pivotal capability for Large Language Models, yet the quadratic complexity of attention remains a critical bottleneck, particularly during the compute-intensive prefilling phase. While various sparse attention mechanisms have been explored, they typically suffer from either significant search latency or insufficient sparsity. In this paper, we propose FlashPrefill, a framework enabling ultra-fast prefilling via instantaneous pattern discovery and thresholding. FlashPrefill leverages a fast block-searching technique to simultaneously locate dynamic vertical, slash, and block-sparse attention patterns. Crucially, it introduces a dynamic thresholding mechanism that bypasses the prohibitive overhead of sorting or accumulating attention scores while effectively eliminating the long-tail distribution to enhance sparsity. Extensive evaluations demonstrate that FlashPrefill achieves a substantial leap in efficiency, delivering an unprecedented 27.78x speedup on 256K sequences. Notably, unlike existing methods that incur efficiency degradation on shorter contexts, FlashPrefill maintains a 1.71x speedup even at a 4K context length, demonstrating its robustness and practical utility across varying sequence scales.

研究动机与目标

  • Motivate reducing quadratic attention cost in long-context prefilling for LLMs and VLMs.
  • Develop an ultra-fast pattern discovery mechanism for vertical, slash, and block sparsity patterns.
  • Introduce a block-approximation kernel to minimize memory traffic during discovery.
  • Propose a Max-based Dynamic Thresholding to avoid sorting/cumulative operations while handling long-tail score distributions.
  • Demonstrate efficiency gains and robustness across multiple models and long-context benchmarks.

提出的方法

  • Define three sparsity patterns (vertical, slash, block) and use a qualitative analysis with uniform probes to identify salient attention blocks.
  • Introduce a block-level proxy via mean-pooled block keys and compute block-level scores to guide pattern discovery.
  • Implement a Fused 2D-Reduction kernel for block-wise attention score approximation to reduce memory traffic.
  • Develop Max-based Dynamic Thresholding that uses a single-pass max-reduction to determine per-block thresholds and prune low-scoring blocks.
  • Provide a global normalization step to align block scores across the sequence, preserving comparability.
  • Optimize an optimized Block Sparse Attention kernel with an index-driven physical jumping mechanism to enhance throughput.

实验结果

研究问题

  • RQ1Can instantaneous pattern discovery accurately identify vertical, slash, and block-sparse patterns in long-context attention maps?
  • RQ2Does block-approximation reduce kernel memory traffic without sacrificing accuracy?
  • RQ3How does max-based dynamic thresholding compare to Top-k/Top-p in sparsifying attention for long sequences?
  • RQ4What are the end-to-end speedups in TTFT and prefill when integrating FlashPrefill into existing inference frameworks?
  • RQ5Is FlashPrefill robust across LLMs and VLMs with context lengths ranging from thousands to hundreds of thousands of tokens?

主要发现

  • FlashPrefill achieves up to 27.78x speedup on 256K sequences for long-context prefill.
  • It maintains 1.71x speedup at 4K context and achieves end-to-end TTFT gains up to 7.22x in vLLM integrations.
  • The Max-based Dynamic Thresholding reduces reliance on sorting or accumulating and mitigates long-tail effects, yielding higher sparsity.
  • Block-approximation kernel reduces memory traffic from O(L^2/B) to O((L/B)^2) while preserving accuracy.
  • Across multiple models (LLMs and VLMs) and benchmarks (RULER, InfiniteBench, VideoMME), FlashPrefill consistently outperforms baselines in both speed and sparsity.
  • Ablations show block approximation and dynamic thresholding as key contributors to efficiency and accuracy.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。