Interaction
Markov blankets and the separation of internal and external states
In computer science, a Markov blanket of an element α is the set of nodes that shields α from influence by all other elements in a dynamical system (Pearl, 2014).
Let A denote a collection of nodes representing a dynamical system; a Markov blanket for A comprises:
a) ALL the nodes that can influence ANY member of A (parents),
b) ALL the nodes that ANY member of A can influence (children),
c) ALL the nodes that can influence the children of ANY member of A (spouses), and
d) NO other nodes besides these.
The question posed: identify the Markov blanket of node X in terms of its parent, children, and spouse nodes.
This framework underpins how systems infer states and respond to stimuli while being shielded from irrelevant parts of the world.
Markov blankets and the Markov blanket paradox
How can living organisms adapt to a world that is, by definition, cut off from them? This tension is dubbed the Markov blanket paradox.
Separation and mediation by membranes:
The cell membrane acts as a Markov blanket separating internal states (cytoplasm, organelles, DNA) from the external environment.
It mediates exchange of matter, energy, and information (nutrients, wastes, ions) between cell and environment.
As a physical boundary, it creates a statistical partition between intracellular and extracellular states.
As a communication medium, it allows interactions with the environment.
Living cells access their internal states directly (limited by the membrane) but respond to environmental stimuli, enabling adaptation and survival.
Key terms: Separation; Mediation; and the idea that life persists by operating behind a Markov blanket.
E. coli: a paradigmatic Markov-blanket-bound organism
Organism: Escherichia coli (E. coli) is a prokaryotic, single-celled bacterium; its outer membrane functions as a Markov blanket, separating it from its environment.
Chemotaxis: E. coli can move in response to chemical gradients (up or down concentration of attractants/repellants).
Attractants include nutrients such as glucose; repellants include acids and toxins.
Chemoreceptors enable detection of changes in chemical concentrations.
Movement behavior: E. coli exhibits a run-and-tumble random walk.
In a gradient, run durations become longer in the direction of increasing attractant (biased random walk).
If attractant concentration increases (gradient present), runs lengthen in the positive direction; if not, the bacterium tends to tumble more to reorient.
Scenario A (no gradient): smooth runs punctuated by short tumbles; overall random exploration.
Scenario B (gradient present): longer runs toward higher attractant concentration; biased movement up-gradient.
Running and tumbling: motor behavior in E. coli
Running: flagella rotate anti-clockwise, bundle together, propel forward.
Tumbling: if attractant gradient weakens or plateaus, motor rotation changes to clockwise, flagella unbundle, reorient randomly.
The run-and-tumble strategy enables effective foraging in fluctuating environments.
The running/tumbling dynamics are a concrete example of how a biological system minimizes prediction error by acting to reduce surprise in its environment.
Prediction error minimization (PEM) and active inference in biology
PEM is a framework in which organisms aim to minimize surprise, prediction error, or uncertainty while operating behind a Markov blanket using internal models.
If predicted outcomes diverge from actual outcomes, organisms can minimize free energy by:
acting on the world to change sensory input, or
updating internal models to improve predictive accuracy.
Core figures: Karl Friston, Jakob Hohwy, and collaborators have developed PEM as a unifying account of perception, action, and learning.
Key idea: life maintains structure by reducing discrepancy between internal predictions and incoming sensory data.
Quantifying mismatch: Accuracy and Divergence in E. coli chemotaxis
When there is a mismatch between expected and actual sensory input, the discrepancy is termed surprise, prediction error, or free energy.
If the internal model predicts increasing attractant concentration, the organism selects actions that maximize model accuracy:
If there is a mismatch (gradient does not rise as predicted), the organism updates its beliefs to minimize divergence:
The objective is to minimize prediction error via action (alterting sensory input) or belief updating (adjusting priors).
The PEM view provides a dynamic account of how a simple, non-neural organism like E. coli can exhibit goal-directed, adaptive behavior.
The organism–environment loop under PEM
Organisms operate behind a Markov blanket, using internal models to predict sensory input.
They act to confirm predictions or update internal models when there is prediction error.
Benefits of minimizing free energy and prediction error: resist entropy, minimize surprise and uncertainty, maintain structural and functional integrity, persist in states aligned with prior preferences over expected sensory states.
Prior preferences encode survival-related goals (e.g., energy acquisition, threat avoidance, reproduction).
Biochemical mechanism in E. coli: Perception, internal model, and action
Perception: E. coli samples chemical gradients over time via chemoreceptors; perceives gradient direction and magnitude.
Internal model: receptor–response mapping translates changes in attractant/repellent gradients into movement commands.
↑ attractant gradient → keep swimming (run);
↓ attractant gradient → change direction (tumble);
↓ repellant gradient → keep swimming (run);
↑ repellant gradient → change direction (tumble);
No gradient changes → unbiased random walk.
Action: movement described as biased/unbiased random walk (run/tumble) depending on gradient information.
Prediction error minimization: the running/tumbling cycle encodes continuous updating of the internal model to align predictions with sensory data.
Active inference and E. coli (no nervous system required)
Active inference framework applies to E. coli: actions are selected to minimize expected surprise (free energy) even in simple organisms.
The claim: PEM does not require consciousness or a nervous system; it operates via biochemical signaling and receptor dynamics.
Simulation and visualization: a variety of computational studies illustrate chemotaxis under PEM-like dynamics.
Phototropic plants and PEM
Plants lack a nervous system but can perform active inference-like processing: phototropism is the directed growth toward light.
Phototropins detect light direction and intensity, enabling a gradient to be perceived.
Prediction error arises when light gradient deviates from the plant’s expectation; auxin redistribution acts to correct the gradient by promoting growth on the shaded side.
Result: stem exhibits positive phototropism (bends toward light) and roots exhibit negative phototropism (grow away from light).
Historical anchors: von Sachs, Darwin & Darwin, Cholodny, Went; traditional view held that plants are passive, but PEM offers a biochemical mechanism for adaptive orientation.
Biomats (microbial mats) and layered metabolism
Biomats or microbial mats are multi-layered sheets or biofilms of microbes; among the oldest biosystems.
Fossil and molecular evidence places ancient biomats at ~3.4–3.7 billion years ago; stromatolites are key structures formed by layered microbial mats.
Biomats have existed for roughly 3.96 billion years, predating humans by tens of billions of years in evolutionary terms.
Biomats form when cyanobacteria link to create filamentous networks; EPS (extracellular polymeric substances) glue cells into a cohesive matrix.
Layered structure of modern conceptual biomats:
Top layer: oxygen-rich, well-lit; cyanobacteria perform oxygenic photosynthesis:
Middle layer: purple bacteria perform anoxygenic photosynthesis:
Deeper layers: heterotrophic bacteria decompose organic matter, releasing CO2 and other compounds; oxygen and sulfide cycles are coupled between layers.
The mats circulate nutrients and enable energy flow in microbial ecosystems.
Quorum sensing in biomats
Quorum sensing is a cell-to-cell communication mechanism that enables bacteria to sense cell density via signaling molecules called autoinducers.
Autoinducer concentration acts as a proxy for cell density; regulatory effects switch on/off genes when thresholds are crossed.
Phase-dependent changes:
Low density: autoinducer levels below threshold; gene regulation remains off; microbes conserve energy.
High density: autoinducers accumulate; genes regulated by quorum sensing are switched on, coordinating behaviors such as EPS secretion.
This coordinated behavior exemplifies a collective, PEM-like dynamic: individuals align actions based on noisy sensory inputs from their community and environment.
Perception, internal models, and action in biomats (quorum sensing view)
Perception: each microbe detects autoinducer concentrations.
Internal model: receptor–response mappings translate signal levels into regulatory states.
Action: microbes adjust behaviors (EPS secretion, enzyme production, toxin production) in response to signal levels.
Public goods: EPS, enzymes, and toxins are communal resources that benefit the entire mat but cost energy/resources to produce.
Social cheaters: organisms that exploit public goods without contributing investments, gaining fitness advantages under certain conditions.
Example: Pseudomonas aeruginosa can accumulate social cheaters after ~100 generations under particular conditions, threatening mat stability.
Cheating can destabilize cooperation; multiple strategies exist to curb cheating and sustain mat integrity.
Strategies to counter cheaters in biomats
STRATEGY 1: Toxin-mediated policing
Some microbes produce toxins targeting cheaters; effective when toxins are powerful, durable, and inexpensive to produce.
STRATEGY 2: Kin selection
Clonal growth means cooperating benefits relatives (copies of oneself), making cheating less favorable.
STRATEGY 3: Spatial structure
Limited diffusion of public goods means benefits are localized to nearby producers; distant cheaters gain less advantage.
These strategies illustrate how evolutionary and ecological principles interface with PEM-like dynamics to maintain cooperative behavior.
Survival as a guiding preference under PEM
Survival is a fundamental preference encoded in an organism’s prior expectations.
PEM suggests that resisting entropy, minimizing surprise, and maintaining structural integrity support persistence in states aligned with prior preferences.
Comparative summary:
E. coli: perception of chemical gradients; internal models predict attractant concentration; action via run/tumble to exploit gradients.
Microbial mats: perception of autoinducer levels; internal models regulate EPS, enzymes, and toxins to coordinate community behavior.
Phototropic plants: perception of light gradients; internal models predict light direction; actions via auxin redistribution leading to bending toward light.
PEM extended to human intelligence and everyday cognition
The PEM framework can be extended to human cognition and behavior, including everyday decisions and motor tasks (e.g., cycling).
Example: a cyclist encountering a pedestrian or rain collision risks involves mismatch between predicted and actual sensory input; the cyclist may act (brake) to minimize prediction error or update beliefs about rain likelihood.
Predictions and updates can be framed as:
Accuracy-driven actions to maximize alignment with expectations, or
Divergence-driven belief updates to reduce future surprise.
PEM and everyday examples beyond the microcosm
Example: rain on a path and tyre grip:
Internal model expects dry conditions; sensory input (slippery tyres) mismatches the expectation.
Update beliefs about the path to minimize divergence; even after rain stops, residual moisture may keep the path uncertain.
The broader idea: PEM provides a unified lens for how organisms and agents navigate uncertain environments by balancing action and belief updates.
Theory of everything: PEM as a unifying principle (Hipólito 2019)
Hipólito (2019) argues for PEM as a simple, universal theory that can be applied to nearly everything from particles to minds.
Core claim: self-organizing systems that can be described via Markov blankets fall under PEM as a unifying principle.
Examples of systems described by Markov blankets and PEM:
Stars, planets, environments, organisms, brains, neural nets, neurons, and neuronal processes.
The idea is to derive complex natural phenomena from a small set of principles about Markov blankets and prediction error minimization.
Theory of everything: Markov blankets and system states
An organism or a thing is composed of Markov blankets of smaller things.
A system state is a member of a set X: x = {η, s, a, μ} ∈ X, where:
Internal states (η)
Sensory states (s)
Active states (a)
External states (μ)
Communication pattern:
External states cause changes in internal states via sensory states.
Internal states couple back to external states via active states.
Each Markov blanket partitions internal vs external states; a further partition between sensory and active states can be considered.
Self-entropy, risk, and ambiguity in PEM
Self-entropy measures how unpredictable a system is.
Types of uncertainty:
Meaning: risk or complexity (uncertainty about the outside world).
Ambiguity: uncertainty about what a system senses.
Divergence: discrepancy between prior and posterior distributions over external states.
Self-organizing systems aim to minimize self-entropy by reducing risk and improving reliability of senses (reducing ambiguity), while maintaining beneficial interactions with the environment.
Question posed: Do you agree with Hipólito that PEM is a simple theory of everything? (Inês Hipólito)
PEM and good writing: leveraging PEM to structure text
Imagine an intelligent reader who is predicting what comes next in your text.
Good writing aims to minimize prediction error by providing:
Clear, coherent logical structure and reasoning;
Relevance and precision in language; accessibility of information;
Predictable flow that allows the reader to anticipate and follow arguments.
Cont’d: Introducing surprise strategically by providing novel or nuanced information to encourage updating internal models and reducing divergence.
How good writing aligns with PEM principles
Writing should persist in states consistent with prior preferences over expected sensory states (the reader’s expectations):
Convincing the reader of your position with reasons;
Demonstrating understanding and engagement with the subject matter;
Aiming for high-quality assessment outcomes (A to A+ on assignments).
Appendix: Python code for simulating E. coli chemotaxis
The appendix provides Python code to simulate the chemotactic behavior of a single bacterium in a 2D field with a central attractant.
Key components:
import numpy as np; import matplotlib.pyplot as plt; animation utilities.
Parameters:
gridsize = 50; steps = 300; attractantcenter = (25, 25);
attractantstrength = 100; decay = 0.05; stepsize = 0.7;
Attractant field function:
Precompute attractant grid for visualization (Gaussian-like field) and create a meshgrid of X, Y with Z representing the attractant concentration at each point.
Initialize bacterium position pos randomly in the grid; initial angle random.
Simulation loop (for each step):
deltapos = stepsize * [cos(angle), sin(angle)];
newpos = pos + deltapos; clamp to [0, grid_size];
newconc = attractantfield(new_pos);
delta = newconc - prevconc;
If delta > 0: continue; if delta < 0: rotate angle randomly; if delta == 0: randomly decide to rotate or not;
Update pos and prev_conc; store path history.
Visualization: creates an animation of the bacterium path on top of the attractant field; marks attractant center with a green dot; colorbar shows attractant concentration.
The code illustrates a PEM-like chemotaxis demonstration where the organism follows concentration gradients via simple rules tied to local sensing and motor changes.
Summary: PEM framework across biological scales and human cognition
PEM and Markov blankets provide a unifying lens to view adaptation across organisms, microbial communities, plants, and potentially human cognition.
Key themes:
Internal models predict sensory input; actions serve to minimize prediction error or to update models when errors occur.
Separation via Markov blankets allows organisms to persist while interacting with their environment.
Cooperation in biomats emerges from local interactions (quorum sensing) and ecological strategies to deter cheating.
Writing and communication can be viewed as a PEM exercise: effective writing reduces prediction error and strategically introduces novel information to update the reader’s model.
The synthesis aims to show how simple, local rules and interactions can give rise to complex, adaptive behavior and even broad philosophical claims about information, prediction, and life itself.