Abstract
Standard Deep Neural Networks (DNNs) often exhibit overconfidence in their predictions, posing significant risks in safety-critical applications. Bayesian Neural Networks (BNNs) address this by treating weights as probability distributions to estimate uncertainty. However, the high computational and memory overhead of BNN training—driven by the need to sample and store massive volumes of random variables—limits their deployment. This paper introduces Shift-BNN, a specialized hardware accelerator that leverages the mathematical reversibility of Linear Feedback Shift Registers (LFSRs) to regenerate random variables locally. By eliminating off-chip memory access for these variables, Shift-BNN achieves up to a 10.8× boost in energy efficiency with zero loss in training accuracy.
The GRV Bottleneck in BNN Training
Training BNNs requires the "reparameterization trick," where weights are sampled as $w = \mu + \epsilon \cdot \sigma$. Here, $\epsilon$ represents a Gaussian Random Variable (GRV) that introduces stochasticity. To ensure gradient consistency, the exact same $\epsilon$ generated during the forward pass must be reused during backpropagation.
In conventional hardware architectures, these GRVs are generated, stored in off-chip DRAM, and then retrieved. This creates a massive data movement bottleneck. As shown in the data analysis, GRVs can account for up to 71% of the total data transfer during training, dwarfing the movement of weights and input/output features.
Methodology: LFSR Reversion and Mapping
Shift-BNN's core innovation is LFSR Reversion. Most modern BNN implementations use Linear Feedback Shift Registers (LFSRs) to generate pseudo-random patterns. The authors observed that the XOR-based logic of an LFSR is perfectly reversible. Instead of saving patterns to DRAM, Shift-BNN "shifts the gears in reverse" during the backward pass to reproduce the exact same random bit patterns locally within the Processing Elements (PEs). This effectively reduces the memory footprint of GRVs to zero.
Hardware-Software Co-Design
To maximize the efficiency of this local regeneration, the authors explored various computation mapping schemes. They identified that RC-dimension mapping (focusing on Output Feature Mapping) is the most compatible with LFSR reversion. Unlike other common styles like MN-mapping (used in NVDLA), which require complex data-swapping and wiring to handle kernel rotation during backpropagation, RC-mapping allows for a sequential dataflow that aligns perfectly with the forward-reverse shifting of the LFSR.
Experimental Results
The researchers prototyped Shift-BNN on a Xilinx FPGA and evaluated it against five representative models: B-MLP (MNIST), B-LeNet (CIFAR-10), and B-AlexNet, B-VGG, and B-ResNet (ImageNet).
Key performance metrics include:
- Energy Efficiency: Shift-BNN achieved an average 4.9× boost (up to 10.8×) compared to standard DNN accelerators and 4.7× better efficiency than an Nvidia Tesla P100 GPU.
- Speedup: The architecture provided an average 1.6× speedup, with the most significant gains observed in parameter-dominated layers where memory bottlenecks are most severe.
- Accuracy: Because the LFSR reproduction is mathematically exact, there is zero loss in accuracy compared to standard floating-point training methods.
Conclusion
Shift-BNN demonstrates that the primary challenge in scaling Bayesian Neural Networks is not computation, but the data movement associated with stochasticity. By exploiting the inherent reversibility of random number generators and optimizing hardware mapping, Shift-BNN enables high-fidelity uncertainty estimation on energy-constrained edge devices. Future work will explore extending this reversion logic to broader classes of probabilistic models and investigating lower-precision 8-bit training regimes.
Summary updated