Agents, world models and multi-agent systems

Active inference as a design hypothesis for agents

Rajesh Ranjan Mahapatra

Expected free energy earns its complexity when an action changes both the world and the evidence the agent will later receive; outside that condition, the same behaviour is often available through simpler control methods.

© 2026 Rajesh Ranjan Mahapatra. 30 min read

Active inference as a design hypothesis for agentsAll Human–Machine Convergence

Agents, world models and multi-agent systems

Active inference as a design hypothesis for agents

Expected free energy earns its complexity when an action changes both the world and the evidence the agent will later receive; outside that condition, the same behaviour is often available through simpler control methods.

TLDR

  • Active inference matters most when actions alter future observability.
  • Expected free energy joins preference seeking with uncertainty reduction.
  • Matched RL can imitate the behaviour, so interventions must test the mechanism.
  • Preferences and generative models remain engineering choices, not biological facts.
  • Use active inference as a measured design hypothesis with an authority boundary.
Opening case

The pallet that should not move yet

Kestrel-61 is a warehouse agent responsible for routing sealed medicine pallets. One pallet may contain temperature-sensitive vials. Its barcode is partly hidden by torn wrapping, the thermal trace is noisy, and the dispatch lane will close in ninety seconds. Kestrel can send the pallet to cold storage, send it to ordinary storage, or spend eight seconds moving its camera to read a second label.

The obvious design says: estimate the pallet type, then choose the action with the highest expected reward. Yet that sentence hides an assumption. It treats perception as something that happens before action. Here, moving the camera is itself an action, and the action changes what can be known before an irreversible routing decision.

The central claim of this paper is that active inference becomes a distinctive design option when control and evidence acquisition are causally coupled. Expected free energy can then value a policy partly because it reaches a preferred outcome and partly because it is expected to reveal the hidden state that makes later action safer. That is useful. It is not magic, it is not unique to biology, and it does not make Kestrel an organism.

The action that changes what can be known

Most control diagrams put a sensor on the left and an actuator on the right. The order suggests a pipeline: observe, infer, decide, act. This is adequate when observations arrive independently of the agent’s behaviour. A weather service can read a fixed thermometer without changing the weather. A document classifier can receive a file without choosing which page exists.

Kestrel inhabits a different causal structure. Camera angle changes label visibility. Gripper pressure changes tactile evidence. Opening a package exposes a serial number but may break a sterility seal. Asking a user a question changes both the available evidence and the interaction cost. In such systems, the observation model is policy-dependent. A policy does more than choose a future state; it partly chooses the future experiment.

Scroll horizontally to inspect the full figure Belief-action landscape with pragmatic and epistemic slopes A topographic landscape shows a direct route descending towards a preferred outcome and a curved route that first climbs towards an informative viewpoint before descending more safely. current belief preferred outcome informative viewpoint pragmatic descent epistemic climb A policy can buy a better view before it commits
The two slopes of a perception-action policy.The direct route pursues the currently preferred outcome. The curved route accepts a short-term cost to reach evidence that can improve the later decision. Active inference is most interesting when both slopes belong to one policy evaluation.Illustrative conceptual figure.
Thought experiment 1: move the sensor

Change only the camera’s mobility

Imagine two otherwise identical Kestrel systems. In System A, the camera is fixed. In System B, the camera can move behind the torn wrapper. Both have the same classifier and the same cost of a routing error. Which system should have a different policy?

If the controller treats observations as exogenous, nothing essential changes until a new image happens to arrive. If the controller represents camera movement as an action that changes the likelihood of future observations, the policy space changes immediately. System B can trade eight seconds for a posterior belief that is more useful for dispatch.

The mechanism is not generic curiosity. It is action-conditioned evidence acquisition. The agent should seek information only when that information can change a consequential downstream choice.

Scroll horizontally to inspect the full figure Causal intervention on the observation channel Two causal diagrams compare passive observation with active sensing. In the active diagram, policy intervenes on camera pose, which changes the observation likelihood before the final routing action. Passive observation assumption Action-conditioned observation hiddenstate observation routeaction The controller receives evidence. hiddenstate camerapose observation policybelief routeaction The policy partly chooses its next evidence.
The intervention that makes active sensing causal.In the right-hand system, policy changes camera pose, camera pose changes the observation likelihood, and the resulting evidence changes the final route. The dotted path marks the still-present direct consequence of the hidden pallet state.Illustrative causal diagram.

Active inference provides one formal language for this loop. The agent maintains a generative model of how hidden states produce observations, how actions change hidden states or observation channels, and which outcomes are preferred. Perception updates beliefs under the model. Policy selection evaluates predicted futures under those beliefs. In discrete formulations, this is commonly expressed as inference in a partially observable Markov decision process, or POMDP.[5]

Worked example 2: the model before the objective

Four objects that must be reviewable

