← Back to Catalog

Visual Overlays

Hierarchical Precision

Πindividual 1.00
low precision (flexible)high precision (rigid)
Parr, Pezzulo & Friston (2022) Ch.4
Πwithin-group 1.00
permeable blanketindividual rigid blanket
Individual blanket permeability within each school
Palacios et al. (2020)
Πbetween-groups 2.50
schools mergeseparate schools
School-level blanket permeability between groups
Thestrup Waade et al. (2025)
Prediction error drive 1.00
low drivehigh drive
Proprioceptive prediction strength driving motor output
Parr, Pezzulo & Friston (2022) Ch.5

Intra-group Synchrony

Inter-group Synchrony

Hierarchical Markov Blankets
Nested Self-Organisation in Active Inference

What You Are Seeing

Six fish swim in two schools of three. Each fish is an active inference agent — it minimises variational free energy through perception (sensing the flow field via its lateral line) and action (generating thrust via tail-beats that shed vortices into the water).

The fish do not follow pre-programmed flocking rules. Their coordinated behaviour emerges from three nested levels of precision-weighted coupling — the same mechanism operating at different spatial scales.

Three Levels of Markov Blanket

Level 1 — Individual blanket. Each fish maintains a statistical boundary between its internal states (body oscillators) and the external world (water flow). The dashed line around each fish represents this boundary. The fish's sensory states are its lateral line receptors; its active states are its tail-beat thrust vectors.

Level 2 — Group blanket. Within each school, pairs of fish accumulate evidence of mutual predictability — generalised synchrony. When fish can predict each other's movements, a group-level Markov blanket emerges (the larger dashed boundary around each school). The school now behaves as a single higher-order agent.

Level 3 — Collective blanket. When the two schools interact strongly enough, an even larger blanket can form around the entire collective. This appears as the purple dashed boundary when the boundary between schools becomes sufficiently permeable (low Πbetween-groups).

"We could have multiple Markov blankets, nested within one another (e.g., brains, organisms, communities)." — Parr, Pezzulo & Friston (2022), Active Inference, Ch.6 p.109

What the Sliders Control

Πindividual controls the precision of each fish's internal oscillators — how tightly its body dynamics are tuned. High precision means slow, stereotyped tail-beats: the fish repeats the same motor pattern precisely. Low precision means loose, variable oscillators producing fast, irregular swimming. Note: this is oscillator precision (the tightness of internal dynamics), distinct from the policy precision (γ) that governs the exploration–exploitation trade-off in Chapter 7 of the textbook.

Πwithin-group controls each fish's individual blanket rigidity within its school. High precision means each fish strongly maintains its own boundary, resisting social influence — the school dissolves into independent swimmers. Low precision means permeable individual blankets, allowing generalised synchrony to build — the school self-organises as a higher-order agent.

Πbetween-groups controls how strongly each school maintains its boundary against the other. High precision means autonomous, separate schools. Lower precision allows cross-group coupling — push this low enough and the two schools merge into a single collective agent with a shared generative model.

Prediction error drive controls the strength of proprioceptive predictions that generate action via classical reflex arcs (Ch.5). Higher drive means stronger descending motor predictions, producing more vigorous thrust and larger vortices shed into the water. This is the amplitude of active inference — how forcefully the fish acts on its beliefs — not the direction of action selection.

"Hierarchical self-organisation emerges when the microscopic elements of an ensemble have prior beliefs that they participate in a macroscopic Markov blanket." — Palacios, Razi, Parr, Kirchhoff & Friston (2020), J. Theoretical Biology

Try This

1. Set Πbetween-groups to maximum (slider right). The two schools maintain strong, separate boundaries — two autonomous agents with independent generative models.

2. Slowly lower Πbetween-groups (slide left). Watch generalised synchrony build between the schools. When blanket permeability is high enough, a collective Markov blanket emerges (the purple dashed boundary) — a single higher-order agent.

3. Now raise Πindividual to maximum (slider right). Each fish's oscillators become tight and precise — slow, stereotyped tail-beats. This is exploitation: repeating known patterns.

4. Lower Πindividual to minimum (slider left). Fish become fast and wriggly — loose oscillators producing high-variance motor output. Notice that the group blanket may weaken because rapid, irregular movement makes mutual predictability harder to sustain.

