Interactive Simulations

Hands-on demonstrations of the Free Energy Principle and Active Inference, built as companions to the foundational textbook. Learn by doing, adjust parameters, watch systems adapt, and build intuition for how adaptive behaviour emerges from first principles.

Active Inference: The Free Energy Principle in Mind, Brain, and Behavior

Active Inference

Thomas Parr, Giovanni Pezzulo & Karl J. Friston

The definitive guide to the Free Energy Principle and Active Inference framework. These simulations follow the textbook's progression, from the thermodynamic foundations of self-organisation through generative models, belief updating, and policy selection in partially observable environments.

MIT Press, 2022 · ISBN 978-0-262-04535-3

View at MIT Press

Explore the Simulations

Each simulation pairs interactive demonstrations with direct quotations from the textbook, step-by-step tutorials, and comprehensive glossaries of key concepts.

First Principles – What Is Active Inference?
Living Ink simulation screenshot
Chapters 1–3
Beginner
Life Emerges – Living Ink

Watch particles self-organise from chaos into a living system. Toggle between entropy-maximising dissipation and free-energy-minimising life to see the fundamental difference the FEP describes. Includes a faithful recreation of Figure 3.3, a comprehensive glossary, real-time variational free energy computation, and commentary from Virtual Karl Friston.

Free EnergySelf-OrganisationNESSEntropyMarkov BlanketFigure 3.3
Apple or Frog simulation screenshot
Chapter 2
Beginner
Apple or Frog? – Perception as Inference

A step-by-step tutorial demonstrating how the brain resolves ambiguous sensory data through Bayesian inference. Adjust prior beliefs and likelihoods to see how perception emerges from the interplay between expectation and observation: two hypotheses, one ambiguous stimulus, and the mathematics of how we decide what we see.

Bayesian InferencePrior BeliefsLikelihoodPosterior
Surprise Minimisation simulation screenshot
Chapters 1–2
Beginner
Surprise Minimisation – The Fish Predicts

You control the environment; the fish minimises surprise. Drop food, introduce predators, and reshape the world to see prediction confidence, prediction error, and belief updating unfold in real time. The only Active Inference demo where the learner has agency over the agent's world rather than its parameters. With commentary from Virtual Karl Friston.

SurprisePrediction ErrorBelief UpdatingModel Evidence
Fish schooling simulation screenshot
Chapters 3 & 7
Beginner
Collective Active Inference – Fish Schooling

Every fish minimises its own free energy, yet the school self-organises into a higher-order agent with its own Markov blanket. Split schools to create two autonomous group-level agents, merge them back, and introduce predators to watch collective coherence rupture and reform. Narrated by Daniel Friedman with commentary grounded in precision-weighted coupling and generalised synchrony.

Collective AgencyMarkov BlanketsGeneralised SynchronyPrecision WeightingSymmetry Breaking
The Full Framework – Generative Models & Morphogenesis
From Beliefs to Action tutorial screenshot
Chapters 2–7
Intermediate
From Beliefs to Action – The Complete Loop

An eight-step guided tutorial that walks through the entire Active Inference cycle. Starting from a fish's generative model and its beliefs about the world, you progress through prediction error, variational free energy, prior preferences, policy evaluation, counterfactual reasoning, and expected free energy, building up the full framework one concept at a time.

Generative ModelVFEPrediction ErrorPoliciesEFE
Self-Evidencing Tree simulation screenshot
Chapters 2–4
Intermediate
The Self-Evidencing Tree – Morphogenesis as Inference

A tree that grows by minimising free energy. Each branch tip maintains a generative model, resolving prediction error through perception (updating beliefs about light) or action (growing toward it). Adjust precision and prior preferences to explore the explore–exploit trade-off. Demonstrates that Active Inference is a principle of self-organisation, not only a theory of cognition.

Self-EvidencingPrecisionPrior PreferencesExplore–ExploitMorphogenesis
Active InferAnts colony simulation screenshot
Chapters 3, 6 & 7
Intermediate
The Colony as Inference – Active InferAnts

An ant colony where each ant minimises expected free energy through stigmergic foraging. Pheromone trails form a shared generative model externalised into the environment — niche construction in action. Soldiers and foragers demonstrate that the same algorithm produces different behaviour when prior preferences change. Features a live nest interior webcam, sensory field heatmaps, collaboration networks showing generalised synchrony, and narration by Daniel Friedman. Inspired by Friedman, Tschantz, Ramstead, Friston & Constant (2021).

StigmergyNiche ConstructionHierarchical BlanketsPrior PreferencesEpistemic & Pragmatic ValueGeneralised Synchrony
Active Inference Network simulation screenshot
Chapters 3 & 7
Intermediate
Active Inference Network – Collective Autonomy

Scale a complete graph from one agent to 150 and watch Markov blankets proliferate quadratically. Each agent accumulates evidence toward belief updates; each edge is a statistical boundary mediating prediction errors between them. As the network grows, collective autonomy overtakes individual autonomy, blanket-mediated coupling drives synchronisation cascades, and Dunbar’s number emerges as the point where agents can no longer sustain meaningful individuality within the ensemble.

Markov BlanketsCollective AutonomyGeneralised SynchronyPrediction ErrorPrecision WeightingQuadratic Scaling
Advanced – Planning, Hierarchy & Deep Structure
T-Maze Expected Free Energy simulation screenshot
Chapter 7
Advanced
T-Maze – Expected Free Energy

The canonical Active Inference demonstration. Watch an agent navigate a T-maze by evaluating policies through Expected Free Energy, balancing the epistemic value of information-seeking against the pragmatic value of reward. Adjust precision and epistemic weighting in real time to see how planning under uncertainty unfolds in a partially observable environment.

Expected Free EnergyEpistemic ValuePragmatic ValuePOMDPPolicy Selection
Hierarchical Markov Blankets simulation screenshot
Chapter 3
Advanced
Hierarchical Markov Blankets

Visualise how Markov blankets nest within one another, from cells to organs to organisms. This simulation demonstrates the recursive structure of self-organisation, where each level maintains its own statistical boundary while participating in the dynamics of the whole.

Markov BlanketsHierarchyNested SystemsSelf-Organisation
The Dopamine Dial simulation screenshot
Chapters 5 & 8
Advanced
The Dopamine Dial – Neuromodulation as Precision

Zoom into a single harvester ant’s brain and watch its behaviour change as you adjust four neurotransmitter channels. Dopamine, serotonin, octopamine, and tyramine each implement a distinct precision channel — policy confidence, homeostatic caution, motor readiness, and baseline gain. Recreates the key finding from Friedman et al. (2018) iScience (DOI: 10.1016/j.isci.2018.09.001): pharmacological dopamine boosts increase foraging activity, with low-DA colonies responding more strongly — exactly as precision-weighting predicts. Features a live neural network inset and narration by Daniel Friedman.

PrecisionNeuromodulationSensory AttenuationPolicy SelectionDA:5-HT RatioExplore–Exploit
Tree Morphology Quiz simulation screenshot
Chapters 4, 6 & 10
Advanced
Tree Morphology Quiz – Precision, Preferences & Hierarchy

An interactive quiz about how branching growth expresses precision, prior preferences, hierarchical inference, and bounded rationality. Tune the tree’s model of light and moisture, then check how your choices alter the generative model across branches and roots.

PrecisionPrior PreferencesHierarchyBounded RationalityMarkov Blankets

Build With Us

These simulations are open-source educational tools developed for the Active Inference Institute. We welcome contributions, corrections, and ideas for new demonstrations.