AI Knowledge Tree

Fisher information and information geometry

Define the Fisher information, see it as the curvature of the log-likelihood, and meet the natural gradient.

A parameter space is not flat: moving the mean of a sharp Gaussian by 0.1 changes the distribution far more than the same move on a broad one. Fisher information measures this local sensitivity, and treating it as a metric turns the parameter space into a curved geometry where the natural gradient replaces the ordinary one. This is the foundation of efficient estimation and second-order optimization of probabilistic models.

The score and its mean

Recall the score, the gradient of the log-likelihood of a single observation:

s(θ)=∇θlog⁡p(x∣θ).s(\theta) = \nabla_\theta \log p(x \mid \theta).

Under mild regularity, the score has zero mean at the true parameter:

Ex∼p(⋅∣θ)[s(θ)]=∫p(x∣θ) ∇θp(x∣θ)p(x∣θ) dx=∇θ∫p(x∣θ) dx=∇θ1=0.\mathbb{E}_{x \sim p(\cdot \mid \theta)}[s(\theta)] = \int p(x \mid \theta)\,\frac{\nabla_\theta p(x \mid \theta)}{p(x \mid \theta)}\,dx = \nabla_\theta \int p(x \mid \theta)\,dx = \nabla_\theta 1 = 0.

The densities cancel, the integral is the constant 1, and its gradient is zero.

Fisher information

The Fisher information is the covariance of the score (equivalently, since the score has zero mean, its second moment)[1, 2]:

I(θ)=E ⁣[s(θ) s(θ)⊤]=Cov⁡(s(θ)).\mathcal{I}(\theta) = \mathbb{E}\!\left[s(\theta)\, s(\theta)^\top\right] = \operatorname{Cov}(s(\theta)).

A second identity rewrites it as the expected negative curvature of the log-likelihood:

I(θ)=− E ⁣[∇θ2log⁡p(x∣θ)].\mathcal{I}(\theta) = -\,\mathbb{E}\!\left[\nabla^2_\theta \log p(x \mid \theta)\right].

Sketch. Differentiate the zero-mean score identity ∫p ∇log⁡p dx=0\int p\,\nabla\log p\,dx = 0 once more in θ\theta. The product rule produces two terms: ∫(∇p)(∇log⁡p)⊤\int (\nabla p)(\nabla \log p)^\top and ∫p ∇2log⁡p\int p\,\nabla^2 \log p. The first equals E[ss⊤]\mathbb{E}[s s^\top] (using ∇p=p ∇log⁡p\nabla p = p\,\nabla\log p), the second is E[∇2log⁡p]\mathbb{E}[\nabla^2 \log p], and their sum is zero. Rearranging gives the two forms. High Fisher information means the log-likelihood is sharply peaked, so the parameter is easy to pin down.

This is what makes the opening claim concrete. For a Gaussian with known variance σ2\sigma^2 and unknown mean, a single observation carries Fisher information I=1/σ2\mathcal{I} = 1/\sigma^2. Contrast two models identical except for spread: a sharp σ=0.2\sigma = 0.2 gives I=1/0.22=25\mathcal{I} = 1/0.2^2 = 25, a broad σ=2.0\sigma = 2.0 gives I=1/2.02=0.25\mathcal{I} = 1/2.0^2 = 0.25, a factor of 100100. The same 0.10.1 nudge to the mean is 100100 times more distinguishable under the sharp model: the KL between N(θ,σ2)N(\theta, \sigma^2) and N(θ+0.1,σ2)N(\theta + 0.1, \sigma^2) is 0.5⋅0.12/σ20.5 \cdot 0.1^2/\sigma^2, which is 0.1250.125 for the sharp model and 0.001250.00125 for the broad one. Sharper densities pack more information about their mean into each sample, so the parameter is pinned down faster.

The Cramer-Rao bound

Fisher information sets the best possible precision of any unbiased estimator θ^\hat\theta:

Var⁡(θ^)≥I(θ)−1.\operatorname{Var}(\hat\theta) \ge \mathcal{I}(\theta)^{-1}.

No unbiased estimator beats the inverse Fisher information. The MLE achieves this bound asymptotically, which is the precise sense in which maximum likelihood is efficient.

KL divergence and the Fisher metric

Fisher information is the local curvature of the KL divergence between nearby distributions. A second-order Taylor expansion of DKL(pθ ∥ pθ+δ)D_{\mathrm{KL}}\big(p_\theta \,\|\, p_{\theta + \delta}\big) in the small step δ\delta gives

