Stochastic Optimization for Spectral Risk Measures

Ronak Mehta, Vincent Roulet, Krishna Pillutla, Lang Liu, Zaïd Harchaoui

Abstract

Spectral risk objectives – also called L-risks – allow for learning systems to interpolate between optimizing average-case performance (as in empirical risk minimization) and worst-case performance on a task. We develop LSVRG, a stochastic algorithm to optimize these quantities by characterizing their subdifferential and addressing challenges such as biasedness of subgradient estimates and non-smoothness of the objective. We show theoretically and experimentally that out-of-the-box approaches such as stochastic subgradient and dual averaging can be hindered by bias, whereas our approach exhibits linear convergence.

Introduction

Most machine learning models are trained using Empirical Risk Minimization (ERM), which minimizes the average loss across a dataset. While effective, ERM can fail in "tail" scenarios—situations where a model performs well on average but fails catastrophically on a small subset of difficult or outlier examples. This is a critical issue in high-stakes fields like financial regulation, energy planning, and safety-critical AI.

Spectral Risk Measures (L-risks) offer a solution by allowing practitioners to weight losses differently based on their rank. For example, one might put more weight on the top 10% of highest losses to ensure the model is robust against outliers or rare events.

Spectral Risk Measures and Their Challenges

L-risks interpolate between average and worst-case scenarios by applying a weight function $s(t)$ to the sorted losses. Common examples include the Superquantile (focusing only on the worst $k$ losses) and the Extremile (a smoother tail-focused measure).

Visualizing different Spectral Risk Measures (L-risks) and their corresponding weight functions $s(t)$.

Despite their utility, optimizing L-risks is notoriously difficult due to three primary factors:

  1. Non-smoothness: The objective involves sorting losses, which creates "kinks" in the optimization landscape.
  2. Bias: Standard minibatch SGD produces biased gradient estimates because a small sample rarely represents the true "tail" of the full distribution.
  3. Complexity: Full-batch methods are too slow for large datasets, requiring $O(n \log n)$ operations just to sort the losses every iteration.

The LSVRG Algorithm

To address these challenges, we introduce LSVRG (L-statistic Stochastic Variance Reduced Gradient). This algorithm adapts the popular SVRG framework to the specific structure of L-risks. Key technical components include:

  • Subdifferential Characterization: We formally define how to compute subgradients for objectives based on order statistics (sorted losses).
  • Variance Reduction: By using a periodic full-batch gradient "checkpoint," LSVRG cancels out the noise and bias inherent in minibatch estimates of the tail.
  • Smoothing via Isotonic Regression: To handle non-smoothness, we analyze a smoothed version of the objective. The gradient of this approximation can be computed efficiently using the Pool Adjacent Violators (PAV) algorithm for isotonic regression in $O(n \log n)$ time.
  • Sorting Stability: We exploit the observation that as the model converges, the relative ordering of the losses tends to stabilize. This allows LSVRG to achieve a per-iteration complexity of $O(1)$ gradient calls and $O(\log n)$ elementary operations.

Experimental Evaluation

We evaluated LSVRG across a diverse range of tasks, including regression (yacht, energy, concrete), classification (iWildCam, Emotion), and unsupervised clustering (MNIST, FashionMNIST).

  • Linear Convergence: In regression tasks, LSVRG consistently exhibited a linear drop in suboptimality, whereas out-of-the-box stochastic methods like SGD and SRDA plateaued or converged much slower. On the "concrete" dataset, LSVRG achieved up to 4 orders of magnitude improvement in precision for a given time budget.
  • Tail Control: On the iWildCam and Emotion datasets, models trained with L-risks via LSVRG showed significantly lower "tail" losses (the 95th-99th percentiles) compared to standard ERM, without sacrificing average performance.
  • Robustness: In the presence of outliers, LSVRG-based clustering correctly identified cluster centers that vanilla k-means missed due to being "pulled" by outliers.

Conclusion

LSVRG provides the first approach to achieve linear convergence for Spectral Risk Measures while maintaining low per-iteration complexity. While the "Superquantile" remains a challenge due to its discontinuous spectrum, LSVRG shows dramatic improvements for smoother measures like the Extremile. Future research will focus on extending these linear convergence proofs to non-convex regimes, such as deep neural networks.

Summary updated

BibTeX
@inproceedings{mehta2023stochastic,
  author = {Ronak Mehta and Vincent Roulet and Krishna Pillutla and Lang Liu and Zaïd Harchaoui},
  title = {{Stochastic Optimization for Spectral Risk Measures}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
  url = {https://openreview.net/forum?id=GoN7nWvknL},
}
Figure