Foams, Brains, and AI: When They Speak the Same Mathematical Language
*A story about unity, starting from soap bubbles in your bathroom*
---
Have you ever closely observed the foam on a glass of beer?
Dense little bubbles squeezed together like noisy neighbors. Decades ago, physicists concluded that foam behaves like glass—bubbles locked in place, unable to move. That conclusion entered textbooks, memorized by generations of students.
But it was wrong.
---
1. The Secret Life of Foam
In 2025, engineers at the University of Pennsylvania did something seemingly simple: they simulated the motion of bubbles inside a foam.
The result surprised them.
The bubbles never stop moving.
Beneath the foam's apparently still surface, countless bubbles continuously rearrange themselves—like people in a crowded room constantly adjusting positions to find a more comfortable posture. The motion is not random; it follows a mathematical regularity.
When the researchers analyzed this regularity, they found something remarkable:
The motion of foam bubbles follows exactly the same mathematical rules as parameter adjustment during the training of modern AI systems.
To repeat:
The soap bubbles in your bathroom and the training process of ChatGPT speak the same mathematical language.
---
2. The Wisdom of "Flatness"
To understand why this matters, consider how AI learns.
Picture yourself in rugged terrain, seeking the lowest valley. This is the classic picture of optimization: walk downhill until you reach the bottom.
Early machine learning researchers thought this way—training an AI meant pushing it into the deepest valley to find the "optimal solution."
But modern deep learning says: don't.
Truly effective AI models do not trap themselves in the deepest valley. Instead, they settle in relatively flat regions—where many similar good solutions exist, rather than a single perfect point.
Why? Because flatness means generalization. A model stuck in a steep, narrow valley overfits to training data—it memorizes examples but fails on new ones. In flat regions, the model learns the "general shape," enabling it to handle situations it has never seen.
Foam bubbles do the same.
They don't pursue a single most-stable state; they continuously explore among many viable configurations. This "non-optimal" strategy is precisely what keeps them stable.
---
3. A Bigger Picture
The similarity between foam and AI hints at a deeper regularity.
- Bacteria swim through a petri dish seeking food, sensing chemical gradients via membrane receptors.
- The human brain, with roughly 100 billion neurons and 100 trillion connections, constantly generates predictions about the world, compares them with actual sensations, and updates its internal model.
- Evolution explores fitness landscapes over vast timescales, adapting life to changing environments.
- Repetition suppression: responses weaken when the same stimulus repeats—because predictions grow more accurate and surprise diminishes.
- Mismatch negativity: when stimuli deviate from expectations, the brain produces a characteristic electrical signal—prediction error detection.
- Predictive coding theory holds that the brain works by constantly generating predictions and minimizing prediction error—precisely the Free Energy Principle as embodied in nervous systems.
- Training = minimizing a loss function (variational free energy)
- Generalization = staying in "flat" regions of the solution space
- World-model learning ↔ variational free energy minimization
- Exploration–exploitation tradeoff ↔ expected free energy minimization
- Friston, K. (2012). A free energy principle for biological systems. *Entropy*, 14(11), 2100-2121.
- Parr, T., Pezzulo, G., & Friston, K. J. (2022). *Active inference: The free energy principle in mind, brain, and behavior*. MIT Press.
- Clark, A. (2015). *Surfing uncertainty: Prediction, action, and the embodied mind*. Oxford University Press.
- Thirumalaiswamy, A., et al. (2025). Slow relaxation and landscape-driven dynamics in viscous ripening foams. *PNAS*.
These seemingly unrelated phenomena—bacterial chemotaxis, brain prediction, evolutionary selection, foam rearrangement, AI learning—may share one underlying principle.
---
4. Free Energy: Nature's Universal Currency
That principle has a name: the Free Energy Principle.
Proposed by Professor Karl Friston of University College London, it claims:
> All non-equilibrium steady-state systems—from bacteria to humans, from foam to AI—minimize free energy.
Friston has called it "the most all-encompassing idea since Darwin's natural selection."
What is free energy?
In physics, it is a system's energy minus temperature times entropy. In its information-theoretic form, it is an upper bound on "surprise"—the gap between your expectations and reality.
Imagine walking in a forest, expecting to see a tree, and seeing a person instead. That is surprise. The principle says living systems continuously adjust to minimize it.
Two ways to adjust:
1. Change beliefs (perception): approaching the "person," you discover it is a tree, and update your belief. 2. Change the world (action): if it starts raining, you seek shelter, altering the environment to match your belief of "staying dry."
Perception and action are, mathematically, two sides of the same coin.
---
5. The Bayesian Brain
In the 19th century, German physicist Hermann von Helmholtz proposed a revolutionary idea:
The brain is a statistical inference machine.
We do not "see" the world—we infer it. Our senses deliver limited information, and the brain constructs its best guess of reality from it.
This is the Bayesian brain hypothesis: the brain continuously updates its estimates of the world based on priors and new sensory evidence.
Modern neuroscience has found supporting evidence:
---
6. Another Possibility for AI
If the Free Energy Principle is correct, what does it imply for AI design?
Current deep learning already follows it, unintentionally:
But we can go further.
Active Inference—a framework built on the principle—suggests a different design philosophy: rather than merely minimizing a loss function, let the AI actively explore its environment, verifying and correcting its internal model through action.
This connects deeply with reinforcement learning:
Biological intelligence, shaped by natural evolution, and artificial intelligence, designed by humans, converge on the same underlying logic.
---
7. A Paradigm Shift in How We Understand Ourselves
First: continuity of life, consciousness, and intelligence. Tradition treats these as sharply distinct phenomena. The Free Energy Principle suggests they form a continuum—from self-organization in physical systems, to adaptation in simple life, to cognition in complex organisms, to learning in AI—all different expressions of the same principle.
Second: the nature of "understanding." Understanding means the ability to predict. This prediction need not be explicit or symbolic; it can be implicit and distributed, like the weights of a neural network.
Third: determinism vs. probability. Classical science pursued certainty. But life and intelligence are inherently probabilistic—they handle uncertainty and decide with incomplete information. Von Neumann anticipated this:
> "Information theory includes two branches: strict information theory and probabilistic information theory. The probabilistic-statistical branch is probably more important for modern computer design."
---
8. Open Questions
The Free Energy Principle is not without controversy.
Critics say it is too abstract to falsify. When you can explain any phenomenon after the fact, your explanation may explain nothing.
Supporters respond that, once a state space and generative model are defined for a concrete system, it yields specific, testable predictions—and it already has substantial empirical support in neuroscience and cognitive science.
The deeper question: if everything is free energy minimization, where does "consciousness" fit? What is the "self"? Does "free will" still matter?
There are no easy answers. But the principle at least offers a framework—a single language for discussing them.
---
9. Conclusion: An Epiphany in the Bathroom
Back to the foam on that beer.
Next time you watch soap bubbles in the bath, remember: you may be observing one of the universe's most fundamental organizing principles.
From foam to bacteria, from brains to AI, these seemingly unrelated systems may all follow one simple rule:
Minimize surprise, maintain steady states, persist.
This is not magic. It is mathematics.
And mathematics is the universe's only universal language.
---
*"If everything is computation, then physics, biology, economics... all follow the same underlying rules."*
*This may be one of the deepest scientific insights of the 21st century—or, just a beginning.*
---
Further Reading
*This article was inspired by 2025 University of Pennsylvania research on the mathematical similarity between foam physics and deep learning, and by Professor Karl Friston's Free Energy Principle framework.*