Abstract
Modern neural network accelerators often face bottlenecks in implementing non-linear activation functions like tanh and SELU. Traditional methods rely on memory-intensive Look-Up Tables (LUTs) or high-latency iterative algorithms. This paper explores a purely combinational logic approach to approximate these functions. By leveraging range segmentation and logic synthesis via Karnaugh maps, the proposed method achieves up to 8.45x area reduction and supports clock frequencies exceeding 5 GHz with negligible impact on model accuracy.
Introduction
In the design of Application-Specific Integrated Circuits (ASICs) and Field-Programmable Gate Arrays (FPGAs) for AI, optimizing Multiply-Accumulate (MAC) operations is a primary focus. However, the non-linear activation function remains a significant hardware bottleneck. Functions such as the Hyperbolic Tangent (tanh) and Scaled Exponential Linear Unit (SELU) require complex mathematical operations like exponentiation, which are not natively supported by standard hardware.
Engineers typically employ two strategies:
- Look-Up Tables (LUTs): These store pre-calculated values in memory but consume substantial chip area.
- Iterative Algorithms (e.g., CORDIC): These save area but introduce significant latency over multiple clock cycles.
This research investigates whether these functions can be efficiently approximated using only logic gates to balance the area-latency trade-off.
Methodology
The core of the proposed approach is a purely combinational circuit that processes input bits through a network of logic gates to produce output bits in a single clock cycle.
Range Segmentation and Logic Synthesis
The input range of the activation function is divided into segments. For instance, tanh is segmented within the [0, 2] range, beyond which it converges to unity. The function is then treated as a large truth table. The authors utilize Karnaugh maps to simplify the Boolean logic for each output bit, resulting in an optimized gate-level representation.
Hardware Implementation
Designs were implemented in RTL and synthesized using a 28nm SVT library. The study also explored different bit-widths (e.g., 7-bit vs. 8-bit) to identify the optimal balance between hardware footprint and neural network accuracy.
Results and Discussion
The proposed combinational approach was evaluated against standard benchmarks including MNIST, CIFAR-10, and ImageNet.
Performance and Area Efficiency
The results indicate a substantial improvement over traditional ROM-based methods. The combinational tanh design is 3.13x to 7.69x smaller, while the SELU design achieves up to an 8.45x reduction in area. Furthermore, the circuits support extremely high clock frequencies: 5.14 GHz for tanh and 4.52 GHz for SELU.
Power Consumption
Power efficiency is a critical metric for edge AI. The proposed logic-based approach demonstrates significantly lower power consumption compared to methods that store parameters in ROM.
Impact on Accuracy
Neural networks exhibit a high degree of robustness to approximation "noise." On the MNIST dataset, accuracy loss was limited to 0.05%. Notably, on ImageNet, the SELU implementation yielded a slight accuracy gain of 0.368%, likely due to the regularization effects of quantization.
Conclusion
Converting activation function approximation from a storage-based problem to a logic-based one yields significant gains in area and speed. While the "hard-wired" nature of these circuits limits flexibility compared to LUTs, the performance benefits make them ideal for high-speed, area-constrained AI accelerators. Future work will focus on automating the logic generation for arbitrary non-linear functions and exploring higher precision requirements.
The implementation is open-sourced and available on GitHub.
Summary updated