[论文解读] Learning Recurrent Binary/Ternary Weights
该论文提出一种在反向传播过程中训练具有二值化和三值化权重的循环神经网络(RNN)的方法,用简单的累加操作替代计算成本高昂的乘加运算。该方法在专用硬件上实现了高达12倍的内存减少和10倍的推理速度提升,同时在语言建模和分类等序列建模任务中保持了具有竞争力的准确率。
Recurrent neural networks (RNNs) have shown excellent performance in processing sequence data. However, they are both complex and memory intensive due to their recursive nature. These limitations make RNNs difficult to embed on mobile devices requiring real-time processes with limited hardware resources. To address the above issues, we introduce a method that can learn binary and ternary weights during the training phase to facilitate hardware implementations of RNNs. As a result, using this approach replaces all multiply-accumulate operations by simple accumulations, bringing significant benefits to custom hardware in terms of silicon area and power consumption. On the software side, we evaluate the performance (in terms of accuracy) of our method using long short-term memories (LSTMs) on various sequential models including sequence classification and language modeling. We demonstrate that our method achieves competitive results on the aforementioned tasks while using binary/ternary weights during the runtime. On the hardware side, we present custom hardware for accelerating the recurrent computations of LSTMs with binary/ternary weights. Ultimately, we show that LSTMs with binary/ternary weights can achieve up to 12x memory saving and 10x inference speedup compared to the full-precision implementation on an ASIC platform.
研究动机与目标
- 解决RNN在资源受限的移动设备上面临的高计算与高内存需求问题。
- 通过在训练过程中学习二值化与三值化权重,实现RNN在硬件上的高效部署。
- 在推理过程中减少对全精度乘法的依赖,从而最小化功耗与芯片面积。
- 证明二值化与三值化RNN可在多种序列任务上达到与全精度模型相当的准确率。
- 设计并评估用于二值化/三值化RNN推理的定制ASIC加速器,实现低功耗与高吞吐量。
提出的方法
- 该方法通过可微分近似符号函数,将RNN训练中的权重约束为{+1, -1}(二值化)或{+1, 0, -1}(三值化),实现反向传播。
- 使用可学习的缩放因子以保持训练期间的梯度流动,从而实现对二值化与三值化权重的有效优化。
- 该方法可集成到标准RNN架构(如LSTM和GRU)中,保持使用量化权重的循环计算。
- 通过在MAC单元中用多路选择器替代乘法器实现硬件加速,降低面积与功耗。
- 开发了两种ASIC实现:一种为100个MAC单元的低功耗设计,另一种为MAC单元数量增加10倍的高吞吐量设计。
- 硬件采用12位定点表示法表示激活值与二值化/三值化权重,确保无准确率损失。
实验结果
研究问题
- RQ1在反向传播过程中,是否可以有效学习到循环二值化与三值化权重,而不会造成显著的准确率下降?
- RQ2二值化与三值化RNN在长序列任务(如语言建模与序列分类)中能保持多大程度的性能?
- RQ3在专用硬件中,二值化/三值化RNN能实现多大的内存效率与推理速度提升?
- RQ4所提出的方法能否克服通常阻碍RNN二值化的梯度爆炸问题?
- RQ5针对二值化/三值化RNN优化的ASIC中,功耗、芯片面积与吞吐量之间的权衡关系如何?
主要发现
- 所提方法在字符级语言建模(BPC:全精度为1.39,二值化为1.37,三值化为1.37)和序列分类任务中均实现了具有竞争力的准确率。
- 二值化与三值化RNN相比全精度模型,内存带宽与存储需求最高可降低12倍。
- 高速ASIC实现通过使用10倍以上的MAC单元数量,使推理速度相比全精度硬件最高提升10倍,得益于单位面积的降低。
- 低功耗ASIC设计在400 MHz下,相比全精度对应设计,功耗最高降低9倍,芯片面积降低10.6倍。
- 该方法在多种任务(包括长序列与复杂时间依赖)中泛化良好,未出现性能下降。
- 硬件结果证实,用多路选择器替代乘法器可显著节省能量与面积,同时保持模型准确率。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。