Skip to content
The Daily Triptych233 / 365
Agreement near real data, divergence away from it

A schematic two-dimensional slice of a state space. Real visited states are shown alongside the next-state predictions of four ensemble members, queried once close to the data and once far from it. Positions are illustrative, not measured.

II · THE IDEA · ARTIFICIAL INTELLIGENCE

Model-Based RL and the Limits of a Learned Simulator

model-based reinforcement learning · MBPO, 2019; Bayesian REX, 2020 · ensemble disagreement as an uncertainty signal

▶ Listen · narrated

A learned model of the world lets an agent practise for free. But each prediction feeds the next, so errors grow, and after 20 steps the imagined world may break the laws of physics.

At a glance

The question
How far into a learned model's predictions to trust it
Core device
An ensemble of probabilistic dynamics models
Rollout style
Short branches begun from real, stored states
Policy learner
Off-policy, fed a mixture of real and imagined data
Second axis
Uncertainty over the reward, not the dynamics
Known limit
Ensemble spread is not a guaranteed error bar

Weather forecasters run several computer models at once. When all of them predict rain tomorrow, the forecasters feel confident. When one says rain, another says sun and a third says snow, the honest answer is that nobody knows — and the further ahead you look, the more the models drift apart. A learning agent can use the same trick on its own predictions.

The agent builds a small model of how its world behaves: given the current situation and an action, what happens next. It can then practise inside that model for free, instead of practising in the real world, which is slow and sometimes breakable. The catch is that each prediction becomes the starting point for the next, so small mistakes grow. Ten steps in, the imagined world may have drifted somewhere impossible — and an agent that learns to win there has learned to exploit a flaw, not to act well.

The fix has two parts. First, keep the imagined runs short, and start each one from a moment the agent genuinely lived through rather than from the beginning of an episode. Second, train several copies of the model instead of one, and watch how much they disagree. Where they agree, the data was informative and the prediction is probably usable. Where they scatter, the agent is in territory it has never really explored, and it should not build plans on what it sees there.

Look closer

  1. Where the members agree, and where they part

    Train several neural networks to predict the same thing — given this state and this action, what state comes next — but start each from a different random initialisation and show each a differently resampled slice of the collected experience. In regions the agent has visited often, all of them converge on nearly the same prediction. In regions it has barely touched, each network extrapolates in its own direction and the predictions fan out. That fanning out is the usable signal, and it costs nothing beyond the expense of training more than one model.

  2. Two different kinds of not knowing

    Each member of the ensemble is probabilistic: it outputs not a single next state but a distribution, a mean prediction plus a spread. That spread describes noise the agent cannot remove — a slippery surface, a sensor that jitters. The disagreement between members describes something else: ignorance that more data would cure. Keeping the two apart matters, because only the second should make you shorten a rollout. Noise that is genuinely in the world will not go away no matter how much the agent explores.

  3. Short branches, not long dreams

    The characteristic move in MBPO is to refuse long imagined trajectories altogether. Instead of starting from an initial state and simulating a whole episode, the method picks states the agent has actually visited — real states, stored in the replay buffer, which is simply the log of past experience — and runs only a few predicted steps forward from each. Because the branch begins on the true data distribution, the model has a short window in which to drift. Many such short branches give the policy a great deal of training data while limiting how far any single fabrication can travel.

The story

A dynamics model is a learned function with one job: given the situation the system is in now, and the action it takes, predict the situation that comes next. Fit that function well and you own a simulator that runs for nothing. The agent can practise inside it over and over without touching the real robot or the real environment — nothing wears out and nothing breaks. That is the standing promise of model-based reinforcement learning, and it explains why the field keeps returning to the idea despite repeated disappointment.

The disappointment has a precise mechanism, and it is worth walking through slowly. Suppose the model's first prediction is slightly wrong — a joint angle off by a fraction of a degree. That slightly wrong state is fed back in as the input for the second prediction. But the model was trained on states the agent actually visited, and the slightly wrong state sits just outside that training data, where the model is less reliable. So the second prediction is wronger than the first. The second output becomes the third input, further from the data still. The error does not merely add up step by step; each error pushes the model into territory where it makes larger errors. Run the loop for 20 steps and the imagined trajectory can arrive somewhere real physics forbids — a limb passing through the floor, energy appearing from nowhere.

Now add the second ingredient of the failure. The policy — the decision-making rule the agent is training — is being optimised to score well inside this simulator. If the simulator has a region where it wrongly reports high rewards, optimisation will find that region, because finding high-scoring regions is exactly what optimisation does. The agent ends up expert at exploiting a bug in its own imagination, and useless in the world.

So the practical question is not whether to use a learned model but how far to run it before the imagined data stops helping the policy and starts poisoning it. The 2019 paper When to Trust Your Model, which introduced the method known as MBPO, gives one clean answer: keep the imagined stretches short, and start them from moments that really happened. The agent keeps a replay buffer — simply a stored log of everything it has experienced. The method picks a real state from that log, lets the current policy choose an action, asks the model what happens next, and repeats only a handful of times before stopping and starting afresh from another real state. Because every branch begins on solid ground, the model has only a short window in which to drift. And because the branches are cheap, the agent can grow a great many of them, producing a large volume of training data in which no single fabrication travels far.

That data feeds an off-policy learner — an algorithm, such as a soft actor-critic, that can learn from experience it did not generate itself. It trains on a mixture: real transitions from the environment, and a much larger quantity of these short imagined ones.

