Tutorials › Statistical Learning (Graduate) › Duality For f-Divergence Robust Risk

Robustness and Distribution Shift · Tutorial 979 of 989

Duality For f-Divergence Robust Risk

Translate a worst-case risk over an f-divergence ball into a tractable dual optimization, and verify the formula in discrete KL and chi-square models.

Advanced 12 min read

What You'll Learn

  • Define the f-divergence ambiguity set through likelihood ratios with respect to a reference distribution.
  • Derive the Lagrange dual involving the convex conjugate of the divergence generator.
  • State finite-support conditions that ensure strong duality.
  • Obtain the exponential-tilt form of the KL robust risk.
  • Solve and check discrete KL and chi-square robust-risk examples.
  • Recognize why normalization and the divergence constraint both matter in the dual.

Why Duality Helps

A distributionally robust risk asks how large expected loss could become if the data-generating distribution were allowed to differ from a reference distribution, but only within a prescribed divergence radius. The primal problem optimizes over alternative distributions. A dual formulation instead uses a small number of scalar multipliers and the convex conjugate of the divergence generator. This can simplify analysis and computation, and it exposes how the loss is reweighted in the worst case.

We work with a fixed loss \(L\) and a reference distribution \(P\). An alternative distribution \(Q\) is represented by its density ratio \(r=dQ/dP\), so that \(E_P[r]=1\) and \(E_Q[L]=E_P[rL]\). This change-of-measure representation is the same likelihood-ratio perspective used in distribution-shift analysis.

Definition: Let \(f:[0,\infty)\to(-\infty,\infty]\) be a proper, lower-semicontinuous convex function with \(f(1)=0\). For \(Q\ll P\) with density ratio \(r=dQ/dP\), the \(f\)-divergence is \(D_f(Q\|P)=E_P[f(r)]\). For radius \(\rho\geq 0\), the \(f\)-divergence robust risk of loss \(L\) is \( \sup\{E_P[rL]: r\geq 0,\ E_P[r]=1,\ E_P[f(r)]\leq\rho\}. \)

The condition \(E_P[r]=1\) makes \(r\) a probability density ratio. The divergence constraint limits its departure from the reference distribution. The convex conjugate of \(f\), which will appear in the dual, is \( f^*(s)=\sup_{t\geq 0}\{st-f(t)\}. \) The supremum is over nonnegative \(t\), because a density ratio cannot be negative.

Deriving the Dual

For clarity, first consider a finite reference distribution on \(m\) atoms, with probabilities \(p_i>0\), losses \(L_i\in\mathbb R\), and density ratios \(r_i\geq0\), for \(i=1,\ldots,m\). The robust risk is the convex optimization problem \( \sup_r \sum_i p_i r_iL_i \) subject to \( \sum_i p_i r_i=1\) and \( \sum_i p_i f(r_i)\leq\rho\). Introduce a multiplier \(\nu\in\mathbb R\) for normalization and \(\eta\geq0\) for the divergence constraint. The Lagrangian is \( \nu+\eta\rho+\sum_i p_i\{r_i(L_i-\nu)-\eta f(r_i)\}. \) Taking the supremum separately over each \(r_i\geq0\) gives the conjugate expression below.

Theorem: Suppose the reference distribution has finite support with \(p_i>0\), the losses \(L_i\) are finite, \(f\) is proper, lower-semicontinuous, and convex with \(f(1)=0\), \(f\) is finite on a neighborhood of 1, and \(\rho>0\). Then the primal robust risk equals \( \displaystyle \inf_{\nu\in\mathbb R,\ \eta\geq0}\left\{\nu+\eta\rho+\sum_{i=1}^m p_i\,\eta f^*\!\left(\frac{L_i-\nu}{\eta}\right)\right\}. \) For \(\eta>0\), the term \(\eta f^*((L_i-\nu)/\eta)\) has its usual meaning. At \(\eta=0\), it is interpreted as the closed perspective limit, equivalently as the recession function \((f^*)^\infty(L_i-\nu)\). The infimum formulation includes limiting values at the boundary.

