Optimizing the CVaR via Sampling

Aviv Tamar, Yonatan Glassner, Shie Mannor

Introduction

In many domains, from finance to robotics, maximizing average outcomes is often insufficient; avoiding catastrophic failures is paramount. Conditional Value at Risk (CVaR), also known as Expected Shortfall, is a powerful risk measure that calculates the expected value of the worst $\alpha\%$ of outcomes. While optimizing CVaR is well-understood for fixed probability distributions, it presents significant challenges when actions change the underlying distribution—a common scenario in Reinforcement Learning (RL). Existing methods for this "distribution-dependent" case often lack theoretical convergence guarantees or fail to scale efficiently.

Methods

The authors address these challenges by developing a "Likelihood-Ratio" (LR) approach for CVaR optimization, introducing several key innovations:

  1. A New Gradient Formula: They derive a gradient for CVaR where the Value at Risk (VaR)—the $\alpha$-quantile of the distribution—acts as a natural "baseline." This mathematically justifies the use of quantiles in risk-sensitive policy gradients.
  2. GCVaR Estimator: They propose a Monte-Carlo sampling algorithm that first estimates the VaR from a batch of samples and then uses that estimate to compute the CVaR gradient.
  3. CVaRSGD: This estimator is integrated into a Stochastic Gradient Descent framework. The authors provide a rigorous proof that the estimator's bias (arising from using the same samples for VaR and gradient estimation) vanishes as the sample size increases, ensuring convergence to a local optimum.
  4. Importance Sampling (IS): To improve efficiency when dealing with rare tail events (small $\alpha$), the authors incorporate Importance Sampling, which focuses the agent's learning on the most critical "bad" outcomes.

Evaluation on Tetris

The method was evaluated using a modified Tetris environment. To make risk a critical factor, scoring was made non-linear: clearing 1, 2, 3, or 4 lines yielded 1, 4, 8, or 16 points, respectively. This setup forces the agent to choose between "playing it safe" (clearing single lines) and "taking risks" (waiting for a 4-line "Tetris" bonus).

Key Results and Insights

The CVaR-optimized agent (GCVaR) successfully prioritized stability over raw score maximization. As illustrated in the performance metrics, there is a clear trade-off: while the standard policy gradient achieves a higher average return, the GCVaR policy significantly improves the worst-case outcomes.

Performance comparison of GCVaR vs. Standard Policy Gradient. Subplots A and B demonstrate the trade-off between average return and CVaR. Subplot C shows the reduction in the reward distribution's left tail, while Subplot E highlights the convergence speedup provided by Importance Sampling.

Qualitative Risk Aversion

Analysis of the final policy weights (Subplot D) reveals that the CVaR agent learned to avoid "deep wells"—columns significantly lower than their neighbors. While wells are necessary for high-scoring 4-line clears, they increase the risk of a game-ending board state if the required piece does not arrive. The GCVaR agent preferred a flatter, safer board configuration.

Efficiency Gains

The inclusion of Importance Sampling (IS_GCVaR) proved highly effective. For extreme risk levels (e.g., $\alpha = 0.01$), IS improved the convergence rate by more than a factor of two compared to standard GCVaR (Subplot E).

Conclusion

This work provides a theoretically grounded and practical framework for risk-sensitive learning in distribution-dependent environments. By leveraging the VaR as a natural baseline and utilizing importance sampling, the proposed GCVaR method enables effective optimization of tail risks, offering a robust alternative to standard reward-maximization techniques in safety-critical applications.

Summary updated

BibTeX
@inproceedings{tamar2015optimizing,
  author = {Aviv Tamar and Yonatan Glassner and Shie Mannor},
  title = {{Optimizing the CVaR via Sampling}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2015},
  doi = {10.1609/aaai.v29i1.9561},
}
Figure