Constrained Optimization

Dive into Deep Learning · §35.6

Constrained Optimization
Lagrange multipliers · KKT conditions · Euclidean & simplex projections · proximal operators & ISTA · coordinate descent

When the Optimum Has a Nonzero Gradient

Motivation

Projecting \mathbf{y} = (3, 4) onto the unit disk g(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|_2^2 - 1) \le 0 minimizes f(\mathbf{x}) = \tfrac12\|\mathbf{x} - \mathbf{y}\|_2^2:

\nabla f(\mathbf{x}^\star) + 4\,\nabla g(\mathbf{x}^\star) = (-2.4, -3.2) + 4(0.6, 0.8) = \mathbf{0}

  • Nonzero gradient at \mathbf{x}^\star = (0.6, 0.8): \nabla f(\mathbf{x}^\star) = (-2.4, -3.2) \neq \mathbf{0}.
  • Force balance: No feasible move lowers f because the outward boundary normal \nabla g(\mathbf{x}^\star) pushes back with multiplier \lambda^\star = 4.

Equality Constraints and Tangency of Level Sets

Lagrange Multipliers

Consider minimizing a differentiable objective f(\mathbf{x}) on an equality surface h(\mathbf{x}) = 0 (such as the unit circle h(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|^2 - 1) = 0):

  • Crossing level sets cannot be optimal: If a level set of f crosses \{h = 0\}, then \nabla f has a nonzero component tangent to the surface, providing a feasible descent direction.
  • Tangency condition: At any local extremum \mathbf{x}^\star where \nabla h(\mathbf{x}^\star) \neq \mathbf{0}, the level set of f is tangent to \{h = 0\}, so their normal vectors are parallel: \nabla f(\mathbf{x}^\star) + \nu^\star\,\nabla h(\mathbf{x}^\star) = \mathbf{0}
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

The Lagrangian and Stationarity on the Circle

Lagrange Multipliers

We package both requirements, parallel normals and feasibility h(\mathbf{x}) = 0, into a single function of (\mathbf{x}, \nu), the Lagrangian:

\mathcal{L}(\mathbf{x}, \nu) = f(\mathbf{x}) + \nu\,h(\mathbf{x}) \implies \nabla_{\mathbf{x}}\mathcal{L} = \nabla f(\mathbf{x}) + \nu\,\nabla h(\mathbf{x}) = \mathbf{0}, \qquad \frac{\partial\mathcal{L}}{\partial\nu} = h(\mathbf{x}) = 0

  • Solving the unit-circle problem (\mathbf{y} = (3, 4)):
    1. Stationarity \nabla_{\mathbf{x}}\mathcal{L} = (\mathbf{x} - \mathbf{y}) + \nu\mathbf{x} = \mathbf{0} places \mathbf{x} = \frac{\mathbf{y}}{1 + \nu} on the ray through \mathbf{y}.
    2. Feasibility \|\mathbf{x}\|_2 = 1 requires |1 + \nu| = \|\mathbf{y}\|_2 = 5, yielding two solutions:
      • \nu^\star = +4: \mathbf{x}^\star = (0.6, 0.8) at distance 4 from \mathbf{y} (f = 8, the global minimum).
      • \nu = -6: \mathbf{x} = (-0.6, -0.8) at distance 6 from \mathbf{y} (f = 18, the global maximum).
  • Why \nabla h(\mathbf{x}^\star) \neq \mathbf{0} matters: On \min x_1 subject to h(x_1, x_2) = x_1^2 + x_2^2 = 0, the unique feasible point \mathbf{0} has \nabla f(\mathbf{0}) = (1, 0) but \nabla h(\mathbf{0}) = \mathbf{0}, so no multiplier \nu exists.

Closest Point on a Hyperplane and Shadow Prices

Lagrange Multipliers

Minimizing f(\mathbf{x}) = \tfrac12\|\mathbf{x}\|_2^2 on the hyperplane h(\mathbf{x}) = \mathbf{a}^\top\mathbf{x} - b = 0 gives \mathbf{x} = -\nu\mathbf{a} and:

\nu^\star = -\frac{b}{\|\mathbf{a}\|^2}, \qquad \mathbf{x}^\star = \frac{b}{\|\mathbf{a}\|^2}\,\mathbf{a}, \qquad p^\star(b) = \frac{b^2}{2\|\mathbf{a}\|^2}

  • Shadow price: Differentiating p^\star(b) with respect to threshold b reveals \frac{\partial p^\star(b)}{\partial b} = -\nu^\star.

