---
title: Variance-Based Penalties in Optimization
url: https://www.emergentmind.com/topics/variance-based-penalty
type: topic
---

# Variance-Based Penalties in Optimization

A variance-based penalty is an objective modification in which a primary criterion—typically expected return, empirical risk, or expected cost—is augmented by a term proportional to a variance or variance-derived dispersion functional. In the supplied literature, this pattern appears in mean–variance reinforcement learning, variance-penalized distributionally robust optimization, empirical Bernstein-type statistical learning, domain generalization via cross-domain risk dispersion, and portfolio selection with explicit covariance terms. Canonical instances include the mean–variance reinforcement learning objective
\[
\max_\pi \; \mathbb{E}[G_0] - \lambda\,\mathbb{V}[G_0],
\]
the variance-penalized DRO problem
\[
\min_{x\in \mathcal{X}} \sup_{Q\in\mathcal{U}} \left\{ E_Q[\rho_x] + \operatorname{Var}_Q[\phi_x] \right\},
\]
and sample variance penalization
\[
SVP_{\lambda}(\mathbf{X}) \;=\; \arg\min_{f\in\mathcal{F}} \; P_n(f,\mathbf{X}) \;+\; \lambda \sqrt{\frac{V_n(f,\mathbf{X})}{n}}.
\]
Across these settings, the variance term is used either as a risk surrogate, a robustness regularizer, or a device for balancing approximation and estimation error [2504.11412] [2009.09264] [0907.3740].

## 1. Formal structure and representative objective classes