A compact discrete active-inference model is often introduced through matrices named A, B, C and D. The letters are less important than the contracts they encode. A is the observation likelihood: for each hidden pallet type and camera pose, how probable is each label reading? If A says the torn barcode is 90 per cent reliable when it is actually 60 per cent reliable, posterior confidence will be wrong before any policy objective is evaluated.

B is the transition model: what happens to hidden state when an action is taken? Moving the camera changes pose but should not change the medicine type. Opening the wrapping may change seal integrity. Routing changes location and may make recovery expensive. A single undifferentiated “action” variable would hide these different causal effects.

C represents preferences over outcomes in a common notation. It might favour verified cold storage, penalise quarantine delay and strongly disfavour an unverified release. Calling C a preference does not remove value design. Someone still chooses its semantics, scale, subject and time horizon. The choice must be traceable to operating policy rather than inferred from fluent model output.

D supplies initial beliefs before the current evidence arrives. Kestrel’s 0.55 cold-chain prior could come from the dispatch manifest, historical base rates or a stale cache. Those sources are not equivalent. Their provenance affects whether D may be used for this pallet at this time.

A policy then predicts trajectories through these objects. The engineering benefit is not the alphabet. It is that likelihood, transition, preference and prior assumptions become separately falsifiable. A failed route can be traced to a bad sensor model, a bad transition, a bad preference or a bad prior rather than being explained by the single phrase “the agent reasoned poorly”.

Evidence status

Established mathematics: variational free energy is a tractable variational objective and bounds negative log model evidence under the stated probabilistic model.[1][2]

Framework claim: active inference uses related variational machinery to model perception, learning and policy selection.[4][5]

Practitioner synthesis: the engineering value is highest when actions change decision-bearing evidence. That narrowing is proposed and tested here.

The argument in one pass
Chart · flow
flowchart TD
  A["The pallet that should not<br/>move yet"] --> B["The action that changes what<br/>can be known"]
  B --> C["How expected free energy earns<br/>its keep"]
  C --> D["Build it as a hypothesis, not<br/>a creed"]
  D -. "re-test" .-> A
  classDef first fill:#0a1424,stroke:#5B5CF6,stroke-width:2px,color:#e6f3ff
  classDef step fill:#0a1424,stroke:#3f7da0,stroke-width:1px,color:#e6f3ff
  class A first
  class B,C,D step
A structural route through Active inference as a design hypothesis for agents: from The pallet that should not move yet to Use active inference only when action…. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

How expected free energy earns its keep

Before looking into the future, start with an observation already received. Let s denote a hidden state, such as the pallet type. Let o denote the observed label fragment. The generative model supplies p(o, s), while the agent uses an approximate posterior q(s). Variational free energy can be written as:

F(q,o) = DKL[q(s) || p(s|o)] - ln p(o)   ≥   -ln p(o)

The first term measures how far the approximate posterior is from the exact posterior. Because that divergence cannot be negative, minimising F tightens an upper bound on surprise under the chosen model. This is an inference statement. It does not say that a surprising event is emotionally unpleasant.

A policy concerns observations that have not happened. Active inference therefore scores predicted futures. One common discrete-state expression decomposes expected free energy into risk plus ambiguity:

G(π) = DKL[q(o|π) || p*(o)] + Eq(s|π)[ H[p(o|s)] ]

Here π is a candidate policy. The distribution q(o|π) predicts observations under that policy. The distribution p*(o) encodes preferred observations. The first term penalises predicted outcomes that differ from those preferences. The second penalises states whose observations remain ambiguous.

Under related factorisations and approximations, the same design intuition is often expressed as expected preference cost minus expected information gain:

G(π) ≈ Eq[ -ln p*(o) ] - Iq(s ; o | π)

The minus sign is the useful part: a policy can score well because its outcomes are preferred, because its observations are informative about hidden state, or both. Exact decompositions depend on the model factorisation and convention. Expected free energy is not simply “free energy in the future”, and its mathematical motivation remains an active subject of analysis.[3][7]

Worked example 1: mental arithmetic

When eight seconds are worth more than immediate action

Kestrel believes the pallet is cold-chain with probability 0.55 and ordinary with probability 0.45. A wrong route has a synthetic loss of 40 units. Committing to cold storage now therefore has expected loss 0.45 × 40 = 18.

The second-label inspection costs 4 units and is 90 per cent accurate. After the noisy label, Kestrel chooses the more probable route. The residual probability of a routing mistake is 0.10, so the expected total loss is 4 + 0.10 × 40 = 8. Inspection saves 10 expected loss units.

The label also carries about 0.526 bits of mutual information about the pallet type. Yet entropy reduction alone is not the reason to inspect. The decisive fact is that the information arrives before the route and changes expected decision loss.

Follow the posterior, not the slogan

The calculation is small enough to inspect. A “cold” cue occurs with probability 0.55 × 0.90 + 0.45 × 0.10 = 0.54. After that cue, Bayes’ rule gives a cold-chain posterior of 0.495 ÷ 0.54, about 0.917. Kestrel routes cold and is wrong only about 8.3 per cent of the time in that branch. An “ordinary” cue occurs with probability 0.46. The cold-chain posterior then falls to 0.055 ÷ 0.46, about 0.120, so Kestrel routes ordinary and is wrong about 12 per cent of the time in that branch.