Here is the complete duality justification. For any feasible \(r\), any \(\nu\in\mathbb R\), and any \(\eta\geq0\), the definition of the conjugate gives, when \(\eta>0\), \( r_i(L_i-\nu)-\eta f(r_i)\leq \eta f^*((L_i-\nu)/\eta). \) Summing with weights \(p_i\), and using \(\sum_i p_i r_i=1\) and \(\sum_i p_i f(r_i)\leq\rho\), shows that the proposed dual objective is at least the primal objective. This is weak duality.

For equality, the point \(r_i=1\) is feasible and satisfies the normalization constraint, while its divergence is \(\sum_i p_i f(1)=0<\rho\). Since \(f\) is finite on a neighborhood of 1, this point lies in the relative interior of the effective domain, so Slater's condition applies. In this finite-dimensional convex problem, the objective and normalization are affine and the divergence constraint is convex. Slater's condition therefore gives strong Lagrangian duality: the supremum of the primal equals the infimum of the Lagrangian supremum over \(\nu,\eta\). Evaluating that supremum coordinate by coordinate yields the displayed formula. \(\square\)

The strict inequality \(\rho>0\) matters for this Slater argument. At radius zero, the only feasible ratios need not be covered by the same strict-feasibility proof; in the usual strictly convex examples the robust risk is simply the reference risk. On general, non-finite spaces the same conjugate calculation gives weak duality under appropriate integrability conditions, but equality requires additional functional-analytic regularity. The finite-support theorem above gives a direct, explicit sufficient set of conditions.

KL Divergence and Exponential Tilting

For KL divergence, use \(f(t)=t\log t-t+1\), with \(0\log0=0\). Its conjugate on \(t\geq0\) is \(f^*(s)=e^s-1\): maximizing \(st-t\log t+t-1\) over \(t>0\) gives \(t=e^s\), and substitution gives \(e^s-1\). For \(\eta>0\), the dual objective becomes \( \nu+\eta\rho+\eta\{e^{-\nu/\eta}E_P[e^{L/\eta}]-1\}. \)

For fixed \(\eta>0\), minimizing over \(\nu\) sets \(e^{-\nu/\eta}E_P[e^{L/\eta}]=1\), so \(\nu=\eta\log E_P[e^{L/\eta}]\). Substitution gives the familiar one-dimensional representation \( \displaystyle \inf_{\eta>0}\left\{\eta\rho+\eta\log E_P[e^{L/\eta}]\right\}, \) with boundary values understood by limits. The associated density ratio at an interior optimum is proportional to \(e^{L/\eta}\): larger losses receive more weight.

Worked Example: A Two-Point KL Robust Risk

Let \(P\) assign probability \(1/2\) to each of two outcomes, with losses \(L=(0,2)\). Choose \(\eta=1\). The exponential normalizer is \( Z=E_P[e^L]=\tfrac12+\tfrac12e^2=\tfrac{1+e^2}{2}\approx4.1945. \) The tilted probabilities are \(q_1=(1/2)/Z\approx0.1192\) and \(q_2=(e^2/2)/Z\approx0.8808\). They sum to one.

Define the radius to be the KL divergence of this tilted distribution from \(P\). Since \(q_i/p_i=e^{L_i}/Z\), \( \rho=\sum_i q_i\log(q_i/p_i)=\sum_i q_iL_i-\log Z. \) The tilted expected loss is \(0q_1+2q_2\approx1.7616\), and \(\log Z\approx1.4338\), so \(\rho\approx0.3278\). At \(\eta=1\), the dual value is \(\rho+\log Z\approx0.3278+1.4338=1.7616\), exactly the tilted risk up to rounding. This is the optimizer for this radius: the exponential tilt satisfies the divergence constraint with equality and the dual stationarity condition.

Worked Example: A Three-Point KL Tilt

Let \(P=(1/2,1/3,1/6)\) and \(L=(0,1,2)\). Again take \(\eta=1\). The normalizer and tilted probabilities are \( Z=\tfrac12+\tfrac e3+\tfrac{e^2}{6}\approx2.6376,\qquad q_i=\frac{p_ie^{L_i}}{Z}. \) Using \(e\approx2.71828\), the probabilities are approximately \((0.1896,0.3435,0.4669)\); these rounded values sum to \(1.0000\).

