Qm
Advanced

Large Deviations and Cramér's Theorem

When a rare event happens anyway, a portfolio far from its mean, a queue that never clears, large deviations theory tells you it isn't just "unlikely," it's unlikely at a precise, computable exponential rate.

Prerequisites: Chernoff Bounds, Moment Generating Functions

The Law of Large Numbers says a sample average converges to the true mean. That's reassuring, but a risk manager needs more: not just "the average settles down," but how rare is it, precisely, for the average to sit far from where it should be after nn trials? "Very rare" isn't a number you can size capital against. Cramér's theorem gives the exact exponential rate at which that rareness decays, turning a vague intuition into a formula.

The analogy: the odds of an unlikely streak

If a coin is fair, seeing 60% heads in 10 flips is mildly surprising. Seeing 60% heads in 10,000 flips would be almost unbelievable, not just "more surprising," but surprising by an amount that compounds. Large deviations theory quantifies exactly how that improbability compounds: the probability of the sample average sitting at some wrong level xx instead of the true mean shrinks like enI(x)e^{-nI(x)}, where I(x)I(x) is a fixed "cost per observation" of drifting to xx. Double the sample size, and you don't double the improbability, you square it.

Writing it down

Let X1,,XnX_1, \ldots, X_n be i.i.d. with mean μ\mu, and let Xˉn=1nXi\bar{X}_n = \frac1n\sum X_i. Cramér's theorem says that for xμx \ne \mu,

limn1nlogP(Xˉnx)=I(x),\lim_{n\to\infty} \frac{1}{n} \log P(\bar{X}_n \approx x) = -I(x),

where I(x)I(x), the rate function, is defined as the Legendre transform of the log-MGF:

I(x)=sups(sxlogMX(s)).I(x) = \sup_{s} \big( sx - \log M_X(s) \big).

In words: the probability of the sample average landing near some off-target value xx behaves like enI(x)e^{-nI(x)} for large nn, and I(x)I(x), a single number per xx, always 0\ge 0 and equal to zero exactly at x=μx=\mu, is computed by the same optimize-over-ss trick used in Chernoff bounds. In fact Cramér's theorem is the exact asymptotic version of what Chernoff bounds only bound from above: I(x)I(x) is the tightest possible exponential rate, not just an upper bound on it.

Function explorer
-2222.0
x = 1.00f(x) = 2.000

Near the mean, I(x)I(x) behaves roughly like a parabola, this plot's shape is a stand-in for that local behavior; the further xx sits from μ\mu, the steeper II climbs and the more astronomically rare that deviation becomes.

Worked example 1: fair coin, rate function

For Xi{0,1}X_i \in \{0,1\} Bernoulli(p=0.5p=0.5), the rate function works out to the binary relative entropy:

I(x)=xlogx0.5+(1x)log1x0.5.I(x) = x\log\frac{x}{0.5} + (1-x)\log\frac{1-x}{0.5}.

At x=0.6x = 0.6: I(0.6)=0.6log(1.2)+0.4log(0.8)=0.6(0.182)+0.4(0.223)=0.1090.089=0.020I(0.6) = 0.6\log(1.2) + 0.4\log(0.8) = 0.6(0.182) + 0.4(-0.223) = 0.109 - 0.089 = 0.020. So P(Xˉn0.6)e0.020nP(\bar{X}_n \approx 0.6) \approx e^{-0.020n}. At n=100n=100: e2.00.135e^{-2.0}\approx 0.135, plausible. At n=10,000n=10{,}000: e2001087e^{-200} \approx 10^{-87}, utterly impossible in practice. The same 10-percentage-point gap from the mean goes from "happens sometimes" to "will never happen" purely because nn grew, exactly the compounding the streak analogy described.

Convergence explorer
true meansamples →
after n = 200estimate -0.025error 0.025std error 0.071

Watch the running average tighten around the truth as nn grows, large deviations theory is the precise statement of how fast the probability of it sitting away from that band collapses, exponentially in nn rather than merely shrinking.

Worked example 2: sizing a "never happens" loss

A market maker's daily P&L is the sum of 200 independent trades, each with mean edge μ=\textdollar5\mu = \textdollar 5 and roughly ±\textdollar50\pm\textdollar 50 range. Historical data suggests I(x)I(x) near a loss level of xˉ=\textdollar5\bar{x}=-\textdollar 5 per trade (i.e., total daily P&L around \textdollar1,000-\textdollar 1{,}000 instead of the expected +\textdollar1,000+\textdollar 1{,}000) is about I0.05I \approx 0.05. Then P(daily P&L\textdollar1,000)e0.05×200=e104.5×105P(\text{daily P\&L} \approx -\textdollar 1{,}000) \approx e^{-0.05 \times 200} = e^{-10} \approx 4.5\times10^{-5}, roughly a 1-in-22,000 event, i.e. expect to see it about once every 85 years of trading days. That number is exactly the kind of figure a capital or limits committee needs, and it came from one estimated rate function, not from guessing "should be rare."

What this means in practice

  • Setting risk limits. The rate function converts "how many standard deviations away" (a normal-distribution habit) into an honest, distribution-specific exponential probability, useful precisely when P&L isn't normal.
  • Queueing and execution. The same machinery bounds the probability that an order queue or inventory position drifts far from target, informing how much buffer capital or inventory a market maker needs to hold.
  • Insurance and ruin. Large deviations theory underlies ruin probability estimates: how unlikely is it that cumulative losses exceed reserves before some horizon.

Cramér's theorem says the probability a sample average lands away from its true mean decays like enI(x)e^{-nI(x)}, where the rate function I(x)I(x) is the same Legendre-transform optimization that produces Chernoff bounds, but exact, not just an upper bound.

Large deviations results are asymptotic in nn, the formula PenI(x)P \approx e^{-nI(x)} is a limit, and for small or moderate nn the actual probability can differ from the exponential approximation by a large multiplicative (polynomial) factor. Treating enI(x)e^{-nI(x)} as exact for, say, n=20n=20 trades is a common overreach; it's a guide to the rate of decay, not a precise probability at small sample sizes.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. Ask and answer about this concept. Off-topic gets removed.
  2. No homework dumps. Show what you tried first.
  3. Corrections are welcome. Cite a source when you claim an error.

Loading discussion…

Related concepts

Practice in interviews

Further reading

  • Dembo, Zeitouni, Large Deviations Techniques and Applications (ch. 2)
  • Mitzenmacher, Upfal, Probability and Computing (ch. 4)
ShareTwitterLinkedIn