[论文解读] FAST-Prefill: FPGA Accelerated Sparse Attention for Long Context LLM Prefill
FAST-Prefill 是用于长上下文LLM预填的动态稀疏注意力的FPGA加速器,提供流式稀疏索引生成、以活性为驱动的双层KV缓存以及混合矩阵处理单元,在TTFT上相较于GPU基线实现高达2.5x提升,能效提升高达4.5x。
In long-context large language model (LLM) inference, the prefill stage dominates computation due to self-attention over the complete input context. Sparse attention significantly reduces self-attention computation by limiting each token's interactions to a subset of tokens. The attention sparsity pattern varies across input prompts, and within a prompt, each attention head can follow a distinct pattern. This makes attention sparsity dynamic. The requirement of generating the sparsity pattern, combined with limited data reuse in attention, shifts the prefill compute to being memory-bound. This, in addition to the huge energy requirements for long-context inference on GPU, motivates FPGAs as good candidates for accelerating dynamic long-context inference. To tackle these challenges, we propose FAST-Prefill, the first FPGA accelerator for long-context prefill-stage inference with dynamic sparse attention. To efficiently generate sparse indices, we propose a extit{fused pipeline unit with a memory-aware execution order} to reduce large tensors and irregular memory accesses. To reduce off-chip memory traffic for accessing the KV cache, we utilize the memory hierarchy to design a extit{liveness-driven, dual-tier cache}. For high-throughput matrix multiplication, we design a extit{hybrid Matrix Processing Unit (MPU)} with DSPs and bit-plane decomposition using LUTs. We implement FAST-Prefill on Alveo U280 and evaluate it on the Llama and Qwen models (batch size = 1) for context lengths ranging from 4K to 128K tokens. We demonstrate an average speedup of up to 2.5$ imes$ in TTFT and 4.5$ imes$ improvement in energy efficiency over GPU implementation on Nvidia A5000 GPU.
研究动机与目标
- 驱动高效的长上下文LLM预填,其中自注意力是主要成本。
- 解决FPGA上动态稀疏模式和内存受限的预填工作负载的挑战。
- 提出架构创新,用于生成稀疏索引、管理KV缓存以及加速矩阵乘法。
- 在真实模型的FPGA硬件上展示可行性及性能/能耗收益。
提出的方法
- 提出 FAST-Prefill,首个用于长上下文LLMs 动态稀疏预填的FPGA加速器,采用 W8A8 精度。
- 实现一个流式、内存感知的稀疏索引生成单元(SIGU),通过增量聚合消除大型中间张量。
- 设计一个活性驱动的双层KV缓存(Hot/Cold),以减少片外内存带宽并提升KV重用。
- 开发一个混合矩阵处理单元(MPU),将基于DSP的算术与位平面(基于LUT)的INT-8矩阵乘法结合。
- 以128-token 块处理输入,并采用障碍填充的流水线,在流式穿过各层时保持稀疏索引生成的正确性。
- 在Xilinx Alveo U280 上对比 Nvidia A5000,使用Llama和Qwen模型,覆盖4K–128K上下文长度,报告TTFT和能效。

实验结果
研究问题
- RQ1动态稀疏注意力是否可以在FPGA上高效加速用于长上下文预填且采用W8A8精度?
- RQ2如何将稀疏索引生成与累积融合,以避免在FPGA上产生巨大中间量?
- RQ3哪种缓存设计和内存层次结构最能维持高KV重用以应对动态稀疏模式?
- RQ4将基于位平面的混合MPU与DSP型矩阵乘法结合是否能提高INT-8计算的吞吐?
主要发现
- FAST-Prefill 相较于GPU端的动态稀疏预填实现,TTFT提升幅度为1.2–2.5x。
- FAST-Prefill 相对于GPU基线的能效提升高达4.5x。
- 以活性驱动的双层KV缓存实现约65%的命中率,降低片上外访问并使TTFT相对于无缓存设计提升约2.5x。
- 混合MPU相比仅DSP的MPU带来约1.8x的等待时间降低,并防止LUT空转。
- 流式稀疏索引生成与累积融合,避免生成大型中间量(约4KB对比约4GB),实现带宽友好运行。
- 与Flex-Prefill基线相比,当量化到INT-8时,W8A8-FAST-Prefill在RULER基准上保持相当的精度。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。