The labs

Real mathematics you can run: Bayes’ theorem, variational free energy, predictive coding and the POMDP machinery behind every UNI agent — each one an interactive laboratory, not a slideshow.

Read this first. Three kinds of entry are listed here and they are drawn differently on purpose. Run them here are labs served from this site, byte-verified on every build against a pinned commit of the public Workbench repository. Live on the campus are labs on another host: the links are declared destinations, never probed, and this page does not claim they answer right now. Built, not yet hosted are labs that exist and are served from nowhere — they are listed with what is missing rather than dropped. The labs are MIT-licensed and come from the public Workbench repository. Every lab served here runs entirely in your browser: no account, no server, no analytics, CPU only. What these labs and the course model is a developmental simulation— about two of eleven-plus rungs on a long ladder, never a person, never aware, never alive; each lab asserts only the mathematics you can run inside it.

22 served from this site · 6 live on the campus · 1 built but hosted nowhere · read at 2026-10-16T22:16:26.502Z

These labs are the practical half of a curriculum: the course is the syllabus they teach inside, and the hallway places them among the rest of the estate.

Walk in

The laboratory’s own rooms, served whole from this site — 6 rooms and 25assets, every file an exact copy of a named path at a named commit, verified byte-for-byte on every build. The classroom is also the site’s front door.

The classroom

The room you stand in: a photo-real laboratory with pixel-measured, hash-bound hotspots — the whiteboard, the specimen bench, the frequency wall and the mind-body wall.

the two viewer-API fetches fail closed into the page's own fallbacks; everything else — the room, the anchors, the specimens, the microscopy — is served from this site

byte-verified · sha256 fcd96d23e4829793 · docs/classroom.html @ 7d9e0f3f4e5f

The models

Every model the laboratory carries, as the classroom's own model wall presents them.

the live model-registry fetch fails closed; the page's built-in content is served as committed

byte-verified · sha256 924825d941942b29 · docs/models.html @ 7d9e0f3f4e5f

The architecture

How the laboratory is built: the world process, the recorder, the reconstruction and the agent, kept deliberately separate.

fully static — no fetches

byte-verified · sha256 568aa8fa3856ec3f · docs/architecture.html @ 7d9e0f3f4e5f

The whiteboard — the model

Every matrix drawn, every step of the mathematics shown as it happens — the colony's generative model on one board.

fully static — no fetches; the defaults on the board are the committed defaults

byte-verified · sha256 76645aabaef223cd · docs/whiteboard/model.html @ d73ba89cb419

Run them here. These 22 labs are copies of files from the public Workbench repository, pinned at commit 35a0c64b3cf0. On every build each served copy is hashed and compared byte-for-byte against that pinned commit; a mismatch fails the build rather than shipping, and the cite line under each card carries the hash so you can rerun the comparison yourself. (At the last read, the public repository’s head was the pinned commit itself.)

Part I — Active Inference by hand (Modules 1–8)

The computer-based course, taken in order: you build free energy by hand, from a numberless hunch to a landscape a mind rolls downhill. Eight modules, each a self-contained lab.

CBT Module 1 — Surprise

The first module of the computer-based course: build your OWN probability from a numberless hunch, then watch two tempting surprise rules die against one demand and earn S(p) = −log p by hand — nothing is handed to you.

The math
Surprisal S(p) = −log p, forced by additivity S(p×q)=S(p)+S(q); units in bits and nats; the learner's own arithmetic lands −ln(0.69)=0.3710636814 on its sealed reference
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_01_surprise.html @ 35a0c64b3cf0 — sha256 5396aa604e84f39c — source

CBT Module 2 — The wall

