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

Investigating the Histogram Loss in Regression

Ehsan Imani, Kai Luedemann, Sam Scholnick-Hughes, Esraa Elelimy, Martha White · OpenReview

Authors: Ehsan Imani, Kai Luedemann, Sam Scholnick-Hughes, Esraa Elelimy, Martha White

Abstract

It is becoming increasingly common in regression to train neural networks that model the entire distribution even if only the mean is required for prediction. This additional modeling often comes with performance gain and the reasons behind the improvement are not fully known. This paper investigates a recent approach to regression, the Histogram Loss, which involves learning the conditional distribution of the target variable by minimizing the cross-entropy between a target distribution and a flexible histogram prediction. We design theoretical and empirical analyses to determine why and when this performance gain appears, and how different components of the loss contribute to it. Our results suggest that the benefits of learning distributions in this setup come from improvements in optimization rather than modelling extra information. We then demonstrate the viability of the Histogram Loss in common deep learning applications without a need for costly hyperparameter tuning.

1. Introduction

In classical regression tasks, the standard approach is to minimize the squared-error ($\ell_2$) loss. This objective implicitly assumes that the target variable follows a Gaussian distribution and seeks to estimate its mean. However, recent empirical evidence suggests that neural networks often achieve superior performance when tasked with modeling the entire probability distribution of the target, even when the ultimate goal remains a single-point prediction. This paper investigates the Histogram Loss (HL) to uncover the mechanisms behind this performance gain.

2. The Histogram Loss Framework

The Histogram Loss approach discretizes the continuous target space into $k$ fixed bins. Instead of a single output neuron, the network employs a softmax layer to output a probability distribution across these bins, effectively predicting a histogram $h(\mathbf{x})$.

Overview of the Histogram Loss framework, illustrating the construction of a target distribution from data $(x_j, y_j)$ and the corresponding neural network prediction.

As shown in Figure 1, training involves constructing a target distribution from a single data point $y_j$. The authors explore three primary construction methods:

  1. HL-OneBin: Assigns all probability to the bin containing $y_j$, similar to standard classification.
  2. HL-Gaussian: Spreads probability across bins using a truncated Gaussian distribution centered at $y_j$, acting as a form of label smoothing.
  3. HL-Uniform: A mixture of a Dirac delta and a uniform distribution.
Detailed view of the histogram output $h_i(\mathbf{x})$ with defined bin edges $l_i$ and widths $w_i$, alongside the neural network architecture.

Figure 2 details the architectural implementation, where the input $\mathbf{x}$ is mapped through hidden layers to a final layer representing the histogram bins. The loss is calculated as the cross-entropy between the predicted histogram $h(\mathbf{x})$ and the constructed target distribution.

3. Theoretical and Empirical Analysis

A key contribution of this work is the theoretical analysis of the loss landscape. The authors demonstrate that HL-Gaussian possesses a locally Lipschitz constant that is significantly more stable than that of the $\ell_2$ loss. While the gradient of the $\ell_2$ loss grows linearly with the prediction error—potentially leading to unstable "exploding" updates when targets are distant—the gradient of HL-Gaussian is bounded. This property ensures more stable training and faster initial error reduction.

Furthermore, the authors address whether the performance gain stems from better internal representations (the auxiliary task hypothesis) or numerical optimization benefits. Through "representation swapping" experiments—where features learned by one loss were used to train the final layer of another—they found that HL does not necessarily learn "better" features. Instead, it enables the optimizer to find a superior set of weights within the same feature space, supporting the optimization hypothesis.

4. Experimental Evaluation

The efficacy of HL-Gaussian was evaluated across diverse domains:

  • Standard Regression: On the CT Position dataset, HL-Gaussian achieved a Test Mean Absolute Error (MAE) of 0.098, nearly halving the 0.176 achieved by $\ell_2$ loss.
  • Time Series Forecasting: Using the Electricity Transformer Dataset (ETD), an LSTM trained with HL-Gaussian reached a Test MSE of 0.1205, compared to 0.6067 for the $\ell_2$ baseline.
  • Reinforcement Learning: In state-value prediction for 55 Atari 2600 games, HL-Gaussian consistently outperformed $\ell_2$ in both RMSE and MAE.

Notably, these results were achieved using a robust "rule of thumb" for hyperparameters: 100 bins with a Gaussian standard deviation ($\sigma$) set to twice the bin width. This configuration proved effective across tasks without requiring extensive tuning.

5. Conclusion

The Histogram Loss offers a powerful alternative to standard regression objectives by improving the optimization landscape. While it requires prior knowledge of the target range and uses fixed binning, its robustness to noise and stability during training make it highly viable for deep learning applications. Future work may explore adaptive discretization to handle skewed distributions and the application of HL to simpler linear models.

Summary updated

BibTeX
@misc{imani2024investigating,
  author = {Ehsan Imani and Kai Luedemann and Sam Scholnick-Hughes and Esraa Elelimy and Martha White},
  title = {{Investigating the Histogram Loss in Regression}},
  year = {2024},
  eprint = {2402.13425},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.13425},
}
Figure