Compositionality and Systematic Generalization › Out-of-Distribution Composition
World Models HandbookAll chapters Compositionality and Systematic Generalization › Out-of-Distribution CompositionOne 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
We now have the vocabulary to be precise about what "out of distribution" means for world models, because not all distribution shift is the same kind of problem. Lumping them together leads to bad diagnosis and bad remediation: a team that treats a cheap recombination failure as if it needed new primitive learning will waste data, and a team that expects recombination to solve a novel structure will ship a silently broken model. The taxonomy below is the diagnostic instrument.
A Taxonomy of Compositional Shift
Consider a model trained on a set of worlds drawn from . The following situations require different responses:
- Novel recombination: each mechanism value was seen during training, but a particular combination was not (the mug on the new counter). No world-specific learning is needed once the relevant component functions are adequately identified on the state-action support required by the new pairing and the composition rule is valid. If those conditions hold, failure suggests a factorization or composition problem; without them, insufficient support, excitation, estimation, or optimization remain alternative explanations.
- Novel instance within a known class: a new object that is recognizably a mug but with a different handle. Here generalization must come from the representation abstracting away instance details, which is the concern of Part III's chapters on sufficient state and object-centric representations. The relevant question is whether the representation has discarded the details that do not matter (decorative variations) while retaining the ones that do (mass distribution, handle geometry that affects grasping), a judgment that only a sufficient-state analysis can make.
- Novel mechanism parameters: a continuous mechanism (friction, mass, elasticity) takes a value outside the training range. A physically meaningful parameter supplies an ordered extrapolation axis that an opaque categorical embedding lacks, but predictive accuracy still depends on the functional form, regularity, and training support. Conditioning on a friction coefficient of gives the model a notion of direction beyond a training range of through ; it does not guarantee a correct prediction there.
- Novel structure: a new relation or a new way for mechanisms to interact that cannot be expressed with the current vocabulary and composition rule. A new object class is structurally novel only if its relevant properties or mechanisms cannot be represented by existing primitives. Recombination alone cannot cover a genuine vocabulary gap; the model needs richer primitives or structural revision. Uncertainty estimates and mechanism-level diagnostics can help flag such cases, but no generic method guarantees detection of every novel structure, so deployment needs explicit abstention and data-collection policies.
The practical lesson is that "OOD" is not one problem. Diagnosing which kind of shift you face tells you which test or remedy is appropriate. A useful habit is to write the shift in mechanism notation before reacting to it: if the new situation is a point in with familiar coordinates, recombination is plausible only after checking support, identification, and the composition rule; if it is outside that space, existing primitives alone do not determine the answer.
A factorized architecture makes a claim about the world: that mechanisms are separable and recombination is valid. When that claim is materially false, invalid compositions can produce confident, silent errors if the model lacks corrective interaction terms, calibrated uncertainty, or effective diagnostics. Treat the factorization as a testable hypothesis, not a design freebie.
The warning example is worth unpacking, because interactions between mechanisms are common in the physical world and easy to miss in a factorial design. If the model factors dynamics into "object mechanism" and "surface mechanism," and the surface mechanism was learned only with light objects, then composing the heavy-object mechanism with the polished-surface mechanism may predict a confident glide where reality delivers stiction or deformation. Nothing in the training objective flagged the interaction, because the training combinations never separated heavy objects from rough surfaces. This is why the factorial design of training data matters as much as the factorial design of the model: combinations in the training data are the only place where mechanism interactions could have been observed.
Interpolation, Extrapolation, and the Missing-Cell Problem
It is worth being precise about why an unconstrained function approximator may fail at novel combinations. Empirical loss directly constrains a flexible network only on sampled support. Without a valid inductive bias or additional assumptions, multiple functions can agree on every training transition and disagree on a missing cell, so off-support behavior is not identified. Some architectures and target functions extrapolate successfully; the training loss alone does not guarantee which extension is learned.
The missing cell has no direct empirical-loss term: no observed transition evaluates the prediction at that world. Gradients from observed cells still update shared weights and thereby change its output indirectly, according to the architecture, regularization, initialization, and optimization path. Those inductive couplings may be useful, but the data do not identify which off-cell extension is correct. A missing cell can even sit between seen inputs, where neighboring constraints may disagree.
A compositional architecture changes this by constraining the hypothesis space. If the model must compute its prediction as , then the value at the missing combination is determined by the learned and , each of which was trained on abundant data from other combinations. The generalization is not luck; it is a consequence of restricting the model to functions that factor. This is inductive bias in the strict sense: you give up the ability to represent non-factorizing worlds in exchange for automatic coverage of all combinations.
The grid picture makes the implemented contrast visible: the categorical world-ID baseline has no sharing rule that constrains a missing cell, whereas the additive compositional model assembles that cell from its learned row and column factors. Other flat or monolithic architectures may encode equivalent sharing through different inductive biases.
## A 5x5 factorial grid over two mechanisms with 5 values each.
## The anti-diagonal (m + n == 4) is held out of training.
GRID_SIZE = 5
grid = np.ones((GRID_SIZE, GRID_SIZE))
for m in range(GRID_SIZE):
for n in range(GRID_SIZE):
if m + n == GRID_SIZE - 1:
grid[m, n] = 0.0
When the factorization matches the world, the coverage trade can be favorable. When it is materially wrong and the model lacks corrective interaction terms or calibrated uncertainty, it can be confidently wrong in a structured way.
The additive example also shows how composition rules trade expressiveness for coverage, and why the choice of rule is a real design decision. An additive rule composes contributions that do not interact; a multiplicative or gating rule allows interaction but needs data to estimate the interaction terms. The true dynamics of the worked example below are additive, so the additive bias matches reality exactly; had the true dynamics contained a term like , the additive model would be systematically biased at every combination where the interaction term is large, including seen ones. Matching the composition rule to the world's actual combination structure is as important as factorizing at all.
Compounding Error and Exploitation
Two themes from earlier parts become sharper here. First, compositional correctness is about one-step mechanisms, but agents act over horizons. Even small per-step errors in a novel combination compound over an autoregressive rollout, so a model that is "right" about the composition can still produce useless long-horizon predictions. Evaluation must therefore measure fixed-action autoregressive error as a function of horizon and, separately, closed-loop decision performance when a policy or planner selects actions, a distinction that connects to the uncertainty machinery of Stochasticity and Uncertainty.
Second, in model-based reinforcement learning (Part II's chapter on model-based RL), the planner searches for action sequences where predicted outcomes are good. Out-of-distribution and novel combinations can contain large optimistic errors that such a planner exploits, especially without support constraints or uncertainty penalties. They need not be the worst-error regions or coincide with every composition test. Compositional structure can reduce some unconstrained variation, but it does not eliminate unsupported component outputs or planning exploitation.
The two error-growth regimes are worth seeing side by side, because they call for different fixes.
## Stylized autoregressive error growth over a rollout horizon.
## Linear growth models a persistent per-step bias; exponential growth
## models instability where each wrong prediction feeds the next.
HORIZON = np.arange(0, 61)
PER_STEP_BIAS = 0.05
linear_growth = PER_STEP_BIAS * HORIZON
exponential_growth = 0.01 * (1.25**HORIZON)
Factorization ties a novel world's prediction to its component outputs, but those outputs can still be arbitrary outside their learned state-action support. Their composition may therefore assign an optimistically low cost to an unsupported combination. Distribution shift and model exploitation are treated as first-class reliability concerns in Part XII.