Module 06
Mathematical Optimization
How do we find the best parameters or decisions within a mathematical space of possibilities?
- lessons
- 27
- duration
- 48 h 20 min
- concepts
- 143
- available in English
- 27 / 27
- completed by you
0 of 27
Where it fits
Prerequisites
Overview
Explore optimization from classical convex theory—convex sets and functions, KKT conditions, duality and interior-point methods—to the first-order, second-order and stochastic methods used to train modern models. Derive each algorithm, prove its convergence rate and implement it from scratch before using SciPy, CVXPY or PyTorch. The module ends with the nonconvex reality of deep learning: saddle points, loss landscapes, the edge of stability and frontier optimizers such as Shampoo, SOAP and Muon.
Why it matters
Training a GPT, AlphaZero's network or an imitation policy is essentially running AdamW on a nonconvex loss: understanding why it converges or diverges lets you debug training instead of trying hyperparameters blindly. Convex optimization and duality are the language of SVMs, portfolio construction, control and inverse problems. For research, this module supplies tools to analyze the convergence of a new method and compare it fairly with others.
Lessons 27
- 01Formulating optimization problems and recognizing optimaFormulate optimization problems and derive existence and optimality conditions.
- 02Convex sets and conesStudy convex sets, cones, projection and separation.
- 03Convex functions, strong convexity and smoothnessCharacterize convexity, strong convexity and smoothness and their consequences for optimization.
- 04Convex problems: LP, QP, SOCP, SDP and disciplined convex programmingRecognize and reformulate convex problems in the LP, QP, SOCP and SDP standard-form hierarchy understood by solvers. Introduce disciplined convex programming with CVXPY and convex relaxations of hard problems, using MAXCUT and Goemans-Williamson rounding as the flagship example.
- 05Lagrange multipliers and KKT conditionsExtend optimality conditions to constrained problems, from the geometry of parallel Lagrange gradients to Karush-Kuhn-Tucker conditions with inequalities and complementary slackness. Study the constraint qualifications making them necessary, their sufficiency for convex problems, and second-order conditions on the tangent space.
- 06Lagrangian duality: bounds, certificates and sensitivityConstruct the dual problem and explain why it always provides bounds (weak duality), when they are exact (strong duality under Slater), and how the duality gap certifies solution quality. Introduce convex conjugates and Fenchel duality, alternative theorems such as Farkas' lemma, and multipliers as shadow prices.
- 07Gradient descent and line searchDerive gradient descent as minimization of a local quadratic model and study step selection precisely: fixed steps, exact search, Armijo backtracking and Wolfe conditions. Spectral analysis on quadratics explains zigzagging, the stability limit η < 2/L and the role of conditioning.
- 08Convergence analysis of first-order methodsProve the classical gradient-descent rates: O(1/k) for L-smooth convex functions, linear for strongly convex functions, and O(1/k) for squared gradient norm in nonconvex functions. Introduce the Polyak-Łojasiewicz condition, giving linear convergence without convexity and helping explain training of overparameterized models.
- 09Momentum and Nesterov accelerationExplain why adding inertia to gradient descent changes dependence on κ to √κ: exact spectral analysis of Polyak's heavy ball on quadratics, Nesterov accelerated gradient at O(1/k²), and its matching lower bound. Conclude with the damped differential-equation view and adaptive restarts.
- 10Nonsmooth optimization: subgradientsGeneralize gradients to convex functions with corners (norms, maxima and hinge loss) using subdifferentials and their calculus. Analyze the subgradient method, which is not a descent method and converges at O(1/√k), and Polyak's step when the optimal value is known.
- 11Proximal methods: ISTA, FISTA and the Moreau envelopeIntroduce the proximal operator as a generalization of projection that handles simple nonsmooth terms exactly. Use it to build proximal gradient (ISTA) for composite f + g problems, its accelerated FISTA version, and the Moreau envelope, which smooths nondifferentiable functions while preserving their minimizers.
- 12Constraints with first-order methods: projection, Frank-Wolfe and mirror descentCompare 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.
- 13Newton's method, trust regions and Gauss-NewtonDerive Newton's method by minimizing the complete quadratic model and prove its local quadratic convergence and affine invariance. Study globalization by damped line search or trust regions, and exploit nonlinear least-squares structure with Gauss-Newton and Levenberg-Marquardt.
- 14Quasi-Newton and inexact Newton: second order at scaleObtain much of Newton's advantage without calculating or factoring Hessians: the secant equation, BFGS update and limited-memory L-BFGS two-loop recursion. Complete the picture with inexact Newton (Newton-CG), which only needs Hessian-vector products.
- 15Coordinate descent methodsStudy methods that optimize one coordinate or block at a time: cyclic, randomized and block methods, with rates depending on coordinate Lipschitz constants. Understand why they dominate separable problems such as lasso, where they fail with nonseparable nonsmoothness, and their relationship with alternating minimization.
- 16Interior-point methodsExplain the internals of solvers for LP, QP, SOCP and SDP: logarithmic barrier, central path and Newton barrier method. Introduce self-concordance and its problem-independent complexity bounds, and the primal-dual method used by solvers such as Clarabel and HiGHS.
- 17Penalties, augmented Lagrangian and ADMMExplore methods that move constraints into the objective: quadratic penalties, ill-conditioning, multipliers, dual decomposition and ADMM.
- 18Stochastic optimization and SGDFormulate learning as minimization of an expectation or finite sum and introduce stochastic gradient descent as Robbins–Monro stochastic approximation. Analyze minibatch noise, prove SGD rates for convex and strongly convex problems, and explain the constant-step noise ball and Polyak–Ruppert averaging.
- 19SGD in depth: nonconvexity, momentum, learning-rate schedules and variance reductionExtend SGD analysis to practical settings: convergence to stationary points in nonconvex problems, stochastic momentum, learning-rate schedules (decay, cosine, warmup and WSD), and SVRG and SAGA variance reduction, which recover linear convergence for finite sums.
- 20Adaptive methods: AdaGrad, RMSProp and AdamIntroduce methods adapting each coordinate's step from its gradient history. Derive AdaGrad from online convex optimization and regret, then RMSProp's exponential average and Adam's bias correction, interpreting all as diagonal preconditioning.
- 21AdamW, weight decay and the theory of AdamExplain why L2 regularization and weight decay coincide for SGD but not Adam, and how AdamW decouples them. Critically review Adam theory: its nonconvergence counterexample and AMSGrad, modern convergence analyses, sign descent and explanations for Adam's advantage over SGD in transformers.
- 22Zeroth-order and derivative-free optimizationOptimize functions available only through evaluations, from simulators to models without gradient access, using gradient estimators, evolutionary strategies, CMA-ES and direct search.
- 23The nonconvex reality: saddle points, negative curvature and benign landscapesStudy realistic guarantees for nonconvex optimization, including saddle points, perturbed gradient descent, benign landscapes and the PL condition in overparameterized models.
- 24Loss landscapes of deep learningStudy real network loss geometry through experiments and partial theory: avoiding misleading visualizations, the Hessian spectrum, sharpness and flat minima, the edge of stability, mode connectivity, and SAM as an optimizer seeking flat regions. Critically assess an open research literature.
- 25Beyond minimization: min-max and bilevel problemsStudy two structures central to modern machine learning that defy minimization intuition: saddle-point problems (GANs, adversarial training and Lagrangians) and bilevel problems (hyperparameters, meta-learning and optimization layers). See why simultaneous descent-ascent cycles, how extragradient and optimistic gradient correct it, and how to differentiate through an optimum.
- 26Steepest descent in other geometries: sign, natural gradient and MuonUnify modern optimizers under a classical idea: steepest descent in a chosen norm. The ℓ∞ norm gives sign descent (signSGD, Lion), the Fisher metric gives natural gradient, and spectral norm on weight matrices gives Muon’s orthogonalized update, computed with Newton–Schulz iterations.
- 27The optimizer frontier: preconditioners at scale and rigorous evaluationExplore approximate second-order optimizers for large networks (K-FAC, Shampoo, SOAP and Sophia), schedule-free methods, and rigorous evaluation of a new optimizer: tuning budgets, benchmarks such as AlgoPerf, and common pitfalls in optimizer papers.
Module capstone
optim-lab: your own optimization library, from convex theory to GPU training
Build a library with a common interface including GD with Wolfe line search, Nesterov with restart, L-BFGS, FISTA, ADMM and a barrier method for convex problems, plus SGD with momentum, Adam, AdamW and Muon as torch.optim.Optimizer subclasses. Validate on three fronts: (1) a convex benchmark suite (lasso, regularized logistic regression and a constrained allocation QP), with duality-gap certificates and comparisons with CVXPY and SciPy; (2) RTX 4060 training of a Fashion-MNIST MLP and a softmax model with Zipf-like classes, measuring sharpness, the edge of stability and the Hessian spectrum using Hessian–vector products; (3) a benchmark report with fixed tuning budget, five seeds, time to target and confidence intervals, written like the experimental section of a paper.
Check what you already know
- Classify a critical point using the eigenvalues of its Hessian, including degenerate cases
- Prove a function is convex using composition rules or its Hessian
- Reformulate a problem with ℓ1 or ℓ∞ norms as an LP and write it in CVXPY following DCP rules
- Write and solve the KKT conditions of a problem with inequality constraints
- Derive the dual of an LP or QP and use the duality gap as a certificate
- Explain the stability limit η < 2/L for gradient descent on a quadratic
- Prove the O(1/k) rate of gradient descent on L-smooth convex functions
- Explain why momentum changes the dependence on κ to √κ for quadratics
- Calculate the proximal operator of the ℓ1 norm and implement ISTA
- Implement L-BFGS with the two-loop recursion
- Explain SGD's noise ball with a constant step size and the effect of minibatch size
- Write the bias-corrected Adam update from memory
- Explain why L2 regularization and weight decay are not equivalent in Adam
- Explain the edge of stability and how to measure a network's sharpness
References
- Convex Optimization
- Numerical Optimization (2.ª edición)
- Lectures on Convex Optimization (2.ª edición)
- First-Order Methods in Optimization
- Convex Optimization: Algorithms and Complexity
- Optimization for Data Analysis
- First-order and Stochastic Optimization Methods for Machine Learning
- Optimization Methods for Large-Scale Machine Learning
- Handbook of Convergence Theorems for (Stochastic) Gradient Methods
- Learning Theory from First Principles
- Deep Learning
- EE364a: Convex Optimization I
- EE364b: Convex Optimization II
- 10-725: Convex Optimization
- Documentación de scipy.optimize
- Documentación de torch.optim
- Documentación de CVXPY