Skip to content
AI360Xpert
Beta

Amari's Natural Gradient

Natural gradient descent measures distance between probability distributions rather than arbitrary parameter coordinates, following steepest descent on a Riemannian manifold.

Euclidean gradient steps depend on arbitrary parameterization and distort distribution shifts, whereas natural gradient steps follow the intrinsic Riemannian metric defined by Fisher information.
Euclidean gradient steps depend on arbitrary parameterization and distort distribution shifts, whereas natural gradient steps follow the intrinsic Riemannian metric defined by Fisher information.

Why Does This Exist?

Standard gradient descent defines "steepest descent" using the standard Euclidean distance metric in coordinate space: ∥Δθ∥2=∑i(Δθi)2\|\Delta \mathbf{\theta}\|^2 = \sum_i (\Delta \theta_i)^2. When parameters represent physical coordinates on a flat plane, this metric makes total sense.

In modern probabilistic machine learning — including neural networks with softmax classification, policy gradients in reinforcement learning, and variational autoencoders — parameters θ\mathbf{\theta} do not represent physical locations. They define a probability distribution p(x;θ)p(\mathbf{x}; \mathbf{\theta}).

Euclidean parameter distance has virtually no relationship with the actual change in the underlying probability distribution. Consider a Gaussian distribution N(μ,σ2)\mathcal{N}(\mu, \sigma^2):

  • Shifting mean μ\mu by 0.10.1 when σ2=100\sigma^2 = 100 barely nudges the distribution; the Kullback-Leibler (KL) divergence is negligible.
  • Shifting μ\mu by that same 0.10.1 when σ2=0.001\sigma^2 = 0.001 produces two non-overlapping spikes; the KL divergence explodes.

Standard gradient descent takes identical step sizes in both scenarios because it is blinded by coordinate Euclidean distance. Even worse, if you change units (e.g., scaling weights or swapping to polar coordinates), the standard gradient changes direction entirely.

Pioneered by mathematician Shun-ichi Amari, Information Geometry models parametric probability distributions as points on a curved Riemannian manifold. Amari's Natural Gradient replaces the arbitrary Euclidean metric with the intrinsic Fisher Information Matrix (FIM), ensuring that optimization steps are invariant to parameterization and strictly bounded by true distributional divergence.

For background on directional derivatives and coordinate slopes, see our guide on gradients.

Think of It Like This

Navigating by flat paper map inches vs. true spherical Earth distances

Imagine piloting an aircraft across Greenland using a flat Mercator projection wall map.

On the flat paper map, one inch measured near the North Pole corresponds to only a few miles of real physical terrain. Near the equator, however, that same one-inch line on the map covers hundreds of miles of ocean.

If your autopilot blindly commands the aircraft to "fly 2 inches on the paper map every hour," your physical airspeed will fluctuate wildly depending on where you are. Near the poles you will crawl at a walking pace; near the equator you will break the sound barrier. The paper grid coordinates distort the underlying physical reality.

Standard gradient descent is that naive autopilot: it measures steps in arbitrary paper inches (parameter coordinates).

Information geometry recognizes that the physical surface of the Earth is a curved sphere with its own intrinsic geometry. Amari's natural gradient calculates compass headings and distances directly on the spherical globe. It ensures that an update step moves the probability distribution by a calibrated physical distance (measured in KL divergence), completely ignoring the distortions of whatever arbitrary coordinate projection you chose.

The analogy stops because probability manifolds generally do not have constant spherical curvature; their curvature varies at every point according to the Fisher information metric.

How It Actually Works

The Fisher Information Metric and Invariant Riemannian Descent

Let S={p(x;θ)∣θ∈Θ⊂Rd}S = \{ p(\mathbf{x}; \mathbf{\theta}) \mid \mathbf{\theta} \in \Theta \subset \mathbb{R}^d \} be a parametric statistical model. Information geometry treats SS as a smooth dd-dimensional Riemannian manifold M\mathcal{M}.

To define distance on this manifold, we measure the dissimilarity between two infinitesimally close distributions p(x;θ)p(\mathbf{x}; \mathbf{\theta}) and p(x;θ+dθ)p(\mathbf{x}; \mathbf{\theta} + d\mathbf{\theta}) using Kullback-Leibler (KL) divergence:

