Taylor Expansions in Optimization
Approximating complex non-linear loss functions using local polynomial expansions around current parameter weights.
What is a Taylor Series?
A Taylor Series approximates any smooth non-linear function near point using a sum of polynomial terms constructed from derivatives:
Non-linear Loss Function f(x) vs Taylor Approximations
Loss
High ┤ / Actual Non-linear Loss f(x)
│ / / 2nd-order Quadratic Approx (Parabola)
│ / / /
│ / / / 1st-order Linear Approx (Tangent Line)
│ / / / /
Low ┴───────( * )─────────────────► Parameter x
x_0 (Expansion Point)
First-Order Approximation (Gradient Descent)
Truncating the series after the first derivative term:
To make loss , choose displacement :
This proves mathematically why moving in the opposite direction of the gradient guarantees local loss reduction!
Second-Order Approximation (Newton's Method)
Including the second derivative (Hessian matrix ):
To find the step that minimizes this quadratic approximation, set derivative wrt to 0:
Newton's Method uses curvature to jump directly to the minimum of the quadratic approximation in a single step!
Why Deep Learning Prefers 1st-Order
- 1st-Order (SGD / Adam): Requires memory and compute per step.
- 2nd-Order (Newton): Requires storing Hessian matrix and computing inverse . For weights, is computationally impossible.
Say this out loud
Taylor series expands complex functions locally using derivatives. 1st-order expansion f(x) ≈ f(x_0) + ∇f^T Δx proves why setting Δx = -α ∇f guarantees local loss reduction in Gradient Descent. 2nd-order expansion adds Hessian curvature (1/2) Δx^T H Δx, deriving Newton's method step Δx = -H^-1 ∇f for single-step quadratic minimization.
Follow-ups to expect
- What is the Trust Region in 1st-order optimization? The local hyper-sphere radius ||Δx|| <= r where 1st-order linear Taylor approximation remains accurate. Learning rate alpha controls step size within the trust region.
- How does XGBoost use Taylor Expansion? XGBoost computes 2nd-order Taylor expansions of arbitrary loss functions, deriving optimal leaf split scores directly using gradient g_i and hessian h_i values per sample.
Check yourself
What is the 2nd-order Taylor Series expansion formula for a scalar loss function f(x) around point x_0 with displacement Δx = x - x_0?