NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Adversarial Distillation of Bayesian Neural Network Posteriors

Kuan-Chieh Wang, Paul Vicol, James Lucas, Li Gu, Roger B. Grosse, Richard S. Zemel

TL;DR

This paper introduces Adversarial Posterior Distillation (APD), a novel method that uses Generative Adversarial Networks (GANs) to compress the posterior distributions of Bayesian Neural Networks (BNNs) learned via Stochastic Gradient Langevin Dynamics (SGLD). APD significantly reduces the storage requirements of SGLD while maintaining its performance on critical tasks like anomaly detection, active learning, and adversarial attack defense.

What Problem Does This Paper Address?

Bayesian Neural Networks (BNNs) are powerful tools for quantifying uncertainty in predictions, which is crucial for safety-critical applications. A common method for learning BNNs is Stochastic Gradient Langevin Dynamics (SGLD), which draws samples from the BNN's posterior distribution. However, SGLD requires storing numerous copies of the model's parameters to represent this distribution, leading to prohibitive storage costs, especially for large neural networks. This paper addresses the challenge of making SGLD-learned BNNs practical by developing a method to distill these numerous parameter samples into a more compact representation.

Methods

The core contribution is Adversarial Posterior Distillation (APD). The process involves two main steps:

  1. Posterior Sampling: First, a set of samples from the BNN's posterior distribution over model parameters is obtained using Stochastic Gradient Langevin Dynamics (SGLD).
  2. GAN-based Distillation: A Generative Adversarial Network (GAN), specifically a Wasserstein GAN with Gradient Penalty (WGAN-GP), is trained to model these SGLD posterior samples. The GAN's generator learns to produce parameter samples that mimic the distribution of the original SGLD samples.

At test time, instead of using the large set of SGLD samples, the GAN's generator is used to efficiently produce parameter samples. This approach effectively distills the entire posterior distribution into the parameters of a relatively small generator network. The paper also discusses both "offline" (where SGLD samples are collected first) and "online" (where SGLD and GAN updates are interleaved) variants of APD.

Datasets

The paper evaluates its approach on the following datasets:

  • MNIST: Used for classification, anomaly detection, and adversarial example detection experiments.
  • Toy 2D Dataset: A simple, linearly separable dataset used for initial validation of uncertainty capture.
  • notMNIST: Used as an out-of-distribution (OOD) dataset for anomaly detection.
  • sklearn.datasets.load_digits: A smaller digit dataset also used for anomaly detection with OOD data.

No new benchmarks were introduced; instead, the paper leverages existing benchmarks for anomaly detection (Hendrycks & Gimpel, 2016) and active learning.

Key Insights and Ideas

  • GANs as Posterior Compressors: The paper demonstrates that GANs are capable of effectively learning and mimicking complex posterior distributions of BNN parameters, going beyond simple point estimates.
  • Storage vs. Performance Trade-off: APD offers a significant reduction in storage overhead compared to traditional SGLD, without a substantial loss in performance across various downstream tasks. This makes BNNs more deployable in resource-constrained environments.
  • Distilling the Posterior, Not Just Predictions: Unlike some prior work that might distill predictive distributions, APD distills the actual posterior distribution of the model parameters. This allows for downstream tasks that require access to the posterior itself, such as estimating model variance.
  • Importance of GAN Formulation: The paper highlights that the choice of GAN formulation matters, with WGAN-GP showing superior performance and faster convergence compared to the original GAN and WGAN with weight clipping.

Key Results

  • Classification Accuracy: APD achieved classification accuracy on MNIST comparable to SGLD and MC dropout, demonstrating that distillation does not sacrifice performance on standard tasks.
  • Anomaly Detection: APD consistently outperformed SGD and MC dropout on anomaly detection tasks, and was competitive with SGLD, even showing greater robustness to OOD data scaling.
  • Active Learning: APD performed best early in the active learning process, suggesting its regularization effect or better uncertainty estimation was beneficial.
  • Adversarial Example Detection: APD showed promise in detecting adversarial examples, outperforming MC dropout, though SGLD showed a slight edge in some transfer scenarios.
  • Storage Savings: APD significantly reduces storage requirements. For instance, generating 50 samples from APD achieved performance comparable to using 50 SGLD samples, but with a fixed, much smaller generator size.

Limitations and Future Work

  • GAN Performance Gap: While APD performed well, in some adversarial detection scenarios, SGLD showed a slight advantage, suggesting that the GAN might not perfectly capture all nuances of the posterior distribution critical for certain tasks.
  • Future Directions: The authors suggest exploring other generative models, such as autoregressive models, to further reduce storage costs. They also aim to explore more challenging datasets and attacks for adversarial example detection.

Summary updated

BibTeX
@inproceedings{wang2018adversarial,
  author = {Kuan-Chieh Wang and Paul Vicol and James Lucas and Li Gu and Roger B. Grosse and Richard S. Zemel},
  title = {{Adversarial Distillation of Bayesian Neural Network Posteriors}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
  url = {https://openreview.net/forum?id=rJbekoWOZr},
}
Figure