Weight those branch errors by their cue probabilities: 0.54 × 0.083 + 0.46 × 0.120 = 0.10. The sensor has converted a 45 per cent minimum error before inspection into a 10 per cent minimum error after inspection. The maximum rational price of the observation, under this loss model, is therefore 40 × (0.45 - 0.10) = 14. Any inspection cost below 14 has positive decision value.

Now change one variable. If a wrong route costs 10 rather than 40, the maximum price falls to 3.5. The same four-unit inspection is no longer worthwhile even though it conveys exactly the same 0.526 bits. Epistemic value is decision-relative when actions have costs. A system that always seeks the most informative observation is not solving this task; it is solving an entropy-reduction task chosen by the designer.

Information has value only through a later decision.A useful inspection reduces expected loss from 18 to 8. When inspection accuracy is reduced to chance, the same action adds cost without changing the posterior, so its expected loss rises to 22.Illustrative synthetic values calculated in the text.
Thought experiment 2: preserve the reward, remove the evidence

Make the second label random

Keep every cost and reward unchanged, but replace the second label with a random mark. A novelty bonus may still reward looking because the image differs from previous images. A correctly specified expected-free-energy policy should stop looking because the observation no longer resolves hidden state. A correctly specified Bayesian POMDP controller should also stop.

This intervention exposes a crucial boundary. Information seeking is not unique to active inference. Bayesian experimental design, belief-state planning and model-based reinforcement learning can all value observations through their effect on future decisions. The useful comparison is not “curious versus uncurious”. It is whether the formalism makes the relevant coupling explicit, tractable and easier to maintain.

DesignWhat is optimisedHow information entersCharacteristic failure
Model-free RLExpected cumulative reward learned from interactionUsually through exploration strategy, intrinsic reward or learned stateSlow adaptation after sensor or transition shift
Bayesian model-based RLExpected return under a posterior over models or statesValue of information emerges through belief-state planningPosterior and planning cost can dominate
Control as inferencePosterior over actions conditioned on optimality variablesDepends on the generative model and optimality constructionValue semantics can be hidden in likelihood choices
Active inferenceExpected free energy or a related variational policy objectiveEpistemic value is represented inside policy scoringPreferences, factorisation and approximation can silently determine behaviour

Formal comparisons support this overlap. Active inference and control as inference differ importantly in how value is incorporated into the generative model.[8] Under specified conditions, active-inference schemes can recover Bellman-optimal reward maximisation; the conditions and planning scheme matter, especially beyond a one-step horizon.[9] Empirical papers have also compared active-inference variants with Q-learning and Bayesian model-based RL on shared environments.[6][10]

Mechanism test

Three agents can choose “inspect” for three different reasons

An active-inference agent may inspect because predicted information gain lowers its policy score. A model-based RL agent may inspect because the observation improves expected downstream return. A model-free RL agent may inspect because repeated experience has assigned a high Q-value to the inspect action in the unseen state. The first action is identical, but the counterfactual dependencies differ.

Change the known sensor accuracy without allowing new interaction. The active-inference and model-based agents can respond if their likelihood models are updated. The frozen model-free agent cannot because the change is not represented in its state-action values. Now keep sensor accuracy fixed and change the misroute cost. All three may respond if cost is part of their online input; otherwise only the model-based designs with editable preferences or rewards respond immediately.

Finally, alter a latent variable that produces interesting observations but never affects the route. A pure information-gain term may chase it. A downstream value calculation will ignore it. This is why the paper’s proposed leverage measure conditions epistemic value on decision loss. The intervention target tells us more than the action label.

Scroll horizontally to inspect the full figure Policy trajectories under an observation intervention Three horizontal trajectories compare an active-inference agent, a model-free RL agent, and a Bayesian model-based RL agent before and after sensor accuracy falls. The active-inference and Bayesian agents stop inspecting when their models are updated, while a fixed model-free policy continues until relearned. sensor accuracy falls informative sensor uninformative sensor Active inference Model-free RL Bayesian RL III CCC III IIC III CCC I = inspect C = commit fixed policy keeps paying until new experience arrives
Behavioural equality can disappear under a sensor intervention.Before the intervention, all three controllers may inspect. After accuracy falls, an active-inference or Bayesian controller with an updated observation model can change immediately. A model-free policy usually needs new experience. A model-based RL agent with the same update would erase this difference.Illustrative trajectory, not measured performance.
Thought experiment 3: lengthen the horizon

Turn one inspection into a branching expedition

Give Kestrel four camera poses, three possible questions to a human operator, five route choices and a six-step horizon. The apparent elegance of scoring policies now meets a combinatorial fact: the number of action sequences grows exponentially with horizon if policies are enumerated.