Inequality Constraints: Active vs. Inactive Walls

Inequality Constraints

Minimizing \tfrac12\|\mathbf{x} - \mathbf{y}\|_2^2 over the solid ball g(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|_2^2 - r^2) \le 0 splits into two regimes:

\mathbf{x}^\star = \frac{\mathbf{y}}{\max\big(1,\, \|\mathbf{y}\|/r\big)}, \qquad \lambda^\star = \max\!\left(0,\, \frac{\|\mathbf{y}\|}{r} - 1\right)

  • Inactive (g(\mathbf{x}^\star) < 0, \|\mathbf{y}\| < r): \mathbf{x}^\star = \mathbf{y} lies inside the ball and \lambda^\star = 0.
  • Active (g(\mathbf{x}^\star) = 0, \|\mathbf{y}\| \ge r): \mathbf{x}^\star = r\mathbf{y}/\|\mathbf{y}\| sits on the boundary sphere with \lambda^\star \ge 0.

Verifying Force Balance in Gradient Clipping

Inequality Constraints

For \mathbf{y} = (3, 4) and radius r = 1, the active constraint formula yields \lambda^\star = 5/1 - 1 = 4 and \mathbf{x}^\star = (0.6, 0.8):

x* = [0.6 0.8]  lambda* = 4.0  f(x*) = 8.0
grad f(x*) = [-2.4 -3.2]  lambda* grad g(x*) = [2.4 3.2]  sum = [0. 0.]

Why inequality multipliers must be nonnegative (\lambda^\star \ge 0): Since \nabla g(\mathbf{x}^\star) points outward from the feasible set \{g \le 0\}, stationarity -\nabla f(\mathbf{x}^\star) = \lambda^\star \nabla g(\mathbf{x}^\star) with \lambda^\star \ge 0 ensures that the downhill direction -\nabla f pulls outward into the wall. If \lambda^\star < 0, -\nabla f would point inward, so stepping into the interior would lower f.

The Four Karush–Kuhn–Tucker (KKT) Conditions

KKT Conditions

For \min_{\mathbf{x}} f(\mathbf{x}) subject to g_i(\mathbf{x}) \le 0 and h_j(\mathbf{x}) = 0, form \mathcal{L}(\mathbf{x}, \boldsymbol{\lambda}, \boldsymbol{\nu}) = f(\mathbf{x}) + \sum_i \lambda_i g_i(\mathbf{x}) + \sum_j \nu_j h_j(\mathbf{x}):

\nabla f(\mathbf{x}^\star) + \sum_{i=1}^m \lambda_i^\star\nabla g_i(\mathbf{x}^\star) + \sum_{j=1}^p \nu_j^\star\nabla h_j(\mathbf{x}^\star) = \mathbf{0}

  • Feasibility: Primal (g_i(\mathbf{x}^\star) \le 0, h_j(\mathbf{x}^\star) = 0) and Dual (\lambda_i^\star \ge 0).
  • Complementary slackness: \lambda_i^\star g_i(\mathbf{x}^\star) = 0 for every i (inactive walls exert zero force).

Normal Cone Geometry of Active Constraints

KKT Conditions

By complementary slackness, inactive constraints (g_i(\mathbf{x}^\star) < 0) have \lambda_i^\star = 0 and drop out of the stationarity sum. Let \mathcal{A}(\mathbf{x}^\star) = \{i : g_i(\mathbf{x}^\star) = 0\} denote the active set, with \lambda_i^\star \ge 0:

-\nabla f(\mathbf{x}^\star) = \sum_{i \in \mathcal{A}(\mathbf{x}^\star)} \lambda_i^\star\,\nabla g_i(\mathbf{x}^\star)

  • The normal cone: At an optimum, the steepest descent direction -\nabla f(\mathbf{x}^\star) must lie inside the convex cone spanned by the outward normals \nabla g_i(\mathbf{x}^\star) of the active walls.
  • Nonconvex caveat: On \min_{x \in [-1, 1]} -x^2, the interior point x = 0 satisfies all four KKT conditions with \lambda_1 = \lambda_2 = 0, yet x = 0 is the global maximum.
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Constraint Qualifications: LICQ and Slater’s Rule