DKL(p(x;θ)∥p(x;θ+dθ))=∫p(x;θ)log⁡p(x;θ)p(x;θ+dθ) dxD_{\text{KL}}(p(\mathbf{x}; \mathbf{\theta}) \parallel p(\mathbf{x}; \mathbf{\theta} + d\mathbf{\theta})) = \int p(\mathbf{x}; \mathbf{\theta}) \log \frac{p(\mathbf{x}; \mathbf{\theta})}{p(\mathbf{x}; \mathbf{\theta} + d\mathbf{\theta})} \, d\mathbf{x}

Taking the second-order Taylor expansion of the KL divergence around dθ=0d\mathbf{\theta} = \mathbf{0} yields:

DKL(p(θ)∥p(θ+dθ))≈12dθTF(θ)dθD_{\text{KL}}(p(\mathbf{\theta}) \parallel p(\mathbf{\theta} + d\mathbf{\theta})) \approx \frac{1}{2} d\mathbf{\theta}^T \mathbf{F}(\mathbf{\theta}) d\mathbf{\theta}

where F(θ)∈Rd×d\mathbf{F}(\mathbf{\theta}) \in \mathbb{R}^{d \times d} is the Fisher Information Matrix (FIM), which acts as the Riemannian metric tensor gij(θ)g_{ij}(\mathbf{\theta}):

Fij(θ)=Ex∼p(x;θ)[∂log⁡p(x;θ)∂θi∂log⁡p(x;θ)∂θj]F_{ij}(\mathbf{\theta}) = \mathbb{E}_{\mathbf{x} \sim p(\mathbf{x}; \mathbf{\theta})} \left[ \frac{\partial \log p(\mathbf{x}; \mathbf{\theta})}{\partial \theta_i} \frac{\partial \log p(\mathbf{x}; \mathbf{\theta})}{\partial \theta_j} \right]

Deriving the Natural Gradient

Standard gradient descent defines steepest descent under a Euclidean step constraint: min⁡dθL(θ+dθ)\min_{d\mathbf{\theta}} \mathcal{L}(\mathbf{\theta} + d\mathbf{\theta}) subject to ∥dθ∥2≤ϵ2\|d\mathbf{\theta}\|^2 \le \epsilon^2.

Amari defined the Natural Gradient by constraining the step in distribution space via the Fisher metric:

min⁡dθL(θ+dθ)subject todθTF(θ)dθ≤ϵ2\min_{d\mathbf{\theta}} \mathcal{L}(\mathbf{\theta} + d\mathbf{\theta}) \quad \text{subject to} \quad d\mathbf{\theta}^T \mathbf{F}(\mathbf{\theta}) d\mathbf{\theta} \le \epsilon^2

Linearizing the objective L(θ+dθ)≈L(θ)+∇L(θ)Tdθ\mathcal{L}(\mathbf{\theta} + d\mathbf{\theta}) \approx \mathcal{L}(\mathbf{\theta}) + \nabla \mathcal{L}(\mathbf{\theta})^T d\mathbf{\theta} and setting up the Lagrangian:

LLagrange(dθ,λ)=∇L(θ)Tdθ+λ(dθTF(θ)dθ−ϵ2)\mathcal{L}_{\text{Lagrange}}(d\mathbf{\theta}, \lambda) = \nabla \mathcal{L}(\mathbf{\theta})^T d\mathbf{\theta} + \lambda \left( d\mathbf{\theta}^T \mathbf{F}(\mathbf{\theta}) d\mathbf{\theta} - \epsilon^2 \right)

Setting the derivative with respect to dθd\mathbf{\theta} to zero:

∇L(θ)+2λF(θ)dθ=0  ⟹  dθ∝−F(θ)−1∇L(θ)\nabla \mathcal{L}(\mathbf{\theta}) + 2\lambda \mathbf{F}(\mathbf{\theta}) d\mathbf{\theta} = \mathbf{0} \implies d\mathbf{\theta} \propto -\mathbf{F}(\mathbf{\theta})^{-1} \nabla \mathcal{L}(\mathbf{\theta})

We define the Natural Gradient vector ∇~L(θ)\tilde{\nabla} \mathcal{L}(\mathbf{\theta}) as:

∇~L(θ)=F(θ)−1∇L(θ)\tilde{\nabla} \mathcal{L}(\mathbf{\theta}) = \mathbf{F}(\mathbf{\theta})^{-1} \nabla \mathcal{L}(\mathbf{\theta})