Short horizons alone are still a guess. What makes the discipline principled is the ensemble. Train not one dynamics model but several, each starting from different random initial weights and each shown a differently resampled slice of the same experience. Then compare their predictions. In situations the agent has visited often, the data pins all of them down, and they give nearly the same answer. In situations it has barely touched, the data constrains nothing, so each network falls back on its own inductive bias — the kind of pattern its structure prefers to fit — and the predictions fan out. The size of that fan measures how little the data said about this situation, and it costs nothing beyond the expense of training more than one model.

Each individual member is itself probabilistic: it outputs not a single next state but a spread of possibilities. That spread describes noise genuinely in the world — a slippery surface, a sensor that jitters — which no amount of exploring will remove. The disagreement between members describes something different: ignorance that more data would cure. Keeping the two apart matters, because only the second is a reason to shorten a rollout.

The disagreement signal can be used in at least three ways. Sample a different member at each imagined step, so a path through uncertain territory becomes visibly noisy rather than confidently wrong, and the policy learns not to rely on it. Subtract a penalty from the imagined reward wherever the members scatter, making unfamiliar states unattractive by construction. Or watch the scatter grow along a branch and cut the branch when it crosses a threshold. All three follow the same logic: disagreement among equally well-trained models stands in for the true error, which cannot be measured directly, because measuring it would require the ground truth the agent does not have.

Dynamics are not the only thing an agent can be wrong about. The second paper here, on fast Bayesian reward inference from preferences, applies the same style of reasoning to the goal itself. When a reward function is inferred from human comparisons — this attempt was better than that one — many different reward functions fit the same comparisons equally well. Rather than committing to a single best guess, the method keeps a whole distribution of plausible rewards, which allows a statement of the form: under most of the goals consistent with what the human said, this policy performs at least this well. That is a stronger and more useful claim than a good average, and it is the claim you want before deploying an imitation-trained system anywhere consequential.

Put the two papers together and the picture is symmetrical. An agent can be wrong about where its actions lead, and wrong about what it is being asked to achieve. In both cases the remedy is the same: hold several hypotheses at once, and let their disagreement decide how boldly to act.

Why it mattered then

For most of the 2010s, model-free reinforcement learning — learning a policy directly from real experience, with no simulator in the loop — was the dependable choice. Model-based methods had a reputation: they learned quickly at first, then stalled below their model-free rivals. The usual diagnosis was compounding model error — the imagined data was good enough to start the learning and not good enough to finish it. Two ideas arriving together changed the arithmetic. Probabilistic ensembles supplied a cheap, usable signal for where a model should not be trusted. And off-policy learners could absorb enormous quantities of imagined experience without the instability that had wrecked earlier attempts. When to Trust Your Model, published in 2019, is one of the clearest statements of the resulting recipe: do not run your imagination further; run it from more places. The title did as much work as the method. It moved the field's question from whether learned models work to the narrower, answerable question of when.

Why it matters now

The same problem now appears wherever a system is trained against a learned stand-in for reality rather than reality itself, which is most places. A policy optimised inside a learned world model; a language model tuned against a learned reward model; a controller trained in a simulator fitted to logged data. In every case there is an approximation that is accurate near the data it came from and unreliable away from it — and sustained optimisation pressure will find the unreliable places, because that is where the approximation pays rewards the real world would not. Ensembles endure as a remedy because they are simple enough to actually get used: train several copies, measure their disagreement, treat disagreement as a reason for caution. No new theory, no special architecture — only a linear increase in compute. The reward-side version matters just as much. When a goal is inferred from human feedback, many goals fit the feedback equally well, and knowing the range of them is the difference between a policy that is probably fine and a policy about which you can make a bounded claim. Uncertainty calibration, in both senses, is less a technique than a habit: build the system so that not knowing produces restraint rather than confident nonsense.

The surprising detail

The reasoning behind the ensemble trick is quietly circular, and it works anyway. At the moment you need an error estimate, no ground truth exists — if you knew the true next state, you would not need the model. So the method substitutes a proxy: several models trained on the same data, differing only in their random starting points and their resampled slices of experience, and the degree to which they part company. This is not a calibrated error bar. It measures how weakly the data constrained the answer, not how wrong the answer is. Members that share an architecture share a bias about what sensible extrapolation looks like, so an entire ensemble can be confidently wrong together. The field uses the signal because it is cheap, because it correlates with error often enough to help, and because the alternative is no signal at all.

What is disputed

Ensemble disagreement is a heuristic, not a bound. Nothing guarantees that the spread between members is proportional to the true prediction error, and members sharing an architecture can be wrong in the same direction at once. The choice of how many members to train, how many imagined steps to take, and how heavily to penalise disagreement is largely empirical, tuned per environment, and results reported on one benchmark family do not transfer reliably to another. The Bayesian reward work offers stronger formal statements, but they are conditional on the assumed model of how humans express preferences, which is itself an approximation.

Remember this

An ensemble cannot tell you where your model is wrong. It can tell you where the data failed to pin the answer down — and that is close enough to be worth acting on.

Test yourself

You penalise imagined rewards in proportion to your ensemble's disagreement, and the agent stops exploring almost entirely. What has gone wrong conceptually, and what does that reveal about the two kinds of uncertainty?

Go deeper

Image: Original diagram, The Daily Triptych. Licence: Original work. Source.

← Back to day 233