ConSmax:具有可学习参数的硬件友好型替代Softmax
ConSmax: Hardware-Friendly Alternative Softmax with Learnable Parameters
AI总结:
提出软硬件协同设计的ConSmax替代Softmax,利用可微归一化参数消除最大值搜索与求和,结合位宽分割LUT硬件设计,在保持模型准确率的同时显著降低功耗与面积开销。
摘要:
自注意力机制使基于transformer的大型语言模型(LLMs)区别于卷积和循环神经网络。尽管性能有所提升,但由于在自注意力中大量使用Softmax,在硅片上实现实时LLM推理仍然具有挑战性。除了非线性外,较低的算术强度极大地限制了处理并行性,特别是在处理较长上下文时。为了应对这一挑战,我们提出了Constant Softmax(ConSmax),这是一种软硬件协同设计,可作为Softmax的高效替代方案。ConSmax利用可微的归一化参数,消除了Softmax中寻找最大值和分母求和的需要。这种方法在仍然执行Softmax基本功能的同时实现了广泛的并行化。此外,采用位宽分割查找表(LUT)的可扩展ConSmax硬件设计可以实现无损的非线性操作,并支持混合精度计算。实验结果表明,在16nm FinFET工艺下,ConSmax在1250MHz工作频率时的功耗仅为0.2mW,面积为0.0008mm^2。为了开源贡献,我们进一步使用OpenROAD工具链在SkyWater的130nm CMOS工艺下实现了我们的设计。相应的功耗为2.69mW,面积为0.007mm^2。ConSmax在16nm工艺下实现了3.35倍的功耗节省和2.75倍的面积节省,在使用开源EDA工具链时实现了3.15倍的功耗节省和4.14倍的面积节省。同时,它在GPT-2模型和WikiText103数据集上也保持了相当的准确率。该项目可在https://github.com/ReaLLMASIC/ConSmax获取。
英文摘要:
The self-attention mechanism distinguishes transformer-based large language models (LLMs) apart from convolutional and recurrent neural networks. Despite the performance improvement, achieving real-time LLM inference on silicon remains challenging due to the extensive use of Softmax in self-attention. In addition to the non-linearity, the low arithmetic intensity significantly limits processing parallelism, especially when working with longer contexts. To address this challenge, we propose Constant Softmax (ConSmax), a software-hardware co-design that serves as an efficient alternative to Softmax. ConSmax utilizes differentiable normalization parameters to eliminate the need for maximum searching and denominator summation in Softmax. This approach enables extensive parallelization while still executing the essential functions of Softmax. Moreover, a scalable ConSmax hardware design with a bitwidth-split look-up table (LUT) can achieve lossless non-linear operations and support mixed-precision computing. Experimental results show that ConSmax achieves a minuscule power consumption of 0.2mW and an area of 0.0008mm^2 at 1250MHz working frequency in 16nm FinFET technology. For open-source contribution, we further implement our design with the OpenROAD toolchain under SkyWater's 130nm CMOS technology. The corresponding power is 2.69mW and the area is 0.007mm^2. ConSmax achieves 3.35x power savings and 2.75x area savings in 16nm technology, and 3.15x power savings and 4.14x area savings with the open-source EDA toolchain. In the meantime, it also maintains comparable accuracy on the GPT-2 model and the WikiText103 dataset. The project is available at https://github.com/ReaLLMASIC/ConSmax
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。