The tilted expected loss is \(E_q[L]=q_2+2q_3\approx0.3435+2(0.4669)=1.2773\). For the radius equal to the tilt's KL divergence, \( \rho=\sum_iq_i\log(q_i/p_i)=E_q[L]-\log Z\approx1.2773-0.9699=0.3075. \) The dual objective at \(\eta=1\) is \(\rho+\log Z=E_q[L]=\frac{e+e^2}{3Z}\approx1.2773\), agreeing with the tilted expected loss. As in the previous example, defining the radius by the tilt makes this candidate feasible with equality and satisfies the interior dual optimality condition.

Chi-Square Divergence

For the Pearson chi-square convention used here, \(f(t)=(t-1)^2\), so \(D_f(Q\|P)=E_P[(r-1)^2]\). The conjugate must respect \(t\geq0\). The unconstrained quadratic maximizer is \(t=1+s/2\); it is allowed when \(s\geq-2\). If \(s<-2\), the maximum over \(t\geq0\) occurs at \(t=0\). Therefore \( f^*(s)=\begin{cases}-1,&s<-2,\\s+s^2/4,&s\geq-2.\end{cases} \)

Worked Example: Exact Chi-Square Risk on Two Atoms

Let \(P=(1/2,1/2)\), \(L=(0,2)\), and \(\rho=1/4\). Write the alternative probabilities as \(q=(1-a,1+a)/2\), so the density ratios are \(r=(1-a,1+a)\). Nonnegativity requires \(-1\leq a\leq1\), and \( D_f(Q\|P)=\tfrac12\{(-a)^2+a^2\}=a^2. \) The expected loss is \(E_Q[L]=0(1-a)/2+2(1+a)/2=1+a\). Maximizing this subject to \(a^2\leq1/4\) and \(-1\leq a\leq1\) gives \(a=1/2\), hence \(q=(1/4,3/4)\), divergence \(1/4\), and worst-case risk \(3/2\).

The dual gives the same answer. Take \(\eta=1\) and \(\nu=1\). The conjugate arguments \((L_i-\nu)/\eta\) are \(-1\) and \(1\), where \(f^*(-1)=-3/4\) and \(f^*(1)=5/4\). Their \(P\)-average is \(\tfrac12(-3/4+5/4)=1/4\). Thus the dual objective is \(\nu+\eta\rho+E_P[\eta f^*((L-\nu)/\eta)]=1+1/4+1/4=3/2\), matching the primal solution.

Interpretation and a Common Pitfall

The dual separates the cost of allowing distribution shift, represented by \(\eta\rho\), from the loss-dependent conjugate term. The multiplier \(\nu\) is not an optional offset: it enforces the normalization \(E_P[r]=1\). For KL divergence, eliminating \(\nu\) produces a log moment-generating function; for other generators, the conjugate specifies a different response to high losses.

  • Pitfall: dropping normalization. One might maximize \(E_P[rL]-\eta E_P[f(r)]\) over ratios and conclude that its conjugate alone is the robust risk. This omits the requirement \(E_P[r]=1\), so the maximizing \(r\) need not describe any probability distribution.
  • Correction. Include a free multiplier \(\nu\) for \(E_P[r]=1\), and a nonnegative multiplier \(\eta\) for the divergence bound. Only then does the Lagrangian bound the risk over valid alternative distributions.
  • Pitfall: using the wrong chi-square convention. Some definitions include a factor of \(1/2\). That changes the divergence radius and conjugate. Here the generator is exactly \(f(t)=(t-1)^2\).
Key takeaway: Under finite support, positive reference probabilities, a proper lower-semicontinuous convex generator with \(f(1)=0\) that is finite on a neighborhood of 1, and a positive radius, Slater's condition yields a strong dual. The dual uses a normalization multiplier, a nonnegative divergence multiplier, and the convex conjugate \(f^*\).

Check Your Understanding

Use the definitions and derivations above to answer the following questions.

  1. Why must a density ratio satisfy \(E_P[r]=1\), in addition to \(r\geq0\)?
  2. In the finite-support strong-duality result, which feasible point verifies strict feasibility when \(\rho>0\)?
  3. For KL divergence, what is the form of the density ratio associated with a fixed positive \(\eta\), after enforcing normalization?
  4. For \(f(t)=(t-1)^2\), why is the conjugate's formula different when \(s<-2\) than when \(s\geq-2\)?
  5. In the two-atom chi-square example, verify directly that \(q=(1/4,3/4)\) has density ratios \((1/2,3/2)\) and divergence \(1/4\).
Clinical Biostats