Graph Learning2017intermediate12 min read
Neural Message Passing for Quantum Chemistry
تمرير الرسائل العصبي للكيمياء الكمّية
Gilmer, J. · Schoenholz, S. S. · Riley, P. F. · Vinyals, O. · Dahl, G. E. — ICML
The problem
By 2017, predicting molecular properties with machine learning was far behind progress in vision and language. Multiple architectures had appeared — GG-NNs, Interaction Networks, molecular fingerprints, spectral methods — but each used different notation, different update rules, and different outputs. Researchers could not easily compare them, combine their strengths, or know which design choices actually mattered. Meanwhile, quantum chemistry simulations (DFT) remained the workhorse, but a single calculation on one small molecule took about an hour — far too slow for drug discovery at scale.
The contribution
The paper reformulates eight existing graph neural network models into a single unified framework called Neural Networks (MPNNs). Every MPNN is defined by just three functions: a message function M that computes what information each node sends to its neighbors, an update function U that refreshes each node's , and a R that aggregates all node states into a single graph-level prediction. Within this framework, the authors explore novel variants — edge neural networks for continuous edge features, readouts, , and multi-tower architectures — achieving state-of-the-art results on the QM9 molecular property benchmark, predicting DFT calculations to within chemical accuracy on 11 of 13 targets.
The impact
The MPNN framework became the canonical language for describing graph neural networks. Its message-update-readout abstraction was adopted by virtually every subsequent GNN paper and library — PyTorch Geometric, DGL, and DeepMind's graph_nets all speak MPNN. The framework directly influenced AlphaFold 2's structure module (which uses message passing on residue graphs) and GIN's theoretical analysis (which used MPNN to study expressiveness). MPNN proved that a simple, general abstraction could both unify a scattered field and push its empirical frontier.
Imagine a post office serving a small village. Every house is an atom, and the roads between houses are chemical bonds. Each morning every house writes a postcard describing itself — its element, its charge, its mood — and hands copies to its immediate neighbors. Each house reads all incoming postcards, combines them with what it already knows, and writes a new postcard for the next round.
After a few delivery rounds, even houses at opposite ends of the village know about each other — not because anyone ran across the whole map, but because information rippled outward through the local mail network.
The village clerk then reads everyone's final postcard and writes a single summary report: "This molecule's energy is X, its dipole moment is Y."
That is the entire MPNN: message → update → readout. Everything else is choosing how to write the postcards.
The problem: a zoo of graph models with no common language
Before MPNN, if you wanted to learn on molecular graphs you had at least eight architectures to choose from — each described with its own notation, trained on its own benchmarks, and impossible to compare fairly:
- Convolutional Fingerprints (Duvenaud et al., 2015) — learned molecular fingerprints via , but the message function summed node states and edge states separately, missing correlations between them.
- Gated Graph Neural Networks (Li et al., 2016) — used a update and matrix-multiply messages, but assumed discrete edge types.
- Interaction Networks (Battaglia et al., 2016) — modeled physics simulations with a neural network message function over concatenated node and edge features.
- Deep Tensor Neural Networks (Schütt et al., 2017) — used element-wise multiplication to combine node and edge information.
- Spectral / Laplacian methods (Bruna et al., 2013; Kipf & Welling, 2016) — defined convolution via the eigenvectors, elegant but hard to scale beyond a single fixed graph.
The community needed a Rosetta Stone — a single framework that revealed what these models shared and where they truly differed.
The framework: message → update → readout
An MPNN operates on an undirected graph with node features and edge features . The has two phases:
Phase 1 — Message passing runs for time steps. At each step, every node collects messages from its neighbors , aggregates them, and updates its own hidden state. Think of it as rounds of the postcard game: each round, every atom listens to its bonded neighbors and revises its internal description.
Phase 2 — Readout takes all the final node states and produces a single prediction for the entire graph. This is the village clerk writing the summary report. The readout must be permutation-invariant — shuffling the order of atoms cannot change the prediction, because molecules have no canonical ordering.
Unification: eight architectures in three functions
The power of the MPNN framework is that seemingly different architectures become interchangeable parts. Here is how three key models decompose:
GG-NN (Li et al., 2016): the message function is a matrix multiply , one learned matrix per edge type. The update is a GRU. The readout uses gating: .
Interaction Networks (Battaglia et al., 2016): the message function is a full neural network over concatenated inputs: . The update is also a neural network. The readout sums and passes through another network.
GCN (Kipf & Welling, 2016): the message function scales by normalized degree: where . The update is .
Once you see the pattern, every new GNN architecture becomes a sentence in the same language: "My message function is ___; my update is ___; my readout is ___."
Key innovations within the framework
Beyond unification, the paper introduced several novel MPNN variants that each addressed a specific limitation:
Edge Neural Network — Previous message functions either assumed discrete edge types (bond = single/double/triple) or ignored edge information entirely. The edge network replaces the fixed matrix multiply with a small neural network that maps continuous edge features (bond type + spatial distance) to a matrix: . This lets the model reason about 3D spatial relationships — how far apart two atoms are — not just whether they are bonded.
Virtual Graph Elements — In a sparse molecular graph, two atoms on opposite ends are separated by many hops. Information must ripple step by step, which is slow and lossy. Two fixes:
- Virtual edges: add a special edge type between every non-bonded pair, creating a fully connected graph. Now every atom can talk to every other atom in a single step.
- Master node: add a single global node connected to all atoms with a special edge type. The master node acts as a shared bulletin board — every atom writes to it and reads from it each round, enabling global coordination without quadratic edge count.
Set2Set Readout — Simple readout functions just sum the final node states, which limits expressiveness. Set2Set (Vinyals et al., 2015) uses an mechanism that reads the node set multiple times, producing a richer graph-level representation. This alone improved average performance across all 13 targets.
Scaling up: the multi-tower trick
One bottleneck of message passing is cost: a single step on a dense graph with nodes and -dimensional embeddings costs multiplications. As molecules get larger or embeddings get richer, this becomes expensive.
The multi-tower trick splits each -dimensional node into smaller pieces of size . Each piece runs message passing independently (like parallel "towers"), then a mixing network recombines them. The total cost drops to — an 8-tower model with runs roughly 2× faster than a single-tower model.
Surprisingly, the tower structure also improved generalization on 12 of 13 targets, likely because it acts like an implicit ensemble — each tower learns slightly different features, and the mixing network combines their perspectives.
QM9: predicting quantum properties of molecules
The paper evaluated MPNNs on QM9 — a dataset of ~134,000 small organic molecules (up to 9 heavy atoms: C, N, O, F plus hydrogens). For each molecule, density functional theory (DFT) computes 13 quantum properties: atomization energies at various conditions, orbital energies (HOMO, LUMO, gap), vibrational frequencies, dipole moments, and polarizability.
DFT is the gold standard, but painfully slow: a single molecule takes about an hour on a modern CPU. The MPNN runs ~300,000 times faster.
The key benchmark threshold is "chemical accuracy" — an error level that chemists consider small enough to be practically useful. The best MPNN variant (edge network + set2set + explicit hydrogens) achieved chemical accuracy on 11 of 13 targets, and the ensemble model on all 13 in some configurations.
What the model sees: atoms, bonds, and distances
Each atom is described by a feature vector encoding its element type (one-hot: H, C, N, O, F), atomic number, whether it accepts or donates electrons, whether it is aromatic, its hybridization state (sp, sp², sp³), and the number of attached hydrogens.
Edges carry bond information. Three representations were tested, each adding more spatial detail:
- Chemical graph only: edges are discrete bond types (single, double, triple, aromatic). No 3D information.
- Distance bins: bond distances are binned into 10 intervals (8 uniform bins over [2, 6] Å plus [0, 2] and [6, ∞]), combined with bond type. This lets the GG-NN style matrix multiply handle distance.
- Raw distance + bond type: a 5-dimensional edge vector — one continuous distance value plus a 4-dimensional one-hot bond type. This requires the edge neural network to process.
The richest representation (raw distance + explicit hydrogen atoms as nodes) performed best, but made graphs ~3× larger (up to 29 nodes instead of 9), increasing time by ~10×.
The MPNN forward pass in code
Simplified to show the idea — not the real implementation.
import numpy as np
def message_pass(node_states, adj, edge_features, M_fn, U_fn, T=3):
"""Run T rounds of message passing on a molecular graph.
node_states: (n, d) — one row per atom
adj: list of (i, j) pairs — edges
edge_features: dict (i,j) -> feature vector
M_fn: message function M(h_v, h_w, e_vw) -> message vector
U_fn: update function U(h_v, aggregated_msg) -> new h_v
"""
h = node_states.copy()
for t in range(T):
new_h = h.copy()
for v in range(len(h)):
# Gather messages from all neighbors
neighbors = [w for (i, w) in adj if i == v]
msgs = [M_fn(h[v], h[w], edge_features[(v, w)]) for w in neighbors]
if msgs:
agg = sum(msgs) # sum aggregation
new_h[v] = U_fn(h[v], agg) # update node state
h = new_h
return h
def readout(final_states, R_fn):
"""Aggregate all node states into a single graph prediction.
R must be permutation-invariant — simplest: sum then MLP.
"""
graph_vec = sum(final_states) # sum pooling
return R_fn(graph_vec) # predict property
# That's the whole framework. GG-NN, GCN, Interaction Nets,
# and every other MPNN differ only in their M, U, and R choices.Why it mattered
2016
GG-NN (Gated Graph Neural Network)
Li et al. introduced gated recurrent updates on graph-structured data, one of the key precursors that MPNN unified.
2017
MPNN — This Paper
Gilmer et al. unify eight GNN architectures into the message-update-readout framework and achieve state of the art on QM9.
2017
SchNet
Continuous-filter convolutional networks for molecules that use the same MPNN language for spatial message passing.
2019
GIN (Graph Isomorphism Network)
Xu et al. prove that sum aggregation in MPNNs is as powerful as the Weisfeiler-Leman graph isomorphism test, establishing theoretical limits for the entire framework.
2020
DimeNet — Directional Message Passing
Gasteiger et al. extend MPNN with directional information (bond angles), pushing molecular property prediction further.
2021
AlphaFold 2
DeepMind's protein structure predictor uses message passing on residue graphs in its Evoformer and structure modules — a direct descendant of the MPNN abstraction applied to biology's hardest problem.
2022
GNN Libraries Mature
PyTorch Geometric, DGL, and JAX-based frameworks all implement the MPNN abstraction as their core API, making message passing the default paradigm for graph learning.
The MPNN paper's greatest legacy is not any single model variant — it is the language it gave the field. When a researcher today says "message function," "update function," and "readout function," they are speaking MPNN. That vocabulary made it possible to compare, compose, and improve graph neural networks systematically, and it is the foundation on which every modern GNN is built.
CitationGilmer, Schoenholz, Riley, Vinyals, Dahl. Neural Message Passing for Quantum Chemistry. ICML, 2017.
Terms in this paper
- Message Passingتمرير الرسائل
- Graph Neural Network (GNN)الشبكات العصبية الرسومية (البيانية)
- Readout Functionدالة القراءة
- Edge Networkشبكة الحواف
- Node Featureسمة العقدة
- Adjacency Matrixمصفوفة التجاور
- Graph Isomorphismتشابُه البيانات البيانية
- Virtual Graph Elementsعناصر بيانية افتراضية
- Set2SetSet2Set
- Molecular Fingerprintالبصمة الجزيئية