Module contents
Lesson 12 of 27Advanced 110 min

Constraints with first-order methods: projection, Frank-Wolfe and mirror descent

Compare three ways to respect constraints with first-order methods: projection after each step, moving toward a linear-model minimizer (Frank-Wolfe), and changing step geometry with a Bregman divergence (mirror descent). Prove when each wins and why exponentiated gradient is natural on the simplex.

After this lesson you can

  • Implement projected gradient and prove it retains unconstrained convergence rates.
  • Implement Frank-Wolfe with linear minimization oracles on polyhedra, ℓ1 balls and nuclear-norm balls, and use its duality gap.
  • Define Bregman divergences and derive mirror descent as a gradient step in dual space.
  • Derive exponentiated gradient as mirror descent with negative entropy and prove that with ℓ∞-bounded gradients its bound depends on dimension as √(log n), versus √n for projected gradient.
  • Choose between projection, Frank-Wolfe and mirror descent based on projection cost, set geometry and desired sparsity.

Before you start

Motivation: when the feasible set matters

So far, the module’s first-order methods either lived in all of Rn\R^n or hid constraints inside a nondifferentiable term, as proximal gradient did. In practice, constraints are often the most important part of the problem:

  • The probability simplex Δn={x∈Rn:x≥0, ∑ixi=1}\Delta_n = \{\vb{x} \in \R^n : \vb{x} \ge \vb{0},\ \sum_i x_i = 1\}. It appears when parameters are a distribution: weights in a mixture of experts, allocating a budget among nn assets without short positions, a zero-sum game’s policy, weights of a model ensemble.
  • Norm balls. The ℓ1\ell_1 ball encourages sparse solutions (the constrained form of LASSO); the ℓ∞\ell_\infty ball is the perturbation budget of the PGD attack used to evaluate and train network robustness.
  • The nuclear norm ball {X∈Rm×n:∥X∥∗≤τ}\{\mat{X} \in \R^{m \times n} : \norm{\mat{X}}_* \le \tau\}, the sum of singular values (the order-1 Schatten norm). It is the convex relaxation of “low rank” and the basis of matrix completion: recovering a user-ratings matrix from a small fraction of its entries.

There are three ways to respect a convex set CC while using first-order methods, compared in this lesson:

  1. Project. Take the usual gradient step and return to CC via the nearest point. This works when projection is cheap.
  2. Solve a linear problem. Minimize the linear model of ff over CC and move toward that solution. This is Frank-Wolfe, which never projects and produces iterates that are combinations of few extreme points.
  3. Change geometry. Replace Euclidean distance with a divergence adapted to CC. This is mirror descent; on the simplex, with entropy, it gives exponentiated gradient, whose dimension dependence is log⁡n\sqrt{\log n} instead of n\sqrt{n}.

Which method suits the problem depends mainly on the cost of each operation on CC. The table summarizes this lesson’s sets; the rest justifies each entry.

SetEuclidean projectionLinear oracle arg min⁡s∈C⟨g,s⟩\argmin_{\vb{s} \in C} \inner{\vb{g}}{\vb{s}}
Box or ℓ∞\ell_\infty ball of radius τ\tauO(n)\bigO(n): clip each coordinateO(n)\bigO(n): −τ sign(g)-\tau\,\mathrm{sign}(\vb{g})
ℓ2\ell_2 ballO(n)\bigO(n): rescaleO(n)\bigO(n): −τ g/∥g∥2-\tau\,\vb{g}/\norm{\vb{g}}_2
Simplex Δn\Delta_nO(nlog⁡n)\bigO(n \log n): sortO(n)\bigO(n): vertex ei\vb{e}_i with i=arg min⁡jgji = \argmin_j g_j
ℓ1\ell_1 ballO(nlog⁡n)\bigO(n \log n): via simplexO(n)\bigO(n): −τ sign(gi) ei-\tau\,\mathrm{sign}(g_i)\,\vb{e}_i with i=arg max⁡j∣gj∣i = \argmax_j \abs{g_j}
Nuclear ball in Rm×n\R^{m \times n}full SVD, O(mnmin⁡(m,n))\bigO(mn\min(m, n))dominant singular pair: dozens of matrix-vector products
Birkhoff polytope (n×nn \times n)no closed form: iterative subproblemlinear assignment, O(n3)\bigO(n^3)
Polyhedron {Ax≤b}\{\mat{A}\vb{x} \le \vb{b}\}QPLP

Projected gradient

Projection onto a convex set exists, is unique, and is characterized by a variational inequality used often:

x=ΠC(y)  ⟺  x∈C  and  ⟨y−x,z−x⟩≤0  for all z∈C.\vb{x} = \Pi_C(\vb{y}) \iff \vb{x} \in C \ \text{ and } \ \inner{\vb{y} - \vb{x}}{\vb{z} - \vb{x}} \le 0 \ \text{ for all } \vb{z} \in C.

