HLSTransform:通过高层次综合在FPGA上实现高能效Llama 2推理
HLSTransform: Energy-Efficient Llama 2 Inference on FPGAs Via High Level Synthesis
AI总结:
本文提出HLSTransform方法,利用高层次综合在FPGA上加速Llama 2推理,相比CPU和GPU显著降低每token能耗并提升推理速度,同时开源代码以推动FPGA在Transformer推理中的普及。
摘要:
图形处理单元(GPU)已成为深度学习应用的主要硬件加速器,并广泛用于Transformer的训练和推理;Transformer在机器学习的许多领域已取得最先进的性能,尤其被用于大多数现代大语言模型(LLMs)。然而,GPU需要大量能源,这带来了环境问题,要求高昂的运营成本,并导致GPU不适合边缘计算。我们使用高层次综合(HLS)在现场可编程门阵列(FPGA)上为Transformer(即Llama 2,一种开源的最先进LLM)开发了一个加速器。HLS使我们能够快速原型化FPGA设计,而无需在寄存器传输级(RTL)编写代码。我们将方法命名为HLSTransform,与Intel Xeon Broadwell E5-2686 v4 CPU和NVIDIA RTX 3090 GPU相比,我们用HLS综合得到的FPGA设计在Xilinx Virtex UltraScale+ VU9P FPGA上每个token消耗的能量分别实现了最高12.75倍和8.25倍的降低,同时与CPU相比推理速度最高提升2.46倍,并在GPU基础时钟频率高出4倍的情况下仍保持RTX 3090 GPU速度的0.53倍。由于缺乏现有的开源Transformer FPGA加速器,我们开源了代码并记录了综合步骤。我们希望这项工作能够成为在Transformer推理中普及FPGA使用的一步,并激发对高能效推理方法的整体研究。代码可在https://github.com/HLSTransform/submission找到。
英文摘要:
Graphics Processing Units (GPUs) have become the leading hardware accelerator for deep learning applications and are used widely in training and inference of transformers; transformers have achieved state-of-the-art performance in many areas of machine learning and are especially used in most modern Large Language Models (LLMs). However, GPUs require large amounts of energy, which poses environmental concerns, demands high operational costs, and causes GPUs to be unsuitable for edge computing. We develop an accelerator for transformers, namely, Llama 2, an open-source state-of-the-art LLM, using high level synthesis (HLS) on Field Programmable Gate Arrays (FPGAs). HLS allows us to rapidly prototype FPGA designs without writing code at the register-transfer level (RTL). We name our method HLSTransform, and the FPGA designs we synthesize with HLS achieve up to a 12.75x reduction and 8.25x reduction in energy used per token on the Xilinx Virtex UltraScale+ VU9P FPGA compared to an Intel Xeon Broadwell E5-2686 v4 CPU and NVIDIA RTX 3090 GPU respectively, while increasing inference speeds by up to 2.46x compared to CPU and maintaining 0.53x the speed of an RTX 3090 GPU despite the GPU's 4 times higher base clock rate. With the lack of existing open-source FPGA accelerators for transformers, we open-source our code and document our steps for synthesis. We hope this work will serve as a step in democratizing the use of FPGAs in transformer inference and inspire research into energy-efficient inference methods as a whole. The code can be found on https://github.com/HLSTransform/submission.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。