Skip to main content
QUICK REVIEW

[Paper 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 Science0 citations
TL;DR

FlashPrefill introduces instantaneous pattern discovery and max-based dynamic thresholding to accelerate long-context prefill in LLMs, achieving up to 27.78x speedups on 256k sequences with minimal accuracy loss.

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.

Motivation & Objective

  • 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.

Proposed method

  • 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.

Experimental results

Research questions

  • 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?

Key findings

  • 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.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.