TL;DR
Optimizing objectives that contain the LogSumExp function is notoriously difficult at scale due to biased mini-batch gradients and numerical overflow from exponential terms. This paper introduces a novel, convexity-preserving approximation of LogSumExp rooted in a new mathematical framework called the "Safe KL divergence." By replacing raw exponentials with a rescaled SoftPlus function, the proposed method enables stable, unbiased stochastic gradient optimization for large-scale problems like optimal transport and distributionally robust optimization.
What Problem Does This Paper Address?
The LogSumExp function (and its continuous counterpart, the log-partition functional) is a foundational component in machine learning. It appears everywhere from softmax classification and variational inference to entropy-regularized Optimal Transport (eOT) and Distributionally Robust Optimization (DRO).
However, optimizing LogSumExp at scale presents two major challenges:
- The Mini-batch Bias: When the number of exponential terms is massive or infinite, calculating the exact gradient requires evaluating every single term. If you try to approximate this by subsampling a mini-batch, putting the expectation inside the logarithm introduces a severe mathematical bias.
- Numerical Instability (Overflow): Computing raw exponentials ($e^x$) frequently triggers floating-point overflows, especially when regularization parameters are small. For instance, standard single-precision floats (
float32) overflow easily when evaluating sharp exponential penalties.
The authors set out to find an approximation of LogSumExp that preserves its core geometric properties (like convexity and smoothness) while making it safe and unbiased for standard Stochastic Gradient Descent (SGD).
Methods
Instead of inventing a new optimization algorithm, the authors modify the objective function itself using convex duality.
They start with the classic Gibbs variational principle, which relates LogSumExp to the Kullback-Leibler (KL) divergence. They swap the standard KL divergence for a newly defined $f$-divergence called the Safe KL divergence ($D_\rho$).
The Safe KL divergence introduces a tuning parameter $\rho \in (0, 1)$ that places a hard upper bound ($1/\rho$) on the density reweighting factor. When you derive the dual form of this new objective, the troublesome exponential function is naturally replaced by a rescaled SoftPlus function:
$$\text{SoftPlus}_\rho(s) = \frac{1}{\rho} \log(1 + \rho e^s) - 1$$
This mathematical pivot accomplishes two things:
- It moves the expectation outside of the logarithm, allowing for completely unbiased stochastic gradient estimation.
- It tames the explosive growth of the exponential function, preventing numerical overflow.
The authors prove that as $\rho \to 0$, this formulation converges exactly to the original LogSumExp function, giving practitioners explicit control over the approximation accuracy.
Datasets
The authors evaluated their method across three distinct machine learning tasks using several standard datasets:
- MNIST & EMNIST-letters: Used to simulate continuous distributions for continuous entropy-regularized optimal transport and Unbalanced DRO.
- California Housing Dataset: Used to evaluate DRO under standard KL-divergence constraints.
- ACS PUMS (via Folktables): Used to test distributionally robust linear regression under real-world train-test distribution shifts (e.g., training on high-income states and testing on low-income states).
Key Insights and Ideas
- Pulling the Expectation Out: The "aha moment" of the paper is using the variational dual form to structurally alter the objective. Moving the expectation outside the logarithm completely sidesteps the batch-size-dependent bias that plagues standard mini-batch LogSumExp approximations.
- SoftPlus as a Numerical Shield: Replacing $e^x$ with $\log(1 + e^x)$ acts as a natural buffer. Even if the inner term grows, the outer logarithm keeps the gradient magnitudes controlled, allowing for much larger, more stable learning rates.
- A Bridge to CVaR: The authors reveal a fascinating theoretical connection: the Safe KL approximation structurally bridges LogSumExp minimization and Conditional Value-at-Risk (CVaR) optimization, showing they are limit cases of the same broader functional family.
Key Results
The proposed Safe KL approach consistently outperformed application-specific baselines in stability and convergence speed:
- Continuous Optimal Transport: In weak regularization regimes ($\epsilon = 10^{-2}, 10^{-4}$), the standard baseline (Large-Scale Optimal Transport / LSOT) frequently crashed due to numerical overflow unless the learning rate was kept prohibitively small. The proposed method remained perfectly stable, converging rapidly with larger stepsizes.
- Robustness to Batch Size: In DRO experiments on the California Housing dataset, the proposed method significantly outperformed the baseline when using small mini-batches ($|D| = 10$ or $10^2$), thanks to its unbiased gradient estimators.
- Label Noise Resilience: Under severe label corruption (up to 85% noise on MNIST), the Safe KL approach achieved lower robust objective values, which translated directly into better downstream classification metrics like worst-class accuracy and ROC AUC.
Limitations and Future Work
While powerful, the method has a few limitations:
- Altering the Objective: Because Safe KL modifies the underlying divergence metric, any application-specific structural properties guaranteed by a pure KL divergence must be re-evaluated under the Safe KL framework.
- Hyperparameter Tuning: The parameter $\rho$ controls the bias-stability tradeoff. While the authors found that intermediate values like $\rho = 10^{-3}$ generally provide an excellent trade-off, an automated, adaptive procedure for selecting $\rho$ dynamically during training remains an open area for future research.
Summary updated