Newton’s method, also called the Newton-Raphson method, is an iterative algorithm that finds a root of an equation or a stationary point of a function by repeatedly solving a local quadratic approximation built from the first and second derivatives. Optimization in machine learning and statistics uses it to minimize an objective function: at each step it moves to the minimum of the second-order Taylor model, which gives quadratic convergence near a well-behaved solution.
In artificial intelligence, the pure method is rarely applied to deep networks with millions of parameters, because the Hessian matrix is too large to store and invert. It remains the reference point for a whole family of second-order methods, including quasi-Newton methods, L-BFGS, natural gradient and the iteratively reweighted least squares solver used to fit logistic regression.
How Newton’s method computes each step
Each iteration replaces the objective with a quadratic model around the current point and jumps to that model’s minimum. For a twice-differentiable function f with gradient g and Hessian H at the point x, the model is f(x) + g·d + ½ d·H·d, and setting its derivative to zero gives the Newton step d = −H⁻¹g.
In practice the inverse is never formed explicitly. Software solves the linear system H·d = −g, typically with a Cholesky factorization when H is positive definite. The cost of that solve grows as O(n³) in the number of parameters n, while storing H needs O(n²) memory, which is the central scaling limit of the method.
The table below lists the ingredients of one iteration and what each contributes.
| Component | Role in the step | Typical cost |
|---|---|---|
| Gradient g | Direction of steepest increase | O(n) storage |
| Hessian H | Local curvature in every direction | O(n²) storage |
| Linear solve | Computes the step d from H and g | O(n³) for dense H |
| Step length | Scales d to guarantee progress | A few function evaluations |
| Stopping test | Checks gradient norm or step size | Negligible |
Convergence behavior and its conditions
Near a minimum with a positive definite Hessian, Newton’s method converges quadratically: the number of correct digits roughly doubles with every iteration. A solution that gradient descent approaches over thousands of steps is often reached in five to twenty Newton iterations.
This guarantee is local only. Far from the solution the quadratic model can be a poor guide, and the full step may overshoot, oscillate or diverge. When the Hessian is indefinite, as it is near a saddle point of a non-convex objective, the Newton step can point uphill or toward the saddle itself, because the method seeks any stationary point rather than a minimum.
The following comparison places the method among its neighbors in the optimization toolbox.
| Method | Curvature information | Convergence rate | Cost per iteration |
|---|---|---|---|
| Gradient descent | None | Linear | O(n) |
| Newton’s method | Exact Hessian | Quadratic (local) | O(n³) |
| Quasi-Newton (BFGS) | Approximated from gradients | Superlinear | O(n²) |
| L-BFGS | Limited-memory approximation | Superlinear in practice | O(mn) with m about 5-20 |
| Conjugate gradient | Implicit via search directions | Superlinear on quadratics | O(n) |
Globalization: line search and trust regions
Practical implementations add a globalization strategy so that the method makes progress from poor starting points. The two standard choices are a line search, which shortens the step until a sufficient-decrease rule such as the Armijo or Wolfe conditions holds, and a trust region, which minimizes the quadratic model only inside a radius that grows or shrinks with the model’s accuracy.
Curvature problems need separate treatment. Damped or regularized Newton adds a multiple of the identity, H + λI, which makes the matrix positive definite and interpolates between a Newton step and a gradient step. This is the idea behind the Levenberg-Marquardt algorithm for nonlinear least squares.
| Variant | Key modification | Best suited to |
|---|---|---|
| Damped Newton | Step length from line search | Convex smooth problems |
| Trust-region Newton | Step limited to a radius | Nonconvex or ill-conditioned problems |
| Levenberg-Marquardt | Adds λI to the Hessian | Nonlinear least squares |
| Gauss-Newton | Uses JᵀJ instead of H | Curve fitting with small residuals |
| Newton-CG (truncated) | Solves H·d = −g approximately | Large sparse problems |
| Interior-point Newton | Newton steps on barrier problems | Constrained convex optimization |
Uses of Newton’s method in machine learning
The method is most valuable when the parameter count is moderate, from a few to several thousand, and the objective is smooth and convex. Logistic regression is the classic case: its iteratively reweighted least squares solver is exactly Newton’s method on the log-likelihood, and statistical libraries rely on it to produce precise estimates and standard errors.
Further applications include generalized linear models, Gaussian process hyperparameter fitting, interior-point solvers for linear and quadratic programming, and the inner loops of constrained optimization. In deep learning, curvature ideas survive in Hessian-free optimization, which uses conjugate gradient with Hessian-vector products, and in approximations such as K-FAC and the Shampoo optimizer.
- Choose Newton’s method when n is small, the objective is smooth and high accuracy matters.
- Choose L-BFGS when n reaches tens of thousands and full-batch gradients are affordable.
- Choose stochastic gradient methods when data is massive and only noisy gradients are practical.
Limitations and common mistakes
The main drawbacks are cubic cost, quadratic memory and sensitivity to curvature. Stochastic mini-batch estimates of the Hessian are noisy, so the method also fits poorly with the stochastic training that dominates modern neural networks.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Iterates diverge | Full step from a distant start | Add line search or trust region |
| Step increases the loss | Indefinite Hessian | Regularize with H + λI |
| Solve fails or is unstable | Singular or ill-conditioned H | Use damping or a pseudo-inverse |
| Runs out of memory | Dense Hessian for large n | Switch to L-BFGS or Newton-CG |
| Converges to a saddle | Method seeks any stationary point | Check eigenvalues and use negative curvature |
A frequent misconception is that fast convergence means fast training. Each Newton iteration can cost more than thousands of gradient steps, so the total time is lower only when the Hessian solve is cheap relative to the accuracy gained.
The idea in brief
Imagine standing on a hilly field in fog, looking for the lowest point. A simple strategy is to step downhill a little at a time. Newton’s method is smarter. It measures both the slope and how the ground curves. Then it pictures a smooth bowl that fits the ground nearby and walks straight to the bottom of that bowl.
When you are already close to the valley floor, this works remarkably well. A handful of jumps is often enough. The catch is that measuring the curve in every direction is expensive when there are many directions. Far from the valley, the imagined bowl can also mislead you, so careful versions limit how far each jump may go.
A practical scenario
A credit risk team fits a logistic regression model to predict loan default from 40 features and 200,000 historical loans. The statistical software uses iteratively reweighted least squares, which is Newton’s method applied to the log-likelihood. Each iteration builds a 40 by 40 Hessian from the weighted data, solves one small linear system and updates all coefficients at once.
Starting from zero coefficients, the gradient norm falls from about 10³ to below 10⁻⁸ in seven iterations, and the whole fit takes under a second. The inverse of the final Hessian also gives the standard errors the team needs for regulatory documentation. When the same team later trains a neural network with two million weights, it switches to Adam with mini-batches, because a two-million-square Hessian would never fit in memory.