KKT Necessity & Sufficiency

Two regularity conditions guarantee that every local minimum is a KKT point (preventing degenerate boundary cusps where constraint gradients collapse):

  • 1. Linear Independence Constraint Qualification (LICQ — general smooth problems): The gradients of all active inequalities and all equalities at \mathbf{x}^\star, \big\{\nabla g_i(\mathbf{x}^\star) : i \in \mathcal{A}(\mathbf{x}^\star)\big\} \cup \big\{\nabla h_j(\mathbf{x}^\star) : j = 1, \ldots, p\big\}, are linearly independent.
  • 2. Slater’s Condition (convex problems — f, g_i convex, h_j affine): There exists a single strictly feasible point \bar{\mathbf{x}} satisfying: g_i(\bar{\mathbf{x}}) < 0 \;\text{ (for all non-affine } g_i\text{)}, \qquad g_i(\bar{\mathbf{x}}) \le 0 \;\text{ (for affine } g_i\text{)}, \qquad h_j(\bar{\mathbf{x}}) = 0 \;\forall\,j Checking Slater’s condition requires finding just one interior point (e.g., \bar{\mathbf{x}} = \mathbf{0} for any norm ball of radius r > 0), without knowing \mathbf{x}^\star in advance.

Proving KKT Sufficiency Under Convexity

KKT Necessity & Sufficiency

For convex problems (f and g_i convex and differentiable, h_j affine), the KKT conditions are always sufficient for global optimality—requiring no constraint qualification at all:

  • Proposition: If (\mathbf{x}^\star, \boldsymbol{\lambda}^\star, \boldsymbol{\nu}^\star) satisfies the KKT conditions on a convex problem, then f(\mathbf{x}^\star) \le f(\mathbf{x}) for every feasible \mathbf{x}.
  • Three-line proof:
    1. Fix the KKT multipliers and consider \varphi(\mathbf{x}) = \mathcal{L}(\mathbf{x}, \boldsymbol{\lambda}^\star, \boldsymbol{\nu}^\star) = f(\mathbf{x}) + \sum_i \lambda_i^\star g_i(\mathbf{x}) + \sum_j \nu_j^\star h_j(\mathbf{x}). Because \lambda_i^\star \ge 0, \varphi(\mathbf{x}) is a nonnegative weighted sum of convex functions plus affine functions, so \varphi is convex on \mathbb{R}^n.
    2. By KKT stationarity, \nabla\varphi(\mathbf{x}^\star) = \mathbf{0}, so \mathbf{x}^\star is an unconstrained global minimizer of \varphi: \varphi(\mathbf{x}) \ge \varphi(\mathbf{x}^\star) for all \mathbf{x} \in \mathbb{R}^n.
    3. For any feasible \mathbf{x} (g_i(\mathbf{x}) \le 0, h_j(\mathbf{x}) = 0), complementary slackness (\lambda_i^\star g_i(\mathbf{x}^\star) = 0) gives: f(\mathbf{x}) \ge f(\mathbf{x}) + \sum_{i=1}^m \lambda_i^\star g_i(\mathbf{x}) + \sum_{j=1}^p \nu_j^\star h_j(\mathbf{x}) = \varphi(\mathbf{x}) \ge \varphi(\mathbf{x}^\star) = f(\mathbf{x}^\star)

Euclidean Projection onto a Closed Convex Set

Projections

For any nonempty closed convex set C \subseteq \mathbb{R}^n, the Euclidean projection \Pi_C(\mathbf{y}) maps \mathbf{y} \in \mathbb{R}^n to the unique closest point in C:

\Pi_C(\mathbf{y}) = \mathop{\mathrm{argmin}}_{\mathbf{x} \in C}\;\tfrac12\|\mathbf{x} - \mathbf{y}\|_2^2

  • Existence and uniqueness: Intersecting C with a closed ball around \mathbf{y} creates a compact set (guaranteeing existence by continuity), and 1-strong convexity of \tfrac12\|\mathbf{x} - \mathbf{y}\|^2 guarantees uniqueness.
  • Closed-form dictionary of elementary projections:
    • Euclidean ball \{ \|\mathbf{x}\|_2 \le r \}: \Pi_C(\mathbf{y}) = \frac{\mathbf{y}}{\max(1,\, \|\mathbf{y}\|_2 / r)}.
    • Axis-aligned box [a_i, b_i]: \Pi_C(\mathbf{y})_i = \min\big(b_i, \max(a_i, y_i)\big) (coordinatewise clipping).
    • Half-space \{ \mathbf{a}^\top\mathbf{x} \ge b \}: \Pi_C(\mathbf{y}) = \mathbf{y} + \frac{\max(0,\, b - \mathbf{a}^\top\mathbf{y})}{\|\mathbf{a}\|_2^2}\,\mathbf{a}.