Geometrically, the vector from x\vb{x} to y\vb{y} forms an obtuse angle with any direction pointing into CC. This also shows projection is nonexpansive: ∥ΠC(y)−ΠC(y′)∥2≤∥y−y′∥2\norm{\Pi_C(\vb{y}) - \Pi_C(\vb{y}')}_2 \le \norm{\vb{y} - \vb{y}'}_2.

This is not a new method. Projection is the proximal operator of indicator function ιC\iota_C, which is 00 on CC and +∞+\infty outside:

proxηιC(y)=arg min⁡z(ιC(z)+12η∥z−y∥22)=ΠC(y).\mathrm{prox}_{\eta\iota_C}(\vb{y}) = \argmin_{\vb{z}} \Big(\iota_C(\vb{z}) + \tfrac{1}{2\eta}\norm{\vb{z} - \vb{y}}_2^2\Big) = \Pi_C(\vb{y}).

Thus projected gradient is proximal gradient applied to f+ιCf + \iota_C, inheriting its analysis. Its fixed points are exactly optima: by the variational inequality with y=x−η∇f(x)\vb{y} = \vb{x} - \eta\grad f(\vb{x}),

x=ΠC(x−η∇f(x))  ⟺  ⟨∇f(x),z−x⟩≥0  for all z∈C,\vb{x} = \Pi_C\big(\vb{x} - \eta\grad f(\vb{x})\big) \iff \inner{\grad f(\vb{x})}{\vb{z} - \vb{x}} \ge 0 \ \text{ for all } \vb{z} \in C,

which is first-order optimality for a constrained convex problem: no feasible direction is a descent direction. At the optimum ∇f\grad f need not vanish; what vanishes is the projected gradient mapping, Gη(x)=(x−ΠC(x−η∇f(x)))/ηG_\eta(\vb{x}) = \big(\vb{x} - \Pi_C(\vb{x} - \eta\grad f(\vb{x}))\big)/\eta, replacing ∥∇f∥\norm{\grad f} as a stationarity measure.

Proof

A key inequality. Let x+=ΠC(x−∇f(x)/L)\vb{x}^+ = \Pi_C(\vb{x} - \grad f(\vb{x})/L) and arbitrary z∈C\vb{z} \in C. By the descent lemma and convexity,

f(x+)≤f(x)+⟨∇f(x),x+−x⟩+L2∥x+−x∥2,f(x)≤f(z)+⟨∇f(x),x−z⟩.f(\vb{x}^+) \le f(\vb{x}) + \inner{\grad f(\vb{x})}{\vb{x}^+ - \vb{x}} + \tfrac{L}{2}\norm{\vb{x}^+ - \vb{x}}^2, \qquad f(\vb{x}) \le f(\vb{z}) + \inner{\grad f(\vb{x})}{\vb{x} - \vb{z}}.

Adding, f(x+)≤f(z)+⟨∇f(x),x+−z⟩+L2∥x+−x∥2f(\vb{x}^+) \le f(\vb{z}) + \inner{\grad f(\vb{x})}{\vb{x}^+ - \vb{z}} + \tfrac{L}{2}\norm{\vb{x}^+ - \vb{x}}^2. Projection’s variational inequality, with y=x−∇f(x)/L\vb{y} = \vb{x} - \grad f(\vb{x})/L, says ⟨x−∇f(x)/L−x+,z−x+⟩≤0\inner{\vb{x} - \grad f(\vb{x})/L - \vb{x}^+}{\vb{z} - \vb{x}^+} \le 0, i.e. ⟨∇f(x),x+−z⟩≤L⟨x−x+,x+−z⟩\inner{\grad f(\vb{x})}{\vb{x}^+ - \vb{z}} \le L\inner{\vb{x} - \vb{x}^+}{\vb{x}^+ - \vb{z}}. With identity ∥x−z∥2=∥x−x+∥2+2⟨x−x+,x+−z⟩+∥x+−z∥2\norm{\vb{x} - \vb{z}}^2 = \norm{\vb{x} - \vb{x}^+}^2 + 2\inner{\vb{x} - \vb{x}^+}{\vb{x}^+ - \vb{z}} + \norm{\vb{x}^+ - \vb{z}}^2 we obtain

f(x+)≤f(z)+L2(∥x−z∥2−∥x+−z∥2)for all z∈C.f(\vb{x}^+) \le f(\vb{z}) + \tfrac{L}{2}\big(\norm{\vb{x} - \vb{z}}^2 - \norm{\vb{x}^+ - \vb{z}}^2\big) \qquad \text{for all } \vb{z} \in C.

Sublinear rate. With z=x\vb{z} = \vb{x} we obtain f(x+)≤f(x)f(\vb{x}^+) \le f(\vb{x}): the method is monotone. With z=x⋆\vb{z} = \vb{x}^\star and x=xi\vb{x} = \vb{x}_i, summing for i=0,…,k−1i = 0, \dots, k - 1 telescopes to ∑i=1k(f(xi)−f⋆)≤L2∥x0−x⋆∥2\sum_{i=1}^{k}\big(f(\vb{x}_i) - f^\star\big) \le \tfrac{L}{2}\norm{\vb{x}_0 - \vb{x}^\star}^2. Since terms are nonincreasing, the last is at most the average: k(f(xk)−f⋆)≤L2∥x0−x⋆∥2k\big(f(\vb{x}_k) - f^\star\big) \le \tfrac{L}{2}\norm{\vb{x}_0 - \vb{x}^\star}^2.

Linear rate. The optimum is a fixed point, x⋆=ΠC(x⋆−∇f(x⋆)/L)\vb{x}^\star = \Pi_C(\vb{x}^\star - \grad f(\vb{x}^\star)/L). Since ΠC\Pi_C is nonexpansive,

∥xk+1−x⋆∥≤∥(xk−x⋆)−1L(∇f(xk)−∇f(x⋆))∥.\norm{\vb{x}_{k+1} - \vb{x}^\star} \le \norm{(\vb{x}_k - \vb{x}^\star) - \tfrac1L\big(\grad f(\vb{x}_k) - \grad f(\vb{x}^\star)\big)}.

The right side is the error of an unconstrained gradient step from xk\vb{x}_k toward stationary point x⋆\vb{x}^\star of f−⟨∇f(x⋆),⋅⟩f - \inner{\grad f(\vb{x}^\star)}{\cdot}, which has the same constants μ\mu and LL. It remains to show the step contracts distance by 1−μ/L1 - \mu/L. Let δ=xk−x⋆\boldsymbol{\delta} = \vb{x}_k - \vb{x}^\star and d=∇f(xk)−∇f(x⋆)\vb{d} = \grad f(\vb{x}_k) - \grad f(\vb{x}^\star). For μ\mu-strongly convex LL-smooth ff on Rn\R^n, strengthened cocoercivity holds (Nesterov, Introductory Lectures on Convex Optimization, 2004, theorem 2.1.12), ⟨d,δ⟩≥μLμ+L∥δ∥2+1μ+L∥d∥2\inner{\vb{d}}{\boldsymbol{\delta}} \ge \frac{\mu L}{\mu + L}\norm{\boldsymbol{\delta}}^2 + \frac{1}{\mu + L}\norm{\vb{d}}^2, and strong convexity gives ∥d∥≥μ∥δ∥\norm{\vb{d}} \ge \mu\norm{\boldsymbol{\delta}}. Then

∥δ−1Ld∥2=∥δ∥2−2L⟨d,δ⟩+1L2∥d∥2≤L−μL+μ∥δ∥2−L−μL2(L+μ)∥d∥2≤(L−μ)(L2−μ2)L2(L+μ)∥δ∥2=(1−μL)2∥δ∥2.\begin{aligned} \norm{\boldsymbol{\delta} - \tfrac1L\vb{d}}^2 &= \norm{\boldsymbol{\delta}}^2 - \tfrac2L\inner{\vb{d}}{\boldsymbol{\delta}} + \tfrac{1}{L^2}\norm{\vb{d}}^2 \\ &\le \frac{L - \mu}{L + \mu}\norm{\boldsymbol{\delta}}^2 - \frac{L - \mu}{L^2(L + \mu)}\norm{\vb{d}}^2 \\ &\le \frac{(L - \mu)(L^2 - \mu^2)}{L^2(L + \mu)}\norm{\boldsymbol{\delta}}^2 = \Big(1 - \frac{\mu}{L}\Big)^2\norm{\boldsymbol{\delta}}^2. \end{aligned}

By induction, ∥xk−x⋆∥≤(1−μ/L)k∥x0−x⋆∥\norm{\vb{x}_k - \vb{x}^\star} \le (1 - \mu/L)^k\norm{\vb{x}_0 - \vb{x}^\star}. (Smoothness throughout Rn\R^n is needed here: cocoercivity can fail if ff is only smooth on CC.)

∎

Projecting onto the simplex

The most important case merits a derivation. Projecting y\vb{y} onto Δn\Delta_n minimizes 12∥x−y∥2\tfrac12\norm{\vb{x} - \vb{y}}^2 subject to x≥0\vb{x} \ge \vb{0} and 1⊤x=1\vb{1}\T\vb{x} = 1. With multiplier τ\tau for equality and λi≥0\lambda_i \ge 0 for each inequality, the KKT conditions give xi−yi+τ−λi=0x_i - y_i + \tau - \lambda_i = 0 and λixi=0\lambda_i x_i = 0. If xi>0x_i > 0, then λi=0\lambda_i = 0 and xi=yi−τx_i = y_i - \tau; if xi=0x_i = 0, then yi−τ=−λi≤0y_i - \tau = -\lambda_i \le 0. Combine both branches:

xi=max⁡(yi−τ,0),with τ such that ∑imax⁡(yi−τ,0)=1.x_i = \max(y_i - \tau, 0), \qquad \text{with } \tau \text{ such that } \textstyle\sum_i \max(y_i - \tau, 0) = 1.

Projection onto the simplex subtracts a common threshold and clips at zero. The function τ↦∑imax⁡(yi−τ,0)\tau \mapsto \sum_i \max(y_i - \tau, 0) is continuous, decreasing and piecewise linear, with corners at the yiy_i; if y(1)≥y(2)≥…y_{(1)} \ge y_{(2)} \ge \dots are sorted, the threshold is τ=(∑j≤ρy(j)−1)/ρ\tau = \big(\sum_{j \le \rho} y_{(j)} - 1\big)/\rho, where ρ\rho is the largest index with y(ρ)>τρy_{(\rho)} > \tau_\rho. Sorting costs O(nlog⁡n)\bigO(n \log n). For example, for y=(0.8,0.6,−0.3)\vb{y} = (0.8, 0.6, -0.3), two active coordinates give τ=(0.8+0.6−1)/2=0.2\tau = (0.8 + 0.6 - 1)/2 = 0.2 and x=(0.6,0.4,0)\vb{x} = (0.6, 0.4, 0): the third coordinate is exactly zero. This ability to produce exact zeros distinguishes projection from multiplicative updates seen later.

Two more sets reduce to this. For the ℓ1\ell_1 ball of radius τ\tau: if ∥y∥1≤τ\norm{\vb{y}}_1 \le \tau the projection is y\vb{y}; otherwise it is sign(y)⊙ΠτΔn(∣y∣)\mathrm{sign}(\vb{y}) \odot \Pi_{\tau\Delta_n}(\abs{\vb{y}}). For the nuclear ball: if Y=Udiag⁡(σ)V⊤\mat{Y} = \mat{U}\diag(\boldsymbol{\sigma})\mat{V}\T is an SVD, projection is Udiag⁡(Π(σ))V⊤\mat{U}\diag\big(\Pi(\boldsymbol{\sigma})\big)\mat{V}\T, with Π\Pi projecting singular values onto the ℓ1\ell_1 ball. The expensive part is the full SVD per iteration, not projecting σ\boldsymbol{\sigma}.

Frank-Wolfe: replace projection with a linear problem

If projection is expensive, there is another way to stay in CC: always move toward a point of CC. Since CC is convex, any convex combination of two feasible points is feasible, so choose the destination well. Frank and Wolfe (1956) proposed the natural choice: the point of CC minimizing the linear approximation of ff.

The linear model f(xk)+⟨∇f(xk),s−xk⟩f(\vb{x}_k) + \inner{\grad f(\vb{x}_k)}{\vb{s} - \vb{x}_k} has no minimum on Rn\R^n; it does on a compact set, and a linear function attains its minimum at an extreme point of CC. On a polyhedron the oracle is a linear program returning a vertex. For the table’s sets it has closed form, all following the same dual norm identity:

min⁡∥s∥≤τ ⟨g,s⟩=−τ ∥g∥∗.\min_{\norm{\vb{s}} \le \tau}\ \inner{\vb{g}}{\vb{s}} = -\tau\,\norm{\vb{g}}_*.

For the ℓ1\ell_1 ball the dual norm is ℓ∞\ell_\infty and the minimum is attained at −τ sign(gi) ei-\tau\,\mathrm{sign}(g_i)\,\vb{e}_i with i=arg max⁡j∣gj∣i = \argmax_j \abs{g_j}: one vertex, one nonzero coordinate. For the nuclear ball the dual of ∥⋅∥∗\norm{\cdot}_* is the spectral norm, ∥G∥2=σ1(G)\norm{\mat{G}}_2 = \sigma_1(\mat{G}), and the minimum of ⟨G,S⟩=tr⁡(G⊤S)\inner{\mat{G}}{\mat{S}} = \tr(\mat{G}\T\mat{S}) is attained at S=−τ u1v1⊤\mat{S} = -\tau\,\vb{u}_1\vb{v}_1\T, with (u1,v1)(\vb{u}_1, \vb{v}_1) the dominant singular pair of G\mat{G}: a rank-one matrix. This pair is obtained by power iteration, with dozens of products by G\mat{G} and G⊤\mat{G}\T instead of a full SVD.

Proof

Let hk=f(xk)−f⋆h_k = f(\vb{x}_k) - f^\star and gk=⟨∇f(xk),xk−sk⟩g_k = \inner{\grad f(\vb{x}_k)}{\vb{x}_k - \vb{s}_k}. By convexity, f⋆≥f(xk)+⟨∇f(xk),x⋆−xk⟩≥f(xk)−gkf^\star \ge f(\vb{x}_k) + \inner{\grad f(\vb{x}_k)}{\vb{x}^\star - \vb{x}_k} \ge f(\vb{x}_k) - g_k, since sk\vb{s}_k minimizes the inner product over CC and x⋆∈C\vb{x}^\star \in C. Thus gk≥hkg_k \ge h_k. By LL-smoothness, with ∥sk−xk∥≤D\norm{\vb{s}_k - \vb{x}_k} \le D,

f(xk+1)≤f(xk)−γk gk+Lγk22D2⟹hk+1≤(1−γk) hk+LD22γk2.f(\vb{x}_{k+1}) \le f(\vb{x}_k) - \gamma_k\,g_k + \tfrac{L\gamma_k^2}{2}D^2 \quad\Longrightarrow\quad h_{k+1} \le (1 - \gamma_k)\,h_k + \tfrac{L D^2}{2}\gamma_k^2.

With line search the inequality still holds for γk=2/(k+2)\gamma_k = 2/(k + 2), because the exact step yields an even smaller ff value. By induction: with γ0=1\gamma_0 = 1, h1≤LD2/2≤2LD2/3h_1 \le LD^2/2 \le 2LD^2/3. If hk≤2LD2/(k+2)h_k \le 2LD^2/(k + 2), then

hk+1≤kk+2⋅2LD2k+2+2LD2(k+2)2=2LD2 (k+1)(k+2)2≤2LD2k+3,h_{k+1} \le \frac{k}{k + 2}\cdot\frac{2LD^2}{k + 2} + \frac{2LD^2}{(k + 2)^2} = \frac{2LD^2\,(k + 1)}{(k + 2)^2} \le \frac{2LD^2}{k + 3},

because (k+1)(k+3)≤(k+2)2(k + 1)(k + 3) \le (k + 2)^2.

∎

The rate O(1/k)\bigO(1/k) matches unaccelerated projected gradient, with two fundamental differences. First, each iteration solves only a linear problem. Second, from vertex x0\vb{x}_0, iterate xk\vb{x}_k is a convex combination of x0,s0,…,sk−1\vb{x}_0, \vb{s}_0, \dots, \vb{s}_{k-1}, at most k+1k + 1 extreme points. On the simplex this means at most k+1k + 1 nonzero coordinates; on the nuclear ball, rank at most k+1k + 1, and the iterate can be stored as k+1k + 1 vector pairs, using O(k(m+n))\bigO(k(m + n)) instead of O(mn)\bigO(mn) memory.

That sparsity has a method-independent price. On the simplex, take f(x)=∥x∥22f(\vb{x}) = \norm{\vb{x}}_2^2, with f⋆=1/nf^\star = 1/n at the center. If x\vb{x} has kk nonzero coordinates summing to 1, Cauchy–Schwarz gives ∑xi2≥1/k\sum x_i^2 \ge 1/k, so f(x)−f⋆≥1/k−1/nf(\vb{x}) - f^\star \ge 1/k - 1/n, at least 1/(2k)1/(2k) while k≤n/2k \le n/2. No method building iterates from kk vertices can beat that O(1/k)\bigO(1/k) until kk is comparable to nn: Frank-Wolfe’s rate is optimal for such sparse iterates (Jaggi, 2013).

When each is fast

The bound 2LD2/(k+2)2LD^2/(k + 2) is worst-case. Frank-Wolfe’s actual behavior strongly depends on the optimum’s location; the best way to understand it is to look.

InteractiveFrank-Wolfe versus projection
  • Projected gradient
  • Frank-Wolfe (line search)
  • Frank-Wolfe gap
Move the optimum
Frank-Wolfe step
k = 200
Constrained optimumon an edge
Projected gradient: iterations to 10−610^{-6}7
Frank-Wolfe: iterations to 10−610^{-6}> 200
Frank-Wolfe at k = 200: f−f⋆f - f^\star8.42·10⁻³
its gap, an upper bound0.0147
Zigzag: the optimum is on an edge rather than a vertex. Frank-Wolfe can only move toward vertices, alternates between edge endpoints and its error falls as 1/k1/k. Projected gradient identifies the edge and converges linearly. Enable away steps.
Minimize f(x)=12(x−c)⊤Q(x−c)f(\vb{x}) = \tfrac12(\vb{x} - \vb{c})\T\mat{Q}(\vb{x} - \vb{c}) over the polygon. Projected gradient (blue, step 1/L1/L) takes a gradient step, exits the polygon (hollow point) and projects back; Frank-Wolfe (orange) moves toward the vertex selected by the oracle (orange ring). The hollow gray point is the constrained optimum and the gray ellipse its level curve. Below, f−f⋆f - f^\star on a logarithmic scale, with dashed Frank-Wolfe gap; readouts count iterations to divide initial error by 10610^6. Start with the optimum on an edge, change Frank-Wolfe's step, enable away steps, then move c\vb{c} inside and to a vertex. Polygon vertices are draggable too.

What you should have seen:

  • Optimum at a vertex: Frank-Wolfe gets there almost immediately. The oracle selects that vertex from the start, and line search reaches it in one or two iterations. This is its ideal case.
  • Optimum on an edge but not a vertex: zigzag. Frank-Wolfe only moves toward vertices. Near the optimum the oracle alternates between the edge’s endpoints and each step corrects the previous one. With line search error falls as 1/k1/k: in the initial example, after 200 iterations it remains above 10−310^{-3} times initial error, whereas projected gradient identifies the edge and falls below 10−610^{-6} in fewer than ten. Projected gradient converging linearly and Frank-Wolfe sublinearly despite strongly convex ff is no contradiction: the Frank-Wolfe theorem does not use strong convexity and in this case cannot. With step 2/(k+2)2/(k + 2) error falls somewhat faster here than with line search (preset steps can beat 1/k1/k when the optimum is in a face’s relative interior; Wirth, Kerdreux and Pokutta, 2023), but still not linearly.
  • Interior optimum: depends on the step. With line search, Frank-Wolfe converges linearly, more slowly as the optimum nears the boundary. With γk=2/(k+2)\gamma_k = 2/(k + 2) it does not: each iteration takes a fixed-size step toward a vertex even near the optimum, oscillating around it, and error decreases only as a power of kk.
  • The gap always exceeds f−f⋆f - f^\star. The dashed curve never crosses the solid orange one. It is a free optimality certificate.

The Frank-Wolfe gap and away steps

The previous proof’s first line contains one of the method’s best properties.

You will give the short proof in the exercises. What matters is what it enables: at each iteration the oracle already called for movement gives a free error upper bound, f(xk)−f⋆≤gkf(\vb{x}_k) - f^\star \le g_k, hence a lower bound on the optimum, f⋆≥f(xk)−gkf^\star \ge f(\vb{x}_k) - g_k. No other method in this lesson has such a cheap, honest stopping criterion. Since it only needs the oracle, it can also be calculated for projected or exponentiated-gradient iterates: we will compare all three with the same measure in the lab. Jaggi (2013) shows the gap is a duality gap in Fenchel duality and its minimum through iteration kk also decays as O(LD2/k)\bigO(LD^2/k).

The figure’s zigzag has a concrete cause: when the optimum lies on a polytope face, the iterate carries weight on a vertex outside that face, and the only way to remove it is to keep moving toward other vertices. The away-step variant, proposed by Wolfe in 1970, explicitly maintains xk=∑v∈Skαvv\vb{x}_k = \sum_{\vb{v} \in S_k}\alpha_{\vb{v}}\vb{v} as a combination of an active vertex set SkS_k, comparing two directions each iteration:

  • Frank-Wolfe direction, dFW=sk−xk\vb{d}_{\text{FW}} = \vb{s}_k - \vb{x}_k, toward the best vertex;
  • away direction, dA=xk−vk\vb{d}_{\text{A}} = \vb{x}_k - \vb{v}_k with vk=arg max⁡v∈Sk⟨∇f(xk),v⟩\vb{v}_k = \argmax_{\vb{v} \in S_k}\inner{\grad f(\vb{x}_k)}{\vb{v}}, away from the worst active vertex.

Choose the greater descent, −⟨∇f(xk),d⟩-\inner{\grad f(\vb{x}_k)}{\vb{d}}, and for the away direction limit the step to γmax⁡=αvk/(1−αvk)\gamma_{\max} = \alpha_{\vb{v}_k}/(1 - \alpha_{\vb{v}_k}), the value emptying the weight of vk\vb{v}_k (a drop step). Lacoste-Julien and Jaggi (2015) proved that on a polytope with strongly convex ff, this variant converges linearly, at a rate depending on polytope geometry. In the figure, enabling away steps removes zigzagging.

Bregman divergences

Projected gradient measures proximity with Euclidean distance, which is not always natural. On the simplex, moving from xi=0.5x_i = 0.5 to xi=0.4x_i = 0.4 is modest, while going from xi=0.1x_i = 0.1 to xi=0.0001x_i = 0.0001 changes a probability’s order of magnitude, even though Euclidean distances are similar. A Bregman divergence measures with a different rule.

By convexity, Dφ(x,y)≥0D_\varphi(\vb{x}, \vb{y}) \ge 0, with equality only if x=y\vb{x} = \vb{y} when φ\varphi is strictly convex; it is also convex in its first argument. The three important cases:

  • Euclidean. With φ(x)=12∥x∥22\varphi(\vb{x}) = \tfrac12\norm{\vb{x}}_2^2, Dφ(x,y)=12∥x∥2−12∥y∥2−⟨y,x−y⟩=12∥x−y∥22D_\varphi(\vb{x}, \vb{y}) = \tfrac12\norm{\vb{x}}^2 - \tfrac12\norm{\vb{y}}^2 - \inner{\vb{y}}{\vb{x} - \vb{y}} = \tfrac12\norm{\vb{x} - \vb{y}}_2^2.
  • Mahalanobis. With φ(x)=12x⊤Qx\varphi(\vb{x}) = \tfrac12\vb{x}\T\mat{Q}\vb{x} and positive definite Q\mat{Q}, Dφ(x,y)=12(x−y)⊤Q(x−y)D_\varphi(\vb{x}, \vb{y}) = \tfrac12(\vb{x} - \vb{y})\T\mat{Q}(\vb{x} - \vb{y}).
  • Entropy. With negative entropy φ(x)=∑ixilog⁡xi\varphi(\vb{x}) = \sum_i x_i \log x_i, i.e. minus Shannon entropy, and ∇φ(y)i=1+log⁡yi\grad\varphi(\vb{y})_i = 1 + \log y_i,
Dφ(x,y)=∑ixilog⁡xiyi−∑ixi+∑iyi,D_\varphi(\vb{x}, \vb{y}) = \sum_i x_i\log\frac{x_i}{y_i} - \sum_i x_i + \sum_i y_i,

which on the simplex, where both sums equal 1, is exactly KL divergence KL⁡(x ∥ y)\KL(\vb{x} \,\|\, \vb{y}).

KL being a Bregman divergence explains several properties at once: it is asymmetric, does not satisfy the triangle inequality and is convex in its first argument. (KL is also convex in its second argument, even jointly, but that is a special property from the log-sum inequality; a general Bregman divergence is not convex in its second argument.) Two more facts make what follows work. The first replaces the cosine rule:

Dφ(z,x)+Dφ(x,y)−Dφ(z,y)=⟨∇φ(y)−∇φ(x),z−x⟩,D_\varphi(\vb{z}, \vb{x}) + D_\varphi(\vb{x}, \vb{y}) - D_\varphi(\vb{z}, \vb{y}) = \inner{\grad\varphi(\vb{y}) - \grad\varphi(\vb{x})}{\vb{z} - \vb{x}},

verified by expanding the three divergences: φ\varphi terms cancel, leaving inner products. With φ=12∥⋅∥2\varphi = \tfrac12\norm{\cdot}^2 it is the cosine rule, 12∥z−x∥2+12∥x−y∥2−12∥z−y∥2=⟨y−x,z−x⟩\tfrac12\norm{\vb{z} - \vb{x}}^2 + \tfrac12\norm{\vb{x} - \vb{y}}^2 - \tfrac12\norm{\vb{z} - \vb{y}}^2 = \inner{\vb{y} - \vb{x}}{\vb{z} - \vb{x}}. Second: if φ\varphi is σ\sigma-strongly convex with respect to a norm, in the sense of strong convexity, then Dφ(x,y)≥σ2∥x−y∥2D_\varphi(\vb{x}, \vb{y}) \ge \tfrac{\sigma}{2}\norm{\vb{x} - \vb{y}}^2. For entropy on the simplex this is Pinsker’s inequality: KL⁡(x ∥ y)≥12∥x−y∥12\KL(\vb{x} \,\|\, \vb{y}) \ge \tfrac12\norm{\vb{x} - \vb{y}}_1^2, so negative entropy is 1-strongly convex with respect to the ℓ1\ell_1 norm.

InteractiveBregman balls
y = (0.500, 0.420, 0.080)Euclidean = (0.327, 0.673, 0.000)KL = (0.456, 0.527, 0.018)
0.050
−80°
Euclidean step: smallest coordinate0 (exact)
KL step: smallest coordinate0.0178
KL⁡(xKL ∥ y)\KL(\vb{x}_{\mathrm{KL}} \,\|\, \vb{y}) versus KL⁡(y ∥ xKL)\KL(\vb{y} \,\|\, \vb{x}_{\mathrm{KL}})0.050 and 0.072
KL radius touching edge x3=0x_3 = 00.083
The Euclidean ball crosses an edge and the Euclidean step lands exactly on it, with one coordinate equal to 00. The KL step has all coordinates positive: it is x∝y⊙e−g/λ\vb{x} \propto \vb{y} \odot e^{-\vb{g}/\lambda}.
On the three-component simplex, level curves of 12∥x−y∥22\tfrac12\norm{\vb{x} - \vb{y}}_2^2 (blue) and KL⁡(x ∥ y)\KL(\vb{x} \,\|\, \vb{y}) (teal) around center y\vb{y}; shaded regions are the two balls of radius rr. Each arrow is the step 'minimize ⟨g,x⟩\inner{\vb{g}}{\vb{x}} inside the ball' in dashed direction −g-\vb{g}. Move the center near an edge and compare: the circle intersects the edge and the Euclidean step lands there; the KL ball flattens against the edge and its step does not reach it even when the ball touches it.

What the figure shows:

  • Away from boundaries the two geometries resemble each other. Near the triangle’s center, KL curves are nearly ellipses, because KL⁡(x ∥ y)≈12∑i(xi−yi)2/yi\KL(\vb{x} \,\|\, \vb{y}) \approx \tfrac12\sum_i (x_i - y_i)^2/y_i: a Mahalanobis distance with weights 1/yi1/y_i.
  • Near an edge, KL flattens. Those weights 1/yi1/y_i explode as yi→0y_i \to 0: moving away from the edge is costly, moving along it is not. Thus the KL ball is narrow perpendicular to the edge and elongated parallel to it.
  • The KL ball reaches the edge tangentially, only when r≥−log⁡(1−yi)r \ge -\log(1 - y_i), the minimum of KL⁡(x ∥ y)\KL(\vb{x} \,\|\, \vb{y}) on edge xi=0x_i = 0. Since the KL gradient tends to −∞-\infty approaching the edge, its level curves reach it parallel, and minimizing a linear function over the ball does not land on the boundary even when the ball touches it: by KKT, the solution is x∝y⊙e−g/λ\vb{x} \propto \vb{y} \odot e^{-\vb{g}/\lambda}, with λ>0\lambda > 0 the constraint multiplier and all coordinates positive. The only exception is a radius so large the ball contains the vertex toward which −g-\vb{g} pushes (for g\vb{g} with unique minimum). The Euclidean step lands exactly on the edge as soon as the circle crosses it. Mirror descent does not even have that exception: its proximal form penalizes KL with fixed weight 1/η1/\eta instead of bounding it, giving x∝xk⊙e−ηg\vb{x} \propto \vb{x}_k \odot e^{-\eta\vb{g}} for every step.
  • The KL ball always fits inside the Euclidean ball of the same radius. Pinsker again: KL⁡≥12∥⋅∥12≥12∥⋅∥22\KL \ge \tfrac12\norm{\cdot}_1^2 \ge \tfrac12\norm{\cdot}_2^2.

Mirror descent

There is a deeper reason to change geometry. In x−η∇f(x)\vb{x} - \eta\grad f(\vb{x}) a gradient is subtracted from a point, meaningful only because in Rn\R^n with the Euclidean norm we identify the space with its dual. Strictly speaking a gradient is a linear form: an element of the dual space measured with the dual norm. With ℓ1\ell_1 on the simplex, points and gradients live in spaces with different norms, ℓ1\ell_1 and ℓ∞\ell_\infty; subtracting them directly mixes different kinds of object.

Nemirovski and Yudin solved this with a mirror map: ∇φ\grad\varphi, mapping primal-space points to the dual. If φ\varphi is a Legendre function (strictly convex, differentiable, with gradient exploding at its domain’s boundary), ∇φ\grad\varphi is a bijection whose inverse is the gradient of the convex conjugate, (∇φ)−1=∇φ∗(\grad\varphi)\inv = \grad\varphi^*.

The forms agree because, with ∇φ(yk+1)=∇φ(xk)−ηgk\grad\varphi(\vb{y}_{k+1}) = \grad\varphi(\vb{x}_k) - \eta\vb{g}_k,

Dφ(x,yk+1)=φ(x)−⟨∇φ(xk)−ηgk,x⟩+const=η⟨gk,x⟩+Dφ(x,xk)+const,D_\varphi(\vb{x}, \vb{y}_{k+1}) = \varphi(\vb{x}) - \inner{\grad\varphi(\vb{x}_k) - \eta\vb{g}_k}{\vb{x}} + \text{const} = \eta\inner{\vb{g}_k}{\vb{x}} + D_\varphi(\vb{x}, \vb{x}_k) + \text{const},

where constants do not depend on x\vb{x}. The proximal form says what the method does: minimize the linear model of ff plus a penalty for moving away from xk\vb{x}_k, measured by DφD_\varphi. With φ=12∥⋅∥22\varphi = \tfrac12\norm{\cdot}_2^2 the mirror map is identity, Bregman projection is Euclidean and the projected subgradient method is recovered. With φ=12x⊤Qx\varphi = \tfrac12\vb{x}\T\mat{Q}\vb{x} we get gradient preconditioned by Q−1\mat{Q}\inv, with projection measured in the Q\mat{Q} norm. Entropy yields something new, seen next.

Proof

One step. The proximal form’s optimality condition is ⟨ηgt+∇φ(xt+1)−∇φ(xt),x⋆−xt+1⟩≥0\inner{\eta\vb{g}_t + \grad\varphi(\vb{x}_{t+1}) - \grad\varphi(\vb{x}_t)}{\vb{x}^\star - \vb{x}_{t+1}} \ge 0. With the three-point identity (taking z=x⋆\vb{z} = \vb{x}^\star, x=xt+1\vb{x} = \vb{x}_{t+1}, y=xt\vb{y} = \vb{x}_t),

η⟨gt,xt+1−x⋆⟩≤⟨∇φ(xt)−∇φ(xt+1),xt+1−x⋆⟩=Dφ(x⋆,xt)−Dφ(x⋆,xt+1)−Dφ(xt+1,xt).\eta\inner{\vb{g}_t}{\vb{x}_{t+1} - \vb{x}^\star} \le \inner{\grad\varphi(\vb{x}_t) - \grad\varphi(\vb{x}_{t+1})}{\vb{x}_{t+1} - \vb{x}^\star} = D_\varphi(\vb{x}^\star, \vb{x}_t) - D_\varphi(\vb{x}^\star, \vb{x}_{t+1}) - D_\varphi(\vb{x}_{t+1}, \vb{x}_t).

The missing term. By generalized Hölder and strong convexity of φ\varphi,

η⟨gt,xt−xt+1⟩−Dφ(xt+1,xt)≤ηG∥xt−xt+1∥−σ2∥xt−xt+1∥2≤η2G22σ,\eta\inner{\vb{g}_t}{\vb{x}_t - \vb{x}_{t+1}} - D_\varphi(\vb{x}_{t+1}, \vb{x}_t) \le \eta G\norm{\vb{x}_t - \vb{x}_{t+1}} - \tfrac{\sigma}{2}\norm{\vb{x}_t - \vb{x}_{t+1}}^2 \le \frac{\eta^2 G^2}{2\sigma},

maximizing the parabola in ∥xt−xt+1∥\norm{\vb{x}_t - \vb{x}_{t+1}}. Adding the two inequalities, η⟨gt,xt−x⋆⟩≤Dφ(x⋆,xt)−Dφ(x⋆,xt+1)+η2G22σ\eta\inner{\vb{g}_t}{\vb{x}_t - \vb{x}^\star} \le D_\varphi(\vb{x}^\star, \vb{x}_t) - D_\varphi(\vb{x}^\star, \vb{x}_{t+1}) + \frac{\eta^2G^2}{2\sigma}.

Telescoping. By convexity, f(xt)−f⋆≤⟨gt,xt−x⋆⟩f(\vb{x}_t) - f^\star \le \inner{\vb{g}_t}{\vb{x}_t - \vb{x}^\star}, and by Jensen f(xˉk)≤1k∑tf(xt)f(\bar{\vb{x}}_k) \le \frac1k\sum_t f(\vb{x}_t). Summing from t=0t = 0 to k−1k - 1,

f(xˉk)−f⋆≤Dφ(x⋆,x0)ηk+ηG22σ.f(\bar{\vb{x}}_k) - f^\star \le \frac{D_\varphi(\vb{x}^\star, \vb{x}_0)}{\eta k} + \frac{\eta G^2}{2\sigma}.

Since x0\vb{x}_0 minimizes φ\varphi on CC, its optimality condition gives ⟨∇φ(x0),x⋆−x0⟩≥0\inner{\grad\varphi(\vb{x}_0)}{\vb{x}^\star - \vb{x}_0} \ge 0 and hence Dφ(x⋆,x0)≤φ(x⋆)−φ(x0)≤R2D_\varphi(\vb{x}^\star, \vb{x}_0) \le \varphi(\vb{x}^\star) - \varphi(\vb{x}_0) \le R^2. The stated η\eta equalizes both terms and gives the bound.

∎

The proof is the subgradient proof with two changes: the three-point identity replaces the cosine rule and the dual norm replaces the Euclidean norm for the gradient. That is the gain: R GR\,G depends on the chosen geometry, and a good φ\varphi can make it much smaller. If ff is also LL-smooth with respect to ∥⋅∥\norm{\cdot} and σ=1\sigma = 1, the same argument with the descent lemma in place of the gt\vb{g}_t bound gives, with η=1/L\eta = 1/L, f(xk)−f⋆≤L Dφ(x⋆,x0)/kf(\vb{x}_k) - f^\star \le L\,D_\varphi(\vb{x}^\star, \vb{x}_0)/k.

Exponentiated gradient

In dual space the update is additive: ∇φ(x)i=1+log⁡xi\grad\varphi(\vb{x})_i = 1 + \log x_i, so the step subtracts ηgk\eta\vb{g}_k from the weights’ logarithms; returning to primal space exponentiates, and KL projection onto the simplex normalizes. Each weight is multiplied by e−ηgie^{-\eta g_i}, less than 1 for positive-gradient coordinates and greater for negative ones: hence multiplicative weights. Deriving the formula directly from proximal form is an exercise.

With entropy, the theorem’s constants suit the simplex. By Pinsker, σ=1\sigma = 1 with respect to ℓ1\ell_1; the dual norm is ℓ∞\ell_\infty, so G=G∞G = G_\infty bounds ∥g∥∞\norm{\vb{g}}_\infty; the minimizer of φ\varphi on Δn\Delta_n is the center 1/n\vb{1}/n, with φ(1/n)=−log⁡n\varphi(\vb{1}/n) = -\log n, and since φ≤0\varphi \le 0 on the simplex, R2=log⁡nR^2 = \log n. For Euclidean projected subgradient from the center, R2=max⁡x12∥x−1/n∥22≤12R^2 = \max_{\vb{x}}\tfrac12\norm{\vb{x} - \vb{1}/n}_2^2 \le \tfrac12, but a gradient with all components bounded by G∞G_\infty can have ∥g∥2=n G∞\norm{\vb{g}}_2 = \sqrt{n}\,G_\infty. The bounds are

G∞2log⁡nk⏟exponentiated gradientversusG∞nk⏟subgradiente proyectado.\underbrace{G_\infty\sqrt{\frac{2\log n}{k}}}_{\text{exponentiated gradient}} \qquad\text{versus}\qquad \underbrace{G_\infty\sqrt{\frac{n}{k}}}_{\text{subgradiente proyectado}}.

To reach error ε\eps requires k=2G∞2log⁡n/ε2k = 2G_\infty^2\log n/\eps^2 iterations versus k=G∞2n/ε2k = G_\infty^2 n/\eps^2: with n=1000n = 1000, about 72 times fewer. The difference comes from two sources: a dense gradient’s ℓ∞\ell_\infty norm is n\sqrt{n} times smaller than its ℓ2\ell_2 norm, and the simplex’s entropy-measured “radius” grows only as log⁡n\log n.

InteractiveMultiplicative weights in the triangle
Experts with random losses: error f(xˉK)−f⋆f(\bar{\vb{x}}_K) - f^\star versus dimension nn (mean over 4 seeds).
  • Projected gradient bound, √(n/K)
  • Exponentiated gradient bound, √(2 log n / K)
  • No learning (uniform)
Triangle
Function
0.50
k = 60
Dimension
Iterations KK
× 1
Projected at k = 60: f−f⋆f - f^\star0
Projected: exactly zero coordinates2
Exponentiated at k = 60: f−f⋆f - f^\star2.3·10⁻⁴
Exponentiated: smallest coordinate3.86·10⁻⁷
Experts, n=1000n = 1000: projected…
Experts, n=1000n = 1000: exponentiated…
Projected gradient has reached the boundary: some coordinates are exactly zero. Exponentiated gradient multiplies each weight by e−ηgie^{-\eta g_i}, which is never zero: it approaches the boundary geometrically without touching it.
Above, projected gradient (blue) and exponentiated gradient (teal) with the same step η\eta on the three-component simplex, for a linear function (optimum at a vertex) or quadratic (optimum on an edge). Below, the experts problem: f(x)=⟨p,x⟩f(\vb{x}) = \inner{\vb{p}}{\vb{x}} with p1=0.3p_1 = 0.3 and the rest 0.50.5, and each step observes only random losses ℓt,i∼Bern⁡(pi)\ell_{t,i} \sim \Bern(p_i). Each method uses its bound's prescribed step multiplied by a common factor, measuring error of the iterate average after KK steps for nn between 2 and 1000; dashed curves are the bounds and the error from learning nothing. Increase the factor to check that a larger step does not fix projected gradient.

What you should have seen:

  • Projected gradient reaches the boundary; exponentiated gradient does not. With a linear function, projected gradient moves straight, hits an edge, slides along it and reaches vertex e1\vb{e}_1 in finitely many steps; exponentiated gradient follows a curve, approaching the vertex without ever reaching it. For the quadratic, whose optimum (0.575,0.425,0)(0.575, 0.425, 0) lies on an edge, projected gradient reaches that edge in a few iterations with an exactly zero coordinate and converges there. Exponentiated gradient multiplies the third coordinate by a factor below 1 at each step: it tends geometrically to zero but never zeros it. If you want exact zeros, exponentiated gradient will not supply them.
  • In the experts problem, projected gradient stops learning as nn grows. With K=1000K = 1000 and n=1000n = 1000, its error stays near that of the uniform distribution while exponentiated gradient keeps reducing it. A larger projected step does not fix this: with noisy losses, a large step chases each round’s noise.
  • Bounds predict shape, not value. The projected bound becomes uninformative once n/K\sqrt{n/K} exceeds maximum possible error 0.20.2; exponentiated gradient’s stays below throughout.

A caveat before generalizing: the logarithmic advantage is a worst-case claim for ℓ∞\ell_\infty-bounded gradients, typical of noisy or nondifferentiable losses. For smooth ff with few nonzero optimal coordinates, projected gradient finds support, fixes it with exact zeros and then converges as in a low-dimensional problem, while exponentiated gradient must push hundreds of coordinates toward zero, one at a time without reaching it. The lab measures both regimes.

Implementation from scratch

Start with the pieces: projection onto the simplex and ℓ1\ell_1 ball, and linear oracles. Check against their definitions: no point in the set is closer than the projection, the variational inequality holds, and the oracle matches an exhaustive vertex search.

[ ]Projections and linear oraclesBrowser
import numpy as np
import time

def proj_simplex(y, s=1.0):
    """Proyección euclídea sobre {x >= 0, sum(x) = s}: x = max(y - tau, 0)."""
    u = np.sort(y)[::-1]
    css = np.cumsum(u) - s
    k = np.arange(1, len(y) + 1)
    rho = np.nonzero(u - css / k > 0)[0][-1]        # última coordenada que sigue activa
    tau = css[rho] / (rho + 1)
    return np.maximum(y - tau, 0.0)

def proj_l1_ball(y, tau=1.0):
    if np.abs(y).sum() <= tau:
        return y.copy()
    return np.sign(y) * proj_simplex(np.abs(y), tau)

def lmo_simplex(g):
    s = np.zeros_like(g)
    s[np.argmin(g)] = 1.0
    return s

def lmo_l1_ball(g, tau=1.0):
    i = np.argmax(np.abs(g))
    s = np.zeros_like(g)
    s[i] = -tau * np.sign(g[i])
    return s

print("Π(0.8, 0.6, -0.3) =", proj_simplex(np.array([0.8, 0.6, -0.3])))

rng = np.random.default_rng(0)
y = 0.6 * rng.standard_normal(8)
x = proj_simplex(y)
Z = rng.dirichlet(np.ones(8), size=20000)          # 20000 puntos del símplex
print("‖x − y‖ =", round(np.linalg.norm(x - y), 4), " mínimo entre los aleatorios:", round(np.linalg.norm(Z - y, axis=1).min(), 4))
print("desigualdad variacional, máx <y − x, z − x> =", f"{((Z - x) @ (y - x)).max():.2e}")
print("coordenadas nulas de la proyección:", int(np.sum(x == 0)), "de", len(x))

g = rng.standard_normal(8)
vertices_l1 = np.vstack([np.eye(8), -np.eye(8)])
print("oráculo ℓ1 = mejor vértice:", np.isclose(lmo_l1_ball(g) @ g, (vertices_l1 @ g).min()))
xl1 = proj_l1_ball(3 * y)
print("‖Π_ℓ1(3y)‖₁ =", round(np.abs(xl1).sum(), 12))

The projection is exact: no random simplex point is closer to y\vb{y}, the maximum of ⟨y−x,z−x⟩\inner{\vb{y} - \vb{x}}{\vb{z} - \vb{x}} is negative and several coordinates are exactly zero.

Now all three methods on the same problem: quadratic f(x)=12∥Ax−b∥22f(\vb{x}) = \tfrac12\norm{\mat{A}\vb{x} - \vb{b}}_2^2 on Δn\Delta_n, with A∈R60×n\mat{A} \in \R^{60 \times n} and a solution using few coordinates, for n=10,100,1000n = 10, 100, 1000. Projected gradient uses η=1/L2\eta = 1/L_2, with L2=∥A∥22L_2 = \norm{\mat{A}}_2^2; exponentiated gradient uses η=1/L1\eta = 1/L_1, with L1=max⁡ij∣(A⊤A)ij∣L_1 = \max_{ij}\abs{(\mat{A}\T\mat{A})_{ij}}, the smoothness constant with respect to ℓ1\ell_1; Frank-Wolfe uses exact line search from a vertex. For a fair comparison, all three stop on the same criterion: their iterate’s Frank-Wolfe gap, g(x)=⟨∇f(x),x⟩−min⁡i∂if(x)g(\vb{x}) = \inner{\grad f(\vb{x})}{\vb{x}} - \min_i \partial_i f(\vb{x}), below 10−310^{-3}.

[ ]Three simplex methods with the same certificateBrowser
def make_problem(n, m=60, seed=0):
    rng = np.random.default_rng(seed)
    A = rng.standard_normal((m, n)) / np.sqrt(m)
    x_true = np.zeros(n)
    x_true[:5] = rng.dirichlet(np.ones(5))
    b = A @ x_true + 0.01 * rng.standard_normal(m)
    return A, b

def fw_gap(x, g):
    return g @ x - g.min()                           # max_s <g, x − s> sobre el símplex

def solve(method, A, b, eps=1e-3, kmax=20000):
    n = A.shape[1]
    L2 = np.linalg.norm(A, 2) ** 2
    L1 = np.abs(A.T @ A).max()
    x = np.full(n, 1.0 / n)
    if method == "fw":                               # Frank-Wolfe empieza en un vértice
        x = lmo_simplex(A.T @ (A @ x - b))
    w = np.log(np.full(n, 1.0 / n))                  # el exponenciado guarda log-pesos
    gaps = []
    t0 = time.perf_counter()
    for k in range(kmax):
        g = A.T @ (A @ x - b)
        gaps.append(fw_gap(x, g))
        if gaps[-1] <= eps:
            break
        if method == "pgd":
            x = proj_simplex(x - g / L2)
        elif method == "fw":
            d = lmo_simplex(g) - x
            Ad = A @ d
            x = x + np.clip(-(g @ d) / (Ad @ Ad), 0.0, 1.0) * d
        else:
            w = w - g / L1
            x = np.exp(w - w.max())
            x /= x.sum()
    dt = (time.perf_counter() - t0) / max(k, 1)
    return k, dt, int(np.sum(x > 1e-6)), 0.5 * np.sum((A @ x - b) ** 2), gaps

nombres = {"pgd": "proyectado", "fw": "Frank-Wolfe", "eg": "exponenciado"}
historia = {}
for n in [10, 100, 1000]:
    A, b = make_problem(n)
    print(f"n = {n}:  L2 = {np.linalg.norm(A, 2) ** 2:.1f}, L1 = {np.abs(A.T @ A).max():.2f}")
    for m in ["pgd", "fw", "eg"]:
        k, dt, nnz, f, gaps = solve(m, A, b)
        historia[(n, m)] = gaps
        print(f"   {nombres[m]:13s} iteraciones {k:5d}   {1e6 * dt:6.0f} µs/iter   coordenadas > 1e-6: {nnz:4d}   f = {f:.5f}")

Read the table carefully: it contradicts the intuition of the previous section. In this smooth problem projected gradient and Frank-Wolfe reach the certificate in similar iteration counts, while exponentiated gradient needs four to twenty times more. Projected gradient finds the solution’s support, a few dozen coordinates, and fixes it with exact zeros; thereafter it converges as in a low-dimensional problem. Frank-Wolfe ends with the sparsest iterates, adding at most one coordinate per iteration. Exponentiated iterations are cheaper (no sorting), but dense: it must push nearly a thousand coordinates outside the solution toward zero multiplicatively, never reaching it. With n=1000n = 1000, L2L_2 is about fifteen times L1L_1, so exponentiated gradient takes much longer steps, but here that does not compensate.

Exponentiated gradient wins in the figure’s regime: noisy ℓ∞\ell_\infty-bounded gradients. Reproduce this with the experts problem and each method’s theoretical steps:

[ ]The logarithmic advantage with noisy lossesBrowser
def expertos(n, K=1000, delta=0.2, semillas=3, factor=1.0):
    p = np.full(n, 0.5)
    p[0] = 0.5 - delta
    eta_p = factor / np.sqrt(n * K)                  # (R/G)·sqrt(2/K) con R² = 1/2, G = sqrt(n)
    eta_e = factor * np.sqrt(2 * np.log(n) / K)      # (R/G)·sqrt(2/K) con R² = log n, G = 1
    err = np.zeros(2)
    for s in range(semillas):
        rng = np.random.default_rng(100 + s)
        x = np.full(n, 1.0 / n); w = np.zeros(n)
        media = np.zeros((2, n))
        for t in range(K):
            xe = np.exp(w - w.max()); xe /= xe.sum()
            media[0] += x; media[1] += xe
            perdida = (rng.random(n) < p).astype(float)
            x = proj_simplex(x - eta_p * perdida)
            w = w - eta_e * perdida
        err += (media / K) @ p - p[0]
    return err / semillas

print("   n   proyectado  exponenciado   cota √(n/K)   cota √(2 log n / K)")
for n in [10, 100, 1000]:
    ep, ee = expertos(n)
    print(f"{n:4d}   {ep:9.3f}   {ee:11.3f}   {np.sqrt(n / 1000):11.3f}   {np.sqrt(2 * np.log(n) / 1000):14.3f}")

Maximum possible error is 0.20.2, that of learning nothing. With n=1000n = 1000, projected gradient stays close to it while exponentiated gradient keeps learning, as in the figure.

Finally, the nuclear ball. Complete a 60×5060 \times 50 rank-3 matrix observing 40% of entries: f(X)=12∥PΩ(X−M)∥F2f(\mat{X}) = \tfrac12\norm{P_\Omega(\mat{X} - \mat{M})}_F^2, where PΩP_\Omega zeros unobserved entries, on ∥X∥∗≤τ\norm{\mat{X}}_* \le \tau with τ=∥M∥∗\tau = \norm{\mat{M}}_* (an oracle radius, keeping the comparison separate from choosing τ\tau). Frank-Wolfe uses power iteration for its oracle and exact line search since ff is quadratic; projected gradient uses step 1 (here L=1L = 1) and an SVD per iteration.

[ ]Matrix completion on the nuclear ballBrowser
def top_singular_pair(G, iters=50, seed=0):
    v = np.random.default_rng(seed).standard_normal(G.shape[1])
    for _ in range(iters):
        u = G @ v; u /= np.linalg.norm(u)
        v = G.T @ u; s = np.linalg.norm(v); v /= s
    return u, s, v

def proj_nuclear(Y, tau):
    U, s, Vt = np.linalg.svd(Y, full_matrices=False)
    s = s if s.sum() <= tau else proj_simplex(s, tau)
    return (U * s) @ Vt, int(np.sum(s > 1e-10))

rng = np.random.default_rng(1)
m, n, r = 60, 50, 3
M = rng.standard_normal((m, r)) @ rng.standard_normal((r, n))
mask = rng.random((m, n)) < 0.4
tau = np.linalg.norm(M, "nuc")
f = lambda X: 0.5 * np.sum((mask * (X - M)) ** 2)
err_test = lambda X: np.linalg.norm(~mask * (X - M)) / np.linalg.norm(~mask * M)

X = np.zeros((m, n)); Y = np.zeros((m, n)); t_fw = t_pg = 0.0
for k in range(1, 151):
    t0 = time.perf_counter()
    G = mask * (X - M)
    u, s, v = top_singular_pair(G)
    D = -tau * np.outer(u, v) - X                    # S − X con S = −τ u vᵀ
    gap = -np.sum(G * D)
    PD = mask * D
    X = X + np.clip(gap / np.sum(PD * PD), 0, 1) * D
    t1 = time.perf_counter()
    Y, rango = proj_nuclear(Y - mask * (Y - M), tau)
    t2 = time.perf_counter()
    t_fw += t1 - t0; t_pg += t2 - t1
    if k in (10, 50, 150):
        rango_fw = np.linalg.matrix_rank(X, tol=1e-6)
        print(f"k = {k:3d}  FW: f = {f(X):7.2f}, gap = {gap:7.2f}, rango = {rango_fw:2d}, error fuera = {err_test(X):.3f}"
              f"   |   proyectado: f = {f(Y):6.2f}, rango = {rango:2d}, error fuera = {err_test(Y):.3f}")
print(f"tiempo por iteración: FW {1e3 * t_fw / 150:.2f} ms, proyectado {1e3 * t_pg / 150:.2f} ms")

for N in [100, 200, 300]:
    B = rng.standard_normal((N, N))
    t0 = time.perf_counter(); np.linalg.svd(B); t1 = time.perf_counter(); top_singular_pair(B); t2 = time.perf_counter()
    print(f"N = {N}: SVD completa {1e3 * (t1 - t0):7.1f} ms   par dominante (50 iteraciones de la potencia) {1e3 * (t2 - t1):5.1f} ms")

The two things to measure are clear. Per iteration Frank-Wolfe is cheaper, and the difference grows with size: full SVD costs O(N3)\bigO(N^3) and power iteration O(N2)\bigO(N^2) per iteration, so projected gradient becomes impractical on matrices with thousands of rows. In exchange, Frank-Wolfe fits observed data much more slowly, and the gap grows: its ff is about 4 times projected gradient’s at 10 iterations and 40 times at 150, consistent with its O(1/k)\bigO(1/k) rate versus faster projected convergence. Out-of-sample error, however, is similar or slightly better here: early stopping acts as regularization. Note rank too: each Frank-Wolfe iteration adds a rank-one matrix, so on a 60×5060 \times 50 matrix the iterate soon reaches full rank, while projection, which clips small singular values to zero, stays at rank 9. The low-rank promise holds only when stopping at kk much smaller than min⁡(m,n)\min(m, n), the large-matrix regime, or using atom-removing variants like away steps. The Frank-Wolfe gap, free here, always says at most how much remains to gain.

The professional version

In practice Frank-Wolfe shines when the linear oracle is a classic combinatorial algorithm. The textbook case is the Birkhoff polytope, the set of doubly stochastic matrices: nonnegative with rows and columns summing to 1. By the Birkhoff–von Neumann theorem, vertices are permutation matrices, so linear minimization over it is an assignment problem, solved exactly by scipy.optimize.linear_sum_assignment in O(n3)\bigO(n^3). Projection, by contrast, has no closed form.

Use it to match two graphs: B\mat{B} is graph A\mat{A} with permuted nodes and eight randomly changed edges, and we seek the permutation. The convex relaxation min⁡P∥PA−BP∥F2\min_{\mat{P}}\norm{\mat{P}\mat{A} - \mat{B}\mat{P}}_F^2 over the Birkhoff polytope is solved by Frank-Wolfe, and the result rounded to a permutation via another assignment. SciPy also provides quadratic_assignment with FAQ (Vogelstein et al., 2015), Frank-Wolfe applied to the same problem’s nonconvex relaxation.

[ ]Frank-Wolfe on the Birkhoff polytope with SciPyBrowser
from scipy.optimize import linear_sum_assignment, quadratic_assignment

rng = np.random.default_rng(3)
n = 40
A = np.triu((rng.random((n, n)) < 0.15).astype(float), 1); A = A + A.T
perm = rng.permutation(n)
Pt = np.eye(n)[perm]                                 # B[i, j] = A[perm[i], perm[j]]
B = Pt @ A @ Pt.T
iu = np.triu_indices(n, 1)
for t in rng.choice(len(iu[0]), 8, replace=False):  # ruido: ocho pares cambiados
    i, j = iu[0][t], iu[1][t]
    B[i, j] = B[j, i] = 1 - B[i, j]

f = lambda P: np.sum((P @ A - B @ P) ** 2)
P = np.full((n, n), 1.0 / n)
for k in range(1, 201):
    R = P @ A - B @ P
    G = 2 * (R @ A.T - B.T @ R)
    filas, cols = linear_sum_assignment(G)           # oráculo lineal: la mejor permutación
    D = -P; D[filas, cols] += 1.0                    # D = S − P
    gap = -np.sum(G * D)
    RD = D @ A - B @ D                               # f(P + γD) es cuadrática en γ
    P = P + np.clip(-np.sum(R * RD) / np.sum(RD * RD), 0, 1) * D
    if k in (1, 10, 50, 200):
        _, asignacion = linear_sum_assignment(-P)    # redondeo a la permutación más cercana
        print(f"k = {k:3d}   f = {f(P):6.3f}   gap = {gap:6.3f}   cota inferior de f* = {f(P) - gap:7.3f}"
              f"   nodos bien emparejados: {np.mean(asignacion == perm):.0%}")

res = quadratic_assignment(A, B, method="faq", options={"maximize": True, "rng": 0})
print(f"FAQ de SciPy: {res.nit} iteraciones de Frank-Wolfe, emparejamiento correcto: {np.all(perm[res.col_ind] == np.arange(n))}")

After ten iterations rounding already recovers the entire permutation, although the relaxation is far from optimal. The lower bound f(P)−g(P)f(\mat{P}) - g(\mat{P}) is not monotone, but the best so far is, and at 200 iterations it brackets the relaxation optimum between 0.530.53 and 2.582.58 without calculating it. Outside SciPy, this lesson’s projections and oracles are implemented in the JAX ecosystem’s differentiable optimization libraries and dedicated Frank-Wolfe packages; in PyTorch projected gradient on an ℓ∞\ell_\infty ball is torch.clamp after each step. For exponentiated gradient, scipy.special.softmax on log-weights suffices.

Common mistakes

Exercises

NumericA Euclidean Bregman divergence
Calculate the Bregman divergence generated by φ(x)=12∥x∥22\varphi(\vb{x}) = \tfrac12\norm{\vb{x}}_2^2 between x=(1,2)\vb{x} = (1, 2) and y=(3,0)\vb{y} = (3, 0), i.e. Dφ(x,y)D_\varphi(\vb{x}, \vb{y}).
NumericProject onto the simplex by hand
Calculate the first coordinate of the Euclidean projection of y=(1.2,0.5,0.4,−0.1)\vb{y} = (1.2, 0.5, 0.4, -0.1) onto simplex Δ4\Delta_4.
NumericA multiplicative-weights step
From x=(1/3,1/3,1/3)\vb{x} = (1/3, 1/3, 1/3), gradient g=(1,0,2)\vb{g} = (1, 0, 2) and step η=log⁡2\eta = \log 2, take an exponentiated-gradient step. What is the second coordinate of the new iterate?
NumericThe Frank-Wolfe gap at the center
On simplex Δ3\Delta_3, let f(x)=12∥x−q∥22f(\vb{x}) = \tfrac12\norm{\vb{x} - \vb{q}}_2^2 with q=(0.7,0.55,−0.25)\vb{q} = (0.7, 0.55, -0.25). Calculate the Frank-Wolfe gap g(x)g(\vb{x}) at center x=(1/3,1/3,1/3)\vb{x} = (1/3, 1/3, 1/3).
NumericHow many iterations does entropy save?
With ℓ∞\ell_\infty-bounded gradients on the simplex of dimension n=1000n = 1000, by what factor must the iteration count guaranteed by exponentiated gradient's bound, G∞2log⁡n/kG_\infty\sqrt{2\log n / k}, be multiplied to obtain that guaranteed by projected subgradient's bound, G∞n/kG_\infty\sqrt{n/k}, at the same accuracy ε\eps?
ProofThe Frank-Wolfe gap bounds error
Prove: Let ff be convex and differentiable, CC convex and compact, and x∈C\vb{x} \in C. Then g(x)=max⁡s∈C⟨∇f(x),x−s⟩g(\vb{x}) = \max_{\vb{s} \in C}\inner{\grad f(\vb{x})}{\vb{x} - \vb{s}} satisfies 0≤f(x)−f⋆≤g(x)0 \le f(\vb{x}) - f^\star \le g(\vb{x}).
0
Let x⋆∈C\vb{x}^\star \in C be a minimizer, which exists because CC is compact and ff continuous.

Step 1 of 3. Which inequality do you start with?

ProofFrom entropy mirror descent to multiplicative weights
Prove: With φ(x)=∑ixilog⁡xi\varphi(\vb{x}) = \sum_i x_i\log x_i on Δn\Delta_n and xk\vb{x}_k in the simplex interior, the mirror descent step is xk+1,i=xk,ie−ηgi/∑jxk,je−ηgjx_{k+1,i} = x_{k,i}e^{-\eta g_i}/\sum_j x_{k,j}e^{-\eta g_j}.
0
Start from proximal form: xk+1=arg min⁡x∈Δn(η⟨g,x⟩+Dφ(x,xk))\vb{x}_{k+1} = \argmin_{\vb{x} \in \Delta_n}\big(\eta\inner{\vb{g}}{\vb{x}} + D_\varphi(\vb{x}, \vb{x}_k)\big).

Step 1 of 4. What does Dφ(x,xk)D_\varphi(\vb{x}, \vb{x}_k) become for x∈Δn\vb{x} \in \Delta_n?

QuizOptimizing over doubly stochastic matrices
You want to minimize a smooth convex function of P∈R100×100\mat{P} \in \R^{100 \times 100} (that is, 10410^4 variables) over the Birkhoff polytope of doubly stochastic matrices, and want iterates to be combinations of few permutations for later rounding. Which method do you choose?
QuizFrank-Wolfe with an optimum on an edge
You minimize a strongly convex quadratic on a polytope with Frank-Wolfe and exact line search. The optimum is in an edge's relative interior (not a vertex). What do you expect?
QuizWhat is mirror descent?
Which statements are correct?

More than one answer may be correct.

CodeNuclear-ball oracle via power iteration
Implement lmo_nuclear_ball(G, tau, iters=200) returning S=arg min⁡∥S∥∗≤τ⟨G,S⟩=−τ u1v1⊤\mat{S} = \argmin_{\norm{\mat{S}}_* \le \tau}\inner{\mat{G}}{\mat{S}} = -\tau\,\vb{u}_1\vb{v}_1\T, where (u1,v1)(\vb{u}_1, \vb{v}_1) is G's dominant singular pair. Calculate it only with power iteration on G and G.T (tests disable np.linalg.svd, eig and eigh when calling your function). Use a random starting vector with fixed seed. Tests check the oracle value, rank-one output with nuclear norm τ\tau, and that within Frank-Wolfe on a completion problem the gap computed by your oracle truly bounds error.
import numpy as np

def lmo_nuclear_ball(G, tau, iters=200):
  # 1. método de la potencia: alterna u = G v y v = G.T u, normalizando
  # 2. devuelve -tau * outer(u, v)
  pass
Shift+Enter to run

Summary

Key idea
Three ways to respect a convex set with first-order information: project (fast if projection is cheap, with familiar rates), solve a linear problem (Frank-Wolfe: no projections, sparse iterates and a free certificate, but O(1/k)\bigO(1/k) and zigzag near faces), or change geometry (mirror descent: step in dual space and adapt the measuring rule to the set with a Bregman divergence). On the simplex, entropy turns the step into multiplicative weights and dimension dependence from n\sqrt{n} into log⁡n\sqrt{\log n}.
  • Projected gradient is proximal gradient with the indicator of CC: it retains O(L∥x0−x⋆∥2/k)\bigO(L\norm{\vb{x}_0 - \vb{x}^\star}^2/k) and the linear rate with strong convexity. Simplex projection subtracts a threshold and clips, in O(nlog⁡n)\bigO(n \log n), producing exact zeros.
  • Frank-Wolfe replaces projection with oracle arg min⁡s∈C⟨∇f,s⟩\argmin_{\vb{s} \in C}\inner{\grad f}{\vb{s}}, given by the dual norm on norm balls and a singular pair on the nuclear ball. It converges at 2LD2/(k+2)2LD^2/(k + 2), with iterates combining k+1k + 1 extreme points, and gap g(x)≥f(x)−f⋆g(\vb{x}) \ge f(\vb{x}) - f^\star comes free. It zigzags when the optimum is on a face; away steps fix this.
  • Bregman divergences Dφ(x,y)=φ(x)−φ(y)−⟨∇φ(y),x−y⟩D_\varphi(\vb{x}, \vb{y}) = \varphi(\vb{x}) - \varphi(\vb{y}) - \inner{\grad\varphi(\vb{y})}{\vb{x} - \vb{y}}: Euclidean, Mahalanobis and KL are special cases. The three-point identity replaces the cosine rule, and Pinsker makes entropy 1-strongly convex in ℓ1\ell_1.
  • Mirror descent steps in dual space using ∇φ\grad\varphi, returns with ∇φ∗\grad\varphi^* and projects with DφD_\varphi; its bound is RG2/(σk)RG\sqrt{2/(\sigma k)}. With entropy on the simplex it is exponentiated gradient, xi∝xie−ηgix_i \propto x_i e^{-\eta g_i}, bounded by G∞2log⁡n/kG_\infty\sqrt{2\log n/k} versus G∞n/kG_\infty\sqrt{n/k}. Implement it in log-weights; it never gives exact zeros.
  • Choosing: cheap projection and solution with few active coordinates, projected gradient; expensive projection and cheap linear oracle (nuclear ball, combinatorial polytopes), Frank-Wolfe; noisy or nondifferentiable gradients on the simplex, or online learning, exponentiated gradient.