Deep and tree-search implementations use amortised policies, Monte Carlo sampling, pruning or recursive schemes to control this cost.[11] These approximations are not an implementation footnote. They can change which epistemic futures are seen. An agent may appear to “lose curiosity” simply because search no longer reaches the informative branch.

Scroll horizontally to inspect the full figure Illustrative policy count and approximation envelope by planning horizon A log-scale line chart shows exact policy enumeration rising rapidly with horizon while pruned search and an amortised policy remain lower. A shaded band marks policies that may be omitted by approximation. 10⁰10²10⁴10⁶10⁸ 123456 planning horizon candidate policy evaluations, log scale exact enumeration pruned tree search amortised policy unsearched epistemic branches
Policy search is part of the causal mechanism.With five actions, exact sequence enumeration grows as 5h. Pruning and amortisation make planning feasible, but can hide information-gathering branches. Apparent behavioural differences may therefore arise from search budgets rather than the stated objective.Illustrative counts and trajectories.

Build it as a hypothesis, not a creed

The phrase “epistemic value” can tempt designers to reward any reduction in uncertainty. That is too broad. An inspection might reveal the colour of the inner packaging while leaving the cold-chain decision unchanged. Entropy falls, but operational uncertainty does not.

This paper proposes a narrower quantity: decision-bearing epistemic leverage. It asks how much an action-conditioned observation can reduce the minimum expected loss of the next consequential decision. For a sensing action a:

LDBE(a) = mind E[L(d,S)] - Eo|a[ mind E[L(d,S)|o,a] ]

The hidden state is S, the later decision is d, and L is a declared loss function. The first term is the best expected loss without the new observation. The second is the expected best loss after receiving it. This is closely related to the expected value of sample information. The new design move is to use it as a gate on the epistemic term: information should matter because it can improve a decision, not because uncertainty reduction is intrinsically impressive.

For Kestrel, the leverage of the 90 per cent accurate inspection is 18 - 4 = 14 loss units before paying the inspection cost. Net value is 10 after the 4-unit delay. At 50 per cent accuracy, leverage is zero. This distinction prevents a class of “curiosity traps” in which the agent repeatedly observes variables that are learnable but irrelevant.

Scroll horizontally to inspect the full figure Decision surface for active-inference adoption A two-dimensional surface uses action-dependent observability on the horizontal axis and decision-bearing epistemic leverage on the vertical axis. Active inference is favoured only in the upper right region, while simpler control is preferred elsewhere. candidate threshold test active inference use simpler control action changes future observability → decision-bearing epistemic leverage → movable diagnostic sensor decorative telemetry fixed high-stakes reading static classifier
The epistemic-control adoption surface.Active inference deserves a trial when actions materially alter the evidence channel and that evidence can change a consequential choice. High uncertainty without action-dependent sensing, or active sensing without decision leverage, does not by itself justify the machinery.Practitioner synthesis and decision instrument.
Decision instrument

The five-gate active-inference test

  1. Causal gate: can an available action change the likelihood, precision or timing of a future observation?
  2. Consequence gate: does uncertainty about the hidden state alter a later decision with material loss?
  3. Timing gate: can the observation arrive before the relevant action becomes irreversible?
  4. Model gate: can likelihoods, transitions and preferences be stated, calibrated and versioned?
  5. Comparison gate: does the approach beat a matched Bayesian or RL baseline under sensor, transition and preference interventions?

If the first three gates fail, expected free energy has little causal work to do. If the fourth fails, the agent will optimise an unreviewable story. If the fifth fails, active inference may still be a coherent description, but it is not yet a justified engineering choice.

A configured system, not a free-floating equation

A useful implementation keeps several objects separate. The generative model predicts observations and transitions. The belief state records the current posterior over hidden states. Preferences express desired outcome distributions or costs. A policy evaluator proposes an action sequence. A deterministic authority kernel decides whether a typed action is permitted. The operational system produces an effect receipt, and an independent readback verifies the outcome.

Discrete reference software and factor-graph formulations can make the inference objects and message flow inspectable, but they do not supply the surrounding authority, evidence and recovery contracts.[12][14]

Belief confidence is not authority. An agent can be 99 per cent confident and still lack permission to open the package. Conversely, an action can be permitted but irrational under the current evidence. Active inference belongs inside the proposal path, not at the control boundary.

Scroll horizontally to inspect the full figure Configured active-inference system with separate authority and readback A nested system diagram separates the generative model and belief updater from world state, typed action authority, the physical plant, effect receipts and independent readback. probabilistic proposal boundary generative model likelihoods · transitions · preferences belief update policy proposal authority kernel identity · purpose · freshness · limits physical plant camera · gripper · routing lane independent readback effect receipt · sensor evidence typed action verified outcome updates belief observation World state, evidence ledger and permissions remain distinct from model belief.
Active inference belongs inside a governed action loop.The probabilistic subsystem proposes. A separate authority kernel enforces identity, purpose, freshness and action limits. The physical effect is recorded and independently read back before beliefs and world state are updated.Proposed implementation architecture.
Worked example 3: realistic configured system

