The brilliant idea: replace the complex with the simple
Imagine you need to compute without a calculator. Sine is a complicated function. But near zero, you know that . So . The true value is , the approximation is excellent.
This is the fundamental idea of Taylor series: approximate a complicated function with a polynomial, which is much easier to compute and analyze. The more terms you add to the polynomial, the better the approximation.
The Taylor formula
The Taylor series of around the point is:
Or compactly:
Each term adds a level of precision:
- Order 0: , you assume the function is constant. Very rough.
- Order 1: , you follow the slope. It's a tangent line.
- Order 2: you add curvature. It's a parabola that hugs the curve.
- Higher orders: you capture finer and finer details of the shape of .

Classic examples
The exponential around :
The cosine around :
The logarithm around :
These expansions aren't just mathematical curiosities. They are at the heart of many ML algorithms.
The linear approximation: it's gradient descent
The first-order Taylor approximation is the most important in ML. If we expand the loss around the current parameters :
This formula says: the new loss is approximately equal to the old one, plus the dot product between the gradient and the displacement. To minimize the loss, we want this product to be as negative as possible. The choice gives:
The term is always positive, so the loss decreases at each step (as long as is small enough for the linear approximation to remain valid). This is the theoretical guarantee of gradient descent: locally, you always descend.
Why the learning rate must be small
The linear approximation is only valid locally, when is small. If you take a step that's too large, you leave the zone where the tangent line well approximates the curve. That's exactly the role of the learning rate : controlling the step size to stay within the validity zone of the first-order Taylor approximation.
The quadratic approximation: Newton's method
If we add the second-order term, we get:
Where is the Hessian matrix (second derivatives). This approximation is a parabola (a bowl in dimensions). You can analytically find the minimum of this parabola by setting the gradient to zero:
This is Newton's method. Instead of following the gradient with a fixed step, you jump directly to the minimum of the quadratic approximation. Advantages and disadvantages:
- Advantage: quadratic convergence, each iteration doubles the number of correct digits. Extremely fast near the minimum.
- Major disadvantage: you need to compute and invert the Hessian. For parameters, that's . With a billion parameters, it's completely infeasible.

The first-order vs second-order dilemma
| Property | Gradient descent (order 1) | Newton (order 2) |
|---|---|---|
| Information used | Gradient (slope) | Gradient + Hessian (slope + curvature) |
| Cost per iteration | ||
| Number of iterations | High | Very low |
| Feasible in DL? | Yes | No (too expensive) |
That's why the vast majority of deep learning uses first-order methods (SGD, Adam). The computational cost per iteration matters much more than theoretical convergence speed.
Modern optimizers: between first and second order
The best current optimizers use Taylor information cleverly: they approximate certain aspects of second order without paying the full cost.
Adam: the diagonal approximation
Adam maintains two running averages for each parameter:
- : the running average of the gradient (first moment estimate)
- : the running average of the squared gradient (second moment estimate)
The update is:
The term plays the role of an approximation of the square root of curvature in each direction. If the gradient oscillates a lot in a direction (high variance, strong curvature), is large and the effective step is small. If the gradient is stable (low variance, weak curvature), the step is larger.
Adam doesn't compute the Hessian, but it captures its essence: adapting the learning rate to the local geometry of the loss. It's a remarkable compromise between the simplicity of first order and the intelligence of second order.
AdaGrad and RMSProp
- AdaGrad: accumulates the square of all past gradients. The effective learning rate decreases over time for each parameter. Problem: it can become too small too fast.
- RMSProp: uses an exponential moving average instead of a sum, which avoids AdaGrad's problem. It's one of Adam's two ingredients (the other being momentum).
Beyond second order
Higher-order terms (, etc.) are rarely used in ML. The reason is simple: the cost explodes. If the Hessian has elements, the tensor of third derivatives has . For a billion-parameter model, that's numbers. Absolutely unthinkable.
However, approximations exist:
- L-BFGS: approximates the inverse Hessian using the last gradients (typically to ). Used for small models or fine-tuning.
- K-FAC: approximates the Hessian by a Kronecker product of smaller matrices, exploiting the layer structure of networks.
- Shampoo: an optimizer developed at Google that uses block approximations of the Hessian.
Connection to regularization
The Taylor approximation also sheds light on L2 regularization (weight decay). If we expand the loss around (the minimum without regularization):
Adding a regularization term amounts to shifting the minimum toward the origin. The directions of low curvature (small eigenvalues of ) are most affected: regularization pushes them toward zero. This eliminates directions where the model is "uncertain," which reduces overfitting.
Key takeaways
- Taylor series approximate a function with a polynomial of increasing degree
- The first-order approximation is the theoretical foundation of gradient descent: you minimize a local linear model of the loss
- The second-order approximation (Newton) converges faster but costs , impractical in DL
- Adam is a smart compromise: it approximates the diagonal elements of the Hessian from gradient variance, without the cost of second order
- The learning rate must be small enough to stay within the validity zone of the linear approximation
- L2 regularization is interpreted as a shift of the minimum in parameter space, governed by the curvature of the loss
Where this is used. Every modern optimizer is a Taylor expansion truncated at first or second order.