Object-Centric and Relational Worlds › Relations, Graphs, and Message Passing

Michael BrenndoerferJune 17, 20266 min read
World Models HandbookAll chapters
Part 3 of 12Representing Agents and Worlds
Chapter 17Object-Centric and Relational Worlds › Relations, Graphs, and Message Passing
Reading section 4 of 11 · Relations, Graphs, and Message Passing · 6 minSection 4 of 11 · 6 min

Book contents

Section 4 of 11 · 6 min read

Object-Centric and Relational Worlds › Relations, Graphs, and Message PassingOne section · Sections in this chapter4 / 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

Once the scene is a set of objects, the natural language for how they influence each other is a graph. Objects are nodes; relations, known or learned, are edges. Graph representations give us a principled way to write dynamics that depend on which objects interact, not just on the global scene. The move from sets to graphs is the move from "there are things" to "these things affect each other in these ways," and it is the second half of the structured bet.

Graphs as a Representation

Formally, a graph-structured scene is a tuple (V,E,u)(\mathcal{V}, \mathcal{E}, u): nodes V\mathcal{V} with per-object states hih_i (position, velocity, pose, appearance summary), edges E\mathcal{E} with per-relation attributes eije_{ij} (distance, contact type, spring rest length, relative velocity), and optionally a global attribute uu describing scene-level context (gravity, table friction). The three levels of the tuple are worth keeping separate in your head, because different physical regularities live at different levels: forces between objects live on edges, intrinsic object behavior and damping live on nodes, and uniform fields and shared environment properties live in the global attribute. Battaglia and colleagues (2018) made the influential argument that this "graph network" block generalizes a large family of models, from interaction networks to transformers, and that the choice of graph is a statement of relational inductive bias: an assumption about which interactions can matter.

The bias is a commitment. A fully connected graph assumes any object may affect any other; a sparse spatial graph assumes locality. Getting this wrong can waste computation or omit relevant interactions. With nn objects, a complete graph has O(n2)O(n^2) edge activations, so memory and compute grow quadratically even though a shared edge function keeps parameter count fixed. Sparse graphs are useful when their construction covers the interaction support.

The quadratic cost of the dense choice is easy to state and easy to see.

In[4]:
Code
import numpy as np

n_values = np.arange(4, 41)
k_nn = 2
full_edges = n_values * (n_values - 1) / 2
k_regular_edges = n_values * k_nn / 2
Out[5]:
Visualization
Line chart of edge counts rising much faster for fully connected graphs.
Number of undirected edges versus number of objects for a fully connected graph and an ideal undirected 2-regular graph. The dense topology grows quadratically while the ideal sparse topology grows linearly.

At forty objects the dense graph carries nearly twenty times the edges of this ideal 2-regular graph. This analytic line is not the exact count of the union-symmetrized kk-nearest-neighbor builder used later: that data-dependent construction can contain between nk/2nk/2 and nknk undirected edges depending on reciprocal choices.

For systems whose direct interactions are local in space, a kk-nearest-neighbor or radius graph can be a cheap approximation when its edges cover the true interaction support. The risk is explicit: kk-nearest neighbors can omit contacts in dense regions or add irrelevant neighbors in sparse ones, while fixed-radius graphs omit long-range effects and cannot express mediated influence in one hop.

The Message-Passing Update

Many graph-based dynamics models use a variant of one update, applied one or more times. The recipe has three stages: compute a message per edge, aggregate messages per node, and update each node's state. For every edge from sender jj to receiver ii, an edge function computes a message:

mji=ϕe(hj,  hi,  eji).m_{ji} = \phi_e\big(h_j,\; h_i,\; e_{ji}\big).

Each node aggregates its incoming messages with a permutation-invariant reduction □\square (sum, mean, max, or set attention with shared order-independent scoring):

mˉi=□j∈N(i) mji,\bar{m}_i = \square_{j \in \mathcal{N}(i)}\, m_{ji},

and a node function produces the next node state:

hi′=ϕv(hi,  mˉi),h_i' = \phi_v\big(h_i,\; \bar{m}_i\big),

where:

  • hjh_j, hih_i: the current states of sender node jj and receiver node ii
  • ejie_{ji}: the attributes of the edge from sender jj to receiver ii
  • ϕe\phi_e: the learned edge function, shared across all edges
  • mjim_{ji}: the message computed on the edge from sender jj to receiver ii
  • N(i)\mathcal{N}(i): the set of nodes with an edge into node ii, the in-neighborhood of ii
  • □\square: a permutation-invariant reduction, including sum, mean, max, or order-independent set attention
  • mˉi\bar{m}_i: node ii's aggregated incoming message
  • ϕv\phi_v: the learned node function, shared across all nodes
  • hi′h_i': the next state of node ii, one message-passing round later

A global update ϕu\phi_u over aggregated node and edge summaries can weave in scene-level context. Three properties of this recipe carry the real weight:

  • Permutation invariance of aggregation. Sum, mean, and max do not depend on neighbor order, so the same parameters can be applied to variable-size compatible graphs. Sum preserves the vector total: six equal, co-directed forces yield six times one force, while general force vectors can differ or cancel. Mean instead normalizes by degree.
  • Parameter sharing across edges and nodes. One edge function is applied everywhere. A learned rule can transfer across pairs when relation types, feature semantics, and physical regimes match.
  • Composition. After LL synchronous local rounds, information can travel up to LL hops. Dependence across a path requires at least its graph distance in rounds unless a global solver or nonlocal edge supplies a shortcut.

Transformer self-attention can also be viewed as message passing on a complete graph with attention-weighted aggregation. Key differences include initialization, normalization, iterative recurrent slot updates, exchangeability, and the decoder and training objective. Slot Attention allocates each input's unit weight across slots, creating competition that encourages a partition; standard attention normally lets each query normalize independently over keys. We develop the transformer side in Transformers and Neural State-Space Architectures.

Finally, a symmetry note. Absolute position can often be replaced by relative position Δx=xj−xi\Delta x=x_j-x_i and relative velocity Δv=vj−vi\Delta v=v_j-v_i, while retaining necessary invariant attributes such as mass, type, and spring rest length. When all inputs and operations respect translation symmetry and there are no position-dependent fields or boundaries, this makes translation invariance automatic. Rotation-equivariant architectures such as the equivariant graph networks of Satorras and colleagues (2021) further restrict the hypothesis class and can improve sample efficiency when that symmetry is valid on the evaluated task.