Faithful Heteroscedastic Regression with Neural Networks

Andrew Stirn, Harm Wessels, Megan Schertzer, Laura Pereira, Neville E. Sanjana, David A. Knowles

Introduction

In standard regression tasks, we often assume homoscedasticity—the assumption that the noise level in our data is constant across the entire input space. However, real-world phenomena are frequently heteroscedastic, meaning the variance of the noise depends on the input itself. For instance, in biological assays or financial forecasting, certain regions of the input space may be inherently more unpredictable than others. While neural networks are capable of modeling both the mean ($\mu$) and the variance ($\sigma^2$) by minimizing the Negative Log Likelihood (NLL), this approach often introduces a significant optimization challenge.

The Problem: Optimization Failure in NLL

When a neural network attempts to learn both the mean and variance simultaneously, it can fall into a "rich-get-richer" trap. If the model's mean prediction is initially poor for a specific data point, the NLL loss can be minimized in two ways: by improving the mean estimate or by simply increasing the predicted variance. Often, the optimizer takes the path of least resistance, inflating the variance to "explain away" the mean's error. This reduces the gradient signal for the mean, leading to a model that is less accurate than a simpler homoscedastic model that ignores variance entirely. The authors define a model as "faithful" only if the inclusion of a variance-modeling component does not degrade the accuracy of its mean estimates.

Proposed Methodology: Faithful Heteroscedastic Regression

To address this, the authors propose two surgical modifications to the standard NLL optimization process, ensuring that the mean prediction remains as accurate as a standard Squared Error Loss (SEL) baseline.

Architecture and gradient flow of the Faithful Heteroscedastic model.
  1. Proposal 1: Mean Gradient Scaling. The authors modify the gradient of the mean by scaling it by the predicted variance. This transformation effectively turns the mean update into a Newton-like step. Mathematically, this ensures that the optimization path for the mean is identical to that of a model minimizing standard Squared Error Loss, regardless of the current variance estimate.
  2. Proposal 2: Gradient Shielding. To prevent the variance objective from "corrupting" the shared feature space, a "stop-gradient" operation is applied. This ensures that the parameters of the network's "trunk" (the shared feature extractor) are updated solely based on the mean prediction error. The variance head is then trained to explain the residual errors without influencing the underlying features used for the mean.

Experimental Results

The proposed method was evaluated across a diverse set of benchmarks, ranging from synthetic 1D regression to complex biological sequence data.

Comparison of regression methods on 1D synthetic data over 20,000 epochs.

In 1D synthetic tests (Figure 2), the "Faithful" model was the only heteroscedastic approach that successfully converged on isolated data points. Other methods, such as Conventional Heteroscedastic regression or Beta-NLL, often assigned these points near-infinite variance, effectively "giving up" on learning their mean values.

On the UCI regression repository, the Faithful model consistently matched the Root Mean Squared Error (RMSE) of mean-only baselines while achieving superior uncertainty calibration (measured by Expected Calibration Error). In Variational Autoencoder (VAE) experiments using MNIST, the method successfully decomposed uncertainty into aleatoric and epistemic components, recovering the "true" noise variance added to the images—a feat standard models failed to achieve.

Finally, in a biological application involving CRISPR-Cas13 knockdown efficacy, the model revealed that more effective guides tend to exhibit higher variance. This discovery highlights the practical utility of faithful uncertainty estimation in scientific discovery, where understanding the reliability of a prediction is as crucial as the prediction itself.

Conclusion

Faithful Heteroscedastic Regression provides a theoretical and practical framework for stable uncertainty estimation in neural networks. By decoupling the optimization of the mean and variance, the authors ensure that modeling noise remains a beneficial "add-on" rather than a liability to predictive accuracy.

Summary updated

BibTeX
@inproceedings{stirn2023faithful,
  author = {Andrew Stirn and Harm Wessels and Megan Schertzer and Laura Pereira and Neville E. Sanjana and David A. Knowles},
  title = {{Faithful Heteroscedastic Regression with Neural Networks}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
}
Figure