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

Non-Negative Bregman Divergence Minimization for Deep Direct Density Ratio Estimation

Masahiro Kato, Takeshi Teshima

Density Ratio Estimation (DRE) is a quiet workhorse in machine learning. Whether dealing with covariate shift, anomaly detection, or learning from positive and unlabeled (PU) data, practitioners often need to estimate the ratio between two probability densities: $r(x) = p(x)/q(x)$.

1D illustration of a density ratio $r(x)$ alongside samples from the numerator and denominator distributions.

In a paper presented at ICML 2021, Masahiro Kato and Takeshi Teshima tackle a major roadblock: why do our best density ratio estimators fall apart when we try to scale them with deep neural networks?

The Problem: Train-Loss Hacking

The gold standard for DRE is Bregman Divergence (BD) minimization. It provides a flexible framework to estimate the ratio $r(x)$ directly, bypassing the much harder problem of estimating the individual densities $p(x)$ and $q(x)$ first.

However, there is a catch. When a high-capacity model—like a deep neural network—is plugged into a standard BD objective, it often suffers from train-loss hacking. Because we work with finite samples rather than infinite populations, a flexible model can find "holes" in the data. It learns to make the estimated ratio extremely large on specific points from the numerator distribution while ignoring the denominator. This causes the empirical loss to plummet toward negative infinity. The result is a model that appears to have perfect training loss but is completely useless for real-world tasks.

The Solution: Deep Direct Density Ratio Estimation (D3RE)

To solve this, the authors propose a "non-negative correction" to the empirical BD estimator, introducing D3RE. Their approach involves three key steps:

  1. Decomposition: They rewrite the standard Bregman Divergence objective into two distinct parts.
  2. Identifying Non-negativity: They prove that one of these parts is theoretically non-negative in the population limit (i.e., if we had infinite data).
  3. The "nnBD" Fix: In the real world with finite samples, this specific term can become negative, triggering the train-loss hacking. To fix this, they wrap that term in a $(\cdot)_+$ operator (essentially a ReLU). If the term tries to go negative, it is forced back to zero.

This mathematically grounded change prevents the optimizer from chasing fake negative rewards. They also provide a stochastic optimization algorithm that can optionally use a gradient ascent heuristic to push the model out of unstable regions during training.

Key Results and Insights

The researchers evaluated D3RE across synthetic datasets and image benchmarks (MNIST, CIFAR-10, Fashion-MNIST), focusing primarily on inlier-based anomaly detection.

Training curves demonstrating the stability of nnBD methods (D3RE) compared to standard neural DRE methods which frequently diverge.
  • Stability over Divergence: In experiments with CIFAR-10, standard neural DRE methods (like uLSIF-NN) frequently diverged or produced nonsensical results. In contrast, D3RE remained completely stable throughout training.
  • Superior Anomaly Detection: On CIFAR-10, D3RE improved the average Area Under the ROC Curve (AUROC) by a massive 0.157 compared to the uncorrected neural baseline. It consistently beat traditional linear-in-parameter models and naively capped neural models, often outperforming specialized anomaly detection algorithms like Deep SAD.
  • The Connection to PU Learning: The paper elegantly links DRE to Positive-Unlabeled (PU) learning, showing that the "class-prior" in PU learning acts as an upper bound on the density ratio. This insight allows them to adapt successful ideas from non-negative PU learning into the broader DRE domain.
  • Robustness to Hyperparameters: D3RE requires a constant $C$ related to the upper bound of the density ratio. Crucially, the authors found that a perfect estimate isn't necessary; even a loose, safe guess for $C$ is enough to stabilize training.

Limitations and Future Work

While robust, the method assumes the density ratio $r(x)$ is bounded. If the distributions have non-overlapping supports where the ratio truly goes to infinity, these assumptions might be challenged. Additionally, the gradient ascent trick used to improve performance is a heuristic that practitioners will need to tune.

Despite these limitations, D3RE represents a significant step forward. While the paper focuses heavily on anomaly detection, the authors suggest this stabilized estimator could be a game-changer for causal inference and covariate shift adaptation in the deep learning era.

Summary updated

BibTeX
@inproceedings{kato2021non,
  author = {Masahiro Kato and Takeshi Teshima},
  title = {{Non-Negative Bregman Divergence Minimization for Deep Direct Density Ratio Estimation}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
}
Figure