Gradient-Based Optimization
The gradient¶
For a scalar objective ,
The gradient points in the direction of steepest local increase in Euclidean coordinates, so points toward steepest local decrease.
Gradient descent¶
The basic update is
where is the step length.
Each update uses local slope information. Small steps are slow, while overly large steps may overshoot or diverge.
Line search and trust regions¶
A line-search method chooses a direction and seeks an acceptable solution to
The direction may come from steepest descent, Newton, or quasi-Newton information. A practical line search seeks sufficient reduction rather than an exact one-dimensional optimum. Trust-region methods instead restrict the step to a region where a local model is considered reliable.
Newton and quasi-Newton methods¶
A second-order Taylor approximation is
Minimizing this quadratic model gives the Newton step
Newton’s method can converge rapidly near a well-behaved optimum, but exact Hessians may be expensive and the step may fail if the Hessian is indefinite or ill-conditioned. Quasi-Newton methods such as BFGS estimate Hessian information from changes in gradients.
Computing derivatives¶
Gradient-based algorithms are only as reliable as the derivatives they receive. Four practical families of methods exist, and they differ in cost, accuracy, and required access to the model.
Finite differences. The forward-difference formula follows from a truncated Taylor series,
which is first-order accurate; a central difference reaches at roughly twice the cost. Finite differences face a step-size dilemma: shrinking reduces truncation error, but below a certain size subtractive cancellation in finite-precision arithmetic dominates and the estimate degrades—for double precision, the best forward-difference step is typically near 10-8. Because each design direction requires a separate perturbed model evaluation, the cost of a full Jacobian scales linearly with the number of design variables. Finite differences require no access to source code, so they remain the default when a model is a black box, but they are neither the most accurate nor the most efficient option when the model can be modified.
Complex-step differentiation. Perturbing a design variable along the imaginary axis instead of the real axis,
avoids subtraction entirely, so there is no cancellation error. The step size can then be shrunk toward machine precision (values near 10-200 are typical) without any loss of accuracy, so the resulting derivative matches the precision of the function itself. The cost still scales linearly with the number of design variables, comparable to a central difference, but the method requires source-code access and correct handling of complex arithmetic (including redefined absolute-value and comparison logic).
Algorithmic (automatic) differentiation. AD applies the chain rule mechanically to every elementary operation in the source code, without ever forming a symbolic expression. In forward mode, one input is seeded and its derivative is propagated through every subsequent line of code, so the cost scales with the number of inputs and is independent of the number of outputs. In reverse mode, one output is seeded and its derivative is propagated backward to every variable it depends on, so the cost scales with the number of outputs and is independent of the number of inputs—but it requires storing intermediate values from a forward pass before the backward sweep can run. Reverse-mode AD is therefore especially attractive when a problem has many design variables and few objectives or constraints, which is common in large CCD problems.
Direct and adjoint sensitivity methods. When a model is expressed as governing residual equations, implicit differentiation of the residuals with respect to the states yields a linear system whose solution gives the total derivatives. Solving that system once per design variable is the direct method; solving it once per output is the adjoint method—mirroring the forward/reverse trade-off of AD, but applied at the level of the governing equations rather than lines of code.
Example 3.2: quadratic minimization¶
Consider
Its gradient is
Setting gives and . The Hessian
is positive definite, so this stationary point is the unique global minimum of the convex quadratic.