Embodied intelligence, prediction and action

Active Inference Pong

A simple embodied agent must keep a paddle aligned with a moving ball. It predicts where the ball will cross the paddle line, compares candidate actions and selects the movement with lowest expected free energy.

1. The task

The agent does not need to memorise a teacher's response. It needs to infer the future sensory consequence of the ball's trajectory: where will the ball cross the paddle? Action then becomes a way of reducing expected mismatch between the paddle and the predicted crossing point.

$\text{prediction error} = y_{\text{crossing}} - y_{\text{paddle}}$

2. Interactive Pong agent

The dashed trajectory shows the predicted ball path. The horizontal marker on the paddle line shows where the ball is expected to cross. The agent evaluates up, stay and down, then moves according to the lowest expected free energy.

Predicted crossing 0
Selected action stay
Lowest expected free energy 0.00
Interpretation The paddle moves toward the predicted crossing point.

3. Expected free energy for paddle actions

In this simplified demo, each action is scored by the expected future mismatch between paddle and predicted crossing point, plus a small cost for unnecessary movement.

$G(a) \approx \lambda \left(y_{\text{crossing}} - y_{\text{paddle after }a}\right)^2 + c(a)$

Lower $G$ means the action is expected to produce better future evidence: the sensory outcome of the ball arriving near the paddle.

Prediction

Estimate where the moving ball will cross the paddle line.

Policy evaluation

Score up, stay and down by their expected future mismatch.

Precision

Controls how strongly the agent commits to the best action.

Embodiment

Action changes future sensory input, not just internal belief.

4. Why this is active inference

The agent is not just reacting to the current ball position. It uses a simple generative model of ball motion to predict a future sensory state. It then chooses an action that is expected to make future sensations match preferred outcomes: the ball arriving where the paddle can intercept it.

Observe
ball position and velocity
predict
Imagine policies
up, stay, down
score
Act
move paddle
sample