When Monte-Carlo Dropout Meets Multi-Exit: Optimizing Bayesian Neural Networks on FPGA

Hongxiang Fan, Hao Chen, Liam Castelli, Zhiqiang Que, He Li, Kenneth Long, Wayne Luk

TL;DR

This paper introduces a novel architecture that combines Multi-Exit networks with Monte-Carlo Dropout (MCD) to create Bayesian Neural Networks (BayesNNs) that are both highly accurate and computationally efficient. By deploying these models via a custom FPGA transformation framework, the authors achieve up to 65x better energy efficiency than CPUs and 33x better than GPUs, all while providing superior uncertainty quantification for safety-critical tasks.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are powerful but often act as "black boxes," providing predictions without any sense of how confident they are. In safety-critical fields like autonomous driving or medical imaging, an overconfident wrong answer can be disastrous. Bayesian Neural Networks (BayesNNs) solve this by providing a mathematical framework for uncertainty, but they come with a "Bayesian tax": they are computationally expensive and memory-intensive because they require multiple forward passes (Monte-Carlo sampling) to generate a single calibrated prediction.

Existing approximations like Monte-Carlo Dropout (MCD) reduce this overhead but often struggle with calibration quality compared to massive deep ensembles. Furthermore, there is a lack of specialized hardware support to make these models run efficiently in real-time edge applications.

Methods

The authors propose a two-pronged solution: a new model architecture and a specialized hardware acceleration framework.

1. Multi-Exit MCD-based BayesNN

Instead of applying dropout to every layer (which can over-regularize and hurt accuracy), the authors use a multi-exit architecture.

  • Shared Backbone: The early layers of the network act as a non-Bayesian feature extractor.
  • Bayesian Exits: MCD layers are placed only near the intermediary and final "exits" of the network.
  • Efficiency through Caching: Because the backbone is non-Bayesian, its results can be cached and reused across all Monte-Carlo (MC) samples, drastically reducing the total number of floating-point operations (FLOPs).
Difference between single-exit, multi-exit non-Bayes, and multi-exit BayesNN

2. FPGA Transformation Framework

The authors developed a four-phase framework to automate the creation of FPGA accelerators:

  • Phase 1 (Multi-Exit Optimization): Optimizes the number of exits and dropout rates.
  • Phase 2 (Spatial & Temporal Mapping): Introduces two hardware strategies for MC sampling. Spatial mapping uses separate hardware engines to process samples in parallel (low latency), while temporal mapping reuses a single engine (low resource usage).
  • Phase 3 (Algorithm-Hardware Co-Exploration): A grid search to find the best balance of bitwidth (4, 6, 8, or 16-bit) and channel numbers.
  • Phase 4 (HLS Generation): Uses HLS4ML to generate the final hardware description.
Fig. 2. Framework Overview.

Datasets

The framework was evaluated using several standard benchmarks:

  • MNIST: Used primarily for cross-platform energy efficiency comparisons.
  • CIFAR-10 & CIFAR-100: Used to evaluate accuracy and calibration on more complex image classification tasks.
  • SVHN (Street View House Numbers): Used for hardware cost evaluation.

Key Insights and Ideas

  • The "Ensemble" Effect: A multi-exit network can be viewed as a deep ensemble with a shared backbone. By adding MCD to these exits, you get the calibration benefits of an ensemble without the linear increase in computational cost.
  • Strategic Parallelism: The Bayesian component of the network exhibits unique concurrency. The authors' ability to mix spatial and temporal mapping allows designers to tune the hardware specifically for either high-throughput or resource-constrained environments.
  • Calibration vs. Complexity: The paper demonstrates that you don't need a fully Bayesian network to get good uncertainty estimates. Treating the first half of the network as a deterministic feature extractor preserves accuracy while focusing the "Bayesian effort" where it matters most—near the output.
Fig. 4. Spatial and temporal mappings for Bayesian components.

Key Results

  • Energy Efficiency: The FPGA implementation achieved 65x higher energy efficiency than an Intel i9 CPU and 33x higher than an NVIDIA RTX 2080 GPU.
  • Calibration Quality: On ResNet18, the proposed "MCD+ME" approach reduced the Expected Calibration Error (ECE) by nearly 90% compared to standard single-exit models.
  • Accuracy Boost: The multi-exit Bayesian approach improved ResNet18 accuracy by 2.4% while only marginally increasing FLOPs (1.019x).
  • Hardware Performance: Compared to other state-of-the-art FPGA BayesNN accelerators (like VIBNN or Bynqnet), this framework provided lower latency and better energy efficiency per image.

Limitations and Future Work

While the framework is highly effective, the authors note a few areas for growth:

  • Model Support: The current work focuses on CNNs and LSTMs; the authors aim to extend this to attention-based models (like Transformers) in the future.
  • Optimization: They plan to explore "zero skipping" optimizations to further reduce redundant computations.
  • Flexibility: Future versions may include run-time reconfiguration capabilities, allowing the hardware to adapt its Bayesian complexity on the fly based on the required confidence level.

Summary updated

BibTeX
@inproceedings{fan2023when,
  author = {Hongxiang Fan and Hao Chen and Liam Castelli and Zhiqiang Que and He Li and Kenneth Long and Wayne Luk},
  title = {{When Monte-Carlo Dropout Meets Multi-Exit: Optimizing Bayesian Neural Networks on FPGA}},
  booktitle = {DAC},
  year = {2023},
}
Figure