A coin, a magnet, and a learning machine
Follow a binary trial from coin flips into magnetic spins, Shannon compression, and neural gradient descent.
Picture three rooms situated along the same laboratory hallway.
In the first room, a statistician flips a fair coin repeatedly, logging the sequence of heads and tails in a notebook.
In the second room, a condensed matter physicist places a crystal of tiny magnetic dipoles inside a variable magnetic field, heating and cooling it in a thermal bath.
In the third room, a computer scientist trains a neural network on text, adjusting synaptic weights so the machine can predict whether an incoming sentence ends with a question mark.
At first glance, these three researchers seem to inhabit entirely separate scientific worlds. One is studying combinatorial chance, another is measuring thermodynamics, and the third is optimizing artificial intelligence.
Yet when I set their mathematical models side by side, an astonishing realization emerges: all three rooms are running the exact same equations. Each room investigates a binary event with two possible outcomes. Each room parameterizes that event using the hyperbolic rapidity coordinate of spacetime. And each room discovers that the curvature of its underlying potential is governed by Einstein’s relativistic Lorentz factor.
Let us walk through all three rooms together, following a single binary trial as it evolves from a counting puzzle into a thermodynamic magnet, an optimal data compressor, and an adaptive learning machine.
The three rooms: Coins, spins, and bits
Let us establish a universal mathematical notation for all three rooms.
Consider any elementary trial with two mutually exclusive outcomes, which we label positive (
Let
In Epistemic Physics, we frequently switch between three complementary coordinates that describe this bias:
- The raw probability
. - The centered epistemic velocity
, which maps balance to the origin: where is the discrete random outcome. - The epistemic rapidity
, which represents half the log-odds:
Inverting these definitions expresses probability and velocity in terms of rapidity:
Now recall the relativistic Lorentz factor
Keep this hyperbolic cosine
Counting histories: Microstates and Shannon entropy
Let us step inside the first room, where our statistician is recording coin flips.
Suppose a notebook contains a summary of
The summary records only the total counts, not the chronological sequence in which they arrived. How many distinct ordered histories (microstates) could have produced that exact summary?
This is the elementary binomial coefficient:
Here the exclamation mark denotes the factorial (
Notice how the number of compatible histories changes with balance:
- If a sequence of six trials yields six heads and zero tails, there is only
possible history: . - If the six trials split evenly into three heads and three tails, the number of compatible histories explodes to
distinct orderings.
Balance opens up maximal combinatorial freedom.
When the number of recorded trials
Divide both sides by
This yields Claude Shannon’s famous binary entropy function,
Binary entropy measures the logarithmic volume of possible histories per trial. When natural logarithms are used, entropy is measured in nats; dividing by
Entropy peaks at complete balance (
Make four histories from one notebook
Tap a head and a tail to swap them. Find 4 distinct orderings while preserving the notebook's totals.
The notebook always reads 3 H and 3 T
Choose an H, then a T. Their positions will trade.
Your history album · 1/20 slots
HHHTTTThere are 20 compatible histories in total. Album slots are a display limit, not a limit on possible histories.
Change the notebook and count all possible histories
Notebook size
Exact log-count / trial
0.720 bitsShannon limit / trial
1.000 bitsA Beta ledger for independent identically distributed trials retains counts, so all these orders yield the same final weights. Their tracelet order is still different. Exact finite log-count and the Shannon large-sample expression differ. An all-heads or all-tails notebook has only one history.
Thermal physics: The paramagnet in a heat bath
Now walk into the second room. Put away the coin, and inspect the physicist’s apparatus: a collection of non-interacting magnetic atoms (a paramagnet).
Each atom has an intrinsic magnetic dipole moment that can point in one of two directions along an applied magnetic field: spin up (
An external magnetic field applies an energy bias
If
The crystal sits inside a thermal reservoir at absolute temperature
The sum of all state weights is the canonical partition function, denoted
Now compare this formula with the rapidities from our first room!
Define the dimensionless physical rapidity as the ratio of magnetic field energy to thermal energy:
Substituting
Look at that: the physical partition function is twice the relativistic Lorentz factor!
The thermal probability of finding a spin pointing up is:
The net magnetization (the average alignment per spin) is:
The magnetic alignment of a crystal is mathematically identical to the centered epistemic velocity of a coin!
When the temperature is high (
Thermodynamic potentials: The Lorentz factor as curvature
In statistical physics, all thermodynamic properties of a system can be derived by differentiating a characteristic potential: the free energy, or its dimensionless counterpart, the log-partition function:
Let us differentiate this potential with respect to rapidity
The first derivative gives the expected velocity (magnetization):
The second derivative gives the response sensitivity (magnetic susceptibility, or variance):
Look at that identity:
The curvature of the thermodynamic log-partition function is the inverse square of the Lorentz factor!
Near the balanced center (
Now let us perform a Legendre transformation to switch perspectives. Instead of driving the system with an external force
Define the entropy deficit function
Differentiating
Differentiating once more gives the stiffness (the resistance of the system to being displaced from balance):
The two curvatures are exact reciprocal partners:
The curvature of order in state space is the relativistic Lorentz factor squared!
Where the system is easy to move in rapidity, it is flat in entropy deficit. Near the speed of light, the entropy deficit approaches the finite ceiling
Optimal coding: Cross-entropy and the cost of being wrong
Now enter the third room. Here we meet the computer scientist, who is compressing data and training machine learning models.
Suppose the true environment produces positive outcomes with probability
According to Shannon’s source coding theorem, if an encoder designs an optimal prefix code tailored to an expected probability
Outcomes expected to be common are assigned short code words; outcomes expected to be rare receive long code words.
Now, what is the expected code length per trial when the true data source actually produces outcomes according to probability
This expected cost is the cross-entropy,
We can decompose cross-entropy into two distinct components:
Here
The excess penalty,
Look at what KL divergence measures: it is the informational tax you pay for using the wrong model of reality.
By Gibbs’ inequality,
Pack a message with fewer wasted bits
Pick a prediction recipe for this source. Open its coding bill and see which part of the surprise you can remove.
Source 1 of 3
The source sends plus 80% of the time.
Free recipe mixing and the thermal connection
ρ is field energy divided by thermal energy in the two-state model. Costs here use base-two logs and are expected ideal code lengths for long independent blocks. There are no sampled trials or invented game points. The bars share one cost scale. Choosing a new recipe closes its bill until you inspect it.
Test this in the interactive lab above. Adjust the true probability
Let us see this in concrete numbers:
Suppose the world produces positive outcomes
- If the model knows the true distribution (
), its average description length is . The penalty is zero. - If the model is completely agnostic (
), it assigns 1 bit to every outcome. The penalty is wasted per trial. - If the model is dogmatically wrong, predicting positive outcomes only
of the time ( ), the expected code length leaps to: The penalty is wasted on every single observation!
Dogmatic misprediction is immensely expensive.
Gradient descent: How learning machines follow hyperbolic curves
How does an artificial neural network fix its mistakes?
Let the machine represent its prediction using its own internal rapidity parameter,
Here
Now express the cross-entropy loss
Using elementary algebra:
Combining terms:
Look at that formula:
Cross-entropy loss in machine learning uses the same conjugate expression that builds the Legendre transform of a thermal paramagnet! The transform maximizes
Now compute the gradient of this loss with respect to the network’s parameter
Look at how extraordinarily simple and elegant this gradient is:
The learning force that drives gradient descent is simply the difference between the model’s predicted velocity
When the training data consists of individual discrete observations
If the network predicts
If instead the network encounters an unexpected negative trial (
The machine takes a large stride in rapidity precisely when an observation strongly contradicts its prediction.
Steer a learner into the prediction gate
Choose the size of each learning step. Land within 0.01 extra bits per trial of the source. Big steps can cross the target.
Course 1 of 3 · Cross the track · step 0
Apricot learner
10.0%Sky target
90%The learner starts far from the target. How large a first step would you choose?
Inspect your route and the gradient rule
Current rapidity η = -1.099; gradient g = -1.600.
These are deterministic gradient steps against the source's expected outcome, rather than sampled trials or Beta evidence accumulation. The target measures excess expected log loss. A large gain can overshoot and need not reduce loss every time. Your route is capped at 30 steps; undo and replay remain available.
Spreading convictions: A physical lattice of learning minds
We have now traveled through all three rooms:
- In the coin room, we discovered that microstate volume generates Shannon entropy
. - In the magnet room, we found that thermal partition functions
govern physical dipoles, with response sensitivity given by the inverse Lorentz factor . - In the neural room, we showed that cross-entropy loss reproduces the exact same potential, driving gradient descent through the velocity error
.
Now imagine combining all three rooms into a single physical system: a distributed lattice of learning agents.
Picture a two-dimensional grid where each node maintains an evidence notebook
When neighboring nodes disagree, the cross-entropy mismatch generates an informational shear force proportional to
- At low informational temperature, the lattice exhibits spontaneous symmetry breaking: agents coalesce into vast, coherent domains of shared conviction.
- At high temperature, random noise disrupts communication, dissolving the lattice into an uncommitted paramagnetic gas.
- At the critical temperature, long-range correlations emerge: a single surprising observation at one corner can propagate like a phase wave across the entire collective network.
Such a world possesses three distinct physical stiffnesses:
- Saturation stiffness: An element near certainty responds weakly to bias changes because its susceptibility vanishes (
). - Inertial stiffness: A thick notebook with massive epistemic rest mass
turns slowly because each incoming trial is divided by . - Information tension: A mismatched prediction incurs a steep cross-entropy cost, generating mechanical pressure to realign.
These are distinct physical mechanisms that we can place side by side and simulate.
Build the smallest toy version: two neighboring notebooks, a shared stream of binary events, and a coupling proportional to prediction mismatch. Watch whether agreement spreads like heat, travels like a wave, or freezes into competing domains.
Coins, magnets, and neural networks are not merely loose metaphors for one another. They are distinct physical manifestations of the same underlying information geometry. The equations have given us parts for a little physical world.
In our next excursion, we will follow this geometry into the cosmic fabric of spacetime in A universe written in two inks, where positive and negative evidence lay down the light cones of physical reality.