Predictive and Generative Objectives › Multi-step and Overshooting Losses
World Models HandbookAll chapters Predictive and Generative Objectives › Multi-step and Overshooting LossesOne section · Sections in this chapter5 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
A model with low teacher-forced one-step error can still produce poor recursive rollouts. In one-step training, each target is predicted from a measured or inferred state anchored to data; in open-loop use, each later transition consumes a model-generated state. Multi-step and overshooting losses expose the objective to that recursive mode.
In teacher-forced one-step training, an error at one prediction does not become the next input. In a free-running rollout it does, so the model can visit inputs that are uncommon under the data-conditioned training distribution. Multi-step training starts from a data state and feeds predictions through several transitions before comparing with later targets. This does not eliminate distribution shift, but it trains directly on a bounded version of the recursive computation used at deployment.
The Compounding Error Problem
Suppose the transition map is locally -Lipschitz and introduces at most of one-step model error over the states visited by both rollouts. Starting from the same state, the rollout error obeys
where:
- : state error after model steps
- : bound on local transition mismatch
- : bound on how much the transition amplifies a state perturbation
- : rollout horizon
- : summation index over rollout steps
Intuitively, each rollout step can amplify the error carried from the previous step by up to a factor and then adds at most of fresh one-step error, so the horizon- error is the sum of geometric terms. The bound therefore grows exponentially when (perturbations are amplified faster than they are injected), linearly when , and approaches the steady-state value when (fresh error is injected but prior error is damped away). It applies only while the stated local bounds continue to hold; leaving the covered state region can make the model error uncontrolled.
The regimes show how stability changes the consequence of a fixed local error bound. When , the geometric bound saturates at . Near , it grows approximately linearly over the plotted horizon. When , the upper bound grows geometrically. Greater one-step accuracy still reduces the bound in every regime; zero local mismatch would make it zero. Expansive dynamics amplify any nonzero residual more rapidly. The guarantee also applies only while both rollouts remain in the region where the Lipschitz and mismatch bounds hold.
The three regimes behave very differently, and evaluating the same closed form under three gains makes the contrast visible at a glance.
## Deterministic sweep of the compounding-error bound e_H <= eps * sum_{k=0}^{H-1} rho^k.
## eps is a fixed per-step error budget; the horizon runs from 1 to H_bound steps.
eps = 0.01
H_bound = 20
horizons_bound = np.arange(1, H_bound + 1)
def error_bound(rho):
if np.isclose(rho, 1.0):
return eps * horizons_bound.astype(float)
return eps * (rho**horizons_bound - 1.0) / (rho - 1.0)
bound_contract = error_bound(0.8) # contracting: error saturates
bound_neutral = error_bound(1.0) # neutral: error grows linearly
bound_expansive = error_bound(1.1) # expansive: error grows exponentially
There is also a subtler failure. Even if the model's one-step error is small over the data-supported state region, a predicted state may wander into regions rarely seen during training. Behavior there is weakly constrained by data and depends on inductive bias. This is a distribution-shift problem, and it motivates explicit rollout-consistency objectives and out-of-distribution evaluation.
k-Step and Scheduled Multi-Step Losses
The simplest fix is to train on multi-step rollouts. Given a trajectory of length and a horizon , the k-step objective is
where:
- : the k-step objective
- : training distribution over trajectories and actions
- : start time; the expectation is over valid start times
- : rollout horizon
- : nonnegative weight controlling horizon emphasis
- : model prediction after rolling forward steps from the observed state at , using recorded actions and feeding predicted states back into later transitions
- : target observation at time
- : rollout step index
- : observation and action sequences in the training distribution
The prediction is obtained by rolling the model forward from the observed state at for steps, using the recorded actions and feeding predicted states back into later transitions. The nonnegative weights control the horizon emphasis. Setting and for recovers one-step training; weights all included horizons equally; and with discounts distant errors while leaving the one-step weight at one.
These three settings are easier to compare when drawn on the same axis, so the next cell computes the weight vectors for a rollout horizon of 15 steps.
## Deterministic horizon-weight vectors for a K = 15 rollout objective.
K_sched = 15
k_sched = np.arange(1, K_sched + 1)
w_one_step = np.where(k_sched == 1, 1.0, 0.0)
w_uniform = np.ones(K_sched)
w_geometric = 0.7 ** (k_sched - 1)
Two implementation details matter. First, a recursive -step loss normally starts from a data-conditioned state and then feeds model predictions into the remaining transitions. Supplying a ground-truth state at every step reduces the computation to a sum of teacher-forced one-step terms rather than testing recursive behavior. Scheduled sampling [@bengio2015scheduled] mixes data and model-generated inputs according to a schedule, although the resulting training distribution and estimator require care. Second, differentiating through transitions generally increases compute and activation memory with the unroll length; checkpointing, truncation, and model structure change the exact factor. The useful is task- and budget-dependent.
The weight schedule states which horizons matter to the training criterion. If a planner will use long rollouts, discounting distant errors almost to zero leaves that use weakly supervised. Uniform weights give distant targets equal scalar weight, but those targets can have larger, noisier gradients and destabilize optimization. A geometric schedule is one compromise, not a universal default. Choose both and using validation at the deployment horizons, while accounting for the additional optimization cost.
Overshooting
The latent overshooting objective introduced with PlaNet asks a multi-step latent prior, rolled forward without intermediate observations, to match posterior latent-state distributions inferred at future observations [@hafner2019planet]. For a start time and overshooting distance , a representative term is
where:
- : overshooting loss term at distance
- : the -step predictive prior obtained by composing the transition model
- : observation-conditioned posterior used as the target distribution
- : Kullback-Leibler divergence
- : overshooting distance
- : start time
The KL direction trains the open-loop prior to cover states supported by the posterior. An implementation can average this term over selected distances and start times, often with horizon-dependent weights. Later Dreamer work retained closely related latent consistency terms, although the exact objective and whether overshooting helps are implementation-dependent.
The distinctive feature of overshooting is that it supervises a multi-step prior against a posterior inferred at a future observation. The composed prior advances without intermediate posterior corrections. With and gradients allowed into , missing probability mass where the posterior places mass is penalized strongly. Actual gradient routing matters: implementations may stop gradients through one side, balance directions, or update both distributions, so the written KL direction alone does not determine which network moves.
Overshooting has its own tradeoffs. A deterministic prediction trained with squared error can approach the conditional mean of a multimodal future, producing an average that may not be plausible. Representing aleatoric alternatives requires a conditional distribution, for example through stochastic latents, mixture outputs, autoregressive tokens, or another probabilistic parameterization. Stochasticity and Uncertainty develops this issue further. DreamerV2 and DreamerV3 use discrete stochastic latent variables, but that is one design among several.
The averaging problem follows from using squared error on a multimodal conditional target. With two equally likely branches, the conditional mean minimizes expected squared error even when that mean lies between plausible outcomes. A probabilistic model can instead assign mass to both branches. Its output parameterization and proper scoring rule must therefore be designed together with the rollout objective.
Latent-Space Multi-Step Losses
If the model has a target encoder and a latent state, the multi-step loss can be
where:
- : latent-space multi-step loss
- the expectation is over data trajectories and valid start times
- : model prediction after action-conditioned latent transitions
- : target-encoder representation of the future observation
- : stop-gradient operator, preventing gradients through that target
- : rollout horizon
- : horizon weight
- : training distribution over trajectories and actions
- : observation and action sequences
- : start time
- : rollout step index
The target encoder may be frozen or updated slowly; if it moves during training, its update must be controlled. Latent predictions avoid solving pixel reconstruction at every horizon, but their meaning depends on the quality and stability of the target representation.
The stop-gradient makes the target representation fixed for this loss update, so the prediction branch moves toward it rather than both branches moving together. It does not by itself rule out constant targets. Target initialization, update rule, normalization, architectural asymmetry, and any variance regularization determine whether the representation remains informative. A rapidly changing target can also turn the objective into a moving-target problem.
Rollout-Length Tradeoffs
Choosing involves a three-way tension:
- Short is cheaper and exposes the model to only a limited prefix of its own errors.
- Long exposes training to more of the recursive computation used by a long-horizon planner, but costs more and can yield noisy far-horizon gradients or averaged point predictions.
- A growing or sampled is one possible compromise, but it changes the training distribution and should be validated.
Whatever the choice, evaluate at the intended deployment horizon. A model trained only on three-step recursive losses can still work at thirty steps when its learned dynamics are accurate and stable, but the longer use carries a larger extrapolation risk that short-horizon metrics will not reveal.