ML Systems Lab Open interactive version →
Advanced 60 min read MPNNWeisfeiler-Lemanexpressivenesshigher-ordergraph Transformer

Message Passing Neural Networks (MPNN)

Unified MPNN view, 1-WL test, expressiveness limits, higher-order GNNs, graph Transformers

A caffeine molecule has 24 atoms (nodes) and 25 bonds (edges). Task: predict whether it is toxic. Each atom has features — element type, charge, hybridization. Each bond has features — single, double, or aromatic. A standard MLP on a feature vector per atom would ignore the molecular structure entirely. You need a model that propagates information through the chemical graph.

Message passing is the mechanism. In each round, every atom sends its representation to its bonded neighbors. Every atom aggregates messages from its neighbors and updates its representation. After K rounds, each atom's representation encodes its K-hop chemical environment — the atoms within K bonds of it. A readout function aggregates all atom representations to a molecular property prediction. After 3 rounds, the nitrogen in caffeine's ring "knows" what the carbons 3 bonds away look like. This structural awareness is what makes the model useful.

GCN, GAT, and GraphSAGE look different architecturally, but they are all instances of the same three-step pattern: compute messages, aggregate at nodes, update node states. This unification — the MPNN framework (Gilmer et al., 2017) — also reveals a hard ceiling: no MPNN can be more powerful than the 1-dimensional Weisfeiler-Leman graph isomorphism test. Mean-aggregation GNNs like GCN are strictly below even that ceiling. GIN with sum aggregation reaches the 1-WL ceiling. For most node classification tasks on social networks, this ceiling rarely matters. For molecular chemistry where ring structure determines chemical properties, it matters a great deal.

NOT this. "Message passing requires a fixed number of rounds K." In practice K = 3–6 works for most molecular property prediction tasks, matching the chemical neighborhood relevant to properties. More rounds cause over-smoothing: all nodes converge to similar representations as information propagates through the entire graph, and individual atom identities are lost. The right K depends on the task's relevant locality — drug toxicity depends mostly on functional groups within 3–4 bonds, not the entire molecule. Long-range interactions in protein folding require a different architecture (graph Transformers) rather than more message-passing rounds.

Key points

Takeaway

Every MPNN is bounded by the 1-Weisfeiler-Leman test, and mean-aggregation GNNs (GCN, GraphSAGE) are strictly below that ceiling — mean cannot distinguish multisets with the same average, so nodes with neighborhoods {1,2,3} and {1,1,4} are indistinguishable. GIN with sum aggregation reaches the 1-WL ceiling. This expressiveness limit is consequential for molecular chemistry and combinatorial tasks where substructure counts matter, but for node classification and link prediction on real-world graphs, the empirical performance gap between GCN and GIN usually closes. The key is knowing which regime you're operating in.

Recap

Check your understanding

Q1. Which two of the following statements about mean-aggregation GCN vs 1-WL expressiveness are TRUE? (Select two.)

Q2. What is over-squashing in GNNs, and how would you diagnose and fix it in a production model?

Q3. GIN achieves maximal 1-WL expressiveness. Why does it still fail to distinguish some pairs of non-isomorphic graphs, and what class of graphs is this?

Q4. Explain why graph Transformers are more expressive than MPNNs and what practical tradeoff this introduces at scale.

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →