用查表代替计算,让FPGA加速大模型推理更高效
LUT-LLM: Efficient Large Language Model Inference with Memory-based Computations on FPGAs
- 将大模型推理转为基于查表的内存计算,利用FPGA内存优势
- 相比GPU减少4倍运算量,生成速度提升1.1到3.29倍
- 适合需要低延迟、高能效的大模型部署场景
大型语言模型(LLM)的快速发展极大提升了日常应用能力。尽管基于FPGA的加速器凭借灵活的数据控制,在速度和能效上曾优于GPU,但近年来针对GPU的优化已缩小这一差距。当仅依赖算术计算时,由于计算资源较少,FPGA常落后于GPU。为此,本文利用FPGA在计算单元间嵌入大量分布式片上内存的特性,提出将LLM推理从算术计算转向基于查表的内存计算,以提升效率。现有方法因算法与架构限制,难以扩展和部署10亿级模型。本文提出LUT-LLM,首个基于内存计算实现10亿级以上模型部署的FPGA加速器,采用向量量化技术。构建性能模型,评估多种量化方案,发现激活值与权重联合量化效果最佳。LUT-LLM设计包含:(1) 带带宽感知的并行中心点搜索以降低解码延迟;(2) 高效二维查表机制;(3) 空间-时间混合架构以减少数据缓存,提高查表吞吐。开发训练方案,使现有模型支持查表且精度保持高位。在AMD V80 FPGA上原型化Qwen 3 1.7B模型,相较GPU减少4倍算术操作,生成速度提升1.10~3.29倍,能效提高3.05~6.60倍。
原文摘要 · Abstract (English)
The rapid development of large language models (LLM) has greatly enhanced everyday applications. While many FPGA-based accelerators, with flexibility for fine-grained data control, exhibit superior speed and energy efficiency compared to GPUs, recent GPU-specific optimizations have diminished this advantage. When limited to arithmetic-based computation, FPGAs often underperform GPUs due to their comparatively fewer computational resources. To address this challenge, we exploit a key advantage of FPGAs over GPUs: abundant distributed on-chip memory embedded among computational units. We believe that shifting LLM inference from arithmetic-based to memory-based computations through table lookups can improve the efficiency on FPGAs to compete with GPUs. However, existing methods are inefficient or unable to scale and deploy language models due to algorithm and architecture design limitations. This paper introduces \textbf{LUT-LLM}, the first FPGA accelerator that deploy 1B+ language model with memory-based computation, leveraging vector quantization. We construct a performance model, evaluate multiple quantization schemes, and identify activation-weight vector co-quantization as the most effective approach. To support this scheme, LUT-LLM features (1) bandwidth-aware parallel centroid search to reduce decoding latency, (2) efficient 2D table lookups, and (3) a spatial-temporal hybrid design to reduce data caching for a higher throughput table lookup. We develop a training recipe that converts existing models to support table lookups with high accuracy and prototype LUT-LLM for Qwen 3 1.7B model on the AMD V80 FPGA, reducing arithmetic operations by $4\times$ and achieving a $1.10\sim3.29\times$ faster generation speed and a $3.05\sim 6.60\times$ higher energy efficiency than GPUs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。