The Obtuse-Angle Variational Inequality

Projections

A point \hat{\mathbf{x}} \in C is the projection \Pi_C(\mathbf{y}) if and only if the residual vector \mathbf{y} - \hat{\mathbf{x}} forms an obtuse (or right) angle \ge 90^\circ with every feasible chord \mathbf{x} - \hat{\mathbf{x}} into C (\forall\,\mathbf{x} \in C):

\big(\mathbf{y} - \Pi_C(\mathbf{y})\big)^\top\big(\mathbf{x} - \Pi_C(\mathbf{y})\big) \le 0

  • Necessity: Moving along (1-\theta)\hat{\mathbf{x}} + \theta\mathbf{x} \in C cannot lower \varphi(\mathbf{x}) = \tfrac12\|\mathbf{x} - \mathbf{y}\|^2, so \nabla\varphi(\hat{\mathbf{x}})^\top(\mathbf{x} - \hat{\mathbf{x}}) = (\hat{\mathbf{x}} - \mathbf{y})^\top(\mathbf{x} - \hat{\mathbf{x}}) \ge 0.
  • Sufficiency: By the tangent bound for convex \varphi, \varphi(\mathbf{x}) \ge \varphi(\hat{\mathbf{x}}) + (\hat{\mathbf{x}} - \mathbf{y})^\top(\mathbf{x} - \hat{\mathbf{x}}) \ge \varphi(\hat{\mathbf{x}}).
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Proving Projections Are Nonexpansive

Projections

Projecting two points onto a closed convex set C never increases the Euclidean distance between them:

\|\Pi_C(\mathbf{x}) - \Pi_C(\mathbf{y})\|_2 \le \|\mathbf{x} - \mathbf{y}\|_2

  • Three-line proof: Sum the obtuse-angle inequalities (\mathbf{x} - \mathbf{u})^\top(\mathbf{v} - \mathbf{u}) \le 0 and (\mathbf{y} - \mathbf{v})^\top(\mathbf{u} - \mathbf{v}) \le 0 (where \mathbf{u} = \Pi_C(\mathbf{x}), \mathbf{v} = \Pi_C(\mathbf{y})) to get \|\mathbf{u} - \mathbf{v}\|_2^2 \le (\mathbf{x} - \mathbf{y})^\top(\mathbf{u} - \mathbf{v}), and apply Cauchy–Schwarz.

Projected Gradient Descent and Fixed Points

Projected Gradient Descent

Projected Gradient Descent (PGD) alternates a gradient step with Euclidean projection onto C:

\mathbf{x}_{k+1} = \Pi_C\big(\mathbf{x}_k - \eta\,\nabla f(\mathbf{x}_k)\big)

  • Fixed-point certificate: \mathbf{x}^\star = \Pi_C(\mathbf{x}^\star - \eta\nabla f(\mathbf{x}^\star)) iff \nabla f(\mathbf{x}^\star)^\top(\mathbf{x} - \mathbf{x}^\star) \ge 0 for all \mathbf{x} \in C (no feasible descent direction; global optimum when f is convex).

Why PGD Contracts as Fast as Unconstrained GD

Projected Gradient Descent