DKL(pθ ∥ pθ+δ)≈12 δ⊤I(θ) δ,D_{\mathrm{KL}}\big(p_\theta \,\|\, p_{\theta + \delta}\big) \approx \tfrac{1}{2}\,\delta^\top \mathcal{I}(\theta)\,\delta,

with the zeroth and first-order terms vanishing (KL is zero and minimized at δ=0\delta = 0). So I(θ)\mathcal{I}(\theta) is the metric tensor that measures distance between distributions in parameter space, the central object of information geometry.

The natural gradient

Ordinary gradient descent steps in the direction of steepest descent measured in Euclidean parameter distance, which is arbitrary: it depends on how the model happens to be parameterized. The natural gradient measures steepest descent in KL distance instead, preconditioning by the inverse Fisher matrix[3]:

∇~θL=I(θ)−1 ∇θL.\tilde\nabla_\theta \mathcal{L} = \mathcal{I}(\theta)^{-1}\,\nabla_\theta \mathcal{L}.

Because KL distance is parameterization-invariant, so is the natural-gradient direction. It is the probabilistic cousin of Newton's method (Fisher information in place of the Hessian) and underlies natural-gradient and K-FAC optimizers.

More data sharpens the log-likelihood: its curvature at the peak is the Fisher information, so larger N gives a steeper parabola and pins down θ more tightly.
More data sharpens the log-likelihood: its curvature at the peak is the Fisher information, so larger N gives a steeper parabola and pins down θ more tightly.

Check it on arrays

python · numpy
import numpy as np

rng = np.random.default_rng(17)

# Gaussian with known variance 1, unknown mean theta.
# log p(x|theta) = -0.5 (x-theta)^2 + const; score = (x - theta); I(theta) = 1.
theta_true = 2.0
N = 2_000_000
x = rng.normal(theta_true, 1.0, N)

score = x - theta_true
print("E[score] ~ 0:", round(score.mean(), 4))
print("Fisher I = Var(score):", round(score.var(), 4), " exact 1.0")

# Curvature form: -E[d^2/dtheta^2 log p] = -E[-1] = 1
print("Fisher (curvature form): 1.0")

# Contrasting pair: sharp vs broad Gaussian, I = 1/sigma^2 per observation
for sigma in [0.2, 2.0]:
    xs = rng.normal(theta_true, sigma, N)
    sc = (xs - theta_true) / sigma**2          # score = (x - theta)/sigma^2
    print(f"sigma={sigma}: Fisher I = Var(score) =", round(sc.var(), 3),
          " exact", 1 / sigma**2)

# Cramer-Rao: MLE (sample mean) variance vs 1/(N*I)
trials = 4000
mle = rng.normal(theta_true, 1.0, size=(trials, 50)).mean(axis=1)
print("Var(MLE) over n=50:", round(mle.var(), 5), " CR bound 1/(n*I) =", round(1/50, 5))

# KL between N(theta,1) and N(theta+d,1) is d^2/2 = 0.5 * d * I * d, with I=1
d = 0.1
kl_exact = d**2 / 2
print("KL(N(0,1)||N(d,1)):", round(kl_exact, 6), " ~ 0.5 d I d:", round(0.5 * d * 1.0 * d, 6))

The score averages to zero, its variance recovers the Fisher information of 1 (and 1/σ21/\sigma^2 for the sharp and broad models, a factor of 100 apart), the MLE variance sits at the Cramer-Rao bound, and the KL between nearby Gaussians equals the Fisher quadratic form.

Exercises

Exercise 1. A single Bernoulli(qq) observation has log-likelihood log⁡p(x∣q)=xlog⁡q+(1−x)log⁡(1−q)\log p(x \mid q) = x \log q + (1 - x)\log(1 - q). Use the curvature form I(q)=−E[∂q2log⁡p]\mathcal{I}(q) = -\mathbb{E}[\partial_q^2 \log p] to show that the Fisher information is I(q)=1q(1−q)\mathcal{I}(q) = \frac{1}{q(1 - q)}.

Solution

Step 1. Differentiate the log-likelihood once in qq:

∂qlog⁡p(x∣q)=xq−1−x1−q.\partial_q \log p(x \mid q) = \frac{x}{q} - \frac{1 - x}{1 - q}.

Step 2. Differentiate again:

∂q2log⁡p(x∣q)=−xq2−1−x(1−q)2.\partial_q^2 \log p(x \mid q) = -\frac{x}{q^2} - \frac{1 - x}{(1 - q)^2}.

