Abstract
Reliable uncertainty estimation plays a crucial role in various safety-critical applications such as medical diagnosis and autonomous driving. In recent years, Bayesian neural networks (BayesNNs) have gained substantial research and industrial interests due to their capability to make accurate predictions with reliable uncertainty estimation. However, the algorithmic complexity and the resulting hardware performance of BayesNNs hinder their adoption in real-life applications. To bridge this gap, this paper proposes an algorithm and hardware co-design framework that can generate field-programmable gate array (FPGA)-based accelerators for efficient BayesNNs. At the algorithm level, we propose novel multi-exit dropout-based BayesNNs with reduced computational and memory overheads while achieving high accuracy and quality of uncertainty estimation. At the hardware level, this paper introduces a transformation framework that can generate FPGA-based accelerators for the proposed efficient multi-exit BayesNNs. Several optimization techniques such as the mix of spatial and temporal mappings are introduced to reduce resource consumption and improve the overall hardware performance. Comprehensive experiments demonstrate that our approach can achieve higher energy efficiency compared to CPU, GPU, and other state-of-the-art hardware implementations.
Introduction
Standard Deep Neural Networks (DNNs) are often "overconfident" black boxes; they provide a prediction but cannot tell you how sure they are. This lack of uncertainty quantification is a significant hurdle for safety-critical tasks like autonomous driving or medical diagnosis. Bayesian Neural Networks (BayesNNs) address this by treating weights as probability distributions, allowing them to quantify epistemic uncertainty. However, BayesNNs typically require multiple Monte Carlo (MC) samples—effectively running the network many times for a single input—which creates massive computational and memory bottlenecks for real-time edge devices.
This work introduces an algorithm and hardware co-design framework that brings efficient, reliable uncertainty estimation to FPGAs. By combining multi-exit architectures with dropout-based BayesNNs, the framework achieves up to 65x better energy efficiency than CPUs and 33x better than GPUs, while simultaneously improving the quality of predictive confidence.
Methodology
The proposed approach utilizes a two-pronged co-design strategy encompassing algorithmic and hardware innovations.
Algorithmic Innovations
The core algorithmic contribution is the Multi-Exit BayesNN. Unlike standard models with a single output, these networks feature multiple "exits" at varying depths, capturing uncertainty information from different levels of feature abstraction.
The framework supports both Monte-Carlo Dropout (MCD) and Masksembles. Masksembles are particularly hardware-friendly as they use pre-defined dropout masks to simulate an ensemble within a single model, eliminating the need for runtime random number generation. Furthermore, "Partial Dropout" is employed to save power: dropout is applied only to later layers, allowing early "non-Bayesian" layers to be computed once and cached.
Hardware Innovations
The hardware component consists of a transformation framework that converts software descriptions (Keras/PyTorch) into High-Level Synthesis (HLS) code for FPGAs.
Key hardware optimizations include:
- Spatial vs. Temporal Mapping: The framework can optimize for latency by running multiple MC engines in parallel (spatial) or for area by reusing a single engine over time (temporal).
- Co-Exploration: A grid-search strategy balances bitwidth quantization, the number of exits, and hardware resource constraints.
Experimental Results
The framework was evaluated using MNIST, CIFAR-100, and SVHN datasets across several backbone models including LeNet5, ResNet-18, and VGG variants.
Key Insights
- Uncertainty Quality: Multi-exits improve the quality of uncertainty estimation (measured by Expected Calibration Error) because different layers perceive data ambiguity differently.
- Efficiency Gains: Masksembles allow the hardware to skip computations for "zeroed-out" neurons. Partial dropout avoids the "Bayesian Tax" on early layers, which often account for a large portion of total FLOPs.
Performance Metrics
- Energy Efficiency: The FPGA design achieved 65x higher energy efficiency than an Intel Core i9 CPU and 33x higher than an NVIDIA RTX 2080 GPU.
- Latency: Compared to prior FPGA-based BayesNN accelerators like VIBNN or Bynqnet, this work demonstrated lower latency and superior energy efficiency (0.004 J/Image vs. 0.012–0.033 J/Image).
- Accuracy: On ResNet-18, the Multi-Exit MCD approach improved accuracy by 2.4% over a standard single-exit model with only a negligible 0.019x increase in FLOPs.
Conclusion and Future Work
This paper presents a robust framework for deploying efficient BayesNNs on FPGAs. Future work will focus on further automating the transformation process for non-hardware experts and extending the framework to support Attention-based BayesNNs (Transformers). Additionally, the authors plan to explore dynamic scaling for run-time reconfiguration between high-accuracy and low-power modes.
Summary updated