[论文解读] Template-Based Posit Multiplication for Training and Inferring in Neural Networks
本文提出一种基于模板的正位数乘法算法,支持零指数位(es=0),可实现高效的Sigmoid计算并集成至FloPoCo框架。首次证明使用8位正位数(⟨8,0⟩)训练神经网络可实现与浮点数相当的收敛性,8位正位数在MNIST上达到32位浮点数的精度,尽管在CIFAR-10上存在精度损失,但仍具前景。
The posit number system is arguably the most promising and discussed topic in Arithmetic nowadays. The recent breakthroughs claimed by the format proposed by John L. Gustafson have put posits in the spotlight. In this work, we first describe an algorithm for multiplying two posit numbers, even when the number of exponent bits is zero. This configuration, scarcely tackled in literature, is particularly interesting because it allows the deployment of a fast sigmoid function. The proposed multiplication algorithm is then integrated as a template into the well-known FloPoCo framework. Synthesis results are shown to compare with the floating point multiplication offered by FloPoCo as well. Second, the performance of posits is studied in the scenario of Neural Networks in both training and inference stages. To the best of our knowledge, this is the first time that training is done with posit format, achieving promising results for a binary classification problem even with reduced posit configurations. In the inference stage, 8-bit posits are as good as floating point when dealing with the MNIST dataset, but lose some accuracy with CIFAR-10.
研究动机与目标
- 解决现有框架中缺乏对低精度配置(特别是零指数位)的正位数算术高效支持的问题。
- 实现使用正位数数制训练和推理神经网络,该数制相比IEEE 754浮点数具有更高的精度和硬件效率。
- 设计一种通用、可综合的正位数乘法器算法,支持所有⟨n,es⟩配置,包括es=0,以促进其在硬件中的部署。
- 评估正位数在神经网络训练和推理阶段的性能,重点关注精度、收敛性与资源效率。
- 证明正位数可作为深度学习工作负载中浮点数的可行替代方案,尤其在低精度场景下,可显著减少内存与面积占用。
提出的方法
- 设计一种可处理可变长度区间的通用正位数乘法算法,支持零指数位(es=0),实现神经网络中快速Sigmoid近似。
- 将该算法作为可重用模板在FloPoCo框架中实现,支持自动综合与硬件设计的集成。
- 在神经网络训练流水线中使用基于模板的乘法器,采用均方误差(MSE)损失和随机梯度下降,比较不同格式下的收敛性。
- 使用8位至32位正位数及32/64位浮点数训练小型前馈神经网络,跟踪2500个周期内的损失,以评估收敛行为。
- 在推理阶段,将预训练的浮点模型(LeNet-5)转换为8位正位数(⟨8,0⟩),使用基于NumPy的正位数库进行仿真推理,并在MNIST和CIFAR-10上评估精度。
- 探索一种混合正位数-浮点架构,仅在加法运算中使用正位数格式,以缓解复杂数据集上的精度损失。
实验结果
研究问题
- RQ1能否设计并综合一种通用的正位数乘法算法,支持零指数位(es=0),从而在神经网络中实现高效的Sigmoid计算?
- RQ2使用低精度正位数(如⟨8,0⟩)训练神经网络是否能实现与32位浮点数训练相当的收敛性与性能?
- RQ38位正位数(⟨8,0⟩)在标准数据集(如MNIST和CIFAR-10)上的推理性能与32位浮点数模型相比如何?
- RQ4混合正位数-浮点架构是否能提升推理精度,同时保持正位数在内存与面积上的优势?
- RQ5在深度学习工作负载中,使用不同正位数配置(⟨8,0⟩、⟨10,0⟩、⟨16,1⟩等)时,精度、收敛速度与准确率之间的权衡如何?
主要发现
- 所提出的基于模板的正位数乘法器成功支持所有⟨n,es⟩配置,包括es=0,并已集成至FloPoCo框架,支持硬件综合。
- 使用⟨8,0⟩正位数训练可收敛至稳定损失(第1250个周期时为0.1530),但收敛速度慢于32位浮点数或更高精度的正位数。
- 8位正位数(⟨8,0⟩)在MNIST上达到99.40%的Top-1准确率,略高于32位浮点数(99.22%),表明其在低精度推理中具有很强适用性。
- 在CIFAR-10上,8位正位数的Top-1准确率下降12%(56.11% vs. 68.04%的浮点数),凸显其在复杂图像识别任务中的局限性。
- 在仅加法运算中使用正位数格式的混合架构,使CIFAR-10上的准确率提升至58.92% Top-1,但仍低于全精度浮点数。
- 16位或32位正位数(⟨16,1⟩和⟨32,2⟩)的收敛性与准确率水平几乎与32位浮点数相同,表明其适用于高精度工作负载。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。