通过稀疏量化与FPGA协同设计,显著降低大模型推理内存与延迟。
FPGA Co-Design for Efficient N:M Sparse and Quantized Model Inference
- 融合N:M结构化稀疏与4比特量化,统一压缩模型存储
- 在4096×4096矩阵上实现4倍权重存储减少与1.71倍计算加速
- FPGA加速器支持灵活稀疏模式,适合资源受限部署
大语言模型在众多语言任务中表现卓越,但其巨大的计算与内存需求严重制约了在资源受限环境中的部署。为此,本文提出一种自动化框架,结合权值剪枝与低比特量化,并设计软硬件协同方法,在现场可编程门阵列(FPGA)平台上生成加速器。具体地,构建统一流水线,对模型应用N:M结构化剪枝与4比特整数量化以降低内存占用,随后优化解量化与矩阵乘法操作,提升在CPU、NVIDIA GPU(含密集及2:4稀疏张量核)和定制的行波阵列型FPGA加速器上的推理效率。在4096×4096矩阵上,结合2:4稀疏性与量化,权重存储减少最高达4倍,矩阵乘法速度提升1.71倍,相比密集GPU基线,端到端延迟降低1.29倍。对LLaMA-7B模型的扩展分析显示,结构化稀疏使每令牌吞吐率提升1.36倍。结果表明,细粒度N:M稀疏与量化协同能有效支持高效可部署的大模型推理,所提FPGA加速器亦为超越固定2:4硬件限制的更广泛稀疏模式提供灵活架构路径。
原文摘要 · Abstract (English)
Large language models (LLMs) have demonstrated remarkable performance across a wide range of language processing tasks. However, this success comes at the cost of substantial computation and memory requirements, which significantly impedes their deployment in resource-constrained environments. To address this challenge, this work introduces an automation framework that leverages weight pruning and low-bit quantization, and presents a hardware-software co-design method that generates accelerators on the Field-Programmable Gate Array (FPGA) platform. In particular, we implement a unified pipeline that applies N:M structured pruning and 4-bit integer quantization to reduce the memory footprint, followed by optimized dequantization and matrix multiplication to enhance LLM inference on several hardware platforms, including CPUs, NVIDIA GPUs with Dense and 2:4 Sparse Tensor Cores, and a custom systolic-array-based FPGA accelerator. Utilizing 2:4 sparsity combined with quantization on $4096 \times 4096$ matrices, our approach achieves a reduction of up to $4\times$ in weight storage and a $1.71\times$ speedup in matrix multiplication, yielding a $1.29\times$ end-to-end latency reduction compared to dense GPU baselines. Scaling analysis on the LLaMA-7B model further shows that structured sparsity enhances the throughput per token by $1.36\times$. These results demonstrate the synergy of fine-grained N:M sparsity and quantization for enabling efficient and deployable LLM inference, while the proposed FPGA accelerator offers a flexible architectural path for supporting a broader class of sparsity patterns beyond the fixed 2:4 hardware constraints.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。