The natural gradient descent update rule is:

θt+1=θt−ηF(θt)−1∇L(θt)\mathbf{\theta}_{t+1} = \mathbf{\theta}_t - \eta \mathbf{F}(\mathbf{\theta}_t)^{-1} \nabla \mathcal{L}(\mathbf{\theta}_t)

Fundamental Properties

  1. Reparameterization Invariance: Suppose parameters θ\mathbf{\theta} are mapped bijectively to ϕ=g(θ)\mathbf{\phi} = g(\mathbf{\theta}). The standard gradient directions ∇θL\nabla_{\mathbf{\theta}} \mathcal{L} and ∇ϕL\nabla_{\mathbf{\phi}} \mathcal{L} do not correspond under the Jacobian transformation. In contrast, the natural gradient transforms contravariantly: the updated distribution sequence p(x;θt)p(\mathbf{x}; \mathbf{\theta}_t) is mathematically identical regardless of parameterization!
  2. Equivalence to Gauss-Newton: When the loss function L\mathcal{L} is the negative log-likelihood −log⁡p(x;θ)-\log p(\mathbf{x}; \mathbf{\theta}), the expected Hessian of the loss is precisely the Fisher Information Matrix: E[∇2L]=F\mathbb{E}[\nabla^2 \mathcal{L}] = \mathbf{F}. Thus, natural gradient descent is an optimal, guaranteed positive semi-definite Gauss-Newton step on the statistical manifold.

Worked Example

Consider a 1D Gaussian distribution with unknown mean μ\mu and fixed known variance σ2\sigma^2:

p(x;μ)=12πσ2exp⁡(−(x−μ)22σ2)p(x; \mu) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x - \mu)^2}{2\sigma^2}\right)
  1. Calculate the score function (gradient of log-likelihood):

    log⁡p(x;μ)=−12log⁡(2πσ2)−(x−μ)22σ2\log p(x; \mu) = -\frac{1}{2}\log(2\pi\sigma^2) - \frac{(x - \mu)^2}{2\sigma^2} ∂log⁡p(x;μ)∂μ=x−μσ2\frac{\partial \log p(x; \mu)}{\partial \mu} = \frac{x - \mu}{\sigma^2}
  2. Calculate the scalar Fisher Information F(μ)F(\mu):

    F(μ)=E[(∂log⁡p∂μ)2]=E[(x−μ)2σ4]=1σ4E[(x−μ)2]=σ2σ4=1σ2F(\mu) = \mathbb{E}\left[ \left(\frac{\partial \log p}{\partial \mu}\right)^2 \right] = \mathbb{E}\left[ \frac{(x - \mu)^2}{\sigma^4} \right] = \frac{1}{\sigma^4} \mathbb{E}[(x - \mu)^2] = \frac{\sigma^2}{\sigma^4} = \frac{1}{\sigma^2}

    The metric tensor is F(μ)=1σ2F(\mu) = \frac{1}{\sigma^2}, so its inverse is F(μ)−1=σ2F(\mu)^{-1} = \sigma^2.

  3. Compare two training scenarios with an observed loss gradient ∇L=g\nabla \mathcal{L} = g:

    • Scenario A (High Certainty, σ2=0.04\sigma^2 = 0.04): The standard gradient step is Δμ=−ηg\Delta \mu = -\eta g. The natural gradient step is:

      Δ~μ=−ηF−1g=−η(0.04)g\tilde{\Delta} \mu = -\eta F^{-1} g = -\eta (0.04) g

      Because the distribution is extremely narrow, the natural gradient shrinks the parameter displacement by a factor of 25×25\times, preventing the distribution from jumping out of overlap!

    • Scenario B (High Uncertainty, σ2=4.0\sigma^2 = 4.0): The standard gradient step is Δμ=−ηg\Delta \mu = -\eta g. The natural gradient step is:

      Δ~μ=−ηF−1g=−η(4.0)g\tilde{\Delta} \mu = -\eta F^{-1} g = -\eta (4.0) g

      Because the distribution is wide and dispersed, shifting the mean by a small amount barely registers in KL divergence. The natural gradient amplifies the step by 4×4\times.

In both scenarios, the resulting KL divergence of the step is identical:

DKL≈12(Δ~μ)2F=12(η2σ4g2)(1σ2)=12η2σ2g2D_{\text{KL}} \approx \frac{1}{2} (\tilde{\Delta} \mu)^2 F = \frac{1}{2} (\eta^2 \sigma^4 g^2) \left(\frac{1}{\sigma^2}\right) = \frac{1}{2} \eta^2 \sigma^2 g^2

The step size is calibrated directly to distributional shift rather than coordinate distance.

Code

import numpy as np

def natural_gradient_gaussian_1d(    mu: float,    variance: float,    loss_grad_mu: float,    learning_rate: float = 0.1,) -> tuple[float, float, float]:    """Compute standard Euclidean update vs Amari Natural Gradient update.
    Returns:        (delta_mu_standard, delta_mu_natural, step_kl_divergence)    """    # Fisher Information for Gaussian mean is 1 / variance    fisher_info = 1.0 / variance    inv_fisher = variance
    # Standard gradient update: -lr * grad    delta_standard = -learning_rate * loss_grad_mu
    # Natural gradient update: -lr * (F^-1 * grad)    delta_natural = -learning_rate * (inv_fisher * loss_grad_mu)
    # KL divergence of natural step: 0.5 * delta^2 * F    step_kl = 0.5 * (delta_natural**2) * fisher_info
    return delta_standard, delta_natural, step_kl

# Gradient of loss with respect to meang = 2.0lr = 0.1
# Case A: Sharp distribution (variance = 0.04)d_std_a, d_nat_a, kl_a = natural_gradient_gaussian_1d(    mu=0.0, variance=0.04, loss_grad_mu=g, learning_rate=lr)print(f"Sharp Gaussian (var=0.04): standard={d_std_a:.3f}, natural={d_nat_a:.4f}, KL={kl_a:.6f}")# -> Sharp Gaussian (var=0.04): standard=-0.200, natural=-0.0080, KL=0.000800
# Case B: Wide distribution (variance = 4.0)d_std_b, d_nat_b, kl_b = natural_gradient_gaussian_1d(    mu=0.0, variance=4.0, loss_grad_mu=g, learning_rate=lr)print(f"Wide Gaussian  (var=4.0):  standard={d_std_b:.3f}, natural={d_nat_b:.4f}, KL={kl_b:.6f}")# -> Wide Gaussian  (var=4.0):  standard=-0.200, natural=-0.8000, KL=0.080000

Watch Out For

Attempting direct inversion of high-dimensional Fisher Information Matrices

For a neural network with d=10,000,000d = 10,000,000 weights, the Fisher Information Matrix F\mathbf{F} is of size 107×10710^7 \times 10^7, containing 101410^{14} entries. Storing this matrix in single-precision floating point requires 400 terabytes of memory, and inverting it via exact Cholesky decomposition costs O(d3)≈1021O(d^3) \approx 10^{21} FLOPs.

Writing naive natural gradient code np.linalg.inv(F) @ grad instantly triggers out-of-memory crashes on standard machine learning hardware.

Fix: Use structured approximations of the Fisher matrix. In deep feedforward and convolutional networks, use K-FAC (Kronecker-Factored Approximate Curvature), which factors the layer-wise Fisher matrix into Kronecker products of two small matrices. In reinforcement learning, use TRPO (Trust Region Policy Optimization) or Natural Actor-Critic with conjugate gradient iterations that compute Fisher-vector products Fv\mathbf{F} \mathbf{v} through automatic differentiation without ever materializing F\mathbf{F}.

The Quick Version

  • Standard gradient descent measures steps using Euclidean coordinate distance, which distorts probability distributions and changes with reparameterization.
  • Information geometry defines parametric distributions as points on a Riemannian manifold whose metric tensor is the Fisher Information Matrix F(θ)\mathbf{F}(\mathbf{\theta}).
  • Amari's natural gradient update ∇~L=F−1∇L\tilde{\nabla} \mathcal{L} = \mathbf{F}^{-1} \nabla \mathcal{L} follows the true steepest descent direction measured by Kullback-Leibler divergence.
  • When minimizing negative log-likelihood, the natural gradient is exactly equivalent to the Fisher-Gauss-Newton optimization method.
  • Direct matrix inversion is intractable for deep networks; practical implementations employ Kronecker-factored curvature (K-FAC) or Hessian-free conjugate gradient methods (TRPO).