A synthetic payment-review agent that may ask before it acts

Consider a synthetic agent reviewing an unusual supplier payment. Its hidden state is not “fraud” in the abstract. It includes narrower hypotheses: the supplier bank account changed legitimately, an invoice was duplicated, an operator account was compromised, or the transaction is routine but rare. Available observations include the payment record, approved supplier master data, device attestation and a confirmation from a named account owner.

The agent has three proposals: release, hold, or request device attestation before deciding. Requesting evidence has a cost because it delays settlement and burdens the user. Releasing an unauthorised payment has a much larger loss. Holding a valid payment also has a cost. The attestation is useful only if it discriminates among the hidden hypotheses and arrives before release.

An active-inference design would encode an observation model for attestation under each hypothesis, a transition model for the hold and request actions, and preferences over verified release, unnecessary delay and unauthorised effect. It could prefer the request policy when the expected evidence changes the release decision. Yet the policy evaluator must not send the request or hold the payment by itself.

The authority kernel checks the actor, subject, purpose, permitted context and current policy. A typed request names the payment, evidence sought, expiry and maximum delay. The tool returns a request receipt. After the attestation arrives, a new policy proposal is computed against fresh world state. If release is authorised, execution produces an effect receipt, followed by an independent ledger readback.

This example shows why active inference is a system hypothesis rather than a replacement for controls. The formalism can decide that evidence is worth acquiring. It cannot decide that the evidence is legally available, that the requester is entitled to contact the account owner, or that a model proposal has authority to move money. Those constraints belong to separate contracts and evidence chains.

Executable lab

Sensor-shift comparison: EFE surrogate, Q-learning and value of information

The lab simulates Kestrel’s two-state routing task. A tabular Q-learning agent learns whether to inspect under the training sensor. An expected-free-energy surrogate uses expected decision cost minus a weighted information-gain term. A Bayesian value-of-information baseline computes the expected downstream loss directly.

Change deployment accuracy without retraining. A positive result for the design hypothesis is not “active inference wins”. It is that an explicit observation model adapts immediately to a known sensor change while a frozen model-free policy does not. A negative result means the task does not require the extra machinery, the model is misspecified, or a matched Bayesian baseline already captures the benefit.

EFE surrogate

–
Average deployment cost

Q-learning

–
Frozen policy after training

Bayesian VOI

–
Decision-loss baseline

Run the comparison to generate synthetic results.

View the runnable Python version
Python · two-state active sensing comparison
from __future__ import annotations

from dataclasses import dataclass
from math import log2
import random
from typing import Literal

Action = Literal["inspect", "cold", "ordinary"]

@dataclass(frozen=True)
class Config:
    prior_cold: float = 0.55
    train_accuracy: float = 0.90
    deploy_accuracy: float = 0.65
    inspect_cost: float = 4.0
    mistake_cost: float = 40.0
    epistemic_weight: float = 2.0
    seed: int = 61


def h2(p: float) -> float:
    if p <= 0.0 or p >= 1.0:
        return 0.0
    return -(p * log2(p) + (1.0 - p) * log2(1.0 - p))


def information_gain(prior: float, accuracy: float) -> float:
    p_cue_cold = prior * accuracy + (1.0 - prior) * (1.0 - accuracy)
    return h2(p_cue_cold) - h2(1.0 - accuracy)


def posterior(prior: float, accuracy: float, cue_cold: bool) -> float:
    like_cold = accuracy if cue_cold else 1.0 - accuracy
    like_ordinary = 1.0 - accuracy if cue_cold else accuracy
    evidence = prior * like_cold + (1.0 - prior) * like_ordinary
    return prior * like_cold / evidence


def commit_loss(prior: float, mistake_cost: float) -> tuple[float, Action]:
    if prior >= 0.5:
        return (1.0 - prior) * mistake_cost, "cold"
    return prior * mistake_cost, "ordinary"


def expected_loss_after_inspection(prior: float, accuracy: float,
                                   inspect_cost: float,
                                   mistake_cost: float) -> float:
    p_cue_cold = prior * accuracy + (1.0 - prior) * (1.0 - accuracy)
    post_cold = posterior(prior, accuracy, True)
    post_ordinary = posterior(prior, accuracy, False)
    loss_cold, _ = commit_loss(post_cold, mistake_cost)
    loss_ordinary, _ = commit_loss(post_ordinary, mistake_cost)
    return inspect_cost + p_cue_cold * loss_cold + (1.0 - p_cue_cold) * loss_ordinary


def choose_efe_surrogate(cfg: Config) -> Action:
    direct, action = commit_loss(cfg.prior_cold, cfg.mistake_cost)
    inspect = expected_loss_after_inspection(
        cfg.prior_cold, cfg.deploy_accuracy,
        cfg.inspect_cost, cfg.mistake_cost
    )
    inspect -= cfg.epistemic_weight * information_gain(
        cfg.prior_cold, cfg.deploy_accuracy
    )
    return "inspect" if inspect < direct else action


