Practical Deep Heteroskedastic Regression

Mikkel Jordahn, Jonas Vestergaard Jensen, James Harrison, Michael Riis Andersen, Mikkel N. SchmidtarXiv 2026

TL;DR

Training deep neural networks to predict both the mean and input-dependent variance (heteroskedastic regression) typically breaks down due to optimization issues and feature loss. This paper introduces a simple, highly practical fix: freeze a standard pretrained mean-predicting network, and fit lightweight linear variance heads across its intermediate layers using a small hold-out dataset. This post-hoc approach achieves state-of-the-art uncertainty quantification without degrading prediction accuracy or adding computational overhead at inference time.

What Problem Does This Paper Address?

In risk-sensitive applications like molecular discovery or autonomous driving, deep learning models must not only make predictions but also express how certain they are about those predictions. When the uncertainty changes depending on the input (heteroskedasticity), standard practice is to train a network with two outputs: a mean ($\mu$) and a variance ($\sigma^2$), optimized using Gaussian Negative Log-Likelihood (NLL).

However, the authors identify four core pathologies that cause this end-to-end training approach to fail in over-parameterized deep networks:

  1. Optimization Issues: The gradients of the mean and variance are tightly coupled. If the network predicts a large variance for a data point early on, its learning slows down drastically, leading to poor mean predictions and inflated uncertainties.
  2. Last-Layer Representation Collapse: When a network is trained solely or primarily to predict the mean, it discards features that don't help minimize the mean error—even if those features are crucial for predicting variance.
  3. Residual Variance Overfitting: Modern deep networks easily interpolate the training data (benign overfitting), driving training residuals to zero. Estimating variance on the training set therefore generalizes poorly.
  4. Practicality Barriers: Existing fixes introduce complex hyperparameters that require expensive tuning over the entire dataset or degrade the model's primary prediction accuracy.

Methods

To solve all four problems simultaneously, the authors propose a decoupled, post-hoc method:

  1. Train the Backbone Normally: First, train a standard neural network to predict only the mean using standard Mean Squared Error (MSE) or Mean Absolute Error (MAE). This ensures maximum prediction accuracy.
  2. Freeze and Extract: Freeze the entire network backbone. Extract latent representations ($z^l$) from multiple intermediate layers, not just the final layer.
  3. Fit Linear Variance Heads: Using a small, independent hold-out dataset, train lightweight linear layers on top of these latent representations to predict variance by minimizing NLL.

The authors propose two variants for combining these layers:

  • The "All" Model: A single linear model that takes a concatenated sum of projections across all selected intermediate layers: $$\sigma^2_{\phi}(x^*) = \text{softplus}\left(\sum_{l \in L_\sigma} W_l^T z^l(x^*)\right)$$
  • The "Ensemble" Model: Train independent linear variance heads on individual layers separately, and combine them into a Gaussian mixture distribution at prediction time.

Datasets

The method was evaluated on challenging molecular regression tasks, where fast and accurate uncertainty quantification is essential for molecular simulations:

  • QM9: A standard benchmark dataset for predicting quantum chemical properties of small molecules. The PaiNN (Polarizable Atom Interaction Neural Network) architecture was used as the backbone.
  • OMol25: A massive, state-of-the-art dataset containing 100 million molecules. The authors applied their post-hoc method to large pretrained models (UMA and AllScAIP) to demonstrate scalability.
  • Alchemy: Used as an out-of-distribution (OOD) test set to evaluate how well the variance models detect unfamiliar data.

Key Insights and Ideas

  • Look Earlier in the Network: The most striking insight is that the final latent layer of a trained network is often the worst place to look for variance information due to representation collapse. Earlier layers retain a richer, more diverse set of features that are highly predictive of variance.
  • Decoupling is Safe: You do not need to train mean and variance jointly. Decoupling them completely protects the mean accuracy while allowing the variance model to be trained cleanly on a hold-out set where overfitting hasn't occurred.
  • Extreme Data Efficiency: Because the variance heads are strictly linear, they require very little data to generalize. The authors found the method works remarkably well with as few as 200 hold-out samples.

The phenomenon of representation collapse and why looking at earlier layers matters is conceptually illustrated by the authors:

Illustrative plot of representation collapse

Key Results

  • Superior Uncertainty Quantification: On the QM9 dataset, the post-hoc variance ensemble consistently outperformed or matched sophisticated end-to-end methods (like $\beta$-NLL and Faithful heteroskedastic regression) in terms of NLL, without sacrificing mean absolute error (MAE).
  • Scalability to Foundation Models: The method successfully equipped massive models trained on 100 million molecules (OMol25) with highly calibrated uncertainty estimates at a negligible computational cost.
  • Robustness to Hyperparameters: Unlike end-to-end methods that are highly sensitive to regularization, the post-hoc ensemble proved incredibly stable across a wide range of weight decay values ($\lambda$), as shown in their sensitivity analysis:
Figure 4. The effect of varying the weight decay parameter λ when fitting the linear uncertainty estimator using different individual representations zl, all representations, or an ensemble of the indi- vidual estimators. Results are test NLL averages over three seeds on the QM9 U target and are plotted with one standard error.

Limitations and Future Work

  • Out-of-Distribution (OOD) Trade-off: While the "Ensemble" variant achieved the best NLL scores due to its heavier-tailed distribution (which handles outliers gracefully), it performed slightly worse at sharp OOD detection and Expected Calibration Error (ECE) compared to the "All" variant.
  • Future Exploration of Dynamics: The authors note an unexpected finding: existing end-to-end methods actually rank uncertainties reasonably well but suffer from poor calibration (scale). They suggest that future work should investigate whether simple temperature scaling on end-to-end models might alleviate some optimization narratives in current literature.

Summary updated

BibTeX
@misc{jordahn2026practical,
  author = {Mikkel Jordahn and Jonas Vestergaard Jensen and James Harrison and Michael Riis Andersen and Mikkel N. Schmidt},
  title = {{Practical Deep Heteroskedastic Regression}},
  year = {2026},
  eprint = {2603.01750},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.01750},
}
Figure