The common template is a mean–dispersion tradeoff. In reinforcement learning, the return random variable is
\[
G_0 \overset{\mathrm{def}{=} \sum_{t=0}^{T-1} \gamma^t R_{t+1},
\]
and the variance penalty instantiates a generic mean–variability objective
\[
\max_\pi \; \mathbb{E}[G_0] - \lambda\, \mathbb{D}[G_0]
\]
by choosing \(\mathbb{D}[G_0] = \mathbb{V}[G_0]\). In stochastic and robust optimization, the corresponding structure is an expected cost plus a variance penalty, for example
\[
H[P,x] = E_P[\rho_x] + \operatorname{Var}_P[\phi_x].
\]
In statistical learning, the role of the variance term is played by an empirical loss variance or sample variance, while in domain generalization it is the empirical standard deviation or variance of domainwise risks [2504.11412] [2009.09264] [0907.3740] [2006.07544].

The variance itself is used in its standard form
\[
\mathbb{V}[X] \;=\; \mathbb{E}\big[(X-\mathbb{E}[X])^2\big] \;=\; \mathbb{E}[X^2] - (\mathbb{E}[X])^2,
\]
but the supplied literature also treats empirically estimated analogues and closely related cross-domain dispersion functionals. A notable distinction is whether the penalty is quadratic in deviations, as with variance, or linear in deviations, as with standard-deviation- or MAD-type objectives; that distinction is central to several of the instability and robustness results discussed later.

| Setting | Penalized objective | Penalized quantity |
|---|---|---|
| Risk-averse RL | \(\mathbb{E}[G_0]-\lambda\,\mathbb{V}[G_0]\) | Return variance |
| VP-DRO | \(E_Q[\rho_x]+\operatorname{Var}_Q[\phi_x]\) | Variance under ambiguity |
| SVP | \(P_n(f,\mathbf{X})+\lambda\sqrt{V_n(f,\mathbf{X})/n}\) | Sample variance of loss |
| RVP | \(\frac{1}{n}\mathbf{1}^\top \hat r_n(h)+\lambda\, s_n(\hat r_n(h))\) | Dispersion of domain risks |
| Extended portfolio model | \(\lambda_1 x^TAx\) inside the objective | Covariance-based variance term |

A plausible implication is that “variance-based penalty” is not a single algorithmic motif but a family of objective perturbations whose shared feature is explicit penalization of second-order dispersion. The concrete computational consequences, however, differ sharply by domain.

## 2. Reinforcement learning and Markovian reward optimization

In policy-gradient reinforcement learning, variance is treated as a canonical measure of variability. For a policy \(\pi_\theta\), the gradient of the variance satisfies
\[
\nabla_\theta \mathbb{V}[X] = \nabla_\theta \mathbb{E}[X^2] - 2\,\mathbb{E}[X]\,\nabla_\theta \mathbb{E}[X],
\]
which yields, for \(X=G_0\),
\[
\nabla_\theta \left( \mathbb{E}[G_0] - \lambda\,\mathbb{V}[G_0] \right)
=
\nabla_\theta \mathbb{E}[G_0]
-
\lambda\left(
\nabla_\theta \mathbb{E}[G_0^2]
-
2\,\mathbb{E}[G_0]\,\nabla_\theta \mathbb{E}[G_0]
\right).
\]
The literature emphasizes three structural consequences of this formula: the appearance of \(\nabla_\theta \mathbb{E}[G_0^2]\) and therefore squared returns, the “double sampling” requirement for unbiased estimation of \(\mathbb{E}[G_0]\nabla_\theta \mathbb{E}[G_0]\), and the non–positive-homogeneity of variance under reward rescaling. In REINFORCE and PPO, variance is incorporated through the generic update
\[
\theta \leftarrow \theta + \alpha_\theta\big(\text{mean\_grad} - \lambda \,\text{variability\_grad}\big),
\]
but the empirical study reports that Variance and Semi\_Variance exhibit unstable updates, high gradient variance, and difficulty in selecting stable hyperparameters; in several Mujoco plots they are omitted because they fail to learn a reasonable policy [2504.11412].

A distinct actor–critic line of work uses a direct temporal-difference estimator of return variance rather than a second-moment surrogate. With
\[
\delta_t = R_t + \gamma V^\pi(S_{t+1}) - V^\pi(S_t),
\]
the variance function satisfies
\[
\sigma_\pi^2(s) = \mathbb{E}_\pi\!\left[\delta_t^2 + \gamma^2 \sigma_\pi^2(S_{t+1}) \,\Big|\, S_t = s\right].
\]
This leads to a direct variance TD target
\[
U_t = \delta_t^2 + \gamma^2 \hat \sigma(S_{t+1}; w),
\]
and to actor updates of the form
\[
\theta_{t+1} = \theta_t + \alpha_\theta \, \nabla_\theta \log \pi_{\theta_t}(A_t \mid S_t)
\left[
\delta_t - \lambda \left( \delta_t^2 + \gamma^2 \sigma(S_{t+1}; w_t) - \sigma(S_t; w_t) \right)
\right].
\]
The reported result is convergence to locally optimal policies for finite state–action MDPs, both on-policy and off-policy, while reducing variance of returns and maintaining competitive mean return [2102.01985].

For total-reward MDPs, the variance-penalized expectation
\[
VPE[\lambda]^S(rew) \;=\; \mathbb{E}^S(rew) - \lambda\, V^S(rew)
\]
induces a structural pathology: optimal schedulers can be eventually reward-minimizing, meaning that once enough reward has accumulated they minimize future expected rewards. The supplied analysis treats this as conceptually undesirable for risk aversion, because it suppresses additional gains on already favorable trajectories. Semi-variance does not remove the problem: for any \(\lambda>0\), there exist MDPs in which every SVPE-optimal scheduler is eventually reward-minimizing [2407.06887].

## 3. Distributionally robust and convex-analytic formulations

Variance penalties are especially significant in DRO because \(\operatorname{Var}_Q[\phi] = E_Q[\phi^2] - (E_Q[\phi])^2\) is nonconvex in the distribution \(Q\). Nevertheless, for
\[
\sup_{Q : D_f(Q,P)\le \eta} \left\{E_Q[\rho] + \operatorname{Var}_Q[\phi]\right\},
\]
an exact finite-dimensional convex reformulation is available:
\[
\sup_{Q: D_f(Q,P)\leq\eta}\{E_Q[\rho] + \operatorname{Var}_Q[\phi]\}
=
\inf_{\lambda>0,\ \beta\in\mathbb{R},\ \nu\in\mathbb{R}}
\left\{
\frac{\nu^2}{4} + \beta + \eta\lambda
+ \lambda E_P\!\left[ f^*\!\left(\frac{\rho+\phi^2 - \nu\phi - \beta}{\lambda}\right) \right]
\right\}.
\]
The right-hand side is convex in \((\lambda,\beta,\nu)\), and the equality is tight rather than merely upper-bounding. This turns an infinite-dimensional robust maximization over measures into a finite-dimensional convex program and simultaneously yields tight uncertainty-quantification bounds for variance under model misspecification [2009.09264].

A related but distinct construction appears in convex stochastic optimization. There, a \(\chi^2\)-DRO neighborhood around the empirical distribution yields the robust empirical risk
\[
\mathcal R_n(\theta;\mathcal P_n) =\sup_{P\in\mathcal P_n(\rho)}\E_P[\ell(\theta,X)].
\]
For bounded loss, this objective admits a variance expansion of the form
\[
\mathcal R_n(\theta;\mathcal P_n)
=
\hat \E[\ell(\theta,X)]
+
\sqrt{\frac{2\rho}{n}\,\Var_{\hat P}(\ell(\theta,X))}
+
\varepsilon_n(\theta),
\]
with \(\varepsilon_n(\theta)\le 0\) and \(O_P(1/n)\), and it is convex whenever \(\ell(\cdot;x)\) is convex. This supplies a convex surrogate for direct empirical variance regularization, which is generally nonconvex even when the loss itself is convex [1610.02581].

These two lines are mathematically aligned in one specific sense: both replace a direct optimization over a nonconvex variance-penalized criterion by a tractable convex object whose dependence on variance is preserved exactly or asymptotically. This suggests that robust duality is one of the principal routes by which variance penalties become computationally usable in high-dimensional settings.

## 4. Statistical learning, empirical Bernstein control, and domain-level risk dispersion

In classical learning theory, variance-based penalties arise from variance-sensitive concentration bounds. Given \(\mathbf{Z}=(Z_1,\dots,Z_n)\), the sample variance is defined symmetrically as
\[
V_n(\mathbf{Z}) \;=\; \frac{1}{n(n-1)} \sum_{1\le i<j\le n} (Z_i - Z_j)^2,
\]
and empirical Bernstein inequalities replace the unknown variance in Bennett-type bounds by \(V_n\). This leads directly to sample variance penalization,
\[
SVP_{\lambda}(\mathbf{X}) \;=\; \arg\min_{f\in\mathcal{F}} \; P_n(f,\mathbf{X}) \;+\; \lambda \sqrt{\frac{V_n(f,\mathbf{X})}{n}}.
\]
The corresponding excess-risk guarantee is variance-sensitive: for suitable \(\lambda\), the excess risk of \(SVP_\lambda\) is bounded in terms of \(V(f^\ast,\mu)\), the variance of an optimal hypothesis. When \(V(f^\ast,\mu)=0\), the bound becomes essentially \(O(\ln \mathcal{M}(n)/n)\), and the paper gives a finite-class example in which SVP achieves \(O(1/n)\) while ERM remains at \(O(1/\sqrt{n})\) [0907.3740].

In domain generalization, the same broad idea is transferred from samplewise loss dispersion to domainwise risk dispersion. With empirical domain-risk vector
\[
\hat r_n(h) := [\ldots,\hat R_m(h,e),\ldots] \in \mathbb{R}^n,
\]
V‑REx uses
\[
\mathcal{L}_{\text{v-rex}}(h) = \frac{1}{n}\mathbf{1}^\top \hat r_n(h) + \beta\, s_n^2(\hat r_n(h)),
\]
whereas Risk Variance Penalization uses
\[
\mathcal{L}_{\text{rvp}}(h) = \frac{1}{n}\mathbf{1}^\top \hat r_n(h) + \lambda\, s_n(\hat r_n(h)).
\]
The supplied analysis shows that RVP arises from a quasi-DRO problem over domain weights, establishes pointwise and uniform links between the min–max formulation and the mean-plus-dispersion objective, and gives an asymptotic tuning rule
\[
\lambda = \frac{\Phi^{-1}(1-\gamma)}{\sqrt{n}}.
\]
The stated interpretation is that \(\mathcal{L}_{\text{rvp}}\) acts asymptotically as an upper confidence bound on the average domain risk, while empirically improving worst-domain behavior under appropriate domain diversity [2006.07544].

A plausible synthesis of these two literatures is that variance-based penalties in learning serve two formally different but structurally related roles: they either tighten risk upper bounds by exploiting low empirical variance, or they encode robustness against cross-domain heterogeneity by shrinking the dispersion of domainwise losses.

## 5. Portfolio optimization and variance-component interpretations

In portfolio optimization, variance-based penalties appear both directly as quadratic risk terms and indirectly through variance-component parameterizations. An extended mean–variance–CVaR portfolio model with short selling and cardinality constraints uses the objective
\[
f(x) := \lambda_1 x^TAx - \lambda_2\big(\Psi^Tx - \delta\|x-\phi\|_1\big)
+ \lambda_3\Big( \gamma + \frac{1}{m(1-\beta)}\sum_{j=1}^m (-d_j^Tx - \gamma)^+ \Big),
\]
where \(\lambda_1 x^T A x\) is the variance term. After splitting variables and introducing the quadratic penalty
\[
\rho\big(\|x-y\|_2^2 + \|x-z\|_2^2 + \|x-w\|_2^2\big),
\]
the \(x\)-subproblem becomes a strictly convex quadratic program with
\[
B := \lambda_1A + 3\rho I,
\]
which is positive definite for any \(\rho>0\). This yields a closed-form \(x\)-update inside a penalty-decomposition plus block-coordinate-descent scheme. The paper reports that Algorithm 2 is about twice as fast as PADM and achieves small gaps relative to direct CVX–MOSEK solutions on the S\&P-based instances considered [2404.00605].

A different variance-based interpretation arises in high-dimensional ridge regression. Under the Gaussian random-effects model
\[
\beta \sim \mathcal{N}(0,\tau^2 I_p), \qquad \varepsilon \sim \mathcal{N}(0,\sigma^2 I_n),
\]
the ridge penalty is not an external hyperparameter but the variance ratio
\[
\lambda = \frac{\sigma^2}{\tau^2}.
\]
The same variance components define the heritability index
\[
h^2 = \frac{p\tau^2}{p\tau^2 + \sigma^2}.
\]
Maximum marginal likelihood is then used to estimate \((\sigma^2,\tau^2)\), and therefore \(\lambda\), directly from the marginal model. The supplied study reports good performance of MML relative to CV, and for Poisson and Binomial ridge regression it reports superior accuracy of the resulting MML estimator of \(\lambda\) as compared to CV [1902.02623].

These two examples use the word “variance” differently. In the portfolio model it is a direct penalized quadratic form in the decision variable, whereas in ridge-type models it is a latent variance-component ratio that determines the strength of an \(L_2\) penalty. In both cases, however, the penalty magnitude is controlled by second-order structure.

## 6. Failure modes, critical phenomena, and alternatives to direct variance penalization

The most consistent negative result in the supplied literature is that direct variance penalties are often theoretically natural but operationally brittle. In policy-gradient RL, the quadratic return term \(R_\tau^2\), the need for double sampling, and non–positive-homogeneity make variance-based penalties highly sensitive to scale and sample noise; empirically, Variance and Semi\_Variance are “not recommended in practice” relative to CVaR Deviation, Gini Deviation, Mean Deviation, and Semi\_STD [2504.11412].

For accumulated rewards in MDPs, the critique is more structural. Variance-penalized expectation and semi-variance-penalized expectation can force eventually reward-minimizing behavior, whereas MADPE with \(\lambda \le 1/2\), SMADPE with \(\lambda \le 1\), and threshold-based penalties admit eventually reward-maximizing optimal schedulers. The threshold-based objective
\[
TBP_t^\lambda(x) = x - \lambda\, \max(t-x,0)
\]
is especially notable because once \(x \ge t\), the penalty vanishes and the objective coincides with expected reward, thereby avoiding the suppression of good right-tail outcomes [2407.06887].

High-dimensional portfolio variance optimization under asymmetric \(\ell_1\) regularization exhibits a separate critical phenomenon. The supplied replica analysis states that regularization extends the interval where the optimization can be carried out and suppresses large sample fluctuations, but that the performance of \(\ell_1\) regularization is “rather disappointing”: if \(r=N/T\) is small, the regularizer does not play any role, while where it becomes active the estimation error is already very large. The same analysis finds that \(\ell_1\) regularization can eliminate at most half the assets, and that there is a critical ratio \(r=2\) beyond which the \(\ell_1\)-regularized variance cannot be optimized because the regularized variance becomes constant over the simplex [1709.08755].

An adjacent response to these issues is to avoid explicit variance minimization while still using variance information indirectly. In improved excited-state VMC with deep-learning ansatzes, the main objective is energy plus overlap and spin penalties, while local-energy variance enters only through adaptive scaling of overlap penalties. The stated motivation is that direct variance minimization for neural-network ansatzes involves third derivatives and can converge to undesired states, whereas variance-informed scaling preserves adaptivity without explicit variance optimization [2405.17089].

Taken together, these results delineate the modern status of variance-based penalties. They remain central when dispersion itself is the target quantity, when robust duality yields tractable convex surrogates, or when empirical Bernstein effects are exploitable. But the same literature repeatedly shows that raw quadratic variance penalization can induce unstable gradients, pathological policies, or poor high-dimensional conditioning, making one-sided deviations, MAD-type penalties, CVaR-style objectives, and variance-informed but not variance-minimizing penalties recurring alternatives.

Source: https://www.emergentmind.com/topics/variance-based-penalty