Hardware-Driven Nonlinear Activation for Stochastic Computing Based Deep Convolutional Neural Networks

Ji Li, Zihao Yuan, Zhe Li, Caiwen Ding, Ao Ren, Qinru Qiu, Jeffrey T. Draper, Yanzhi Wang

Introduction

Deep Convolutional Neural Networks (DCNNs) are the state-of-the-art for image recognition tasks. However, their high computational and memory requirements make them difficult to deploy on resource-constrained platforms, such as Internet of Things (IoT) devices and wearables. While high-end GPUs handle these workloads effectively, edge devices require a more hardware-efficient approach.

Stochastic Computing (SC) has emerged as a compelling solution. Unlike traditional binary arithmetic, SC represents numerical values as the probability of "1s" in a random bit stream. This paradigm shift allows complex mathematical operations, such as multiplication, to be performed using simple logic gates (e.g., a single XNOR gate), drastically reducing the hardware footprint and power consumption.

Challenges in Stochastic Activation Functions

A significant hurdle in SC-based DCNNs is the implementation of nonlinear activation functions like ReLU, tanh, and logistic (Sigmoid). These functions are essential for the network's ability to learn complex patterns. In the probabilistic domain of SC, implementing these functions accurately is challenging; small approximation errors in early layers can propagate and amplify, ultimately degrading the network's classification accuracy.

Proposed SC-Neuron Architectures

To address these challenges, this research introduces three highly efficient hardware designs for SC-based neurons, focusing on the activation stage:

  1. SC-tanh: This design utilizes a Finite State Machine (FSM) based on a saturated up/down counter to approximate the hyperbolic tangent function.
  2. SC-logistic: To implement the logistic function, which outputs values between 0 and 1, the authors introduced a history shift register and a shadow counter. This mechanism tracks previous bits to predict the sign of the current value and compensate for inherent stochastic noise.
  3. SC-ReLU: Building on the history-tracking logic of the SC-logistic design, the hardware was adapted to implement the Rectified Linear Unit ($max(0, x)$), currently the most popular activation function in deep learning.

The overall neuron architecture integrates these activation functions with XNOR-based multiplication and Approximate Parallel Counters (APC) for addition, providing a superior balance between precision and hardware cost compared to traditional multiplexer-based SC adders.

Architecture of the proposed SC-based neuron including inner product, pooling, and activation function stages.

Key Results and Performance

The proposed SC-based DCNN was evaluated using the LeNet-5 architecture on the MNIST dataset and compared against traditional 8-bit binary ASIC hardware, as well as standard CPUs and GPUs.

The hardware efficiency gains are substantial. The SC neurons achieved up to a 61x reduction in area and a 151x reduction in power consumption compared to binary ASIC implementations. When compared to general-purpose processors, the energy savings were even more dramatic—up to 198,200x more efficient than a CPU and 96,443x more than a GPU.

Comparison of SC-based activation functions (Tanh, Logistic, ReLU) against their ideal mathematical counterparts.

Crucially, these gains come with minimal impact on performance. The test error increased by less than 3.07% compared to high-precision software versions. The study also highlights that ReLU is particularly well-suited for SC hardware, as it maintains high accuracy even with short bit stream lengths (e.g., 64 bits), which is vital for reducing latency.

Conclusion and Future Work

This work demonstrates that by jointly optimizing bit stream length, FSM states, and hardware logic, SC-based DCNNs can achieve unprecedented efficiency for edge AI applications. Future research will focus on scaling these designs to deeper architectures like ResNet and more complex datasets like ImageNet, as well as optimizing the generation of the initial random bit streams.

Summary updated

BibTeX
@inproceedings{li2017hardware,
  author = {Ji Li and Zihao Yuan and Zhe Li and Caiwen Ding and Ao Ren and Qinru Qiu and Jeffrey T. Draper and Yanzhi Wang},
  title = {{Hardware-Driven Nonlinear Activation for Stochastic Computing Based Deep Convolutional Neural Networks}},
  booktitle = {IJCNN},
  year = {2017},
  doi = {10.1109/ijcnn.2017.7965993},
}
Figure