Papers
Topics
Authors
Recent
Search
2000 character limit reached

Computing Monetary Risk Measures in Linear Time

Published 6 Jul 2026 in cs.LG, cs.MS, and stat.AP | (2607.05078v1)

Abstract: Monetary risk measures have gained popularity for expressing decision-makers' risk aversion. Value-at-Risk (VaR) and Conditional-Value-at-Risk (CVaR), in particular, are used commonly for this purpose. This paper proposes new efficient algorithms to compute these risk measures for a discrete random variable in expected linear time with respect to the size of its domain. First, we propose a QuickVaR algorithm that computes the VaR of a discrete random variable. Then, we leverage QuickVaR to propose QuickDivergence, an algorithm for computing a class of $\varphi$-divergence risk measures, including the popular CVaR risk measure. The QuickVaR algorithm adapts the well-known Quickselect algorithm, while QuickDivergence builds on polymatroid optimization algorithms. Numerical results show that our new algorithms offer an order-of-magnitude speedup for large domains, and a library implementation of the algorithms is available at https://github.com/RiskAverseRL/RiskMeasures.jl.

Summary

  • The paper presents novel expected linear-time algorithms, QuickVaR and QuickDivergence, to compute VaR, CVaR, and related risk measures without relying on sorting.
  • The methodology leverages element-wise separable capacity functions and polymatroid optimization to efficiently handle large discrete distributions.
  • Numerical results and case studies demonstrate order-of-magnitude runtime improvements, making the methods practical for risk-sensitive applications.

Computing Monetary Risk Measures in Linear Time: An Expert Overview

Introduction and Motivation

Monetary risk measures—including Value-at-Risk (VaR) and Conditional-Value-at-Risk (CVaR)—are foundational tools for incorporating risk-averse decision-making in domains such as finance, robotics, and reinforcement learning. Traditional algorithms for computing these measures, especially on large discrete random variables, have Ω(nlogn)\Omega(n \log n) complexity due to reliance on sorting. This computational bottleneck hampers modern applications where risk measures are repeatedly evaluated within scalable machine learning or operational systems.

The discussed paper introduces novel, expected-linear-time algorithms for computing a broad class of risk measures—including VaR, CVaR, and related φ\varphi-divergence-based risk measures—over discrete random variables of arbitrary size. The central innovations are the QuickVaR and QuickDivergence algorithms, which avoid explicit sorting, resulting in order-of-magnitude empirical improvements in runtime without sacrificing accuracy.

Risk Measures and Theoretical Foundations

Monetary risk measures generalize the expectation to capture risk aversion. VaR at confidence level α\alpha is defined as the largest value such that the probability of outcomes below it does not exceed α\alpha:

VaRα[x~]=max{τ:P(x~<τ)α}\operatorname{VaR}_\alpha[\tilde{x}] = \max \{\tau : \mathbb{P}(\tilde{x} < \tau) \le \alpha \}

CVaR (also known as Expected Shortfall) as well as TVaR and EVaR, belong to a class of coherent, law-invariant risk measures expressible as optimization problems over the probability simplex, frequently involving additional convex constraints, e.g., via φ\varphi-divergences.

A central theoretical insight is that for coherent, comonotonic risk measures, the risk computation reduces to linear optimization over (normalized) polymatroids with a particular structure—specifically, those induced by "element-wise-separable" (EWS) capacity functions. These structural properties are harnessed for linear-time optimization. Figure 1

Figure 1: A comparison of risk measure values for a normal distribution (mean $0$, standard deviation $1$) as a function of the risk level α\alpha. CVaR and TVaR provide increasingly conservative risk estimation compared to classical VaR, giving tighter lower bounds for tail behavior.

QuickVaR: Linear-Time Value-at-Risk Computation

The canonical approach to computing VaR (and quantiles with general weights) requires sorting, resulting in Ω(nlogn)\Omega(n \log n) runtime. The QuickVaR algorithm presented in the paper generalizes the quickselect algorithm to handle arbitrary probability weights, computing VaR in expected φ\varphi0 time.

QuickVaR operates recursively:

  • It partitions the vector into elements less than, equal to, or greater than a randomly selected pivot.
  • Probability mass is accumulated for each partition, permitting efficient identification, via adapted recursion, of the index satisfying the VaR criterion:

φ\varphi1

  • The correctness and expected linear-time complexity are established using analogous arguments as for randomized quickselect, extended to weighted data.

Notably, QuickVaR extends naturally to measures like the weighted median but is uniquely correct for non-uniform weights and non-unique quantiles.

QuickDivergence: Linear-Time φ\varphi2-divergence Risk Measures

Many important risk measures—especially those arising in robust optimization and reinforcement learning—fall into the φ\varphi3-divergence family. This class includes CVaR, EVaR (entropic), and TVaR (total variation), all of which can be written as linear function minimization over subsets of the probability simplex subject to divergence-related constraints.

QuickDivergence exploits the structural observation that, for EWS polymatroid formulations, the classical greedy optimization can be performed without sorting, leading to φ\varphi4 algorithms:

  • The computation is reduced to evaluating the optimal allocation of probability mass according to element-wise thresholds, which QuickVaR efficiently determines.
  • The paper proves that the EWS property is met for CVaR and TVaR (with explicit capacity functions), thus allowing both to be computed in linear time.

Numerical Results

Empirical evaluation confirms substantial speedups for the proposed QuickVaR and QuickDivergence algorithms relative to sorting-based baselines across both synthetic and realistic data regimes. Figure 2

Figure 2

Figure 2: Empirical runtime of linear-time algorithms compared to standard sorting-based methods for uniform (left) and sparse (right) distributions, with φ\varphi5 confidence bands over repeated runs. Linear algorithms scale efficiently and increasingly outperform φ\varphi6 approaches as φ\varphi7 grows.

  • Both VaR and CVaR computations achieve order-of-magnitude runtime reductions at large φ\varphi8.
  • The improvements hold even for modestly sized domains, making these techniques practical for repeated application in high-frequency or high-volume settings.
  • Tables and additional case studies (e.g., financial portfolio scenarios) reinforce the practical dominance of the proposed algorithms for all tested settings.

Theoretical and Practical Implications

This work decisively resolves a long-standing computational bottleneck in evaluating key risk measures for large-scale discrete distributions. Theoretical contributions include:

  • Novel extension of randomized selection to the risk aggregation setting.
  • Polymatroidal methods tailored for EWS capacities common to important risk measures.
  • General framework extendable to new risk measures, provided they admit suitable decompositions.

Practically, the algorithms directly enable scalable deployment of risk-aware optimization and RL methods, particularly in AI domains that require frequent evaluation of complicated risk functionals as part of learning or planning loops. The resulting reductions in runtime can translate to substantially more efficient training and inference for risk-sensitive models in finance, robotics, and resource allocation.

Future Directions

Natural avenues for further research include:

  • Extending linear-time algorithms to other risk measures not covered by current EWS structure, such as EVaR or expectiles.
  • Exploring implications for continuous-domain problems via discretization or specialized optimization.
  • Leveraging these techniques within end-to-end differentiable pipelines for risk-averse learning.

Conclusion

The introduction of QuickVaR and QuickDivergence provides expected linear-time methods for exactly computing VaR, CVaR, and TVaR on discrete finite spaces, eliminating the need for sorting. Theoretical and empirical evidence supports significant computational acceleration, with clear benefits for large-scale, risk-sensitive AI and optimization tasks. Broader application and algorithmic generalization remain compelling topics for future work.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.