Generalized Bayesian Posterior Expectation Distillation for Deep Neural Networks

Meet P. Vadera, Brian Jalaian, Benjamin M. Marlin

Introduction

Deep Neural Networks (DNNs) are often prone to overconfidence, leading to "confident errors" on data outside their training distribution. Bayesian Neural Networks (BNNs) address this by treating model weights as probability distributions, providing well-calibrated uncertainty. However, the computational burden of BNNs—which typically require averaging outputs from large ensembles or Monte Carlo samples—makes them impractical for real-time or mobile applications.

While previous methods like Bayesian Dark Knowledge (BDK) attempted to distill these ensembles into a single student network, they were limited to distilling final predictions. This approach loses valuable posterior statistics, such as entropy, which are crucial for effective out-of-distribution (OOD) detection. This paper introduces Generalized Bayesian Posterior Expectation Distillation (GPED), a framework designed to compress complex BNN ensembles while preserving these vital statistics.

The GPED Framework

GPED generalizes the distillation process to any function of the posterior, enabling the student network to learn more than just class probabilities.

  • Generalized Distillation: The student is trained to match a general expectation $E[g(y, x, \theta)]$. This allows the student to explicitly learn targets like expected data uncertainty (entropy).
  • Online Compression: To avoid the massive storage costs associated with teacher ensembles, GPED uses a Stochastic Gradient Langevin Dynamics (SGLD) sampler. This generates teacher samples on the fly, allowing the student to be updated iteratively without storing the full ensemble.
  • Architecture Optimization: The authors utilize Group Lasso ($l_1/l_2$) regularization to automatically prune unnecessary neurons or channels during distillation. This process helps identify the "Goldilocks" student architecture that balances computational efficiency with predictive performance.

Analysis of Distillation Difficulty

A significant finding of this research is that distillation performance is highly sensitive to the level of teacher uncertainty. The authors observed a "moderate uncertainty peak": distillation is easiest when the teacher is very certain or completely uniform. The most challenging regime for the student is the middle ground, where the teacher provides nuanced, moderate uncertainty.

Figure 1: Performance metrics across varying training samples and masking rates. Subplot (c) shows that the MAE of entropy distillation is highest at moderate masking rates, confirming that moderate uncertainty is the most difficult to distill.

Key Results and Efficiency

The GPED framework was evaluated using MNIST and CIFAR-10, along with several OOD benchmarks like KMNIST and SVHN. The results demonstrate that GPED is highly effective for uncertainty quantification:

  • OOD Detection: GPED outperformed the state-of-the-art Ensemble Distribution Distillation (EnD²) in 75% of tested cases for OOD detection (measured by AUROC).
  • Uncertainty Ranking: In tasks requiring the model to rank inputs by uncertainty, GPED was superior in 91% of settings.
  • Computational Efficiency: By using Group Lasso pruning, the authors found student models that achieved significantly better Negative Log-Likelihood (NLL) than standard baselines at the same storage and computation levels. For instance, on MNIST, NLL was reduced from ~0.47 to ~0.30 through architecture optimization.
Figure 5: NLL (Test) vs. FLOPS. This plot illustrates the efficiency gains achieved by the student models (S) compared to the teacher (T) and intermediate configurations (IS), showing the Pareto front of performance versus computational cost.

Conclusion and Future Work

GPED provides a powerful method for bringing the benefits of Bayesian uncertainty to resource-constrained devices. While the current study focused on smaller architectures like FCNNs and simple CNNs, future work will involve scaling GPED to larger models like ResNets and Transformers for large-scale datasets. Additionally, the authors suggest exploring the distillation of higher-order moments and more complex posterior statistics to further enhance model robustness.

Summary updated

BibTeX
@inproceedings{vadera2020generalized,
  author = {Meet P. Vadera and Brian Jalaian and Benjamin M. Marlin},
  title = {{Generalized Bayesian Posterior Expectation Distillation for Deep Neural Networks}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2020},
}
Figure