FATNN: Fast and Accurate Ternary Neural Networks*

Peng Chen, Bohan Zhuang, Chunhua Shen

Introduction

Deep Convolutional Neural Networks (DCNNs) are essential for modern computer vision but pose significant deployment challenges on edge devices due to their high computational costs. Ternary Neural Networks (TNNs), which constrain weights and activations to $\{-1, 0, 1\}$, offer a potential solution by replacing multiplications with bitwise operations. However, TNNs have traditionally suffered from an "efficiency bottleneck"—where they run no faster than standard 2-bit models—and an "accuracy gap" compared to full-precision models.

FATNN (Fast and Accurate Ternary Neural Networks) addresses these challenges through a hardware-software co-design. It introduces a novel bitwise implementation that achieves a 2x speedup over 2-bit models while maintaining high accuracy on benchmarks like ImageNet.

Methods

The FATNN framework employs three primary strategies to optimize both speed and accuracy:

Fast Ternary Inner Product

The authors exploit the "non-overflow" property of ternary values to design a custom sequence of bitwise operations (XNOR, shifts, masks, and popcount). By mapping logical ternary values to a specific 2-bit "codec," they enable parallel accumulations. This implementation maintains higher parallelism (processing 4 values per byte) than standard 2-bit models, effectively doubling the speed of the ternary inner product.

Constrained Ternary Quantization

Rather than using a uniform step size, FATNN utilizes a non-uniform quantizer with learnable parameters ($\alpha_1, \alpha_2$). This allows the network to adapt to the actual distribution of weights and activations during training, minimizing quantization error.

Residual Block Calibration

A key discovery was that distribution mismatches between high-precision skip connections and low-precision main branches in ResNet architectures degrade performance. FATNN introduces an additional Batch Normalization (BN) layer to the skip connection to align these distributions before they are added together.

Comparison of standard residual block (a) and the proposed FATNN block with skip connection calibration (b).

Key Results

FATNN was evaluated on ImageNet and CIFAR-10, demonstrating superior performance in both speed and accuracy.

Speed Performance

FATNN consistently achieves approximately a 2x speedup over standard 2-bit models across various platforms, including mobile GPUs (Qualcomm 821/835) and server-grade GPUs (Nvidia 2080Ti). This hardware-agnostic design allows for efficient deployment on general-purpose processors using standard bit-manipulation instructions.

Speedup of FATNN over standard 2-bit models across different GPU architectures.

Accuracy Benchmarks

On ImageNet with ResNet-18, FATNN achieved 66.0% Top-1 accuracy, surpassing the previous state-of-the-art (LSQ) by 1.3%. For ResNet-50, it reached 72.4%, narrowing the gap to full-precision performance (76.1%) while offering significantly higher efficiency. Ablation studies confirmed that residual block calibration and learnable step sizes contributed 0.6% and 0.7% accuracy boosts, respectively.

Conclusion

FATNN successfully bridges the gap between ultra-low-precision quantization and real-world deployment speed. By co-designing bitwise logic with distribution-aware training techniques, it provides a practical framework for deploying high-performance DCNNs on resource-constrained edge devices. Future work may explore relaxing value restrictions or more complex scaling schemes while maintaining the current efficiency gains.

Summary updated

BibTeX
@inproceedings{chen2020fatnn,
  author = {Peng Chen and Bohan Zhuang and Chunhua Shen},
  title = {{FATNN: Fast and Accurate Ternary Neural Networks*}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2020},
  doi = {10.1109/iccv48922.2021.00517},
}
Figure