Core FEP Concepts
As Demonstrated in This Simulation

Variational Free Energy Minimisation

Each fish minimises variational free energy through two complementary channels: perception (updating internal beliefs about the flow field based on lateral line input) and action (generating thrust to change the sensory input it receives).

F = DKL[Q(μ) ‖ P(μ|o)] − ln P(o)
Variational free energy bounds surprise from above

When fish coordinate successfully, the collective surprise is lower than any individual could achieve alone — this is why schools form.

Precision-Weighted Prediction Errors

The coupling strength between pairs of fish is not a fixed parameter. It is precision-weighted — it grows exponentially as the pair accumulates evidence of mutual predictability. This is the key mechanism: prediction errors between aligned fish are weighted by higher precision, creating stronger coupling.

μ̇ = −∂F/∂μ = Π · ε
Belief updates are precision-weighted prediction errors (Ch.4, Eq. B.46)

Generalised Synchrony

When two active inference agents share similar generative models and can sense each other, their internal states converge onto a synchronisation manifold. The pair-link indicators in the left panel show this process in real time — the progress bar fills as evidence accumulates, then resets at a synchronisation event.

"If agents adopt the same generative model of communicative behaviour, a simple form of communication emerges through generalised synchrony. The birds are not simply repeating what they have heard — they are pursuing a narrative embodied by the dynamical attractors in their generative models." — Friston & Frith (2015), Consciousness and Cognition

Hierarchical Generative Models

The three Π sliders correspond to three levels of a hierarchical generative model. Higher levels change more slowly and contextualise faster dynamics below. The school-level blanket contextualises individual swimming; the collective blanket contextualises school-level dynamics.

"In hierarchical or deep models, the dynamics at higher levels generally encode things that change more slowly and contextualise things that change faster." — Parr, Pezzulo & Friston (2022), Active Inference, Ch.6 p.112

Group-Level Generative Models

When a collective of agents maintains a group-level Markov blanket, the group itself can be described as an active inference agent with its own generative model. The group-level parameters are not simply averages of individual parameters — they have a non-trivial emergent relationship.

"A collective of active inference agents can, if they maintain a group-level Markov blanket, constitute a larger group-level active inference agent with a generative model of its own." — Thestrup Waade, Olesen, Laursen, Nehrer, Heins, Friston & Mathys (2025), Entropy

The Exploration–Exploitation Balance

In the textbook (Ch.7), the exploration–exploitation trade-off is governed by precision on policies (γ): the inverse temperature in the softmax π₀ = σ(−γG). High γ → peaked policy selection → exploitation. Low γ → flat policy selection → exploration. Both epistemic value (information gain) and pragmatic value (preference satisfaction) are components of the same expected free energy — Active Inference dissolves the exploration–exploitation dilemma by optimising both simultaneously.

The Πindividual slider in this simulation controls a different level: oscillator precision — how tightly each fish's internal dynamics are tuned. High oscillator precision produces slow, stereotyped tail-beats (exploiting a known motor pattern). Low oscillator precision produces fast, variable swimming (noisier motor output, not confident exploration). The vigorous movement at low precision reflects higher variance in motor dynamics, not a deliberate search strategy.

