arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.20515cs.AR
收藏

FAST-Prefill:FPGA加速的长上下文LLM预填充稀疏注意力

FAST-Prefill: FPGA Accelerated Sparse Attention for Long Context LLM Prefill

Ming Hsieh Department of Electrical

Rakshith Jayanth, Viktor Prasanna

AI总结:

FAST-Prefill是首个基于FPGA的长上下文LLM预填充加速器,通过动态稀疏注意力技术提升计算效率和能效。

摘要:

在长上下文大语言模型(LLM)推理中,预填充阶段由于对完整输入上下文的自注意力计算而占据主导地位。稀疏注意力通过限制每个token的交互仅限于一部分token来显著减少自注意力计算。注意力稀疏模式在输入提示中会变化,且在同一个提示中,每个注意力头可以遵循不同的模式。这使得注意力稀疏性动态变化。生成稀疏模式的需求,加上注意力中有限的数据重用,使预填充计算变得内存受限。此外,长上下文推理在GPU上的巨大能耗需求,促使FPGA成为加速动态长上下文推理的良好候选。为解决这些挑战,我们提出了FAST-Prefill,这是首个针对长上下文预填充阶段推理的FPGA加速器,支持动态稀疏注意力。为高效生成稀疏索引,我们提出了一种具有内存感知执行顺序的融合流水单元,以减少大张量和不规则内存访问。为减少访问KV缓存的离芯片内存流量,我们利用内存层次结构设计了一种驱动活跃性的双层缓存。对于高吞吐量的矩阵乘法,我们设计了一种混合矩阵处理单元(MPU),结合DSP和使用LUT的位平面分解。我们将在Alveo U280上实现FAST-Prefill,并在Llama和Qwen模型(批大小=1)上评估,上下文长度从4K到128K token。我们展示了在Nvidia A5000 GPU上的平均加速速度最高达2.5倍的TTFT,以及在能量效率方面有4.5倍的改进。

英文摘要:

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 \textit{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 \textit{liveness-driven, dual-tier cache}. For high-throughput matrix multiplication, we design a \textit{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$\times$ in TTFT and 4.5$\times$ improvement in energy efficiency over GPU implementation on Nvidia A5000 GPU.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