Skip to content
StackDecode
AI & ML Atlas
Neural NetworksoptimiserInteractive simulation

Levenberg-Marquardt Algorithm

Blends Gauss-Newton and gradient descent for fast least-squares training.

The idea

It solves (JᵀJ + λI)Δ = −Jᵀr. When λ is large the step is a small gradient-descent step (safe); when λ is small it is a Gauss-Newton step (fast near a minimum). λ is lowered after a step that works and raised after one that fails. For small networks it often converges in far fewer iterations than gradient descent.

(JᵀJ + λI)Δθ = −Jᵀr

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • current weights
  • minimum
  • last update

Start somewhere on the bowl. Rings are lines of equal loss; the minimum is at the centre.

step:
0
loss:
3.4617
1/6

Loss landscape seen from above: a long narrow valley. Final loss 0.0003.

Step by step

  1. 1Compute the residuals r and the Jacobian J.
  2. 2Solve (JᵀJ + λI)Δ = −Jᵀr for the step.
  3. 3If the error drops, accept the step and decrease λ.
  4. 4If not, reject it and increase λ.
  5. 5Repeat until convergence.

Where it is used

Curve fitting and small neural networks.

Watch out for

Memory scales with the square of the number of parameters, so it is impractical for big networks.

Related