Glossary
Key Terms from Active Inference
Markov Blanket
A statistical boundary that separates a system's internal states from external states. Composed of sensory states (mediating external → internal influence) and active states (mediating internal → external influence). In this simulation: the fish's lateral line sensors and thrust vectors. (Parr et al. 2022, Ch.3; Pearl 1988)
Variational Free Energy (F)
The quantity that active inference agents minimise through perception and action. It provides an upper bound on surprise (negative log model evidence). When F is high, predictions are poor. When F is low, the agent's generative model fits its observations. (Parr et al. 2022, Ch.2)
Precision (Π)
The inverse variance (Π = 1/σ²) of a probability distribution. High precision = confident, sharp predictions. Low precision = uncertain, broad predictions. Precision weights prediction errors: high-precision errors drive stronger belief updates. In the brain, precision is associated with neuromodulatory gain (e.g., dopamine, acetylcholine). (Parr et al. 2022, Ch.5)
Prediction Error (ε)
The difference between what the generative model predicts and what is actually observed: ε = o − g(μ). Under Gaussian assumptions, minimising free energy reduces to minimising precision-weighted prediction errors. (Parr et al. 2022, Ch.4, Eq. B.46)
Generative Model
A probabilistic model of how observations are generated from hidden causes. It encodes the agent's beliefs about the causal structure of its world — including how states transition over time (dynamics) and how states produce observations (likelihood). (Parr et al. 2022, Ch.4)
Generative Process
The actual causal process in the external world that produces the agent's observations. In this simulation: the vortex-filled water dynamics. The generative process is distinct from the generative model — the agent's model is always an approximation. (Parr et al. 2022, Ch.6)
Active Inference
The framework in which both perception and action serve the same objective: minimising variational free energy. Perception updates beliefs to fit observations. Action changes the world to fit beliefs. This unification marks Active Inference's key difference from frameworks that treat perception and action as separate. (Parr et al. 2022, Ch.2)
Generalised Synchrony
When two dynamical systems are coupled, their internal states can converge onto a synchronisation manifold — a shared attractor. Under active inference, this emerges naturally when agents share similar generative models. It provides a formal account of communication and social coordination. (Friston & Frith 2015)
Hierarchical Self-Organisation
The process by which Markov blankets self-assemble at successively higher levels. Individual agents form group blankets; groups form collective blankets. Each level has its own characteristic timescale: faster at the micro level, slower at the macro level. (Palacios et al. 2020; Kirchhoff et al. 2018)
Sensory States
Blanket states that mediate the influence of the external world on a system's internal states. In this simulation: the lateral line pressure sensors along each fish's body, sampling the flow field velocity. (Parr et al. 2022, Ch.6)
Active States
Blanket states that mediate the influence of internal states on the external world. In this simulation: each fish's tail-beat thrust, which sheds vortices into the water and thereby changes the sensory input of other fish. (Parr et al. 2022, Ch.6)
Self-Evidencing
By maximising model evidence (minimising free energy), an organism ensures that it realises its prior preferences and avoids surprising states. A fish stays in water; a school stays cohesive. The system provides evidence for its own existence. (Parr et al. 2022, Ch.3)
References
Key Papers and Textbook Citations

Primary Textbook

Parr, T., Pezzulo, G., & Friston, K. J. (2022). Active Inference: The Free Energy Principle in Mind, Brain, and Behavior. MIT Press. Open access.

Hierarchical Markov Blankets

Palacios, E. R., Razi, A., Parr, T., Kirchhoff, M., & Friston, K. (2020). On Markov blankets and hierarchical self-organisation. Journal of Theoretical Biology, 486, 110089.

Kirchhoff, M., Parr, T., Palacios, E., Friston, K., & Kiverstein, J. (2018). The Markov blankets of life: autonomy, active inference and the free energy principle. Journal of the Royal Society Interface, 15(138), 20170792.

Group-Level Generative Models

Thestrup Waade, P., Lundbak Olesen, C., Ehrenreich Laursen, J., Nehrer, S. W., Heins, C., Friston, K., & Mathys, C. (2025). As One and Many: Relating Individual and Emergent Group-Level Generative Models in Active Inference. Entropy, 27(2), 143.

Generalised Synchrony & Communication

Friston, K., & Frith, C. D. (2015). A Duet for one. Consciousness and Cognition, 36, 390–405.

Friston, K., & Frith, C. D. (2015). Active inference, communication and hermeneutics. Cortex, 68, 129–143.

Friston, K., et al. (2020). Generative models, linguistic communication and active inference. Neuroscience & Biobehavioral Reviews, 118, 42–64.

Neuronal Self-Organisation

Palacios, E. R., Isomura, T., Parr, T., & Friston, K. (2019). The emergence of synchrony in networks of mutually inferring neurons. Scientific Reports, 9, 6412.

Parr, T., et al. (2021). Markov blankets in the brain. Neuroscience & Biobehavioral Reviews.

Simulation Framework

This simulation was developed by Alexander Sabine (Active Inference Institute, Board of Directors) for pedagogical purposes. Interactive demonstrations at temporalgrammar.ai.

Contact: Alexander@activeinference.institute