Natural Gradient
The natural gradient rescales updates by the Fisher information, so steps are measured in model behavior change rather than raw parameter distance.
Why Does This Exist?
Plain gradient descent measures distance in parameter coordinates. Rescale one weight by 100 and divide the next layer to compensate, and the model behaves identically while the optimizer sees a step 100 times larger in one direction. It then takes a different path to the same place, wasting steps wherever parameters carry mismatched scales, which is nearly always in deep networks.
The natural gradient changes the ruler. It measures distance between models by KL divergence of their predictive distributions, whose local curvature is the Fisher information matrix . The update corrects for that curvature, where is the ordinary gradient and is the inverse Fisher. This page covers the Fisher ruler, the rescaled update, and one Bernoulli calculation worked by hand.
The one idea you need first
KL divergence scores how much one predictive distribution differs from another. For a tiny parameter move , where names the step vector, it grows quadratically as . So is the local ruler of behavior change. Background lives in KL divergence, and the ruler itself lives in Fisher information.
Think of It Like This
A map with a stretched axis
Picture a city map drawn at one mile per inch east-west but ten miles per inch north-south. The shortest route on paper is not the shortest drive, because the paper lies about one direction.
Plain gradient descent trusts the paper. The natural gradient carries the true scale card. It shortens moves along the stretched axis and lengthens moves along the compressed one, so each step is even in miles, not inches.
Where the analogy stops: the Fisher ruler changes at every point and must be re-estimated from data, while a map scale is printed once.
How It Actually Works
For a model with loss , where collects the parameters and names the predictive distribution:
Here averages over the model's own predictions, is the step size, and equals the expected curvature of the negative log-likelihood. Exact inversion costs in the parameter count , so practice uses diagonal, block-diagonal, or Hessian-free approximations. The closest cousin in loss curvature is Newton's method and BFGS.
Worked example
Take a Bernoulli model with , one observation , at so :
- Loss as negative log-likelihood: . Gradient: .
- Fisher: . Plain step with : moves to .
- Natural quantity: , so moves to . New , new loss .
- Plain gradient reaches with loss about . The natural step gains about in probability against for the plain step, because it knew the parameter sat in a flat-probability zone.
Code
The snippet recomputes the fixture above. Run it to confirm the plain update lands at while the Fisher-scaled update lands at .
import numpy as np
def sigmoid(t: float) -> float: return 1.0 / (1.0 + np.exp(-t))
theta, y, eta = 0.0, 1.0, 1.0p = sigmoid(theta)g = p - y # plain gradient of the negative log-likelihoodF = p * (1 - p) # Fisher for a Bernoulliprint(round(-np.log(p), 3)) # -> 0.693print(round(theta - eta * g, 3)) # -> 0.5 plain updateprint(round(theta - eta * g / F, 3)) # -> 2.0 natural updateWatch Out For
Inverting a singular empirical Fisher
Small batches make the empirical Fisher rank-deficient, and its raw inverse then explodes along unobserved directions. Updates jump to huge values and the loss goes to NaN on the next step.
Symptom: a few steps look fine, then norms blow up right after curvature is switched on. Fix: always damp by solving with near times the Fisher trace, and check the update norm before applying it.
Paying full Fisher cost on every step
Exact Fisher inversion on a million parameters never finishes a training run. Teams that try stall with hours-long steps for a curvature that moves slower than the gradient.
Symptom: throughput collapses the moment second-order code lands. Fix: use diagonal or block-diagonal estimates and refresh curvature every 10 to 100 steps instead of every step.
The Quick Version
- Plain gradients depend on parametrization, while the natural gradient measures distance in behavior change.
- The Fisher matrix is the local ruler supplied by KL curvature.
- The update is inverse-Fisher times gradient, always damped to survive singularity.
- Exact inversion costs cubic time, so diagonal and block-diagonal estimates carry practice.
- The Bernoulli fixture moves plain to with loss and natural to with loss .