def choose_voi(cfg: Config) -> Action:
    direct, action = commit_loss(cfg.prior_cold, cfg.mistake_cost)
    inspect = expected_loss_after_inspection(
        cfg.prior_cold, cfg.deploy_accuracy,
        cfg.inspect_cost, cfg.mistake_cost
    )
    return "inspect" if inspect < direct else action

# The browser lab adds a small tabular Q-learning implementation and
# evaluates all three policies over seeded synthetic episodes.
if __name__ == "__main__":
    cfg = Config()
    print("EFE surrogate:", choose_efe_surrogate(cfg))
    print("Bayesian VOI:", choose_voi(cfg))
    print("Information gain (bits):",
          round(information_gain(cfg.prior_cold, cfg.deploy_accuracy), 3))

How to run: save as active_sensing.py and execute python active_sensing.py. The browser version adds training and evaluation for Q-learning.

Assumptions, interpretation and limits
  • The hidden state is binary, episodes are independent, and sensor accuracy is known to the model-based agents.
  • The EFE agent uses a transparent surrogate, expected loss minus weighted mutual information, rather than claiming one unique canonical decomposition.
  • A lower cost permits the narrow conclusion that the policy is better under this synthetic task and intervention.
  • The lab cannot establish biological plausibility, general sample efficiency, sentience, or superiority over well-tuned model-based RL.
  • Large epistemic weight can cause over-inspection. That is a feature of the test because it exposes preference and weighting sensitivity.
Open research hypothesis

A discriminating comparison

On partially observed tasks where actions control sensor quality, an explicit active-inference agent should adapt faster than a matched model-free RL agent after a known observation-model shift. The advantage should shrink or disappear against Bayesian model-based RL with the same model update, planning budget and preference information.

The observation that would strengthen the hypothesis is lower post-shift decision loss without additional environment interaction. A result that would weaken it is no advantage after matching compute and model access. A rival explanation is simply better system identification. The smallest useful test is a two-state POMDP with a movable sensor, followed by a robotic or software workflow in which sensing has a real cost.

How the claim changes under pressure
Chart · state
stateDiagram-v2
  [*] --> Claim
  state "Change only the camera’s mobility" as Claim
  state "Four objects that must be<br/>reviewable" as Test
  state "When eight seconds are worth<br/>more than immediate action" as Revision
  Claim --> Test: expose mechanism
  Test --> Decision: evidence survives
  Test --> Revision: rival survives
  Revision --> Claim: narrow or rebuild
  Decision --> [*]
The revision loop begins with Change only the camera’s mobility and keeps counterexamples inside the reasoning path. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Where the biological analogy stops

Active inference emerged from theoretical neuroscience and the free-energy principle, where variational inference is used to describe perception, action, learning and self-organisation.[1] That history gives the engineering framework a rich vocabulary. It also creates a recurring error: importing biological meaning with the mathematics.

Kestrel’s preferred outcomes are specified by designers, policy and operating constraints. They are not inherited through metabolism, development or natural selection. Its “surprise” is negative log probability under a model. It is not distress. Its sensor precision is a numerical property or inferred parameter. It is not attention in every biological sense. Its operating boundary is an architecture choice, not automatically a Markov blanket that establishes organismic identity.

An artificial system that minimises an active-inference objective does not thereby acquire biological stakes. It may implement a useful inference-and-control loop. Any further claim needs independent evidence.

Boundary condition

The dark room is a preference-design test

A familiar challenge asks why a surprise-minimising organism does not remain in a dark, silent room where sensory input is predictable. Active-inference replies usually point out that agents do not minimise raw sensory variation in isolation. They act under structured generative models and preferences shaped by expected physiological and environmental trajectories. A dark room may violate expectations about movement, social contact, temperature, nourishment or future viability even if the immediate pixels are stable.

For an artificial agent, this reply becomes an engineering obligation. The designer must specify which outcomes are preferred, over what horizon, and with which confidence. If Kestrel is given only a preference for predictable camera images, parking in front of a blank wall may be locally rational. If it is given strong preferences for verified routing and time-bounded completion, the blank wall is costly. Neither behaviour emerges from “free energy” alone.

The same point applies to curiosity. A generative model can contain thousands of uncertain variables. Without relevance structure, an epistemic policy can spend its budget resolving trivia. Biological accounts may appeal to evolved or learned priors that constrain salience. An engineered system needs an explicit equivalent, such as decision-bearing epistemic leverage, resource budgets and stop conditions. Preference design has moved, not disappeared.

Thought experiment 4: replace the inference substrate

Move Kestrel’s beliefs outside Kestrel

Replace the local belief updater with a remote service. Preserve every input, posterior, policy score and action. Behaviour remains identical. Is the robot still an active-inference agent?

At the system level, yes, if the remote service, robot, observation loop and policy selector form the configured causal system. At the chassis level, no. The chassis is now an actuator and sensor endpoint inside a larger inference loop. The candidate boundary follows causal organisation, not the label on the device.

