An embodied nervous system
The articulated animal
Follow sensory evidence through conductance-based inference and descending motor control, as genuine Hodgkin–Huxley spikes recruit muscles and move an articulated body.
Energy depleted
The animal's energy reserve has reached zero, so this run has ended and its recorded state is retained for inspection or export. Restart the animal to begin a new run with a replenished reserve.
Body and environment
An articulated animalOpposing muscles bend the three joints, while the body's interactions with its surroundings determine how those movements become travel.
Food is collected when the head centre enters a patch's amber capture ring, adding up to 16 percentage points to the energy reserve before the consumed patch is replaced. Reaching zero energy ends the run, while its recorded state remains available for inspection and export. The energy ledger is an abstract task reserve with rates measured per simulated second, while the HH currents retain their separate electrical units.
- Energy reserve
- —
- Food collected
- —
- Selected policy
- —
- Motor spikes
- —
Where the prediction error flows
Conductance inferenceSensory and prior pathways contribute currents towards different predicted voltages, with their conductances setting how strongly each influences the estimate.
Learning how this body responds
Adaptive response modelThe animal compares the joint state it predicted with the state it subsequently senses, using this residual to update its estimate of how opposing muscle activation moves each joint. These estimates inform its predictions and rollouts, while the neural membrane equations and supplied body layout retain their defined roles.
Waiting for learning measurements
- Recent adaptive RMSE
- —
- Recent fixed-model RMSE
- —
- Parameter updates
- —
| Joint | Retention a | Response b |
|---|
qnext = a q + b(mleft − mright), with estimates shown ± one parameter standard deviation. RMSE describes recent one-step prediction errors from the ongoing run.
Actual membrane voltage
Motor neuron 0Each trace records the selected neuron's integrated membrane dynamics, so its action potentials arise from sodium, potassium and leak currents while the separate raster preserves the timing of spikes across the motor circuit.
Voltage and spike times share the simulation clock; the raster shows recent recorded events.
Predicted movements
Expected free energyEach candidate trajectory is evaluated for its predicted outcomes and information gain, with the selected policy supplying the next descending movement expectations.
Blocked forecasts stop at perceived walls; the full scored paths remain in the export.
| Policy | G | Info. | P |
|---|
Change the mechanism
Live perturbationsChange a parameter and follow its effects through neural activity, sensory inference and the movement of the body.
Behaviour and internal state
Inside this animal: from conductance to behaviour
This model connects a small set of sensory observations to conductance-based state estimation, explicit policy evaluation and a spiking motor circuit, allowing us to follow how an electrical mismatch can influence a muscle and change the evidence available on the next step. The guide separates these mechanisms so that we can inspect what each contributes, including the parts represented by graded membrane dynamics and the parts implemented algorithmically.
The complete sensing and movement loop
The animal's visual system supplies a small set of geometric features, while contact receptors and proprioception provide information about encounters and body configuration. Six graded compartments integrate this evidence with prior predictions, representing target direction, proximity on the two sides, head bend and body speed through their membrane voltages.
The resulting estimates and visual range cues inform fourteen candidate policies whose predicted consequences are evaluated through expected free energy, spanning ten forward travelling-wave swimming gaits, two reverse gaits and two asymmetric pivot templates. The selected policy supplies a trajectory of expected joint states that local motor circuitry compares with proprioceptive feedback, producing currents that affect the six HH motor neurons and the muscles recruited by their spikes.
When food is visible, policy preferences favour proximity to the patch while accounting for contact risk, effort and the predicted ability to track the supplied joint targets. Head direction still affects the visual likelihood and expected information, with no separate preference for centring the food in the head's view.
Alongside these graded estimates, the animal keeps a local map of food-presence probabilities positioned through its own motion sensing, with genuinely empty visual observations reducing those probabilities through Bayesian updates. During search, expected free energy values both the prospect of finding food and the information available in uncertain areas, while retaining what has already been learned about inspected empty space.
This discovery map is an explicit algorithmic belief and memory component receiving local visual ranges and own-motion signals, while visible-food approach continues through the existing six graded compartments and HH-actuated gaits. Search policies are evaluated against the accumulated map belief, so repeated views of the same empty space do not receive a renewed food or wall information bonus.
A selected policy is held for one complete 0.9 Hz gait cycle, approximately 1.11 seconds, with a new choice made at a natural phase boundary so that the movement forecast corresponds to a physically completed cycle. Sensing and food-memory observations continue every 20 ms during this commitment, while the HH motor equations retain their 0.05 ms integration step.
Search rollouts extend 84 simulated seconds, compared with eight seconds when food is visible, allowing approximately a quarter-turn of the calibrated pivot to be evaluated for the observations it could reveal. The supplied gait motion means are measured through the actual HH-actuated body, linking these approximate forecasts to the circuit and mechanics used during movement. These approximate forecasts retain signed forward and lateral motion in the proprioceptive body frame, obtain future head orientation from predicted joint shape and apply a five-unit contact-risk threshold consistent with the physical body capsule, including the lateral motion produced by the pivot templates. Known-wall feasibility prevents a forecast from earning food-discovery or information value beyond an impossible crossing of a perceived barrier.
This first nervous system contains six graded inference compartments and six spiking motor neurons, with explicit algorithms for policy evaluation, food-discovery memory and response-model learning. The distinctions matter because they make it possible to test each proposed connection between physiology and inference without assuming that every computation has already been implemented by a spiking network.
How conductance becomes a prediction-error term
Evidence, confidence and electrical influence
Each pathway contributes a current proportional to the difference between its effective equilibrium voltage and the compartment's current estimate, with its conductance determining the strength of that influence. When voltage encodes the estimated state and conductance is proportional to precision, the sensory current is proportional to the familiar precision-weighted residual πᵧ(y − μ).
Under the model's Gaussian and linear-encoding assumptions, the combined membrane dynamics approach the precision-weighted mean of the observation and prior, providing an explicit correspondence between a current balance and a defined inference calculation.
Why opposing currents can remain visible
The observation and prior need not agree, so their currents can remain individually nonzero while cancelling at the compartment's equilibrium. The current panel therefore plots sensory and prior contributions separately, allowing a settled estimate to be distinguished from a lack of input.
The displayed posterior variance is calculated from the model's combined precision, which provides a useful uncertainty readout without implying that the voltage trace itself is sampling the full posterior distribution. The reduced inference objective should fall during a fixed-input settling test, although it can increase when the moving animal receives new evidence.
How descending expectations recruit real spikes and muscles
Each selected policy supplies joint targets for a forward swim, a reverse swim or an asymmetric pivot, and their expected configuration is compared with the body state returned by proprioception. An E/I conductance comparator converts the bounded mismatch into input to the opposing motor neurons, making it possible to change the influence of feedback and observe how that changes spiking and movement.
The reverse gaits change the direction of the travelling wave, allowing withdrawal to arise through the same HH motor neurons, muscles and drag mechanics as forward swimming. Their selection follows the ordinary EFE comparison, so a reverse movement is favoured when its predicted withdrawal or resulting view is useful within the same evaluation used for the other candidates.
Action potentials arise from the motor neurons' HH membrane equations, with emitted spikes contributing to neuromuscular activation and inhibitory conductance in the opposing neuron. The resulting muscle forces bend the articulated body, whose movement through resistive drag supplies the next visual and proprioceptive observations, completing the physical loop.
The voltage selector and overlay allow the six recorded motor waveforms to be examined together, while the raster preserves their actual event times. Display highlights briefly persist so that events remain visible, although this visual hold does not change the recorded duration or timing of an action potential.
What the response model learns from its own movement
The adaptive model predicts the next joint state from the current state and the difference between opposing muscle activations, then uses the discrepancy between its prediction and the subsequent observation to update its response parameters. This is online system identification from sensory prediction errors, with the learned response informing subsequent model predictions and policy rollouts.
The retention term a describes how much of the present joint state persists, while the response term b describes how strongly opposing muscle activation changes that state over one model step. The learning panel shows these estimates and their parameter uncertainty alongside recent prediction errors, with a fixed reference model providing a comparison under the same ongoing conditions.
Freezing updates leaves the current learned model available to the animal, allowing its behaviour to be inspected without continuing to change its parameters, while restarting begins a new animal and parameter history with the current perturbations and learning setting retained. A normal restart preserves the play/pause state, while restarting an energy-depleted run resumes the animal with a replenished reserve. Because the displayed RMSE is calculated from recent one-step predictions during the ongoing run, it describes online prediction performance rather than performance on an independent held-out test.
The adaptive response model is an explicit learning algorithm, while the neural circuit contains fixed equations and supplied connections. Changes in its parameters should therefore be described as learning the body's response, without interpreting them as STDP, the development of new neurons or a fully neurally implemented world model.
| Level | Implemented mechanism | What it allows us to inspect |
|---|---|---|
| Sensory evidence | Geometric visual features, contact and proprioception | How noisy and incomplete observations change inferred states |
| State estimation | Six graded compartments with E/I conductance pooling | Voltage-encoded estimates and precision-weighted mismatch currents |
| Policy evaluation | Explicit EFE scoring of ten forward swims, two reverse swims and two pivot templates | The influence of preferred outcomes and expected information gain |
| Motor system | Six HH motor neurons, reciprocal inhibition and neuromuscular activation | How excitability, feedback and inhibition change muscle recruitment |
| Embodiment | Three joints, opposing muscles and resistive drag | How neural output becomes motion and new sensory evidence |
| Response learning | Online estimation from observed movement residuals | Changes in predictions and rollouts as the body's response is estimated |
Membrane voltages, spike times and trajectory samples are recorded by the simulation, while the diagrams provide an explanatory view of the model's supplied structure.