Skip to content
AI360XpertBeta

Minimum Description Length

The best model compresses hardest: model bits plus data-given-model bits is the total, and the smallest total wins without a validation split.

Minimum description length picks the model with the smallest total: 40 plus 90 beats 120 plus 30 because 130 is less than 150
Minimum description length picks the model with the smallest total: 40 plus 90 beats 120 plus 30 because 130 is less than 150

Why Does This Exist?

Model selection without held-out data looks impossible: training loss always favors complexity. Cross-validation answers with extra compute and extra variance, and Bayes answers with priors a skeptic can dispute. Minimum description length answers with codelength: the model that compresses the data most, counting the model itself, is the one to trust, because compression is prediction written in bits.

The two-part form is L=L(model)+L(data∣model)L = L(\text{model}) + L(\text{data} \mid \text{model}). A complex model shrinks the second term and explodes the first. Unlike the information bottleneck, which compresses a representation while keeping prediction power, MDL scores whole models for selection. Unlike rate-distortion theory, which prices lossy compression at a tolerated distortion, MDL picks the model whose total description is shortest.

The one idea you need first

L(data∣model)=−log⁡2p(data∣θ^)L(\text{data} \mid \text{model}) = -\log_2 p(\text{data} \mid \hat{\theta}): the better the fit, the fewer bits the residuals need. L(model)≈k2log⁡2nL(\text{model}) \approx \frac{k}{2}\log_2 n: each of the kk fitted parameters costs about half a log of the nn data points in bits. Here pp is the likelihood, θ^\hat{\theta} the fitted parameters, kk the parameter count, and nn the sample size. Add the two parts and minimize the sum.

Think of It Like This

Shipping furniture flat-pack

Two sellers ship the same shelf. One ships air: a huge box with a tiny manual. The other flat-packs: a small box with a thick manual. The shipping bill depends on total volume, not on either part alone.

Complex models ship air: a short manual, because the fit is great, inside a huge box, because the parameters are many. MDL measures the truck, not the shelf. Where it stops: real manuals are approximations such as BIC, and exact codelengths need carefully designed codes such as normalized maximum likelihood or Bayesian mixtures.

How It Actually Works

Crude two-part MDL plugs in a penalty per parameter and moves on. The large-sample price is the Bayesian information criterion, BIC=−2ℓ+klog⁡n\text{BIC} = -2\ell + k \log n, where ℓ\ell is the maximized log-likelihood in nats: each parameter pays 12log⁡n\frac{1}{2}\log n. Normalized maximum likelihood refines this with minimax regret, log⁡∑yp(y∣θ^(y))\log \sum_y p(y \mid \hat{\theta}(y)), summed over every dataset yy the model could have fit. Bayesian mixtures instead average, −log⁡∫p(y∣θ)w(θ)dθ-\log \int p(y \mid \theta) w(\theta) d\theta, over a prior weight ww. Prequential MDL skips code design entirely and accumulates −∑tlog⁡p(yt∣y<t)-\sum_t \log p(y_t \mid y_{<t}): compress each point given the past, and the best sequential predictor wins.

Worked example

One hundred points from a true line plus noise. The linear model has k=2k = 2 parameters: L(model)=40L(\text{model}) = 40 bits for the slope and intercept, residuals 9090 bits, total 40+90=13040 + 90 = 130. The tenth-degree polynomial has k=11k = 11: L(model)=120L(\text{model}) = 120 bits, residuals 3030 bits, total 120+30=150120 + 30 = 150. MDL picks the line because 130130 is less than 150150, even though the polynomial fits better. The diagram draws exactly these two stacked bars.

The BIC penalty tells the same story in nats, where log⁡100=4.6052\log 100 = 4.6052. The linear model pays klog⁡n=2×4.6052=9.21k \log n = 2 \times 4.6052 = 9.21; the tenth-degree pays 11×4.6052=50.6611 \times 4.6052 = 50.66. The 41.4541.45-nat extra penalty prices the nine extra parameters, which is the same tradeoff as the 8080-bit model-cost gap up to the bits-to-nats constant.

Code

linear, complex_ = (40, 90), (120, 30)  # (model, data) bitsprint(sum(linear), sum(complex_))  # -> (130, 150)print("linear" if sum(linear) < sum(complex_) else "complex")  # -> linear

Totals 130 versus 150 pick the simpler model. Fit alone would crown the complex one at 30 data bits.

Watch Out For

Comparing codelengths across different codes

Bits from mismatched codes do not compare: different precisions, different priors, or different model families turn the verdict into an artifact of the ruler. The winner may just use the coarser quantization.

Fix the coding scheme before comparing: same precision, same normalized maximum likelihood family, same prior. If changing float precision flips the winner, the comparison was void.

Using MDL where compute is the constraint

The shortest description can be slow to decode: huge ensembles and deep searches compress well and run badly. Edge latency budgets care about FLOPs and memory, not bits.

Constrain the model class by deployability first, then apply MDL inside it. If the winner cannot ship, the bits were academic.

The Quick Version

  • Total bits equals model bits plus data-given-model bits, and the smallest sum wins.
  • Worked totals: 40 plus 90 is 130, 120 plus 30 is 150, so the simpler model wins despite worse fit.
  • BIC is large-sample MDL: each parameter pays about half a log of n.
  • Normalized maximum likelihood, Bayesian mixtures, and prequential coding refine the crude two-part code.
  • Fix the coding scheme before comparing, or the ruler decides the winner.
  • Constrain by deployability first and compress inside that class second.