Does adding a projection step after every gradient update slow down convergence? On a \mu-strongly convex, L-smooth function (\mu\mathbf{I} \preceq \nabla^2 f(\mathbf{x}) \preceq L\mathbf{I}), nonexpansiveness guarantees the exact same worst-case contraction factor \rho = \max(|1 - \eta\mu|, |1 - \eta L|) as unconstrained gradient descent:

  • Step 1: Write \mathbf{x}^\star as a fixed point: \mathbf{x}^\star = \Pi_C\big(\mathbf{x}^\star - \eta\nabla f(\mathbf{x}^\star)\big).
  • Step 2: Strip away \Pi_C via nonexpansiveness: \|\mathbf{x}_{k+1} - \mathbf{x}^\star\| = \big\|\Pi_C(\mathbf{x}_k - \eta\nabla f(\mathbf{x}_k)) - \Pi_C(\mathbf{x}^\star - \eta\nabla f(\mathbf{x}^\star))\big\| \le \big\|(\mathbf{x}_k - \mathbf{x}^\star) - \eta\big(\nabla f(\mathbf{x}_k) - \nabla f(\mathbf{x}^\star)\big)\big\|
  • Step 3: Apply the fundamental theorem of calculus: With \bar{\mathbf{H}} = \int_0^1 \nabla^2 f(\mathbf{x}^\star + t(\mathbf{x}_k - \mathbf{x}^\star))\,dt (\mu\mathbf{I} \preceq \bar{\mathbf{H}} \preceq L\mathbf{I}), \|\mathbf{x}_{k+1} - \mathbf{x}^\star\| = \big\|(\mathbf{I} - \eta\bar{\mathbf{H}})(\mathbf{x}_k - \mathbf{x}^\star)\big\| \le \max\big(|1 - \eta\mu|,\, |1 - \eta L|\big)\,\|\mathbf{x}_k - \mathbf{x}^\star\|

Two-Phase PGD Dynamics on the κ = 1000 Valley

Projected Gradient Descent

Minimize f(\mathbf{x}) = \tfrac12(x_1^2 + 1000\,x_2^2) over the half-space x_1 + x_2 \ge 1 (\mathbf{x}^\star = (\frac{1000}{1001}, \frac{1}{1001}), \lambda^\star = \frac{1000}{1001}) using PGD with \eta = 1.5 \times 10^{-3} from (3, 4):

bound rho = 0.9985   largest ratio in a step = 0.9977
steps to |x - x*| < 1e-6: 738   every step projected from step 733 on
ratio per step on the line: 0.2492   1 - 500.5 eta = 0.2492
grad f at the end = [0.999001 0.999001]
  • Why 738 steps instead of 10{,}200? For the first 732 steps, the iterate drifts through the interior at the slow rate 1 - \eta = 0.9985. Once it hits the boundary line x_1 + x_2 = 1 at step 733, the restricted quadratic along the line has curvature 500.5, contracting at 1 - 500.5\eta = 0.249 per step.

Projecting onto the Probability Simplex (Sparsemax)

Simplex Projection

To project a score vector \mathbf{y} \in \mathbb{R}^n onto the probability simplex \Delta = \{\mathbf{x} \succeq \mathbf{0} : \mathbf{1}^\top\mathbf{x} = 1\}, solve \min_{\mathbf{x} \in \Delta}\tfrac12\|\mathbf{x} - \mathbf{y}\|^2:

  • KKT stationarity & slackness: With multiplier \tau on \sum_i x_i = 1 and \lambda_i \ge 0 on -x_i \le 0, stationarity x_i - y_i + \tau - \lambda_i = 0 and \lambda_i x_i = 0 collapse to x_i^\star = \max(y_i - \tau,\, 0), where \tau is uniquely determined by the unit-sum budget: \sum_{i=1}^n \max(y_i - \tau,\, 0) = 1
  • Exact O(n\log n) sort-and-threshold: Sort u_1 \ge \cdots \ge u_n, form \tau_k = \frac{1}{k}\big(\sum_{j=1}^k u_j - 1\big), and pick the largest k with u_k > \tau_k.
image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

Certifying Simplex Projections via Vertex Tests

Simplex Projection

Because x_i(\tau) = \max(y_i - \tau, 0) and \lambda_i(\tau) = \max(0, \tau - y_i) satisfy stationarity, dual feasibility, and complementary slackness for every scalar \tau, checking those three KKT residuals alone can be fooled by an incorrect \tau:

x* = [0.666 0.334 0.    0.    0.    0.   ]  zeros: 4  tau = 1.662
tau =  1.662: stationarity 0e+00, comp. slack 0e+00, dual feas. True, sum x = 1.000
tau =  1.962: stationarity 0e+00, comp. slack 0e+00, dual feas. True, sum x = 0.400
certificate max_i (y - x*)^T(e_i - x*) = -3e-16  (<= 0 up to rounding: True)
  • Only the unit-sum budget \sum_i x_i = 1 and the obtuse-angle certificate tested at the n simplex vertices \mathbf{e}_i, \max_{1 \le i \le n}(\mathbf{y} - \mathbf{x}^\star)^\top(\mathbf{e}_i - \mathbf{x}^\star) \le 0, certify that \mathbf{x}^\star = \Pi_\Delta(\mathbf{y}).

Why Subgradient Descent Fails to Produce Sparsity

Proximal Operators

The lasso minimizes F(\mathbf{w}) = \tfrac12\|\mathbf{A}\mathbf{w} - \mathbf{b}\|_2^2 + \lambda\|\mathbf{w}\|_1 (\mathbf{A} \in \mathbb{R}^{100 \times 8}, 5 planted zero weights, \lambda = 3). What happens if we run subgradient descent \mathbf{w}_{k+1} = \mathbf{w}_k - \eta\big(\mathbf{A}^\top(\mathbf{A}\mathbf{w}_k - \mathbf{b}) + \lambda\,\mathrm{sign}(\mathbf{w}_k)\big) at \eta = 1/L?

exact zeros: 0 of 8;  sign flips of the null coordinates, last 20 steps: 95 of 95
largest null coordinate: 0.033;  eta * lam = 0.021

Why subgradient steps chatter across zero: At a planted zero coordinate, the smooth gradient has magnitude < \lambda, so the subgradient kick \pm\eta\lambda overpowers it and flips the coordinate’s sign on nearly every step, leaving 0 exact zeros.

Soft-Thresholding and the Proximal Operator

Proximal Operators

The proximal operator minimizes a nonsmooth convex penalty \psi(\mathbf{x}) against a quadratic tether to \mathbf{z}:

\mathrm{prox}_\psi(\mathbf{z}) = \mathop{\mathrm{argmin}}_{\mathbf{x} \in \mathbb{R}^d}\left(\psi(\mathbf{x}) + \tfrac12\|\mathbf{x} - \mathbf{z}\|_2^2\right)

  • 1D soft-thresholding (\psi(x) = \lambda|x|): By Fermat’s rule 0 \in \lambda\partial|x| + (x - z), \mathrm{prox}_{\lambda|\cdot|}(z) = \mathrm{sign}(z)\max(|z| - \lambda, 0), with an exact zero dead zone for |z| \le \lambda.

Proximal Gradient Descent (ISTA) Recovers Exact Zeros

Proximal Operators

For composite objectives F(\mathbf{w}) = s(\mathbf{w}) + \psi(\mathbf{w}) where s is convex and L-smooth and \psi is proper closed convex, proximal gradient descent minimizes the L-smoothness quadratic upper bound of s plus the exact penalty \psi:

\mathbf{w}_{k+1} = \mathrm{prox}_{\eta\psi}\big(\mathbf{w}_k - \eta\,\nabla s(\mathbf{w}_k)\big)

exact zeros: 5 of 8;  support recovered: True;  max deviation on the support: 0.029
  • When \psi(\mathbf{w}) = \lambda\|\mathbf{w}\|_1, this update is ISTA (Iterative Shrinkage-Thresholding Algorithm): its dead zone [-\eta\lambda, \eta\lambda] absorbs the exact chattering amplitude of subgradient descent, recovering all 5 planted zeros cleanly.

Cyclic Coordinate Descent on the Lasso

Coordinate Descent

Because \|\mathbf{w}\|_1 = \sum_{j=1}^d |w_j| separates across coordinates, minimizing the lasso along a single weight w_j (with partial residual \mathbf{r}_{-j} = \mathbf{b} - \sum_{i \neq j}\mathbf{a}_i w_i and correlation c_j = \mathbf{a}_j^\top\mathbf{r}_{-j}) has an exact closed form:

w_j \leftarrow \frac{\mathrm{sign}(c_j)\,\max(|c_j| - \lambda,\, 0)}{\|\mathbf{a}_j\|_2^2}

  • Why coordinate sweeps beat ISTA: Each coordinate step uses its own single-column curvature L_j = \|\mathbf{a}_j\|_2^2 \approx 100 rather than the global eigenvalue ceiling L = \lambda_{\max}(\mathbf{A}^\top\mathbf{A}) \approx 160, reaching 10^{-8} in 4–6 passes vs. \sim 20 for ISTA.

