Skip to content
AI360XpertBeta

Information-Theoretic Generalization Bounds

Generalisation costs information: the gap between test and train grows with how much the learned weights reveal about the training sample, measured by mutual information.

Weights holding 10 nats about the sample generalise within 0.10 while weights holding 100 nats allow gaps near 0.32
Weights holding 10 nats about the sample generalise within 0.10 while weights holding 100 nats allow gaps near 0.32

Why Does This Exist?

Uniform bounds charge you for the whole model class even when your trained weights are simple. A network with millions of parameters gets a vacuous guarantee although noisy training leaked almost nothing about the sample. You need a bound on the weights you actually learned, not the ones you could have learned.

That is what Xu and Raginsky proved. If the learned weights WW reveal little about the sample SS, memorisation is impossible and the test gap must be small. The leakage is mutual information I(W;S)I(W;S) in nats, and the expected gap scales as I(W;S)/n\sqrt{I(W;S)/n}. Noisy updates, compression and early stopping all shrink II and tighten the number.

This page covers the weights story. The prior to posterior story lives in PAC-Bayes bounds, and the ceiling that post-processing cannot beat lives in data processing inequality.

The one idea you need first

Mutual information I(W;S)I(W;S) counts the nats of dependence between weights and sample. Zero means the weights would look the same on a fresh sample. The loss is σ\sigma sub-Gaussian when its tails fall at least as fast as a Gaussian with spread σ\sigma, which holds for bounded losses. Background is in mutual information.

Think of It Like This

A student who saw the exam versus one who learned the subject

Two students score 9595 on practice sheets. One memorised answer keys, so their notes hold 100100 nats about those exact sheets and collapse on new questions. The other learned methods, so their notes hold 1010 nats, mostly shared structure, and repeat on finals.

Mutual information is the memorisation count. The bound charges the gap by I/n\sqrt{I/n}, so the memoriser pays triple at the same nn. Noisy study habits blur exact answers and force the second strategy, which is what stochastic gradient Langevin dynamics does to weights.

Where the analogy stops: students choose strategies while I(W;S)I(W;S) is a property of the algorithm plus the distribution. You cannot read it off a notebook for a real net, you bound it with noise, compression or stability arguments.

How It Actually Works

Let WW be weights learned from nn samples SS, with population risk L(W)L(W) and train risk L^(W)\hat{L}(W). If the loss is σ\sigma sub-Gaussian then

∣E[L(W)−L^(W)]∣≤2σ2I(W;S)n\lvert E[L(W) - \hat{L}(W)] \rvert \le \sqrt{\frac{2\sigma^2 I(W;S)}{n}}

In plain words: LL is test error, L^\hat{L} is train error, II is the leakage in nats, σ\sigma sets the loss scale, nn is the sample count. Halve the leakage or double the samples and the allowed gap shrinks by 2\sqrt{2}.

For stochastic gradient Langevin dynamics with step η\eta and noise variance σsgld2\sigma_{\text{sgld}}^2 over TT steps, II grows with TT and shrinks with noise. More steps leak more, more noise leaks less. Compression bounds swap II for description length: a model you can compress to 1010 nats generalises almost as if I=10I = 10. That is why the information bottleneck preference for minimal sufficient codes helps: fewer kept bits, smaller gap.

Worked example

Take n=2000n = 2000 and σ=1\sigma = 1. With I=10I = 10 nats:

2×1×102000=202000=0.01=0.10\sqrt{\frac{2 \times 1 \times 10}{2000}} = \sqrt{\frac{20}{2000}} = \sqrt{0.01} = 0.10

Train at 0.150.15 and test sits below 0.250.25 in expectation. With I=100I = 100 nats:

2002000=0.10≈0.316\sqrt{\frac{200}{2000}} = \sqrt{0.10} \approx 0.316

Same training, allowed gap 0.320.32 as drawn, triple the price. Halve the data to n=500n = 500 with I=10I = 10: 20/500=0.04=0.20\sqrt{20/500} = \sqrt{0.04} = 0.20. Information budgets trade directly against samples, which is why compression helps most on small data.

Code

The snippet evaluates the bound you just computed by hand. It uses only the standard library.

import math

def mi_bound(mi_nats: float, n: int, sigma: float = 1.0) -> float:    return math.sqrt(2.0 * sigma**2 * mi_nats / n)

print(round(mi_bound(10, 2000), 4))  # -> 0.1print(round(mi_bound(100, 2000), 4))  # -> 0.3162print(round(mi_bound(10, 500), 4))  # -> 0.2

The three prints match the hand arithmetic: 0.100.10, about 0.320.32, and 0.200.20. Change II or nn and you will see the square root trade at once.

Watch Out For

Estimating MI on the same data and quoting the bound

Plug-in MI estimates from training data understate leakage because the estimator shares the memorisation. You will measure I=2I = 2 where the truth is 5050, promise 0.0450.045 and allow 0.220.22 in reality.

Fix: bound II analytically through noise, compression or stability, or estimate on held-out randomisation. Never plug a point estimate into its own bound.

Confusing representation MI with weights MI

I(X;Z)I(X;Z) for a representation and I(W;S)I(W;S) for weights bound different gaps through different theorems. Swap them and you apply bottleneck intuition to weight leakage with mismatched σ\sigma and nn scaling.

Fix: name both arguments of II every time. Weights plus sample bounds generalisation, inputs plus codes bound compression.

The Quick Version

  • Test to train gap scales as I(W;S)/n\sqrt{I(W;S)/n}: leakage about the sample is the price.
  • Ten nats at 2000 samples hold the gap below 0.10, one hundred nats allow about 0.32.
  • Noisy training, compression and early stopping shrink II and tighten the bound.
  • Bound II analytically, plug-in estimates on training data understate it.
  • Weights plus sample and input plus representation answer different questions, so name both arguments.