FlashPrefill: ultra-fast long-context prefilling的即时模式发现与阈值处理
FlashPrefill: Instantaneous Pattern Discovery and Thresholding for Ultra-Fast Long-Context Prefilling
AI总结:
FlashPrefill通过即时模式发现和动态阈值机制,实现超快长上下文prefilling,显著提升效率并保持在不同序列规模下的鲁棒性。
摘要:
长上下文建模是大型语言模型的关键能力,但注意力的二次复杂性仍然是关键瓶颈,尤其是在计算密集的prefilling阶段。尽管已经探索了各种稀疏注意力机制,但它们通常面临显著的搜索延迟或稀疏性不足的问题。在本文中,我们提出了FlashPrefill,一个通过即时模式发现和阈值处理实现超快prefilling的框架。FlashPrefill利用一种快速块搜索技术,同时定位动态垂直、斜线和块稀疏的注意力模式。关键在于它引入了动态阈值机制,通过避免排序或累积注意力分数的高昂开销,同时有效消除长尾分布以提高稀疏性。广泛的评估表明,FlashPrefill在效率上实现了显著的飞跃,在256K序列上实现了前所未有的27.78倍加速。值得注意的是,与现有方法在较短上下文上效率下降不同,FlashPrefill在4K上下文长度时仍能保持1.71倍的加速,展示了其在不同序列规模上的鲁棒性和实用性。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。