
Active Inference & The Free Energy Principle: From First Principles to Working Systems
A 1.6-million-parameter system beats models with 400 times more parameters. VERSES Genius solves code-breaking challenges 140 times faster and 5,260 times cheaper than frontier AI models. Against DeepSeek R1, Genius achieves 100 percent where DeepSeek manages 45 percent, while running 300 times faster and 800 times cheaper.
Those numbers should not be possible. The explanation is not a trick or a narrow benchmark optimization. It is a structural difference in how intelligence is built.
This article derives Active Inference and the Free Energy Principle from first principles, then walks through AXIOM, the four-module cognitive architecture that achieves these results. No hand-waving. Full math. Working systems.
Part I: The Crisis of Scale
Diminishing Returns
The current AI paradigm is simple: intelligence emerges from scale. Train on more data, with more parameters, using more compute. Each doubling of model scale produces a measurable capability gain.
The problem is that the capability gain per doubling is shrinking while the cost per doubling is holding steady or growing. The scaling curves are flattening. We are deep in the zone of diminishing returns, each dollar buys less intelligence than the last.
The Same Bug
When an image generator draws a person with six fingers, it knows that pixel clusters co-occur in certain patterns, but not that hands have five fingers. When a language model confidently states a false fact, it knows word sequences, but not truth conditions. When a deep RL agent trained on one Atari game is placed in a slightly modified version, it collapses, it memorized pixel patterns, not game mechanics.
These are not separate bugs. They are the same bug: the absence of a causal model. Deep learning builds statistical mappings from inputs to outputs. This is pattern recognition, and pattern recognition is genuinely useful. But pattern recognition is not understanding.
A system that knows correlations can interpolate, it performs within the training distribution. A system that knows causes can extrapolate, it performs outside the training distribution. Every real-world deployment involves situations outside the training distribution.
What Intelligence Requires
True intelligence requires four capabilities that pattern matching cannot provide:
- A world model. The system maintains an internal representation of what causes what, not just what co-occurs with what.
- Prediction. The model generates expectations about future observations before they arrive.
- Surgical updating. When predictions fail, the system updates specific beliefs without disrupting unrelated knowledge. Deep learning's catastrophic forgetting is the direct consequence of lacking this.
- Uncertainty tracking. The system maintains probability distributions over hypotheses, not point estimates. It knows what it does not know, and can target information-gathering actions to resolve specific uncertainties.
Deep learning fails on all four. The question is: where does the alternative come from?
Part II: The Free Energy Principle
Friston's Question
In the 1990s and 2000s, a neuroscientist named Karl Friston asked a deceptively simple question: what does the brain do? Not what each region does, but what single objective unifies everything, seeing, speaking, planning, dreaming, remembering, moving.
The answer he arrived at has become one of the most debated and productive frameworks in neuroscience. It is called the Free Energy Principle.
Thermodynamic Surprise
The core idea: every self-organizing system survives by minimizing surprise. Not emotional surprise, thermodynamic surprise. The quantity the system works to minimize is called variational free energy, and it measures the gap between what a system expects to sense and what it actually senses.
A fish in water has low free energy. Its sensory channels, pressure, oxygen, resistance, match its expectations. Remove the fish from water and every sensory channel screams mismatch. Free energy spikes to maximum. If the fish cannot reduce this gap, it dies. Sustained high free energy is dissolution.
This is not a metaphor. The same mechanism operates at every scale of biology. A bacterium swims up a sugar gradient. A cell maintains pH balance. A body maintains core temperature. A brain maintains a predictive model of the world. In every case: predict, compare, reduce the gap.
Two Ways to Reduce the Gap
When prediction error occurs, there are exactly two responses:
Perception: Change your mind. Update internal beliefs to match reality. You expected a step to be there, but it was not. You update the model. The room did not change, only the model did.
Action: Change the world. You are cold. Your model predicts your body should be warm. You put on a jacket. Reality changed to match the model.
The system chooses between these based on precision, how confident it is in its model versus its preferences. High precision on preferences (body MUST be 37°C) with low precision on situation → act. Low precision on preferences with high precision on model → perceive and update.
Beliefs Are Distributions
The formalization rests on one key idea: beliefs are not single values. They are probability distributions. The mathematical workhorse is the Gaussian, a bell curve characterized by a mean (best guess) and variance (uncertainty). Precision (τ = 1/σ²) is the inverse of variance: high precision means high confidence.
When the world is generated by multiple overlapping causes, a single Gaussian is insufficient. A Gaussian mixture model decomposes complex data into a sum of simple Gaussians, each representing one cause. The model learns three things for each component: where its center is, how wide it is, and how much of the data it explains.
The Free Energy Equation
Bayesian inference updates beliefs through three components: the prior (what you believed before data), the likelihood (how probable the data is under each hypothesis), and the posterior (what you believe after seeing the data).
Variational free energy is defined as:
F(q) = E_q[-log p(y|s)] + KL[q(s) || p(s)]
Or in plain terms: F = Complexity − Accuracy.
Complexity (KL divergence) measures how far your beliefs moved from your starting point. Accuracy measures how well your updated beliefs explain the observed data. Minimizing free energy means explaining the data (accuracy) while keeping beliefs close to priors (complexity). This prevents both ignoring evidence and overfitting to noise.
KL divergence is the cost of changing your mind. When evidence is strong, the accuracy gain exceeds the complexity cost, and the system updates fully. When evidence is weak, the complexity cost dominates, and the system shifts only slightly. This built-in caution distinguishes free energy minimization from both reward maximization and maximum likelihood estimation.
Part III: Active Inference, From Principle to Engineering
Generative Models
Active Inference is the engineering framework that turns the Free Energy Principle into a working agent. The key architectural choice is the generative model, a model that goes from causes to predicted effects, not from effects to labels.
A discriminative model (standard deep learning) maps inputs to outputs. It cannot simulate, cannot predict consequences of actions, and cannot diagnose failures. A generative model runs in both directions: given causes, it predicts effects; given effects, it infers causes.
The Active Inference Loop
An Active Inference agent maintains beliefs about hidden causes. It uses its generative model to predict what it should observe. It compares predictions to actual sensory input, this is perception. But it also selects actions that will make future observations match its preferences, this is action.
The critical difference from reinforcement learning: preferences are not external reward signals bolted onto the system. They are beliefs about preferred future states, encoded in the same format as physics beliefs. When a collision occurs, two prediction errors fire simultaneously, one for violated physics predictions, one for violated preference predictions. Both drive the agent to act. Same mechanism for physics and goals.
Expected Free Energy
Most planning systems optimize for reward. An Active Inference agent optimizes for Expected Free Energy, which naturally decomposes into two components:
Pragmatic value: Will this action lead to preferred outcomes? Epistemic value: Will this action reduce my uncertainty?
This dissolves the exploration-exploitation tradeoff. Early in learning, when the model is uncertain, epistemic value dominates, the agent explores. Late in learning, when the model is accurate, pragmatic value dominates, the agent exploits. The transition is smooth, automatic, and mathematically principled. No hyperparameter controls it.
Active Inference vs Reinforcement Learning
Three structural differences:
- Sample efficiency. Active Inference agents learn from 10,000 frames. Deep RL agents need 1,000,000+. A 100-1000x gap.
- Adaptability. When the environment changes, an RL agent must retrain. An Active Inference agent updates one belief and adapts in tens of frames.
- Transparency. An RL agent's policy is a black box. An Active Inference agent's beliefs are readable: "Object at (50,30), velocity (3,-1), mode: bouncing, confidence: 92%."
The costs are real. Building generative models is hard. The Active Inference ecosystem is young. Scaling to complex continuous environments is research-grade.
Part IV: AXIOM, A Working Cognitive Architecture
AXIOM (Active eXpanding Inference with Object-centric Models) implements Active Inference as a four-module cognitive hierarchy. Each module handles a specific layer of cognition.
sMM: The Slot Mixture Model, Perception
AXIOM makes a bet about reality: what you see on screen is generated by a small number of coherent, persistent objects. The sMM does not classify pixels, it hypothesizes objects and generates predicted images from those hypotheses.
The algorithm is Expectation Maximization. In the E-step, each pixel is soft-assigned to slots based on which slot's predicted pixel was closest. In the M-step, each slot updates its parameters (position, color, size) based on its assigned pixels. After a few iterations, objects emerge, without labels, without training data, without supervision.
AXIOM receives a 210×160 pixel RGB image (33,600 data points) and describes the entire scene with roughly 30 Gaussian parameters. This is extreme compression through structure.
When a new object appears, the sMM uses a truncated stick-breaking prior. Empty slots with near-zero weight grow to accommodate new objects on demand. The system expands its complexity to match the environment.
iMM: The Identity Mixture Model, Memory
The iMM assigns type-level identity codes. Not instance-level labels (this particular red ball) but type-level labels (BALL). Three different red balls on screen each get the same identity code.
The benefit: when the agent learns "BALL objects bounce" from one instance, new instances immediately inherit that knowledge. When perturbations swap object colors mid-game, the iMM notices shape and motion patterns are unchanged and remaps new appearances to old identity codes. Learned dynamics are preserved.
tMM: The Transition Mixture Model, Physics
The tMM learns a shared library of dynamics modes, a self-built physics engine. Mode 1: falling (next_y = current_y + velocity, velocity += gravity). Mode 2: bouncing (velocity = -velocity). Mode 3: stationary. Mode 4: drifting.
Technically, this is a switching linear dynamical system. The mode library is shared across all objects of each identity type, so dynamics learned from one ball transfer to all balls. When a ball hits the floor and switches from falling to bouncing, the tMM detects the prediction error against the falling mode and switches to the bouncing mode.
rMM: The Recurrent Mixture Model, Logic
The rMM is the executive brain. It takes the full context of the current moment, object states, nearest objects, agent actions, last reward, and infers which dynamics mode applies. Its key capability is compositionality: it can handle novel situations by composing familiar elements.
If it has seen "enemy nearby + no action = safe" and "jump + far from enemy = safe" and "jump + enemy nearby = danger," it can infer the correct dynamics mode for "enemy nearby + jump" even if it has never encountered that specific combination. Generative composition, not lookup table.
Self-Structuring Intelligence
AXIOM's most striking property is that it structures itself.
Expansion. When prediction error from existing components is persistently high (not momentarily high), the system spawns new components. New slots, new identity codes, new dynamics modes, new causal clusters. Growth is triggered by persistent surprise, not novelty.
Bayesian Model Reduction. Growth without governance is entropy. BMR tests whether merging similar components improves prediction. If two dynamics modes ("red ball bouncing" and "blue square bouncing") can be merged into one ("objects bouncing") with lower free energy, the merge is accepted. Generalization emerges from principled pruning.
Model Predictive Control with CEM. AXIOM plans by sampling 64 action sequences, scoring each through its world model using Expected Free Energy, keeping the top 10%, refitting the distribution, and repeating. But it executes only the first action, observes the result, and replans. Plan a trajectory. Execute one step. Observe. Replan.
Part V: The Proof
Gameworld 10k Benchmark
AXIOM was tested on the Gameworld 10k benchmark, ten Atari-style game environments with a strict data budget of 10,000 interaction frames (about 5.5 minutes of gameplay).
Key results:
- Parameter efficiency. 0.3 to 1.6 million parameters vs hundreds of millions for deep RL baselines. Approximately 400:1 ratio.
- Sample efficiency. 10,000 frames to competent play. Deep RL: 1,000,000+. A 100-1000x gap.
- Mastermind code-breaking. VERSES Genius (same architectural family) achieves 100% success rate where DeepSeek R1 achieves 45%. 140x faster than o1-preview. 5,260x cheaper.
Perturbation Experiments
Mid-game, experimenters change object colors or shapes. Deep RL baselines collapse, they learned pixel correlations, and those correlations no longer hold. AXIOM's iMM creates new identity slots briefly, then shape-based remapping kicks in. Within approximately 50 frames, the agent resumes correct play. No retraining.
Ablation Studies
Remove Bayesian Model Reduction and generalization suffers, redundant components accumulate. Remove information gain from planning and exploration suffers, the agent gets stuck in local optima. Both components are load-bearing. AXIOM is not a collection of independent tricks. It is a coherent system.
Edge Deployment
AXIOM runs in real time on a single GPU. For deployment, the target is edge hardware, NVIDIA Jetson-class devices. Intelligence that does not require datacenter-scale compute budgets. This changes who gets to build intelligent systems.
Part VI: The Structural Coordination Thesis
The Convergent Pattern
Two systems from completely different domains arrived at the same structural insight independently.
AXIOM, in the domain of game-playing AI: decompose perception into object-centric Gaussians, coordinate through a shared generative model, grow where prediction error is high, compress where redundancy exists.
The Irys Swarm API, in the domain of document analysis: decompose extraction into typed observations, coordinate through a shared blackboard, dispatch follow-up workers where uncertainty is high, stop iterating when coverage is complete.
The correspondence is specific and structural:
| AXIOM | Irys Swarm API |
|---|---|
| sMM segments pixels into objects | Extraction workers segment documents into observations |
| iMM assigns type-level identity codes | Typed observation schemas separate kind from instance |
| tMM builds shared dynamics mode library | Recurring extraction patterns transfer across documents |
| rMM selects actions based on causal context | Supervisor dispatches follow-up based on uncertainty |
| Free energy drives exploration toward uncertainty | Blackboard gaps drive targeted investigation |
On the Harvey Legal Agent Benchmark (1,251 tasks), commodity models routed through the Irys architecture achieved 17.75 percent strict all-pass rate at $1.30 per task, compared to 10.4 percent at $50.90 for previous approaches. The models did not change. The coordination did.
The Thesis
The deep learning paradigm says: scale the model and the behavior will follow.
The structural coordination thesis says: structure the coordination and the behavior will emerge from smaller, cheaper, more transparent components.
AXIOM: 400x fewer parameters, human-level play from 10,000 frames, runs on edge hardware. Irys: 39x lower cost, higher accuracy, commodity models. Both: every step traceable, every conclusion auditable.
The two are not mutually exclusive. But structure sits on top.
Open Questions
The open questions are genuine. Can Active Inference scale to continuous real-world environments with high-dimensional state spaces? Can the Irys Swarm API maintain its cost advantage on tens of thousands of pages? Can either system handle complex multi-step reasoning beyond current benchmarks?
What is not open is the direction. Two independent systems from different fields, built by different teams, using different tools, arrived at the same pattern. Decompose. Specialize. Share state. Iterate. Grow where uncertain. Compress where redundant. Audit by construction.
The future is not bigger models. It is smarter coordination over structured, persistent, auditable state.
This article accompanies the Irys University video "Active Inference & The Free Energy Principle, From First Principles to Working Systems." For the full 2.5-hour visual walkthrough, see the Irys University channel.
Try Irys AI → irys.ai | Irys Swarm API → irys.ai/irys-api
See how Irys puts research like this to work for your practice.