Now replace the entire variational machinery with a POMDP planner that generates the same actions. Behaviour alone no longer distinguishes mechanisms. The correct test intervenes on beliefs, likelihoods, preferences or search, then compares the action changes.

Scroll horizontally to inspect the full figure Replacement experiment with preserved behaviour and changed system boundary Three vertically arranged systems show local active inference, remote inference with the same behaviour, and a POMDP planner with the same behaviour. The system boundary expands in the second case and the mechanism changes in the third. A. Local loop beliefs + EFE + actuator A same route B. Remote loop remote beliefs + EFE robot endpoint A same route C. Mechanism swap POMDP value planner A same route Output matching cannot identify the objective or the relevant system boundary.
Preserve behaviour, change the mechanism.Externalising inference changes the candidate system boundary without changing action. Replacing the objective changes the mechanism while preserving action. Behaviour is therefore insufficient to establish that active inference caused the policy.Replacement thought experiment.

What biological evidence can and cannot license

The free-energy principle has been criticised as difficult to falsify when stated too generally. A more productive approach fixes a generative model and process theory, then asks whether it predicts unseen dynamics. Work with cultured neuronal networks has reported that a specified variational model predicted later neuronal responses and plasticity from early data, while also noting that a mapping alone is insufficient and predictive validity is the stronger test.[13]

This evidence supports a constrained claim about those networks and models. It does not prove that every brain process performs the same algorithm, that expected free energy is the unique objective of behaviour, or that an engineered agent inherits the biological interpretation. The mathematical review literature is valuable precisely because it exposes assumption structure rather than treating the framework as a slogan.[2]

StructureWhat may transferWhat does not transfer automaticallyRequired test
Variational inferenceApproximate posterior updating under a generative modelNeural implementation or biological plausibilityCompare update dynamics and interventions
Expected free energyJoint scoring of preferred and informative futuresUnique derivation, organismic purpose or felt valueCompare rival objectives under matched models
Prior preferencesA formal target distribution over outcomesNeeds, values or homeostasisTrace preference provenance and failure costs
PrecisionWeight assigned to uncertainty or prediction errorAttention, arousal or dopamine as an identity claimSpecify the mapping and perturb both sides
Agent boundaryA declared causal system for inference and actionSelfhood, sentience or moral statusBoundary interventions plus independent evidence
Strongest boundary

The rival that can reproduce the same benefit

A Bayesian model-based RL agent can maintain a belief over hidden states, model how sensing actions alter observations, compute the value of information and choose a policy that first looks and then acts. With matched models, planning horizons and compute, it may reproduce every practical advantage described in the Kestrel case.

This rival does not make active inference useless. It changes the adoption claim. Choose active inference when its generative-model grammar, preference representation or process hypotheses make the system easier to reason about or test. Do not choose it because uncertainty-aware action is impossible elsewhere.

Five failure paths worth injecting

Preference laundering occurs when a designer hides a conventional reward function inside “prior preferences” and then claims reward engineering has disappeared. Epistemic obsession occurs when information gain is weighted without decision relevance. Model capture occurs when a wrong likelihood makes bad evidence look decisive. Search myopia occurs when approximations omit the informative branch. Authority collapse occurs when the policy evaluator is allowed to execute its own proposal.

Scroll horizontally to inspect the full figure Adversarial failure paths in an active-inference agent A central policy loop is surrounded by five failure paths: hidden preferences, irrelevant information seeking, misspecified likelihood, pruned informative policies and direct execution without authority. Each path ends in a distinct observable symptom. belief + policy evaluation loop Preference laundering reward hides in p*(o) Epistemic obsession learns what cannot help Model capture wrong sensor confidence Search myopia informative path pruned Authority collapse proposal executes itself unreviewed objective irrelevant uncertainty false confidence horizon artefact unsafe effect
Five ways the same elegant objective can fail.Each path requires a different control: preference provenance, decision-bearing information gates, likelihood calibration, search-budget tests and an external authority kernel. A single aggregate score will not reveal which failure occurred.Proposed failure-injection map.
The evidence conversation
Chart · sequence
sequenceDiagram
  participant Q as Question
  participant M as Mechanism
  participant E as Evidence
  participant D as Decision
  Q->>M: The pallet that should not move yet
  M->>E: Change only the camera’s mobility
  E-->>M: compare rival explanations
  E->>D: Use active inference only when action controls evidence
  D-->>Q: revise scope or act
Question, mechanism, evidence and decision exchange the burdens developed in Active inference as a design hypothesis for agents. Reading use: follow the relation, then return to the surrounding argument for evidence and limits.

Use active inference only when action controls evidence

Do not adopt active inference because an agent “should minimise surprise”, because the brain has been described that way, or because epistemic value sounds more principled than an exploration bonus. Those reasons do not identify an engineering need.

