• Journal of Semiconductors
  • Vol. 41, Issue 2, 022404 (2020)
Chunyou Su1, Sheng Zhou2, Liang Feng1, and Wei Zhang1
Author Affiliations
  • 1Department of Electronics and Computer Engineering, Hong Kong University of Science and Technology, Hong Kong, China
  • 2Department of Computer Science Engineering, Hong Kong University of Science and Technology, Hong Kong, China
  • show less
    DOI: 10.1088/1674-4926/41/2/022404 Cite this Article
    Chunyou Su, Sheng Zhou, Liang Feng, Wei Zhang. Towards high performance low bitwidth training for deep neural networks[J]. Journal of Semiconductors, 2020, 41(2): 022404 Copy Citation Text show less

    Abstract

    The high performance of the state-of-the-art deep neural networks (DNNs) is acquired at the cost of huge consumption of computing resources. Quantization of networks is recently recognized as a promising solution to solve the problem and significantly reduce the resource usage. However, the previous quantization works have mostly focused on the DNN inference, and there were very few works to address on the challenges of DNN training. In this paper, we leverage dynamic fixed-point (DFP) quantization algorithm and stochastic rounding (SR) strategy to develop a fully quantized 8-bit neural networks targeting low bitwidth training. The experiments show that, in comparison to the full-precision networks, the accuracy drop of our quantized convolutional neural networks (CNNs) can be less than 2%, even when applied to deep models evaluated on ImageNet dataset. Additionally, our 8-bit GNMT translation network can achieve almost identical BLEU to full-precision network. We further implement a prototype on FPGA and the synthesis shows that the low bitwidth training scheme can reduce the resource usage significantly.
    $ \widetilde{x} = f(x) = x \; /\; 2^e. $()

    View in Article

    $ {r_x} = \left\{ {\begin{array}{*{20}{l}} 1, & {{\rm{if}}\;{\rm{any}}\;{\rm{entry}}\;{\rm{of}}\;\widetilde x\;{\rm{falls}}\;{\rm{out}}\;{\rm{of}}\;{\rm{the}}\;{\rm{interval}}\;S,} \\ 0, & {{\rm{if}}\;{\rm{all}}\;{\rm{entries}}\;{\rm{of}}\;\widetilde x\;{\rm{lie}}\;{\rm{in}}\;{\rm{the}}\;{\rm{interval}}\;S.} \end{array}} \right.$()

    View in Article

    $ \frac{\partial L}{\partial w^{l}_{jk}} = a^{l-1}_{k}\delta^{l}_{j}. $()

    View in Article

    $ Q(x) = {\rm{min}}(x) + {{step}}\times {\rm{Round}}(\frac{x-{\rm{min}}(x)}{{{step}}}). $()

    View in Article

    $ {{step}} = \frac{{\rm{min}}(x)-{\rm{min}}(x)}{2^{n}-1}. $()

    View in Article

    $\begin{array}{l} Q(x) = \left\{ \begin{align} & 0, & & {\rm{if}}\;{\rm{scalar}} \; x = 0, \\ & 2^{\widehat{x}}\cdot {\rm{sgn}}(x), & & {\rm{if}}\;{\rm{scalar}} \; x\ne0. \\ \end{align} \right. \end{array} $()

    View in Article

    $ \widehat{x} = {\rm{Round}}({\rm{log}}_{2}(|x|)). $()

    View in Article

    $ f: x \rightarrow \widetilde{x}. $()

    View in Article

    $ \widetilde{x} = \left\lfloor {\widetilde{x}} \right\rfloor + \{\widetilde{x}\}. $()

    View in Article

    $ {\rm{NR}}(x) = \left\{ \begin{align} & \left\lfloor { x } \right\rfloor, & {\rm{if}} \; 0 \leqslant \{ x \} \leqslant \frac{1}{2}, \\ & \left\lfloor { x } \right\rfloor + 1, & {\rm{if}} \; \frac{1}{2} \lt \{ x \} \lt 1. \\ \end{align} \right. $()

    View in Article

    $ {\rm{SR}}(x) = \left\{ \begin{align} & \left\lfloor { x } \right\rfloor, & & \text{w.p}. \; 1-\{ x \} ,\\ & \left\lfloor { x } \right\rfloor + 1, & & {\rm{w.p.}} \; \{ x \} .\\ \end{align} \right. $()

    View in Article

    $ {\rm{Round}}(x) = \left\{ \begin{align} & -2^{n-1}, & & {\rm{if}} \; x \leqslant -2^{n-1} ,\\ & 2^{n-1}-1, & & {\rm{if}} \; x \geqslant 2^{n-1}-1, \\ & {\rm{NR}}(x)\; {\rm {or}}\; {\rm{SR}}(x) , & & {\rm{otherwise}}. \end{align} \right. $()

    View in Article

    $ \varepsilon \sim U(0,1). $()

    View in Article

    $ {\rm{SR}}(x) = \left\lfloor { x+\varepsilon } \right\rfloor. $()

    View in Article

    $ \begin{array}{l} \varepsilon \in \left\{ {\begin{array}{*{20}{l}} {[0,1 - \{ x\} ),} & {{\rm{w}}.{\rm{p}}.\;1 - \{ x\} ,}\\ {[1 - \{ x\} ,1),} & {{\rm{w}}.{\rm{p}}.\;\{ x\} ,} \end{array}} \right.\;\; {\rm{such}}\;{\rm{that}} \\ \;\;x + \varepsilon \in \left\{ {\begin{array}{*{20}{l}} {[x,1 + \left\lfloor x \right\rfloor ),} & {{\rm{w}}.{\rm{p}}.\;1 - \{ x\} ,}\\ {[1 + \left\lfloor x \right\rfloor ,1 + x),} & {{\rm{w}}.{\rm{p}}.\;\{ x\} .} \end{array}} \right. \end{array}$()

    View in Article

    $ {\rm{SR}}(x) = \left\lfloor { x+\varepsilon } \right\rfloor = \left\{ \begin{align} & \left\lfloor { x } \right\rfloor, & & {\rm{w.p.}} \; 1-\{ x \}, \\ & \left\lfloor { x } \right\rfloor + 1 , & & {\rm{w.p.}} \; \{ x \} .\\ \end{align} \right. $()

    View in Article

    $ X \sim N(0,3^2). $()

    View in Article

    Chunyou Su, Sheng Zhou, Liang Feng, Wei Zhang. Towards high performance low bitwidth training for deep neural networks[J]. Journal of Semiconductors, 2020, 41(2): 022404
    Download Citation