LLM + RoboticsUnit 1 · The foundations · Day 07

Quantifying the Rise and Fall of Complexity in Closed Systems: The Coffee Automaton

Simulate cream mixing into coffee, blur the picture, and compress it. Entropy climbs steadily. The compressed size of the blurred picture rises, peaks and falls.

AuthorsScott Aaronson, Sean M. Carroll, Lauren Ouellette
Year / venue2014 · arXiv (1405.6903)
Core ideaApparent complexity = compressed size of a coarse-grained state
Study time2–3 h

Original: arXiv:1405.6903 · Code, notebook and exercises: 30u30 Day 7

Start here (no maths needed)

Scientists simulated milk mixing into coffee on a grid of pixels and showed that, measured the right way, how complicated it looks rises and then falls.

Think of it like this

Squint at a photo of milky coffee from across the room. You stop seeing every tiny speck, and only see the big shapes: milky parts, dark parts and swirly in-between parts. Now imagine zipping that blurry picture. At the start and the end the blurry picture is boring and zips small. In the middle, with all the swirls, it zips bigger.

How it works

  1. Make a grid of squares: white (milk) on top, black (coffee) on the bottom.
  2. Again and again, pick two neighbouring squares at random and swap them if they are different colours.
  3. Zip the sharp picture to measure how mixed it is. This number keeps going up.
  4. Blur the picture into three shades (milk, coffee, mixed) and zip that. This number goes up, then comes back down.
  5. Repeat with bigger grids to see how the peak grows.

Why robots care

Robots build blurry maps of the world, made of little squares marked "free", "blocked" or "not sure". Choosing how big those squares are is the same choice as the blur size here. Too small and the map is full of noise. Too big and a chair leg disappears.

Try it

Words to know

Simulation
A computer model that acts out a process step by step.
Pixel
One small square of a picture.
Coarse-graining
Blurring a picture so only the big shapes are left.
Compressor
A program like zip that shrinks files by spotting patterns.
Entropy
How mixed-up or random something is.

Going deeper: everything below is the full version, with some maths. On a first read, skim the headings and the "Why it matters for robotics" box, and come back for the rest later.

1. Summary

TL;DR

This is the empirical follow-up to Day 06. The authors build a 2D grid of cream (1) and coffee (0) cells, cream on top, and let particles mix by random local moves. Entropy is estimated as the gzip size of the exact grid. "Apparent complexity" is the gzip size of a smoothed, three-level version of the grid. In the interacting model, apparent complexity rises then falls, and its peak grows linearly with the grid's side length. In a non-interacting model, a refined measurement shows it stays low, which they also prove. It's a careful first experiment, with honest caveats about what a compressor can and can't show.

2. The core idea

Pick a smoothing function f that throws away "incidental" detail. Then measure entropy on the raw state and complexity on the smoothed one:

entropy(x)             ≈ |gzip(x)|
apparent complexity(x) ≈ |gzip(f(x))|

f(x)[i,j] = threshold( mean of x over the g×g square centred at (i,j) )
            → 3 levels: mostly coffee / mixed / mostly cream

The paper links this back to theory. The coarse-grained image f(x) defines the set of all microstates that blur to the same picture. That is a model set S in the sense of sophistication, so apparent complexity is a heavily resource-bounded version of it.

3. Deep dive

Run it yourself

Interactive: the coffee automaton

48×48 interacting model, seeded. Each step picks a random cell and a random neighbour and swaps them if they differ, a slight variant of the paper's rule. Left: fine grid. Middle: coarse-grained, 3 levels. Right: entropy (LZ78 size of the fine grid) and apparent complexity (LZ78 size of the coarse grid), each scaled to its own maximum.

Steps
–
Entropy (bits)
–
Complexity (bits)
–

Try g = 3: the blur is too fine, random fluctuations survive the threshold, and "complexity" stays high long after mixing. The paper's appendix makes this precise for the non-interacting case: the grain must grow like √(log n) for fluctuations to average out. The choice of blur is not a detail.

Thresholding artefacts and the adjusted measure

With three buckets, a smooth gradient from cream to coffee will always have a row sitting near a bucket boundary. Tiny fluctuations make that row flicker between two levels, and the compressor counts the flicker as structure. The authors' fix: use seven levels, and let each cell move one level towards the majority value of its row. With this adjustment, the interacting model still shows the rise and fall. The non-interacting model's complexity is flattened to a low value, matching their proof that its coarse-grained state is always simple to describe: given n and t, you can compute the expected picture, and with a big enough grain nothing deviates from it.

What they tried and dropped

Limits

Every number here is an upper bound. A compressor can prove something is simple, never that it is complex. The blur and the thresholds encode human judgement about what counts as "interesting", which the authors acknowledge. And a cellular automaton is a long way from real fluid dynamics.

4. Why it matters for robotics

5. How to study it

  1. Read Sections 1–6 of the paper (about 1 h). Skim Section 2's tour of complexity measures, and read the short appendix proof.
  2. In the 30u30 Day 7 folder, read implementation.py and run train_minimal.py to reproduce the rise-and-fall curves.
  3. Do the exercises: coarse-graining, interacting vs non-interacting models, scaling with grid size, adjusted coarse-graining, and comparing compressors.
  4. Check the scaling claim yourself: run three grid sizes and plot peak complexity against side length.
  5. Stretch: replace gzip with a small learned model (for example a PixelCNN-style predictor) and use its log-loss as the code length.

6. Self-check

Why compress the coarse-grained grid rather than the fine one to measure complexity?

The fine grid's compressed size tracks randomness, so it just keeps rising like entropy. Blurring removes the random detail and leaves the large-scale structure, which is what "interesting" means here.

Why does the non-interacting model stay simple?

Each particle walks independently, so the expected density depends only on row and time and can be computed from n and t. With a large enough grain, the actual coarse picture matches that expectation with high probability.

What problem does thresholding cause, and how did they fix it?

Rows near a bucket boundary flicker between levels and look like structure. They used seven levels and let cells move one level towards their row's majority value.

How do maximum entropy and maximum complexity scale with grid side n?

Maximum entropy grows like n² (number of cells). Maximum complexity grows roughly linearly in n, since structure develops along one dimension, the cream–coffee boundary.

Why can't simulation alone prove the system becomes complex?

Compressors give upper bounds on complexity. Proving a state is complex needs a lower bound, which the paper leaves as an open problem.

7. Further reading