The true surprise of what you sense is −ln of the evidence — a sum over every hidden cause. Build that sum by hand (it is Module 1's 0.69 all along), then turn the dial and watch the term count explode past any hope of finishing: the wall.

The math
Evidence p(y)=Σ p(y|η)p(η); true surprise −ln p(y); posterior p(η|y)=p(y,η)/p(y); the intractable-evidence (partition-function) wall. Goldens: evidence 0.69, surprisal 0.3710636814, posterior 0.913.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_02_the_wall.html @ 35a0c64b3cf0 — sha256 e99320a7407f9b65 — source

CBT Module 3 — A belief is a position

The true belief is behind the wall, so carry one you can move: a position on 0–1. Meet the three pressures on it — fit, stretch, looseness — and prove by your own ranking that no single one is enough (the conflict that forces free energy).

The math
The movable belief q(η) with b=q(η=on)∈[0,1] — a free stand-in, not the true posterior; the three pressures (fit / stretch / looseness) and their conflict. Reuses Module 2's two-cause world (prior 0.7, evidence 0.69, posterior 0.913); no free-energy score drawn yet.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_03_belief_position.html @ 35a0c64b3cf0 — sha256 1168e88abdade480 — source

CBT Module 4 — Free energy

Three pressures, one number: free energy is the height under a belief — energy minus looseness, fit-and-stretch fused in the joint minus the spread. Assemble it, verify the forbidden evidence sum is nowhere in it, and compute it by hand (F falls from 0.944576 to 0.371064).

The math
F[q]=Σ q(η)[ln q(η) − ln p(y,η)] = energy − entropy = complexity − accuracy; computable from the joint alone, with no evidence term. Reuses Module 2's joints (0.63/0.06). Goldens F(0.5)=0.944576, F(0.913)=min F=0.3710636814. :exact bound tag.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_04_free_energy.html @ 35a0c64b3cf0 — sha256 6872925df769bf94 — source

CBT Module 5 — The landscape

Free energy over every belief makes a valley. Feel the slope (a log-odds mismatch) blind, drop a ball anywhere, and watch it roll to the floor at b=0.913 — which is the Module 2 posterior. The valley bottom is Bayes, reached without the evidence.

The math
F(b) over b∈[0,1] is a convex valley; slope dF/db = ln(b/(1−b)) − ln(p(y,on)/p(y,off)) = log-odds mismatch; blind gradient descent reaches the floor b=0.913 = the posterior 0.63/0.69. Curve points F(0)=2.813, F(0.5)=0.944576, F(0.913)=0.371064, F(1)=0.462.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_05_the_landscape.html @ 35a0c64b3cf0 — sha256 9e8588e855a1b4d7 — source

CBT Module 6 — The floor you cannot cross

Split free energy the other way — F = surprise + gap — and a floor appears: F can never fall below the surprise −ln(0.69)=0.371064. Try to push F below the floor and you can't; the proof is one line (ln x ≤ x−1) drawn above a curve.

The math
F = −ln p(y) + KL(q‖posterior) = surprise + gap, gap ≥ 0 ⇒ F ≥ −ln p(y) = 0.3710636814 (the floor), touched only at the posterior b=0.913; proved by Gibbs' inequality (ln x ≤ x−1). gap(0.5)=0.573512. :exact bound tag.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_06_the_floor.html @ 35a0c64b3cf0 — sha256 35d0de80c92855a6 — source

CBT Module 7 — Minimize free energy

The punchline: roll downhill on the one number you can compute and you're handed both things the wall took — the true belief (the posterior 0.913) AND the true surprise (−ln 0.69 = 0.371064), at once. A bound tag keeps it honest: not every F is a safe bound.

The math
argmin F = posterior, min F = −ln p(y) = 0.3710636814 (the surprise); minimizing the computable F = minimizing the gap → 0 at the posterior. Bound tags: :exact (on the floor), :exact_mean_field / :laplace (valid ceilings above), :mmp (can dip below — ln2=0.693147 vs ln2/2=0.346574 — never a bound; MMP-BOUND-01).
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_07_minimize_f.html @ 35a0c64b3cf0 — sha256 b68be2dcbeacf34e — source

CBT Module 8 — Scale to a brain

Two causes and one dial was a training world. A real mind is a tower of causes — each a belief rolling downhill on the one above, predictions flowing down and errors up until it settles. The exact floor survives as a genuine but looser ceiling. Part I closes; action (Part II) opens.

The math
Hierarchical (mean-field) inference: predictions descend, prediction errors ascend, beliefs settle. The exact floor −ln p(y)=0.3710636814 becomes a guaranteed-but-loose ceiling, tagged :exact_mean_field (always ≥ surprise, never equal off the exact posterior): F(0.80)=0.4319080875 and F(0.50)=0.9445759076 both sit above the floor. Teaser: expected free energy G over futures (action) — built by hand in Part II, held open, not asserted. No DDNA runtime values reproduced; the tower is an illustrative mechanism, not a measurement.
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_08_scale_to_a_brain.html @ 35a0c64b3cf0 — sha256 b30e7773f40fc1cd — source

Part II — Action and choice by hand (Modules 9–15)

The second half, now live: you build the machinery of action by hand — expected free energy as risk + ambiguity, the explore–exploit balance, and precision — each derived step by step and held open, built to model how a mind would act and choose, not asserted as a finished faculty. Seven modules, built on Part I.

CBT Module 9 — The second engine

Part II (Action) opens. Part I made beliefs fit the world; action makes the world fit beliefs — the same free energy, pointed the other way. A bedrock prior ('stay warm') you can't re-believe away forces you to act; a prediction you refuse to surrender becomes a goal.

The math
Action lowers the same free energy by changing sensations, not the belief: minimise over the world's data rather than over q. An un-erasable (high-precision) prior barely moves under re-believing, so only action closes its gap — which is why bedrock priors are the engine of behaviour. Expected free energy (the forward cousin) is NOT yet built or sealed in the organism — standard theory, held open ('built to', never 'does').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_09_the_second_engine.html @ 35a0c64b3cf0 — sha256 dba2d70688f33508 — source

CBT Module 10 — Scoring an unlived future

The first half of how a mind chooses. To pick an action you haven't taken, you imagine the future it brings (run your model forward) and score that imagined future by risk — the distance between the future you'd predict and the future you prefer. Rank three futures (sweater, fire, do nothing) by risk without living any of them.

The math
Expected free energy (G) is Part I's free energy rolled forward over an unlived future, scored from the model before acting. Its first (pragmatic) term is risk = KL(predicted outcomes ‖ preferred outcomes), where preferences are a prior over the sensations you expect; the epistemic term arrives in Module 11. G is NOT yet built or sealed in the organism — standard active inference, held open ('built to', never 'does').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_10_scoring_a_future.html @ 35a0c64b3cf0 — sha256 a1f7d78ea8fed91a — source

CBT Module 11 — The worth of finding out

The second half of how a mind chooses. A mind doesn't only chase what it wants (risk); it pays to resolve what it doesn't know, because information is an investment that lowers every future bill. The blanket and the strange stove tie on risk and effort — only the stove resolves an uncertainty, and over many cold nights that pays for itself.

The math
Expected free energy G = risk + ambiguity. The epistemic term (ambiguity) is expected information gain — how far an action is expected to shrink uncertainty about the hidden state; minimising G maximises information gain while minimising risk. Information is worth exactly the future free energy it saves. G and its epistemic term are NOT yet built or sealed in the organism — standard active inference (exact form in Module 14), held open ('built to', never 'does').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_11_finding_out.html @ 35a0c64b3cf0 — sha256 1ad3abe5a789edb2 — source

CBT Module 12 — One engine, two directions

The keystone. Perception (Part I, over beliefs about now) and action (Part II, over actions into the future) are not two machines — they are one engine minimising one free energy on opposite sides of the same gap: bend the map to the territory (perceive), or bend the territory to the map (act). Close one gap from either side and watch the unity fall out.

The math
One objective, two free arguments: minimise free energy over the belief q (perception, Part I) or over the actions that shape future sensations (action, Part II) — the same quantity, pushed on whichever side of the prediction gap gives. The perception half rests on the sealed Gate-F0 arithmetic; the action half (expected free energy) is NOT yet built or sealed in DDNA, so the unity is held open on its action half ('built to be', never 'is').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_12_one_engine.html @ 35a0c64b3cf0 — sha256 02b1ec05397974ea — source

CBT Module 13 — A path through an uncertain future

A mind chooses whole paths through a branching, uncertain future — it can't see the tree, so it plans a little ahead, acts, learns, and re-plans. The oldest dilemma, explore vs exploit, falls out of expected free energy for free: raise one uncertainty knob and the min-G agent switches by itself, no explore/exploit dial anywhere.

The math
Score policies pi by their expected free energy G(pi) summed over the future; act by softmax(-gamma G(pi)) (gamma = precision, Module 15). Because G = risk + ambiguity, the epistemic half dominates under uncertainty (explore) and vanishes under confidence (exploit) — the balance auto-tunes, no separate exploration schedule. The policy machinery is NOT yet built or sealed in DDNA — standard active inference (exact G form in Module 14), held open ('built to run', never 'runs today').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_13_uncertain_future.html @ 35a0c64b3cf0 — sha256 6ac2fb05314e2189 — source

CBT Module 14 — The formula, by hand

G = risk + ambiguity, on the page and computed by hand. On a concrete cold-cabin choice, the reward-perfect sweater (G=0.60) LOSES to the uncertain-but-revealing stove (G=0.36) once ambiguity is added — the epistemic term flips the decision. A calculator, not a curve: you check the risk KL yourself.

The math
risk = KL(predicted outcomes ‖ preferred outcomes) — EXACT and checkable (risk_A=0, risk_B=0.6 ln(0.6/0.9)+0.4 ln(0.4/0.1)=0.311). ambiguity = expected likelihood entropy E_state[H(o|s)] — illustrative values (0.60 state-blind sweater, 0.05 revealing stove). G_A=0.60, G_B=0.36 -> min G picks the stove. Canonical: G(pi)=KL[Q(o|pi)‖C(o)]+E_Q(s|pi)[H[P(o|s)]]. DDNA's G term is NOT yet built or sealed — held open ('built to', never 'does').
Time
25–45 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_14_g_formula.html @ 35a0c64b3cf0 — sha256 e6b34f1249d66f9e — source

CBT Module 15 — Precision: how hard to commit

The last rung of Part II. Scoring ranks your options; precision (gamma) sets how hard you bet on the winner — decisiveness to doubt. Turn one dial over a FIXED set of G scores and watch the choice distribution sharpen onto the best (decisive) or flatten toward uniform (hedging): same scores, different sharpness.

The math
A mind acts out policies with P(pi) proportional to exp(-gamma G(pi)) — a softmax with inverse temperature gamma = precision. gamma -> infinity: all weight on the lowest-G policy (decisive); gamma -> 0: uniform (hedging). gamma is inferred, tracking how much to trust one's own scoring (world reliable -> raise; volatile -> lower). A neuromodulator label is ONLY ever a functional analogue — never the specific chemical, never a feeling. Precision over policies rides on expected free energy, NOT yet built or sealed in DDNA — held open ('built to tune', never 'does').
Time
20–40 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/cbt_module_15_precision.html @ 35a0c64b3cf0 — sha256 171e565d1dbe60d2 — source

Interactive labs

Standalone sandboxes beyond the course track — Bayes’ theorem, the POMDP machine, and the predictive-coding and generative-model builders — each a self-contained instrument.

Bayes Machine

Bayes' theorem as a physical machine: prior chips pour through likelihood gates and what lands in the tray is the posterior.

The math
P(h|e) = P(e|h)P(h) / P(e), run as countable chips rather than symbols
Time
10–20 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/BayesChips.html @ 35a0c64b3cf0 — sha256 517a24ca43131c77 — source

POMDP Machine

The discrete-time generative model behind every UNI agent: A, B, C, D matrices you can set by hand, then step and watch beliefs move.

The math
Hidden-state inference and expected free energy over policies in a partially observed Markov decision process
Time
15–30 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/active_inference_pomdp_machine.html @ 35a0c64b3cf0 — sha256 cfdb35a4f51851d8 — source

Free-Energy Forge

Equation 4.19 taken apart on a bench: every term of variational free energy shown, moved, and re-assembled.

The math
F = E_q[ln q(s) − ln p(o,s)] decomposed into energy and entropy, then into accuracy and complexity
Time
15–30 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/free_energy_forge_eq419.html @ 35a0c64b3cf0 — sha256 11ce5a59163b2011 — source

Laplace Tower

A predictive-coding hierarchy built floor by floor: prediction errors climb, predictions descend, precision decides who is heard.

The math
Hierarchical Gaussian generative models under the Laplace approximation — precision-weighted prediction error
Time
15–30 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/laplace_tower_predictive_coding_builder.html @ 35a0c64b3cf0 — sha256 e7c356a62b9d0c89 — source

Jumping Frog

The gentlest start here: one frog, two lily pads, and the whole idea of a generative model before any matrix is named.

The math
A two-state, two-observation generative model — the smallest POMDP that can still surprise you
Time
8–15 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/jumping_frog_generative_model_lab.html @ 35a0c64b3cf0 — sha256 969f03d91b4400c7 — source

Active Inference Atlas

The brain-shaped map: cortical circuits, predictive coding and neuromodulation located on one navigable atlas.

The math
Message passing between cortical layers as belief propagation; neuromodulators as precision control
Time
15–30 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/active_inference_atlas_educational_sim.html @ 35a0c64b3cf0 — sha256 b6578c98bae13820 — source

Anatomy of Inference

Figure 5.5 as a working studio: the full perception–action cycle traced through a living diagram.

The math
The perception–action loop of active inference, factor by factor
Time
15–30 minutes

Open the lab — a single HTML file, served from this site, runs in your browser.

byte-verified against learninglabs/anatomy_of_inference_studio.html @ 35a0c64b3cf0 — sha256 ab185a070ad2e826 — source

Live on the campus

These 6 labs run on the campus site, not here. Every link below is a declared destination, not a probe — this page is a static export and cannot honestly claim what is answering right now.

Precision Lab

Three precision dials — trust in the senses, trust in actions, commitment to a plan — steer a maze agent through visibly different behavioural regimes.

The math
Power-law precision on A and B matrices; policy temperature in π = σ(−G/T); EFE split into epistemic and pragmatic parts

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

developed in the operator's campus repository (private); the engine is a verified translation of the Workbench's Elixir POMDP engine — no source link is offered, because the repository it lives in is not public.

Echo Lab

Active inference with echolocation: sensing as an act the agent chooses to spend.

The math
Epistemic value of an active sensing action vs. its pragmatic cost

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

operator's campus repository (private) — no source link is offered, because the repository it lives in is not public.

Loop Lab

The math of stuck patterns: how a loop forms, holds, and breaks.

The math
Bifurcation structure of a belief–action loop under changing precision

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

operator's campus repository (private) — no source link is offered, because the repository it lives in is not public.

Heart Lab

The long-term cardio-renal loop as a control problem the body is always solving.

The math
Slow homeostatic regulation as inference over interoceptive states

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

operator's campus repository (private) — no source link is offered, because the repository it lives in is not public.

Cell Lab

An autopoietic service cell under active-inference test: a system that maintains itself or stops existing.

The math
Autopoiesis read as existence-preserving free-energy minimisation

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

operator's campus repository (private) — no source link is offered, because the repository it lives in is not public.

UNI·Sensorium

A program learning to read, one letter at a time — watched live as it happens.

The math
Sequential inference over character streams

NOT PROBED — the URL is a declared destination; a static build cannot honestly claim what answers right now

operator's campus repository (private) — no source link is offered, because the repository it lives in is not public.

Built, not yet hosted

These exist and are served from nowhere. They are printed rather than dropped, because a quietly shortened list is how an inventory starts lying.

The Bayes Museum — 50 exhibits

not hosted state as declared: built, verified self-contained, not yet deployed

a Next.js application that does not yet set output:'export'; its 50 exhibits prerender cleanly and carry no external calls, but the repository has no public remote, so there is nothing a citation could resolve to yet

What would change this: a public repository plus a one-line static-export config

Wondering how this connects to the rest of the estate? The hallway has one door per project, and the course walks these labs in teaching order.