Object-Centric and Relational Worlds › Worked Example: A Spring Lattice, Message by Message
World Models HandbookAll chapters Object-Centric and Relational Worlds › Worked Example: A Spring Lattice, Message by MessageOne section · Sections in this chapter7 / 11 ↓
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 message passing concrete with the smallest possible physical system: two unit masses connected by one spring with stiffness and rest length , moving along a line with damping . Small enough to do by hand, rich enough to exercise every stage of the recipe: an edge function, an aggregation, a node update, and an integration step. At some instant, with the position of mass and its velocity:
The worked physical system has one undirected relation. We will display its equal-and-opposite forces as two directed effects. That representation allows both effects to be carried, but a generic learned directed-edge MLP does not enforce Newton's third law unless antisymmetry is built into the parameterization or one pair force is applied with opposite signs.
Edge messages. The signed scalar spring law is ; its magnitude is , with direction supplied separately. Here , so the stretch is and the magnitude is . The physical force on mass 1 points toward mass 2, so , while the paired force is . A learned edge function can use relative position and rest length to approximate this vector law without absolute positions. Exact action-reaction symmetry still requires an antisymmetric construction; otherwise data-sparse regimes are one risk among several sources of approximation error.
Aggregation. Each mass has exactly one neighbor, so and . In a larger lattice, aggregation forms the vector sum of attached spring forces. For two equal, co-directed contributions, averaging would return half of the correct sum; in general, directions and magnitudes differ and may cancel.
Node update. The node function combines the aggregated force with damping: , where is the acceleration of mass (with unit masses, net force and acceleration are numerically equal). With for both masses:
One semi-implicit Euler step with , updating velocity first with and then position with , gives and . The separation becomes
which is down from : the stretched spring is pulling the masses together, with damping bleeding energy.
The edge function in this example is a straight line in the separation, which makes its job easy to picture.
import numpy as np
K_SPRING = 6.0
L0 = 1.0
separations = np.linspace(0.4, 1.8, 200)
forces = K_SPRING * (separations - L0)
r_now = 1.2
f_now = K_SPRING * (r_now - L0)
This curve is one one-dimensional, fixed-parameter slice of the learned relation. The two-dimensional model below receives relative position, relative velocity, and rest length and must learn a direction-dependent vector message across that larger input space.
For a fixed-size joint state , a generic MLP can learn relative differences and symmetry, but does not obtain them by construction. A different object count changes a fixed-width interface unless the design adds padding, masks, sharing, or set-equivariant modules. Message passing supplies shared local computation and permutation-compatible aggregation directly. The following code tests that inductive bias against an edge-free per-object baseline.