Effective Bayesian Heteroscedastic Regression with Deep Neural Networks

Alexander Immer, Emanuele Palumbo, Alexander Marx, Julia E Vogt

TL;DR: This paper introduces a more stable and principled way to train deep neural networks for regression when the noise level varies across the input space (heteroscedasticity). By switching to the natural parametrization of the Gaussian distribution and applying a scalable Laplace approximation, the authors enable automatic regularization and provide high-quality estimates of both data noise and model uncertainty.

The Challenge of Heteroscedasticity

In standard regression, models often assume "homoscedasticity"—that observation noise is constant everywhere. However, real-world data is frequently heteroscedastic, meaning some regions of the input space are inherently noisier than others (e.g., a sensor losing accuracy at extreme temperatures).

Deep Neural Networks (DNNs) can theoretically model this by outputting both a mean ($\mu$) and a variance ($\sigma^2$). In practice, however, this is notoriously unstable. The standard Negative Log-Likelihood (NLL) loss scales the gradients of the mean by the inverse of the predicted variance. This creates a vicious cycle: if the model underestimates noise, gradients explode; if it overestimates noise, the model stops learning the mean. Previous workarounds involved heuristics like stop-gradient operations or surrogate losses (e.g., $\beta$-NLL), which often compromise accuracy or require tedious hyperparameter tuning.

Proposed Methodology

To tackle these instabilities, the authors propose three major improvements:

  1. Natural Parametrization: Instead of predicting $\mu$ and $\sigma^2$, the network predicts the "natural parameters" of the Gaussian: $\eta_1 = \mu/\sigma^2$ and $\eta_2 = -1/2\sigma^2$. Common in Gaussian Processes but rare in DNNs, this formulation makes the optimization objective jointly concave in both parameters, leading to significantly more stable training.
  2. Scalable Laplace Approximation: Giving a network the freedom to explain away errors as noise often leads to overfitting. To prevent this, the authors use a linearized Laplace approximation, employing a Kronecker-factored (KFAC) Hessian approximation to make it computationally feasible for deep architectures.
  3. Empirical Bayes (EB): Using the Laplace approximation, the model calculates the "marginal likelihood." This allows it to automatically tune its own regularization (weight decay) per layer during training, eliminating the need for expensive hyperparameter grid searches.
Decomposition of epistemic and aleatoric uncertainty across different models.

Datasets and Benchmarks

The authors evaluated their approach across a diverse set of benchmarks, including standard UCI Regression datasets and a real-world CRISPR-Cas13 efficacy dataset where noise varies significantly.

Furthermore, they introduced a New Image Regression Benchmark using rotated MNIST and FashionMNIST. The target is the rotation angle, but the noise level is artificially tied to the image's class label (e.g., "1"s have low noise, "5"s have high noise). This rigorously tests the model's ability to learn complex, non-linear variance dependencies from high-dimensional inputs.

Rotated MNIST benchmark task, test NLL vs. regularization, and accuracy comparisons.

Key Insights and Results

  • Regularization is the Missing Link: The authors argue that the "compromised mean fits" reported in previous literature are fundamentally a regularization problem, not just an optimization one. By using Empirical Bayes to find the right amount of weight decay, the model perfectly balances fitting the mean and estimating the noise.
  • Uncertainty Decomposition: The closed-form posterior predictive provides a clean mathematical split between aleatoric uncertainty (inherent data noise) and epistemic uncertainty (the model's lack of knowledge). As shown in the 1D regression plots, the Heteroscedastic Laplace method successfully captures both, which is vital for safety-critical applications.
  • Superior Generalization and Stability: On UCI benchmarks, the "Natural Laplace" method achieved the highest test log-likelihood in most cases, outperforming baselines like $\beta$-NLL and MC-Dropout. The natural parametrization also proved significantly more robust to different initializations and learning rates.
  • Image Regression Success: On the new rotated image benchmark, Natural Laplace was the only method that successfully captured the label-dependent noise while maintaining a high-accuracy mean fit (achieving 76.8% accuracy compared to ~71% for baselines).

Limitations and Future Work

While powerful, the method assumes the conditional distribution of the target is Gaussian, which may struggle with multi-modal distributions or heavy-tailed noise. Additionally, the Laplace approximation is a "local" Bayesian method that approximates the posterior as a single Gaussian around a mode, potentially missing the full complexity of the neural network's weight space compared to more expensive methods like Hamiltonian Monte Carlo. Future directions include extending this framework to non-Gaussian likelihoods (like Poisson for count data) and exploring its use in active learning.

Summary updated

BibTeX
@inproceedings{immer2023effective,
  author = {Alexander Immer and Emanuele Palumbo and Alexander Marx and Julia E Vogt},
  title = {{Effective Bayesian Heteroscedastic Regression with Deep Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=A6EquH0enk},
}
Figure