Planning with Expected Free Energy in Learned World Models

Wouter W. L. Nuijten, Bert de VriesarXiv 2026

TL;DR

Teaching an AI agent to solve tasks from scratch when rewards are virtually nonexistent is like asking someone to find a light switch in a pitch-black room: random flailing rarely works, and traditional exploration bonuses require finicky, task-specific tuning. Drawing from neuroscience, this paper shows that an agent can learn a neural world model from scratch and solve sparse continuous control tasks simply by minimizing its Expected Free Energy (EFE). Using a single configuration across all tasks—with no value function, no policy network, and no per-task exploration tuning—the agent naturally explores what it doesn't understand and exploits what it does, learning to solve classic physics tasks in just ten episodes.

What Problem Does This Paper Address?

In reinforcement learning (RL), an agent learns by trial and error. When rewards are sparse—meaning the agent gets zero feedback until it stumbles directly onto the goal—learning grinds to a halt. Standard fixes inject randomness into actions or bolt on "curiosity" bonuses that reward visiting unfamiliar states. However, balancing a curiosity bonus against the actual task reward requires tuning a weight that changes wildly from task to task.

Active inference, a neuroscience-inspired framework, offers a cleaner path. Instead of maximizing rewards, agents minimize Expected Free Energy (EFE)—a single mathematical objective combining preferences (achieving desired outcomes) and epistemic value (gaining information to reduce model uncertainty). Until now, pure EFE planning only worked when researchers handed the agent a pre-built model structure. When researchers tried using learned neural networks instead, they usually had to drop the information-gain terms, rely on discrete action searches, or fall back on RL-style policy networks. Whether pure EFE minimization could guide continuous control inside a generic, learned world model from scratch remained an open question.

Methods

The authors combine a clever neural architecture with direct, gradient-based trajectory optimization:

  • Bayesian Last-Layer World Model: The agent learns a latent state-space model (transitions and observations) from scratch using standard multi-layer perceptrons, plus an amortized filter to infer the current hidden state. Crucially, only the final linear layer of the transition and observation networks is Bayesian (using matrix-normal beliefs over weights). While standard neural networks are notoriously overconfident on unseen data, this Bayesian last layer provides a clean, closed-form equation for uncertainty—and thus exact information gain—at the cost of a simple matrix quadratic form.
  • Direct Gradient Planning on $F_{\text{EFE}}$: There is no actor network or value function. At every step, the agent imagines $N$ future trajectories over a short horizon and uses gradient descent (via backpropagation through the world model) to optimize a parametric action sequence.
  • Dual Epistemic Drive: The planning objective naturally rewards gathering information about both observation weights and latent transition dynamics. The balance between exploring and achieving the goal is set by the scale of the agent's preference prior—and remarkably, one fixed scale works across all tested environments.

Datasets

Because this is an online control paper, there are no static datasets; the agent generates its own data starting from zero experience. It is evaluated on four modified OpenAI Gym continuous control benchmarks with sparse rewards (reward is flat everywhere except right at the goal):

  1. Pendulum swing-up (300 steps/episode)
  2. Mountain car (400 steps)
  3. Acrobot (500 steps)
  4. Cart-pole swing-up (400 steps)

Unlike standard Gym setups that end the episode the moment the goal is touched, Mountain Car and Acrobot are run without termination, forcing the agent to actively stay in the goal region.

Key Insights and Ideas

  • Curiosity isn't optional when horizons are short: If the goal is further away than the agent's planning horizon, the preference landscape looks completely flat. Without epistemic (information-seeking) terms, the planner has zero gradient and freezes near the starting line—performing worse than a random policy!
  • Automatic shift from scientist to performer: Early on, unvisited states (like high angular velocities on the pendulum) shine brightly with potential information gain, pulling the agent in to pump energy into the system. Once the model understands the physics, uncertainty drops across the board, and the goal preference seamlessly takes over the plan.
  • One scale to rule them all: While the authors show mathematically that the preference prior's scale acts like an exploration weight, the exact same configuration and scale worked across all four problems, whereas RL exploration bonuses required bespoke tuning per environment.

Key Results

Evaluated at the 10th episode (just 3,000 to 5,000 environment steps from scratch), the agent measures the fraction of steps spent inside the goal region:

  • Outperforming RL baselines: The agent keeps the pendulum upright 75% of the time, the acrobot tip above the line 21%, and the cart-pole upright 89%. The strongest baseline—PETS (an ensemble model-based planner) equipped with an exploration bonus individually tuned for each task—reached only 27%, 13%, and 42% on those same tasks. Model-free SAC and model-based MBPO trailed even further behind in this low-data regime.
  • Ablation proof: Stripping away the epistemic terms caused the agent to score 0.00% on Pendulum, Mountain Car, and Acrobot in episode 10 (only succeeding on Cart-Pole because random motions easily flip the light pole into the goal region).
  • Stability: Extending runs to 100 episodes showed no degradation, with goal-time rising to 82% on Pendulum and 90% on Cart-Pole.

Limitations and Future Work

The authors frame this clearly as a proof of concept rather than a massively scalable system:

  • Batch retraining: The world model only updates every 100 steps by retraining on all past data. Surprising observations don't update the agent's beliefs until the next training pause. Updating the conjugate Bayesian last layer online after every step is an immediate next step.
  • Smoothness assumptions: The model assumes smooth dynamics and uniform state noise. In a test where hard walls were placed close to the cart-pole, every tested method failed because smooth networks struggled to model sharp, inelastic collisions.
  • Double-counting novelty & short horizons: Due to simplifying factorization assumptions, a 10-step plan visiting an unknown region counts that region's novelty 10 times, even though the first visit teaches most of the lesson. Joint trajectory information gain and hierarchical active inference (to handle distant goals beyond short planning horizons) are key targets for future work.

Summary updated

BibTeX
@misc{nuijten2026planning,
  author = {Wouter W. L. Nuijten and Bert de Vries},
  title = {{Planning with Expected Free Energy in Learned World Models}},
  year = {2026},
  eprint = {2611.36588},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.36588},
}
Figure