Marginal

Computational Mechanics

What a predictor must remember about the past: entropy rate and excess entropy, causal states and ε-machines, statistical complexity, belief states and mixed-state presentations, the geometry of beliefs in the probability simplex, generalized hidden Markov models, and evidence that transformers trained on next-token prediction represent belief-state geometry in their residual streams.

15 lessons in 2 units · free with an account

Start your free trialThis course stays free after the trial.
What you'll learn

15 lessons, one small step at a time

Each lesson states its goal, then works up to it in short steps with practice after each. A placement test at the start skips what you already know.

Prediction & Causal States

8 lessons
  1. Block entropy & entropy rateCompute block entropies and the entropy rate of a process, and compare random with periodic processes.
  2. Excess entropyRead the excess entropy off the block-entropy curve, interpret it as information shared by past and future, and classify processes by randomness and structure.
  3. Causal statesGroup pasts that predict the same future into causal states, count them for simple processes, and explain why they are minimal sufficient for prediction.
  4. Statistics as partitionsClassify partitions of histories as sufficient, minimal or neither, and explain why a perfect next-token predictor must carry the causal states.
  5. Unifilar machinesExplain why causal states form a unifilar machine, track its state from observed symbols, and find the words it can never produce.
  6. ε-machinesCompute the stationary state distribution and symbol frequencies of an ε-machine, compute word probabilities from it, and explain why it is the minimal optimal predictor.
  7. Entropy rate from a machineCompute the entropy rate of an ε-machine as a weighted average of per-state uncertainties, and use it as a floor on a trained model's loss.
  8. Statistical complexityCompute the statistical complexity of a process as the entropy of its causal state, and place processes on separate axes of randomness and complexity.

Belief States

7 lessons
  1. Belief statesUpdate a belief over hidden states after each symbol, and explain why belief states form a machine that is sufficient for prediction.
  2. Generating versus predictingExplain why a process can be easy to generate yet hard to predict, tell the two kinds of minimal model apart, and say why optimal prediction is a target for safety research.
  3. SynchronizationCompute how much an observer's uncertainty about the hidden state falls with each symbol, and how fast the observer synchronizes.
  4. Belief geometryPlot a belief as a point of the probability simplex, and explain when the reachable beliefs form a finite set and when a fractal.
  5. Belief states in transformersCompute where a linear embedding places a belief in activation space, and explain what finding belief geometry in transformers suggests about world models.
  6. Testing for belief geometryExplain the controls that test claims of belief geometry, and what changed for a harder process and for post-quantum representations.
  7. Generalized HMMsBound the dimension of a process with the rank of its Hankel matrix, and explain why generalized hidden Markov models give the minimal linear description.
Sample lesson

Block entropy & entropy rate

Goal: Compute block entropies and the entropy rate of a process, and compare random with periodic processes.

Computational mechanics, developed by James Crutchfield and colleagues since the late 1980s, asks what any predictor of a process must know about its past. Language models are predictors, so its answers apply directly to them. The first question is how predictable the next symbol is at all.

We will compute block entropies, take the entropy rate, and finish with random and periodic processes.

Step 1: Block entropies

A process emits a sequence of symbols X₁, X₂, …. Let H(L) be the entropy of a block of L consecutive symbols: the uncertainty, in bits, about the whole block. For an i.i.d. coin with P(1) = p, the symbols are independent, so their entropies add: H(L) = L × H(p), where H(p) is the entropy of one flip. With p = 0.25, H(p) ≈ 0.81, so a block of 5 flips has H(5) ≈ 4.05 bits. For processes with memory, later symbols are partly predictable from earlier ones and H(L) grows more slowly than L × H(1).

Step 2: The entropy rate

The entropy rate is the irreducible randomness per symbol, the uncertainty about the next symbol that remains even given the entire past:

hμ = lim H(L)/L = lim H(XL | X₁…XL−1)

H(L)/L approaches it because early uncertainty, such as not yet knowing a phase, gets spread over more and more symbols. For an i.i.d. coin, hμ = H(p). A next-token predictor's average log loss (its cross-entropy in bits) can never go below hμ, however good the model: the entropy rate is the floor on loss.

Step 3: Random and periodic processes

The entropy rate places processes on a scale of randomness. A periodic process such as 0110 0110 …, once its phase is known, is perfectly predictable, so hμ = 0. A fair coin has the largest possible rate for two symbols, 1 bit. Biased coins sit in between, with H(p) = H(1 − p): a coin landing 1 ninety percent of the time is exactly as unpredictable as one landing 1 ten percent of the time.

In the app, each step ends with practice questions, new ones every time, and the lesson comes back later in spaced reviews.

Start Computational Mechanics

Lessons that need something you haven't learned yet bring it in first, from any course.

Start your free trialThis course stays free after the trial.