arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.13379cs.AReess.SP
收藏

深度神经网络中近似Softmax函数的定量评估

A Quantitative Evaluation of Approximate Softmax Functions for Deep Neural Networks

Instituto Tecnológico de Costa Rica(哥斯达黎加理工学院);Università degli Studi di Trieste(的里雅斯特大学);Universidade Federal de Santa Catarina(圣卡塔琳娜联邦大学)

Anthony Leiva-Valverde, Fabricio Elizondo-Fernández, Luis G. León-Vega, Cristina Meinhardt, Jorge Castro-Godínez

AI总结:

本文评估了利用泰勒级数和插值方法加速Softmax计算的近似技术,发现二次插值在精度上最佳,而泰勒方法在速度和资源效率上更优,实验证明在资源受限FPGA上具有应用潜力。

摘要:

Softmax函数是神经网络输出层中常用的激活函数,负责将原始分数转换为类别概率并引入非线性。在低端FPGA上高效实现Softmax面临挑战,因为硬件资源有限且指数和除法运算复杂。本文评估了使用泰勒级数和插值方法(利用查找表LUTs)的近似计算技术以加速Softmax。这些近似方法旨在减少执行时间和资源消耗,同时保持可接受的数值精度。研究发现,二次插值结合LUTs产生最低的数值误差。相比之下,基于泰勒的近似方法在执行时间和资源效率方面表现更优,因为其计算更简单。当应用于实际深度学习模型如LeNet-5和MobileNet v2时,一阶和二阶泰勒近似在准确性和资源节省之间提供了显著的权衡,相比精确实现,准确度降级达0.2%,资源消耗减少14%。这些结果突显了在资源受限FPGA上近似Softmax设计的有效性,并为将其集成到更大模型(包括大语言模型LLMs)奠定了基础。

英文摘要:

The softmax function is a widely used activation function in the output layers of neural networks, responsible for converting raw scores into class probabilities while introducing essential non-linearity. Implementing Softmax efficiently poses challenges on low-end FPGAs due to limited hardware resources and the computational complexity of exponential and division operations. This work evaluates approximate computing techniques for softmax acceleration using Taylor series and interpolation methods using Look-Up Tables (LUTs). These approximations aim to reduce execution time and resource consumption while maintaining acceptable levels of numerical precision. Our findings show that quadratic interpolation with LUTs yields the lowest numerical error. In contrast, Taylor-based approximations offer significantly better performance in terms of execution time and resource efficiency due to their computational simplicity. When applied to real-world deep learning models such as LeNet-5 and MobileNet v2, the first- and second-order Taylor approximations provided substantial trade-offs between accuracy and resource savings, achieving up to 0.2% accuracy degradation and 14% resource reduction compared to exact implementations. These results highlight the effectiveness of approximate Softmax designs on resource-constrained FPGAs and lay the groundwork for their integration into larger models, including large language models (LLMs).

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

↑