[Paper Review] Accurate and Efficient Hyperbolic Tangent Activation Function on FPGA using the DCT Interpolation Filter
This paper proposes a high-accuracy, resource-efficient hyperbolic tangent activation function approximation for FPGA-based Deep Neural Networks using a Discrete Cosine Transform Interpolation Filter (DCTIF). The method achieves up to 100× greater precision than prior work with minimal area and latency overhead, maintaining DNN training and testing performance comparable to the exact function.
Implementing an accurate and fast activation function with low cost is a crucial aspect to the implementation of Deep Neural Networks (DNNs) on FPGAs. We propose a high-accuracy approximation approach for the hyperbolic tangent activation function of artificial neurons in DNNs. It is based on the Discrete Cosine Transform Interpolation Filter (DCTIF). The proposed architecture combines simple arithmetic operations on stored samples of the hyperbolic tangent function and on input data. The proposed DCTIF implementation achieves two orders of magnitude greater precision than previous work while using the same or fewer computational resources. Various combinations of DCTIF parameters can be chosen to tradeoff the accuracy and complexity of the hyperbolic tangent function. In one case, the proposed architecture approximates the hyperbolic tangent activation function with 10E-5 maximum error while requiring only 1.52 Kbits memory and 57 LUTs of a Virtex-7 FPGA. We also discuss how the activation function accuracy affects the performance of DNNs in terms of their training and testing accuracies. We show that a high accuracy approximation can be necessary in order to maintain the same DNN training and testing performances realized by the exact function.
Motivation & Objective
- Address the challenge of implementing high-accuracy, low-resource hyperbolic tangent activation functions in FPGA-based DNN accelerators.
- Overcome the trade-off between approximation accuracy and computational complexity in existing hardware implementations.
- Investigate the impact of activation function approximation accuracy on DNN training and inference performance.
- Develop a novel DCTIF-based approximation that enables high precision with minimal area and latency overhead on FPGAs.
Proposed method
- Leverage the Discrete Cosine Transform Interpolation Filter (DCTIF) to approximate the hyperbolic tangent function using stored samples and linear interpolation.
- Exploit the odd symmetry of the hyperbolic tangent function to reduce memory requirements by storing only positive input values.
- Use DCT-based interpolation to compute intermediate values between stored samples, minimizing arithmetic complexity.
- Optimize the DCTIF parameters (e.g., filter length, sample density) to balance accuracy and resource usage.
- Implement the architecture using only basic arithmetic operations (additions, shifts) and a small lookup table on a Virtex-7 FPGA.
- Evaluate the method across multiple DNN architectures and datasets to assess its impact on training and testing accuracy.
Experimental results
Research questions
- RQ1How does the accuracy of the hyperbolic tangent approximation affect the training and testing performance of DNNs on FPGAs?
- RQ2Can a DCTIF-based approximation achieve higher precision than existing methods (e.g., PWL, LUT, hybrid) while using fewer computational and memory resources?
- RQ3What is the minimum approximation error required to maintain DNN performance comparable to the exact hyperbolic tangent function?
- RQ4How do different DCTIF parameter configurations trade off accuracy, area, and latency in FPGA implementations?
- RQ5To what extent does the proposed method preserve DNN accuracy across diverse architectures and datasets?
Key findings
- The proposed DCTIF-based approximation achieves a maximum error of 10^-5 with only 1.52 Kbits of memory and 57 LUTs on a Virtex-7 FPGA, outperforming prior work in precision-to-resource ratio.
- For the MNIST dataset, a 10^-5 error approximation maintained 95.8% testing accuracy, matching the performance of the exact function.
- In the Sinc regression task, a 10^-5 error approximation achieved 90.287% training accuracy, comparable to the exact function’s 90.287%.
- Even with a 0.04 maximum error, training accuracy dropped significantly (e.g., from 94.1% to 68.0% in the Cancer dataset), indicating that low-accuracy approximations degrade DNN performance.
- The study demonstrates that high-accuracy approximations (e.g., 10^-5 error) are necessary to preserve DNN training and testing performance, especially in complex architectures.
- The DCTIF method enables a 100× improvement in precision over previous approaches when using similar or fewer resources, making it suitable for high-performance DNN inference on FPGAs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.