Step 3. Take the negative expectation, using E[x]=q\mathbb{E}[x] = q:

I(q)=E[x]q2+1−E[x](1−q)2=qq2+1−q(1−q)2=1q+11−q.\mathcal{I}(q) = \frac{\mathbb{E}[x]}{q^2} + \frac{1 - \mathbb{E}[x]}{(1 - q)^2} = \frac{q}{q^2} + \frac{1 - q}{(1 - q)^2} = \frac{1}{q} + \frac{1}{1 - q}.

Step 4. Combine over a common denominator: 1q+11−q=(1−q)+qq(1−q)=1q(1−q)\frac{1}{q} + \frac{1}{1 - q} = \frac{(1 - q) + q}{q(1 - q)} = \frac{1}{q(1 - q)}. The information blows up near q=0q = 0 or q=1q = 1, where a single flip pins down a near-deterministic coin sharply, and is smallest at q=1/2q = 1/2.

Exercise 2. For the Gaussian mean model with known variance σ2\sigma^2, a single observation carries Fisher information I=1/σ2\mathcal{I} = 1/\sigma^2. Show that nn i.i.d. observations carry n/σ2n/\sigma^2, and read off the Cramer-Rao bound on the variance of any unbiased estimator of the mean.

Solution

Step 1. For independent observations the joint log-likelihood is the sum log⁡p(x1,…,xn∣θ)=∑i=1nlog⁡p(xi∣θ)\log p(x_1, \dots, x_n \mid \theta) = \sum_{i=1}^n \log p(x_i \mid \theta), so the score of the sample is the sum of per-observation scores.

Step 2. Fisher information is the variance of the score. The scores si(θ)=(xi−θ)/σ2s_i(\theta) = (x_i - \theta)/\sigma^2 are independent, so their variances add:

In(θ)=Var⁡ ⁣(∑i=1nsi)=∑i=1nVar⁡(si)=n⋅1σ2=nσ2.\mathcal{I}_n(\theta) = \operatorname{Var}\!\left(\sum_{i=1}^n s_i\right) = \sum_{i=1}^n \operatorname{Var}(s_i) = n \cdot \frac{1}{\sigma^2} = \frac{n}{\sigma^2}.

Step 3. The Cramer-Rao bound gives Var⁡(θ^)≥In(θ)−1=σ2/n\operatorname{Var}(\hat\theta) \ge \mathcal{I}_n(\theta)^{-1} = \sigma^2/n. The sample mean has variance exactly σ2/n\sigma^2/n, so it attains the bound: the sample mean is efficient.

Exercise 3 (code). Estimate the Fisher information of a Bernoulli(qq) model by Monte Carlo, using the score-variance form, and confirm it matches the closed form 1/(q(1−q))1/(q(1-q)) from Exercise 1.

Solution
python · numpy
import numpy as np

rng = np.random.default_rng(7)
N = 4_000_000

for q in [0.3, 0.5, 0.7]:
    x = (rng.random(N) < q).astype(float)
    # score of a single Bernoulli obs: x/q - (1-x)/(1-q)
    score = x / q - (1 - x) / (1 - q)
    fisher_mc = score.var()
    fisher_exact = 1.0 / (q * (1 - q))
    print(f"q={q}: Fisher MC = {fisher_mc:.4f}  exact = {fisher_exact:.4f}")
    assert np.isclose(score.mean(), 0.0, atol=2e-3)   # zero-mean score
    assert np.isclose(fisher_mc, fisher_exact, rtol=2e-3)

The score averages to zero and its variance matches 1/(q(1−q))1/(q(1-q)): 4.76194.7619 at q=0.3q = 0.3, 4.04.0 at q=0.5q = 0.5 (the minimum), and 4.76194.7619 at q=0.7q = 0.7.

This closes the A2 probability and information-theory track; the optimization pillar (A3) builds on these gradients and curvatures to actually minimize losses.


References

  1. [1]Casella, G., & Berger, R. L. (2002). Statistical Inference (2nd ed.). Duxbury. §7.3, Fisher information and the Cramer-Rao lower bound.↩
  2. [2]Murphy, K. P. (2022). Probabilistic Machine Learning: An Introduction. MIT Press. §4.7, the Fisher information matrix.↩
  3. [3]Amari, S. (2016). Information Geometry and Its Applications. Springer. The Fisher metric and the natural gradient. doi:10.1007/978-4-431-55978-8↩