Compositionality and Systematic Generalization › Worked Example: A Factorial Dynamical World
World Models HandbookAll chapters Compositionality and Systematic Generalization › Worked Example: A Factorial Dynamical WorldOne section · Sections in this chapter7 / 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
Let's make all of this concrete with the smallest possible factorial world. The state is a single scalar . The world is described by two independent mechanisms:
- Mechanism A (intrinsic dynamics), with three variants indexed by , each with a decay and a curvature .
- Mechanism B (action response), with three variants indexed by , each with an action gain and a state-action coupling .
The transition is:
where:
- : the scalar state at time
- : the action taken at time
- : the decay and curvature parameters of mechanism A variant
- : the hyperbolic tangent of the state, which bounds the curvature contribution to magnitude at most ; the full intrinsic term can still grow linearly through
- : the action gain and the state-action coupling of mechanism B variant
- : small process noise added to the state at each transition, with standard deviation in the implementation below
The structural form of this equation is the entire point of the exercise. The right-hand side is a literal sum of a mechanism-A term and a mechanism-B term, with no interaction between them, so the true dynamics satisfy the additive factorization exactly. This is the ideal case for a factorized model: its inductive bias is not an approximation of the truth but a restatement of it. The two mechanisms are also semantically distinct, one governing how the state evolves on its own and one governing how actions perturb it, so the factorization matches a natural physical reading of the world rather than a mere algebraic convenience.
There are worlds. We will train on six of them and hold out the anti-diagonal: , , and .
To see the composition rule in action, fix and , and ignore noise. Mechanism A with contributes , using . Mechanism B with contributes , giving . Mechanism B with instead contributes , giving . The two worlds share the intrinsic term exactly and differ only in the action response. If a model has adequately identified both contributions on the state-action support used by the held-out rollout, the valid additive rule determines their combination; learning a separate categorical world embedding supplies no corresponding constraint on .
The arithmetic makes the data-sharing argument tangible. Every training world with in our split, namely and , provides observations of the same intrinsic term , and every world with , namely and , provides observations of the same action-response term. The held-out world asks the model to add two familiar contributions. In the true simulator the pairing introduces no interaction term, but finite data, limited excitation, optimization, and off-support component error can still leave the learned contributions inaccurate.
The composition rule can be drawn directly: each mechanism contributes a curve over states, and the held-out prediction is simply their sum.
## Mechanism contribution curves for mechanism A variant m=1 and
## mechanism B variant n=1 over a range of states, at action a=-1.
## Parameters match FACTOR_A[1] and FACTOR_B[1] from the worked example.
x_range = np.linspace(-2.5, 2.5, 200)
action = -1.0
contrib_a = 0.85 * x_range + (-0.30) * np.tanh(x_range)
contrib_b = 1.60 * action + 0.20 * action * x_range
composed = contrib_a + contrib_b