passes to gap < 1e-8: ISTA 12, coordinate descent 5

Concept Check: KKT, Simplex Projection, and Prox

Concept Check

Work out these three calculations using the KKT and proximal rules:

  1. We project \mathbf{y}_1 = (1.5, 2.0) and \mathbf{y}_2 = (0.3, 0.4) onto the unit disk g(\mathbf{x}) = \tfrac12(\|\mathbf{x}\|_2^2 - 1) \le 0. What are the optimal point \mathbf{x}^\star and KKT multiplier \lambda^\star for each?
  2. Project the score vector \mathbf{y} = (0.9, 0.5, -0.2) onto the probability simplex \Delta: which coordinates survive (k), what is the threshold \tau, and what is \Pi_\Delta(\mathbf{y})?
  3. Evaluate the soft-thresholding operator \mathrm{prox}_{\lambda|\cdot|}(z) with \lambda = 0.7 at z = 0.5 and at z = -2.0.

Answers: (1) \|\mathbf{y}_1\|_2 = 2.5 > 1 (active): \lambda^\star = 2.5 - 1 = \mathbf{1.5} and \mathbf{x}^\star = \mathbf{y}_1 / 2.5 = \mathbf{(0.6, 0.8)}. \|\mathbf{y}_2\|_2 = 0.5 < 1 (inactive): \lambda^\star = \mathbf{0} and \mathbf{x}^\star = \mathbf{(0.3, 0.4)}. (2) Candidate thresholds \tau_k = (\sum_{j \le k} y_j - 1)/k: \tau_1 = -0.1 < 0.9 (valid), \tau_2 = (1.4 - 1)/2 = 0.2 < 0.5 (valid), \tau_3 = 0.2/3 \approx 0.067 \not< -0.2 (invalid). Thus k = 2, \tau = \mathbf{0.2}, and \Pi_\Delta(\mathbf{y}) = \mathbf{(0.7, 0.3, 0.0)}. (3) At z = 0.5, |0.5| \le 0.7 falls inside the dead zone so \mathrm{prox}_{0.7|\cdot|}(0.5) = \mathbf{0}. At z = -2.0, \mathrm{prox}_{0.7|\cdot|}(-2.0) = -(2.0 - 0.7) = \mathbf{-1.3}.

Summary: Constrained Optimization and Operators

Key Takeaways

Problem / Method Mathematical Condition / Update Optimality / Rate Guarantee Deep Learning & ML Role
Equality Lagrange \nabla f(\mathbf{x}^\star) + \sum_j \nu_j^\star \nabla h_j(\mathbf{x}^\star) = \mathbf{0}, h_j = 0 Necessary under LICQ; \nu_j^\star = -\partial p^\star/\partial b_j Hyperplane projections, normalization constraints
Inequality KKT Stationarity, primal/dual feas. (\lambda_i^\star \ge 0), \lambda_i^\star g_i(\mathbf{x}^\star) = 0 Sufficient for convex problems; necessary under Slater Gradient clipping, SVMs, norm-budget regularization
Euclidean Projection \Pi_C (\mathbf{y} - \Pi_C(\mathbf{y}))^\top(\mathbf{x} - \Pi_C(\mathbf{y})) \le 0\;\forall\mathbf{x}\in C Unique and nonexpansive (\|\Pi_C(\mathbf{x}) - \Pi_C(\mathbf{y})\| \le \|\mathbf{x}-\mathbf{y}\|) PGD \mathbf{x}_{k+1} = \Pi_C(\mathbf{x}_k - \eta\nabla f(\mathbf{x}_k)) contracts at least as fast as GD (same \rho)
Simplex Projection x_i^\star = \max(y_i - \tau, 0) with \sum_i x_i^\star = 1 Exact O(n\log n) sort-and-threshold sparsemax attention weights with exact zero entries
Proximal Gradient (ISTA) \mathbf{w}_{k+1} = \mathrm{prox}_{\eta\psi}(\mathbf{w}_k - \eta\nabla s(\mathbf{w}_k)) O(1/k) convex, linear (1-\mu/L)^k strongly convex Soft-thresholding \mathrm{prox}_{\lambda\|\cdot\|_1} creates exact weight sparsity