1. Peel
  2. The Pith
  3. Intelligence and compression
Essay · Information theory

Is Intelligence Just Compression?

Prediction, description length and the limits of an appealing analogy.

By · · Updated · The Pith, no. 12 · 4 min read

A woven textile with repeating motifs beside a gridded pattern card and a spool of orange thread

You could describe the cloth above stitch by stitch. If you spot its repeating motif, you can draw the motif once and say where it repeats. The shorter description works because it captures something about the cloth that the person reading it can use.

That intuition gives compression a place in discussions of intelligence. A model that picks up a regularity can use it to predict what comes next, and we can measure how well it does. The question is how much that measurement tells us about what the model can do.

Prediction and surprise

A probabilistic model assigns a probability to each possible next observation. Under the model, an outcome with probability pp has an ideal coding cost of −log⁡2p-\log_2 p bits. A model that assigns higher probability to what actually happens pays less for that outcome. An entropy coder, such as an arithmetic coder, can approach the sum of those ideal costs over a sequence. Real files also have coding and container overhead. [1]

For a fair coin model, either outcome costs one bit. If the model assigns heads a probability of 0.9, heads costs about 0.152 bits and tails costs about 3.322 bits. The fractional amounts are ideal contributions to the length of a sequence. How often each side actually lands determines whether the trade pays off (Figure 1).

Fig. 01 / Interactive

What does each outcome cost?

With 90% probability on heads and 10% on tails, their ideal costs are 0.152 bits and 3.322 bits. A uniform model gives either outcome one bit.

Figure 1. The two probabilities always add up to 100%. Giving one outcome a shorter ideal code makes the other more expensive.

The cost of the model

The knitting chart takes up space too. If a decoder already knows the chart, you can refer to it using the agreement you share. If the receiver needs a new chart for this one piece of cloth, its description belongs in the accounting.

One version of minimum description length compares two-part descriptions. Add the bits needed to specify a model to the bits needed to encode the data with it. A detailed model can fit the observations closely while costing more overall. The comparison depends on the model family, how models are represented, and what the encoder and decoder already share (Figure 2). [2]

Fig. 02 / Interactive

When does the shorter code pay off?

Exactly 9 of every 10 symbols are heads. Both sides know the sequence length and the coding scheme.

For 20 symbols, the uniform baseline costs 20 bits. A model giving heads 90% probability uses about 9.38 ideal data bits; adding an illustrative 12-bit model description brings the biased total to about 21.38 bits.

Figure 2. The uniform baseline is shared in advance. The 12-bit charge is an example, and the data lengths leave out practical coder overhead.

When the pattern changes

A model can describe the data it saw and predict new observations poorly. To measure the difference, fit on one sample and score a separate one. The average ideal cost on that held-out sample is its cross-entropy under the model. It charges the model for every prediction it makes, including the outcomes it treated as unlikely (Figure 3).

Fig. 03 / Interactive

Keep the model. Change the test data.

The fitted model still expects 90% heads. Change the share of heads in the held-out sample and compare with the uniform baseline.

With 90% heads in the test sample, the fitted model needs about 0.469 bits per symbol. With 50% heads it needs about 1.737. The uniform model stays at one bit per symbol.

Figure 3. Bars show ideal bits per held-out symbol, before model costs. Shorter is better.

The fixture is deliberately simple. In language, some predictions depend on nearby spelling or syntax. Others depend on facts established paragraphs earlier. A lower average cost tells you that a model assigned more probability to the observed sequence in aggregate. To find out what it learned, change the task and see which predictions improve or break.

How to investigate it

Build a synthetic sequence whose structure you can state in advance. A biased binary source isolates frequency. A repeating motif with occasional substitutions lets you compare a frequency model with one that uses position or context.

  1. Separate fitting from scoring. Generate independent training and test sequences with recorded parameters and seeds. Fit the biased model on training data only. Document smoothing so unseen symbols still receive a probability.
  2. Compare held-out predictions. Score the uniform and fitted models on identical unseen symbols. Save per-sequence cross-entropy and report the average in bits per symbol.
  3. Account for what the decoder needs. Specify which model parameters are shared and how any others are encoded. If you implement a coder, log actual encoded lengths, report overhead, and verify exact round trips.
  4. Change the source. Keep the fitted model fixed and move the symbol frequency or alter the motif in a new test set. Record how its score changes alongside the uniform baseline.

This is a proposed experiment. The figures are analytic examples. A reproducible report would include fixtures, software versions, model and coder settings, raw observations, and verification criteria.

What this means

The Hutter Prize makes compression a concrete target by asking entrants to reconstruct a fixed text corpus losslessly under contest rules. That is a way to reward capturing regularities in that corpus. To evaluate whether a system can reason through an unfamiliar problem, interact with an environment, or pursue a goal, design a test that puts that capability to work. [3]

Compression tells you how much a model can predict under a particular test. The rest depends on what you ask it to do.

References and further reading

  1. Claude E. Shannon. A Mathematical Theory of Communication, 1948.
  2. Peter D. Grünwald. A Tutorial Introduction to the Minimum Description Length Principle, 2004.
  3. Marcus Hutter. Human Knowledge Compression Contest rules.
Read next · No. 02 · Information theoryThe Impossible CompressorWhatever a model understands, it can’t escape a counting argument. Why no lossless compressor can make every file smaller.
Peel's icon: an orange on a cream tile

Get Peel. Free forever.

No account, no ads, no trial. Everything Peel does today stays free, and it keeps itself up to date.

Download Peel 1.4.0 brew install --cask snackstudio/tap/peel
Requirements
macOS 13 Ventura or later, on Apple silicon or Intel.
Install
Open the installer and follow it. Or open the disk image and drag Peel to Applications, or run brew install --cask snackstudio/tap/peel in Terminal.
Updates
Peel updates itself, and every update is signed. To check now, choose Peel ▸ Check for Updates…
Uninstall
Drag Peel to the Trash, or run brew uninstall --cask peel.
Price
Free. No account, no ads, no trial.
Privacy
Your files never leave your Mac, and the app has no analytics. This site counts visits to learn what helps; the privacy policy says how.