Skip to main content
QUICK REVIEW

[Paper Review] You Only Derive Once (YODO): Automatic Differentiation for Efficient Sensitivity Analysis in Bayesian Networks

Rafael Ballester‐Ripoll, Manuele Leonelli|arXiv (Cornell University)|Jun 17, 2022
Bayesian Modeling and Causal InferenceComputer Science10 citations
TL;DR

This paper introduces YODO (You Only Derive Once), a novel method that leverages automatic differentiation and exact inference to compute all sensitivity values in a Bayesian network in a single pass, achieving orders-of-magnitude speedup over traditional finite-difference methods. The approach enables efficient, scalable sensitivity analysis across networks with up to 100,000 parameters, with a PyTorch-based implementation freely available.

ABSTRACT

Sensitivity analysis measures the influence of a Bayesian network's parameters on a quantity of interest defined by the network, such as the probability of a variable taking a specific value. In particular, the so-called sensitivity value measures the quantity of interest's partial derivative with respect to the network's conditional probabilities. However, finding such values in large networks with thousands of parameters can become computationally very expensive. We propose to use automatic differentiation combined with exact inference to obtain all sensitivity values in a single pass. Our method first marginalizes the whole network once using e.g. variable elimination and then backpropagates this operation to obtain the gradient with respect to all input parameters. We demonstrate our routines by ranking all parameters by importance on a Bayesian network modeling humanitarian crises and disasters, and then show the method's efficiency by scaling it to huge networks with up to 100'000 parameters. An implementation of the methods using the popular machine learning library PyTorch is freely available.

Motivation & Objective

  • To address the computational inefficiency of existing one-way sensitivity analysis methods in large Bayesian networks with thousands of parameters.
  • To develop a scalable, efficient method for computing all sensitivity values—i.e., partial derivatives of output probabilities with respect to network parameters—without repeated inference.
  • To enable rapid identification of the most influential parameters in a Bayesian network, supporting model validation and risk assessment.
  • To provide a practical, open-source implementation using PyTorch for integration into existing probabilistic modeling workflows.

Proposed method

  • The method first performs exact inference (e.g., variable elimination) once to compute the joint probability distribution over the network.
  • It then applies backpropagation through the computation graph of the inference process to compute gradients with respect to all conditional probability parameters simultaneously.
  • Automatic differentiation is used to compute the sensitivity function’s gradient, i.e., the partial derivative of the output probability of interest with respect to each network parameter.
  • The approach treats the inference process as a differentiable computation graph, enabling efficient gradient computation via backpropagation.
  • The method supports both the identification of parameters with non-zero sensitivity (parameter sensitivity set) and the determination of monotonicity direction (increasing/decreasing effect).
  • The implementation uses PyTorch to leverage its automatic differentiation engine, enabling GPU acceleration and seamless integration with machine learning pipelines.

Experimental results

Research questions

  • RQ1Can automatic differentiation be effectively applied to compute sensitivity values in Bayesian networks with high computational efficiency?
  • RQ2How does the proposed method compare in performance to traditional finite-difference estimation for sensitivity analysis across networks of varying size and complexity?
  • RQ3Can the method scale to large Bayesian networks with tens of thousands of parameters while maintaining low computational overhead?
  • RQ4Does the method enable rapid identification of the most influential parameters in a Bayesian network, particularly in real-world risk assessment applications?
  • RQ5Can the method be extended to support multi-way sensitivity analysis and admissible deviation calculations?

Key findings

  • YODO computes all sensitivity values in a single inference pass, reducing computation time from hours to seconds for large networks.
  • On the pathfinder network with 97,851 parameters, YODO computed all sensitivity values in 0.188 seconds, compared to 8,596.81 seconds using finite differences.
  • For the munin1 network with 19,226 parameters, YODO completed in 14.39 seconds, while finite differences required over 113,000 seconds.
  • The method successfully ranked the top 20 most influential parameters in a humanitarian crisis Bayesian network, identifying both increasing and decreasing effects on the output probability.
  • The performance improvement of YODO over finite differences was consistently several orders of magnitude across all 10 benchmark networks tested.
  • The open-source PyTorch-based implementation enables efficient integration into existing Bayesian network tools and supports future extensions to multi-way sensitivity and admissible deviation analysis.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.