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.
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 . 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
: the better the fit, the fewer bits the residuals need. : each of the fitted parameters costs about half a log of the data points in bits. Here is the likelihood, the fitted parameters, the parameter count, and 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, , where is the maximized log-likelihood in nats: each parameter pays . Normalized maximum likelihood refines this with minimax regret, , summed over every dataset the model could have fit. Bayesian mixtures instead average, , over a prior weight . Prequential MDL skips code design entirely and accumulates : 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 parameters: bits for the slope and intercept, residuals bits, total . The tenth-degree polynomial has : bits, residuals bits, total . MDL picks the line because is less than , even though the polynomial fits better. The diagram draws exactly these two stacked bars.
The BIC penalty tells the same story in nats, where . The linear model pays ; the tenth-degree pays . The -nat extra penalty prices the nine extra parameters, which is the same tradeoff as the -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") # -> linearTotals 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.