Accelerated Execution of Bayesian Neural Networks using a Single Probabilistic Forward Pass and Code Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Klein, Bernhard, Selker, Falk, Borras, Hendrik, Steger, Sophie, Pernkopf, Franz, Fröning, Holger
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911292638363648
author Klein, Bernhard
Selker, Falk
Borras, Hendrik
Steger, Sophie
Pernkopf, Franz
Fröning, Holger
author_facet Klein, Bernhard
Selker, Falk
Borras, Hendrik
Steger, Sophie
Pernkopf, Franz
Fröning, Holger
contents Machine learning models perform well across domains such as diagnostics, weather forecasting, NLP, and autonomous driving, but their limited uncertainty handling restricts use in safety-critical settings. Traditional neural networks often fail to detect out-of-domain (OOD) data and may output confident yet incorrect predictions. Bayesian neural networks (BNNs) address this by providing probabilistic estimates, but incur high computational cost because predictions require sampling weight distributions and multiple forward passes. The Probabilistic Forward Pass (PFP) offers a highly efficient approximation to Stochastic Variational Inference (SVI) by assuming Gaussian-distributed weights and activations, enabling fully analytic uncertainty propagation and replacing sampling with a single deterministic forward pass. We present an end-to-end pipeline for training, compiling, optimizing, and deploying PFP-based BNNs on embedded ARM CPUs. Using the TVM deep learning compiler, we implement a dedicated library of Gaussian-propagating operators for multilayer perceptrons and convolutional neural networks, combined with manual and automated tuning strategies. Ablation studies show that PFP consistently outperforms SVI in computational efficiency, achieving speedups of up to 4200x for small mini-batches. PFP-BNNs match SVI-BNNs on Dirty-MNIST in accuracy, uncertainty estimation, and OOD detection while greatly reducing compute cost. These results highlight the potential of combining Bayesian approximations with code generation to enable efficient BNN deployment on resource-constrained systems.
format Preprint
id arxiv_https___arxiv_org_abs_2511_23440
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Accelerated Execution of Bayesian Neural Networks using a Single Probabilistic Forward Pass and Code Generation
Klein, Bernhard
Selker, Falk
Borras, Hendrik
Steger, Sophie
Pernkopf, Franz
Fröning, Holger
Machine Learning
Hardware Architecture
Distributed, Parallel, and Cluster Computing
Machine learning models perform well across domains such as diagnostics, weather forecasting, NLP, and autonomous driving, but their limited uncertainty handling restricts use in safety-critical settings. Traditional neural networks often fail to detect out-of-domain (OOD) data and may output confident yet incorrect predictions. Bayesian neural networks (BNNs) address this by providing probabilistic estimates, but incur high computational cost because predictions require sampling weight distributions and multiple forward passes. The Probabilistic Forward Pass (PFP) offers a highly efficient approximation to Stochastic Variational Inference (SVI) by assuming Gaussian-distributed weights and activations, enabling fully analytic uncertainty propagation and replacing sampling with a single deterministic forward pass. We present an end-to-end pipeline for training, compiling, optimizing, and deploying PFP-based BNNs on embedded ARM CPUs. Using the TVM deep learning compiler, we implement a dedicated library of Gaussian-propagating operators for multilayer perceptrons and convolutional neural networks, combined with manual and automated tuning strategies. Ablation studies show that PFP consistently outperforms SVI in computational efficiency, achieving speedups of up to 4200x for small mini-batches. PFP-BNNs match SVI-BNNs on Dirty-MNIST in accuracy, uncertainty estimation, and OOD detection while greatly reducing compute cost. These results highlight the potential of combining Bayesian approximations with code generation to enable efficient BNN deployment on resource-constrained systems.
title Accelerated Execution of Bayesian Neural Networks using a Single Probabilistic Forward Pass and Code Generation
topic Machine Learning
Hardware Architecture
Distributed, Parallel, and Cluster Computing
url https://arxiv.org/abs/2511.23440