Start with the causal graph. Ask whether an action can change the evidence channel, whether that evidence can change a consequential decision, and whether it arrives before commitment. Compute decision-bearing epistemic leverage. If leverage is negligible, use the simpler controller. If it is material, build two systems: an active-inference candidate and a matched Bayesian or RL baseline.

Then intervene. Degrade the sensor. Make the informative observation irrelevant. Shift the transition model. Change preferences. Truncate the planning horizon. Externalise the belief updater. The chosen design should change for the reason its theory predicts. If two systems remain behaviourally identical under every useful intervention, prefer the one that is easier to calibrate, govern and recover.

Record five outputs for every intervention: downstream decision loss, calibration, inspection rate, compute cost and recovery burden. A lower task loss that doubles human review, conceals a model update or makes interrupted execution harder to reconstruct is not a system gain. The active-inference candidate should win on the property that motivated it: earlier and safer adaptation when actions control evidence. A null result is useful. It says that epistemic action was not decision-bearing in this environment, that the approximation hid the benefit, or that the rival controller already captured it more simply.

The practical decision is therefore conditional: use expected free energy when perception is an action problem and the explicit generative model makes that coupling testable. Keep preferences versioned, keep authority deterministic, keep world state separate from belief, and keep a rival controller in the experiment.

That decision respects what active inference genuinely offers. It joins sensing and acting inside one policy hypothesis. It also respects the boundary. The resulting agent is an engineered system whose behaviour depends on a declared model, objective and approximation. Whether similar mathematics explains living systems is a scientific question. Whether the artificial system is conscious is another question again.

Glossary

Active inference
A family of frameworks in which perception, learning and action are formulated as inference under a generative model, with policies commonly evaluated using expected free energy or related objectives.
Ambiguity
Expected uncertainty in observations given hidden states. A state is ambiguous when it can generate observations that are hard to distinguish.
Belief state
A probability distribution over hidden states conditioned on available observations and the model.
Decision-bearing epistemic leverage
The expected reduction in minimum downstream decision loss made possible by an action-conditioned observation.
Expected free energy
A prospective policy objective with decompositions that can combine preference-related and epistemic terms. Exact forms and derivations vary.
Generative model
A probabilistic model of how hidden states, observations, actions and transitions relate.
Prior preference
A distribution or potential encoding outcomes the agent is designed or modelled to prefer.
Variational free energy
A variational objective that bounds negative log model evidence and supports approximate posterior inference.

References

  1. Friston, K. (2010). The free-energy principle: a unified brain theory? Nature Reviews Neuroscience, 11, 127–138.
  2. Buckley, C. L., Kim, C. S., McGregor, S., & Seth, A. K. (2017). The free energy principle for action and perception: A mathematical review. Journal of Mathematical Psychology, 81, 55–79.
  3. Friston, K., Rigoli, F., Ognibene, D., Mathys, C., Fitzgerald, T., & Pezzulo, G. (2015). Active inference and epistemic value. Cognitive Neuroscience, 6(4), 187–214.
  4. Friston, K., FitzGerald, T., Rigoli, F., Schwartenbeck, P., & Pezzulo, G. (2017). Active inference: A process theory. Neural Computation, 29(1), 1–49.
  5. Da Costa, L., Parr, T., Sajid, N., Veselic, S., Neacsu, V., & Friston, K. (2020). Active inference on discrete state-spaces: A synthesis. Journal of Mathematical Psychology, 99, 102447.
  6. Sajid, N., Ball, P. J., Parr, T., & Friston, K. J. (2021). Active inference: Demystified and compared. Neural Computation, 33(3), 674–712.
  7. Millidge, B., Tschantz, A., & Buckley, C. L. (2020). Whence the expected free energy? arXiv:2004.08128.
  8. Millidge, B., Tschantz, A., Seth, A. K., & Buckley, C. L. (2020). On the relationship of active inference and control as inference. arXiv:2006.12964.
  9. Da Costa, L., Sajid, N., Parr, T., Friston, K., & Smith, R. (2023). Reward maximization through discrete active inference. Neural Computation, 35(5), 807–852.
  10. Tschantz, A., Millidge, B., Seth, A. K., & Buckley, C. L. (2020). Reinforcement learning through active inference. arXiv:2002.12636.
  11. Fountas, Z., Sajid, N., Mediano, P. A. M., & Friston, K. (2020). Deep active inference agents using Monte-Carlo methods. Advances in Neural Information Processing Systems, 33.
  12. Heins, C., Millidge, B., Demekas, D., Klein, B., Friston, K., Couzin, I., & Tschantz, A. (2022). pymdp: A Python library for active inference in discrete state spaces. Journal of Open Source Software, 7(73), 4098.
  13. Isomura, T., Kotani, K., Jimbo, Y., & Friston, K. J. (2023). Experimental validation of the free-energy principle with in vitro neural networks. Nature Communications, 14, 4547.
  14. van de Laar, T., Koudahl, M., van Erp, B., & de Vries, B. (2022). Active inference and epistemic value in graphical models. Frontiers in Robotics and AI, 9, 794464.