Chapters 4 and 7BeginnerSimulation
Hide and seek
Three children are hiding in long grass at dusk. They crouch back to back, so each can watch only a third of the meadow at a time. Someone is walking round them with a lantern. It may be Mum, who is seeking them, or Gran, who is only out for a walk. A belief is a child’s best guess about where the walker is and who it is, together with how sure the child is. Sharing beliefs means telling the others what you have worked out. Switch whispering on, and three patchy guesses become one sharp one.
Each glowing ring is one child’s belief about where the walker is.
The switch
The game
The meadow has nine places, numbered round the children like a clock face. The walker stands still, or walks one place at a time, clockwise or anticlockwise, on the near track or the far one. Each child faces three of the nine places and lights them in its colour. It looks left, straight ahead or right. It sees the place it looks at sharply, and the place on either side only roughly. A game lasts eight steps. Click a child, or its part of the meadow, to follow it. The switch does not start a new game: it shows the same walk, at the same moment, with the children whispering or not.
The demonstration in the paper, replayed
The paper behind this page shows one walk of eight steps, twice. The walker starts at place 1 and goes clockwise. First nobody whispers, then everybody does. Each small picture below is one child’s belief about the place over those eight steps. The darker a square, the more the child believes the walker is there.
Red outline: where the walker really is. Green dot: where the child is looking. Red bar underneath: the first step at which the child puts at least 90 in 100 on the true place.
On this page Violet, the third child, first knows the place at step 7 without whispering and at step 2 with it. In the paper’s own figure the third agent forms precise beliefs at time step five without communication and by the third with it.
AII: EduActive · Watch, then do
One short clip, one thing to try
This passage comes from the Institute’s course on the fundamentals of active inference. The speaker has a paper open and tells its example in their own words: little children hiding from their mother in a grassy scene. The paper itself speaks of birds on watch for a predator, or sisters hiding from their mother in the garden. The picture above follows the paper’s example and borrows the speaker’s grass. The passage runs for about two and a half minutes. Watch it, then press the button and look for the same thing on the stage.
- The ideaA few plain sentences. Enough on its own.
- Listen for, then tryOne line from the clip, and one thing to do on the stage.
- In the modelWhich matrix, term or rate carries the idea, and how this page differs from what is said.
-
Plays here, from 30:46. Nothing loads from YouTube until you press play.Open on YouTube at 30:46
1Before you start
Sharing what we see
The speaker describes the example in a paper: several agents who each see only part of a scene and tell one another what they have worked out. The paper pictures them as birds on watch for a predator, or as sisters hiding from their mother in the garden. The speaker tells it as children hiding from their mother in a grassy scene. One of them looks out, works out what is there, and tells its brothers and sisters, so that all of them know. The speaker calls looking a scene over, a part at a time, palpating it.
Listen forThen tryOn the stage, each child lights up the part of the meadow it can see, and its ring shows where it thinks the walker is. Say what you think the three rings will look like once each child tells the others what it expects. Then play the same game with whispering.In the model equation 3
“Palpating the scene” is the choice of gaze u in equation 2: each child looks left, straight ahead or right, whichever has the largest expected information gain. “Doing inference” is the filter in equation 1. “Sharing” is equation 3: each child broadcasts its predicted beliefs about the place, the distance and who it is, and each listener multiplies what it hears from the other two into its own prediction, as one more likelihood.
The speaker tells the example more loosely than the paper, Friston and colleagues (2024), states it. The grassy scene is the speaker’s. The paper says birds on watch for a predator, “or sisters hiding from their mother in the garden”, and its subject may be a friend or a foe. This page follows section 3 of the paper: nine places, a walker who is close or far off, gaze chosen by information gain alone, and beliefs broadcast through a mapping the agents already share. It differs in keeping one exact joint belief for each child, and in the other ways listed under “What this model leaves out or changes”. The speaker goes on to distinguish sharing a belief directly from acting on it by talking or gesturing. The paper makes the same distinction and models the second. How the words come to be learned is a later part of the paper and is not on this page.
Equation 2, where to look · Equation 3, whispering · Equation 4, why nobody hears itself
The quoted lines are taken from the automatic captions, with punctuation added and hesitations removed. The speaker is describing a published paper, not this page; where the two differ, the notes say so. The clip stops at the end of the passage. The full recordings are listed under Sources.
Learn by doing
Try this
Before each step, say what you think will happen. Then press the button and watch the rings on the grass and the bars beside the picture.
- Watch one child on its own. Whispering is off. At the first step the walker is in front of one child only. The other two see empty grass. Each of them knows only that the walker is somewhere in the six places it cannot see. Blue is one of those two here. It turns its head left and right to search the places it can reach.Predict: what will Blue’s ring look like while the walker is on the far side of the meadow?
- Play the same game again, with whispering. This is the same walk, step for step. The only change is that every child now says aloud what it expects: where the walker is, whether it is close, and who it is. A speech bubble shows a child that has something definite to say, and at most two are shown at once. The whisper is a forecast. It rests on what the child saw one step ago, so it is only good if the child has worked out which way the walker is going.Predict: at which step will all three rings agree, and where will Blue be looking when the walker comes round?
- Mum or Gran. A child can tell who the walker is only when two things are true at once: the walker is on the near track, and the child is looking straight at it. From the side, or far off, it sees only that someone is there. Watch the small tag under each child’s name. It reads “who?” until that child knows.Predict: with whispering on, how many children have to see the walker’s face before all three know who it is?
- Replay the walk in the paper. The walker starts at place 1 and goes clockwise for eight steps. The stage plays it without whispering and then again with it. Violet is the third child, and it starts by looking the other way, so follow Violet. The small pictures under the stage show the whole of both runs at once.Predict: at which step does Violet first know where the walker is, alone and with whispering?
- Cover one child’s eyes. This step is this page’s own addition. Blue now sees nothing at all, so on its own it can never do better than a blind guess: one chance in nine. With whispering it still hears the other two. Use the switch to compare, and press the cover button again to give Blue its eyes back.Predict: with whispering on, how sure will Blue be of the walker’s place by the third step?
The mathematics
What is being computed
Four things about the walker are hidden from the children. Together they are the hidden state s: the place p (one of nine), the distance d (close or far off), who it is w (Mum or Gran), and the path m (standing still, walking clockwise, or walking anticlockwise). That makes 9 × 2 × 2 × 3 = 108 states. Where a child chooses to look is its action u: left, straight ahead or right. What it then sees is its outcome o. The live numbers below are for the child you are following, at the step on the stage.
A child’s belief q is a probability for each of the 108 states. The first line is the prediction: the belief from the last step, moved on by what the child knows about how walkers behave. That knowledge is the matrix B = P(s′ | s). The place moves by the path, and the path does not change during a game. The distance stays as it was 5 times in 6 and switches 1 time in 6. Who it is never changes. The second line is the correction. The likelihood A = P(o | s, u) says what a child sees in each state. Sight has four channels. The sharp one covers the place the child looks at and reports one of four things: Mum close, Gran close, someone far off, or nothing. Three coarse ones cover the place to the left, the looked-at place and the place to the right, and each reports something close, something far off, or nothing. So a child can tell who it is only when the walker is close and at the place it is looking at. Sight is exact here: within its view a child never misses the walker and never misplaces it. Nothing a child sees depends on the path. A belief about the path builds up only because someone who was at place 4 and is now at place 5 must be walking clockwise.
Looking is something a child does, so it has to choose. For each of its three gazes it works out the expected information gain I: how much, on average, what it expects to see would change its belief. H is entropy, a measure of uncertainty in nats. The first term is how uncertain the child is about what it will see. The second is the uncertainty that would remain even if it knew the state, and it is zero here because sight is exact. The expected free energy G of an action is the quantity active inference uses to choose. The children prefer no outcome over any other, so G is a constant minus I. The constant is ln 8 because the four channels can show eight different things between them. The gaze with the smallest G is the gaze expected to teach most. This is how the paper’s agents choose too: their looking is driven by expected information gain alone. A child that expects the walker from one side turns that way before it arrives. A child that knows where a close walker is looks straight at it, because only that can settle who it is.
With whispering on, child k says three things aloud at every step: its predicted belief about the place, bkp, about the distance, bkd, and about who it is, bkw. The first line shows the one for place. Each is a whole set of probabilities, not a single word, so it carries how sure the child is as well as what it thinks. A child that is unsure speaks faintly and changes nothing. It does not say which way it thinks the walker is going, and it does not say where it is looking. Child j hears the other two together: for each of the three, the two broadcasts multiplied and rescaled to sum to one. That is hj. The second line is the update. What was heard is treated exactly like something seen: as one more likelihood, multiplied into the child’s own prediction. The words are understood perfectly, which is what the paper calls an identity mapping from belief to sound.
The timing matters. Seeing and whispering happen at the same moment, so what a child says at step t cannot include what it sees at step t. It is a forecast made from everything up to step t − 1. A forecast of place is only as good as the speaker’s belief about the path, which is why a child that has seen the walker once says “near place 4” and a child that has seen it twice says “at place 5”.
If child j also heard itself, the product would run over all three children, as on the left. Its own forecast bj is already in its prediction q̄j, so it would be counted twice, and the child’s belief would be pulled further towards what it already expected, with no new evidence. Leaving its own voice out prevents that. The paper makes the same point: agents do not hear themselves, which “precludes double-counting” of an agent’s own belief.
Even so, this update is not ordinary Bayesian updating, and the paper says so: belief sharing is “formally distinct from Bayesian belief updating”. A heard belief contains the speaker’s prior as well as what the speaker saw, and part of that prior came from the listener one step before. For comparison, the tests compute what a single observer with all three pairs of eyes would believe by exact Bayes. Over 2,000 games that observer always knows the place, and a whispering child puts 89 in 100 on it. Nearly all of that gap is the one-step delay. Against an exact observer with the same delay, the whispered belief about place differs by 0.01 on average (total variation distance) and the belief about who it is does not differ at all. The belief about distance differs by 0.06, and it errs towards being too sure: when a whispering child is at least 90 in 100 sure of the distance, without being certain, it is right 83 times in 100.
Surprise is how unexpected a child’s outcomes were, given what it predicted: the less probable they were, the larger the number. The variational free energy F of a belief is never less than the surprise, and it equals the surprise when the belief is the exact result of the update. That is the case for every child here, so the two numbers agree. Lj is the likelihood of what child j heard. With whispering on it is the product hjp hjd hjw from equation 3. With whispering off the child treats anything it might hear as equally likely in every state, so Lj is 1/36 throughout, which is 1/9 × 1/2 × 1/2. This puts the two cases on the same footing. Over the 2,000 games described below, the average free energy for each child at each step is 4.27 nats on its own and 2.18 nats with whispering.
Reading
Where this comes from
What is established
Active inference treats perception as belief updating under a generative model: a likelihood A that says how hidden states cause outcomes, and transitions B that say how states change (Parr, Pezzulo and Friston 2022, chapter 4). It treats looking as an action, chosen because it is expected to reduce uncertainty. That expected information gain is the epistemic part of expected free energy (chapter 7).
Friston and colleagues (2024) extend this to several agents who share a world and a model of it. The example in section 3 of their paper is the one drawn here. Three agents sit back to back. The authors suggest thinking of them as birds on watch for a predator, “or sisters hiding from their mother in the garden”. The long grass comes from a lecture about the paper, shown in the clip on this page, and the game of hide and seek is this page’s way of telling the story. Each agent sees about a third of the horizon and can look straight ahead, left or right. A subject stands still or walks round them, to the left or to the right, at one of nine locations, close or further off. The agents cannot see motion, so they infer it from one inferred location after another. They can tell where the subject is and how near it is from any part of their view, but they can tell friend from foe only when the subject is close. Where they look is driven by expected information gain alone.
The authors distinguish two ways of pooling what agents know. One is to pass beliefs directly from one agent to another. The other is to communicate them through something that can be heard. They model the second, and call the result federated inference. Each agent broadcasts its beliefs about location, proximity, and friend or foe, with its confidence, and hears the other two but not itself. Because agents see and speak at the same moment, what is broadcast is a prediction based on the observations of the previous time step. In section 3 the agents already share the mapping from beliefs to sounds. How a child could learn that mapping, and how a shared language could emerge among agents that start without one, are separate experiments later in the paper, in sections 4 and 5.
The paper’s Fig. 5 shows one episode of eight time steps, with the subject moving clockwise from the first location, played with and without communication on the same sequence of hidden states. Without communication the third agent forms precise beliefs about location only at time step five, after seeing the subject. With communication it has resolved its uncertainty by the third. The paper also reports that, with one exception, the communicating agents have a lower free energy.
On this page the same walk gives the following. Without whispering Violet, the third child, first puts at least 90 in 100 on the true place at step 7. With whispering it does so at step 2. Gold does so at step 4 and step 3. Of the 21 comparisons of free energy after the first step, one for each child at each step, 18 are lower with whispering and 3 are higher. Averaged over all three children and all eight steps, whispering lowers the free energy by 1.9 nats. These are this page’s numbers. They are not the paper’s, and the two models differ in the ways listed opposite.
Over 2,000 seeded games, each played both ways, a child on its own puts about 73 in 100 on the place where the walker really is, and a child that whispers puts about 89 in 100. From the third step of every one of those games, all three whispering children know the place. On their own, all three know it by the last step in about 66 games in 100. A child on its own puts about 64 in 100 on who the walker really is, where 50 means it cannot tell, and a whispering child about 77. A child with its eyes covered is right 1 time in 9 on its own, whatever happens. With whispering it puts about 77 in 100 on the true place.
This page illustrates a modelling framework. It is not evidence about real children, and it is not evidence for the framework.
What this model leaves out or changes
The states, the outcomes, the choice of gaze and the whispering follow section 3 of the paper. Where the paper’s text does not give a number, this page takes it from DEM_federation.m, the demonstration routine for this example in the SPM software: the chance that the distance changes, exact sight, flat starting beliefs, a path that stays the same through an episode, and one-step planning. The points below are where this page differs from the paper, or makes a choice of its own.
- Each child here keeps one joint belief over all 108 states and updates it exactly. The paper’s routine keeps a separate belief for each factor and for the path, and passes messages between them. The same goes for the choice of gaze: here the information gain is worked out for the four channels of sight together, and there channel by channel.
- The three children face places 2, 5 and 8, evenly spaced, so that the picture is a true circle. The routine puts the three lines of sight at locations 3, 5 and 7. One result is that place 1, where the replay starts, is just beyond the edge of Violet’s three places here, while in the routine it is out of the third agent’s reach altogether.
- A child here always takes the gaze with the most expected information gain. If the gaze it holds is among the best it keeps it, and any other tie is settled by a seeded number. Every child starts by looking straight ahead. These are this page’s choices.
- In the replay, the paper does not say who the walker was or how near. Here it is Mum, far off for four steps and close for four. Which way each child turns on a tie is also this page’s choice. So the replay follows the paper’s walk but not every detail of its run.
- Free energy with whispering off is scored by giving anything heard the same probability in every state. The paper suppresses communication by making the mapping from beliefs to sounds very imprecise. The two are meant to be the same thing, but the numbers here are this page’s own.
- A time step in the paper stands for about 250 milliseconds. Here a step takes about a second so that it can be watched.
- The averages over thousands of games are this page’s own. The paper shows single episodes.
- The paper also simulates the neuronal responses that would go with the belief updating. They are left out.
- The paper’s agents sense where their own eyes are pointing through a further channel. Here a child simply knows where it is looking.
- Learning the language, passing it from parent to child, and the emergence of a shared language (sections 4 and 5 of the paper) are not modelled. The children here already understand one another perfectly, as the agents do in section 3.
- The names are this page’s. Mum stands for the paper’s foe and Gran for its friend. Covering a child’s eyes is this page’s addition.
- The children are honest and hold the same model of the walker, and that model is the true one. The chance of the distance changing is a setting. It is not a measurement.
- The figures are drawn from the model: where the walker is, how near, who it is, where each head is turned, the glow on the rings, and the words in the speech bubbles. The meadow is scenery.
- Active Inference Institute (2026). Fundamentals of Active Inference, Chapter 13: Active Inference Robotics, Session 64. Recording. youtube.com/watch?v=QPohWDAGuKo
- Friston, K. J., Parr, T., Heins, C., Constant, A., Friedman, D., Isomura, T., Fields, C., Verbelen, T., Ramstead, M., Clippinger, J. & Frith, C. D. (2024). Federated inference and belief sharing. Neuroscience & Biobehavioral Reviews, 156, 105500. doi:10.1016/j.neubiorev.2023.105500
- Friston, K. J. DEM_federation.m. Demonstration routine in the SPM software, Wellcome Centre for Human Neuroimaging. github.com/spm/spm, toolbox/DEM/DEM_federation.m
- Parr, T., Pezzulo, G. & Friston, K. J. (2022). Active Inference: The Free Energy Principle in Mind, Brain, and Behavior. MIT Press. Chapters 4 and 7. doi:10.7551/mitpress/12441.001.0001