A message passing neural network (MPNN) is a neural network for graph-structured data in which each node repeatedly sends messages to its neighbors, aggregates the messages it receives and updates its own hidden state. After several rounds, each node representation summarizes its local neighborhood, and an optional readout function turns all node states into a single graph-level output. The MPNN is the general framework behind most graph neural networks in graph learning.
The framework was formalized in 2017 for predicting quantum chemical properties of molecules, where it unified earlier graph models under one notation. Today architectures such as the graph convolutional network, GraphSAGE, the graph attention network and the graph isomorphism network are usually described as special cases of message passing in artificial intelligence research and practice.
How message passing works in an MPNN
An MPNN runs for a fixed number of message passing steps T, often called layers. In each step, every node computes messages from its neighbors with a message function, combines them with a permutation-invariant aggregation such as sum, mean or max, and passes the result together with its previous state to an update function. Edge features, such as bond types in a molecule, can enter the message function directly.
The aggregation must be invariant to neighbor order, because a graph has no natural ordering of nodes. This property makes the whole network permutation equivariant at the node level: relabeling the nodes relabels the outputs in the same way without changing their values.
The table below lists the three learnable functions that define any MPNN.
| Function | Inputs | Typical implementation | Role |
|---|---|---|---|
| Message function | Sender state, receiver state, edge features | Linear layer or small MLP | Decide what information flows |
| Update function | Previous node state, aggregated message | GRU cell or MLP | Integrate neighborhood information |
| Readout function | All final node states | Sum, mean, attention or Set2Set | Produce graph-level output |
| Aggregation operator | Set of incoming messages | Sum, mean, max or attention | Combine messages without order |
After k steps, a node’s representation depends on its k-hop neighborhood, which is the receptive field of the network. Most practical models use two to six layers, because deeper stacks tend to degrade rather than improve, as described later.
Common MPNN variants
Popular graph neural network architectures differ mainly in how they weight and aggregate messages. Writing them as MPNNs makes their assumptions explicit and easier to compare.
| Architecture | Message weighting | Aggregation | Notable property |
|---|---|---|---|
| Graph convolutional network | Fixed by normalized node degrees | Weighted sum | Simple, strong baseline |
| GraphSAGE | Uniform over sampled neighbors | Mean, max or LSTM | Scales with neighbor sampling |
| Graph attention network | Learned attention coefficients | Attention-weighted sum | Adapts to neighbor relevance |
| Graph isomorphism network | Uniform with learnable self-weight | Sum followed by MLP | Maximally expressive among MPNNs |
| Relational graph convolutional network | Separate weights per edge type | Sum per relation | Handles knowledge graphs |
The choice of aggregator affects what the network can distinguish. Sum aggregation preserves multiset size, so it can count neighbors, whereas mean and max lose that information. This difference underlies the theoretical result discussed in the next section.
Expressive power and the Weisfeiler-Lehman limit
Standard MPNNs are at most as powerful as the 1-dimensional Weisfeiler-Lehman test at telling non-isomorphic graphs apart. The Weisfeiler-Lehman test iteratively recolors each node from the multiset of its neighbors’ colors, which is structurally the same operation as message passing. Graph isomorphism networks reach this upper bound by using injective sum aggregation with multilayer perceptrons.
The limit has practical consequences. A plain MPNN cannot distinguish two disjoint triangles from one six-node ring when all nodes have identical features, and it cannot reliably count cycles or detect certain substructures. Chemistry tasks that depend on ring structure can therefore suffer.
| Extension | Mechanism | Cost |
|---|---|---|
| Positional encodings | Laplacian eigenvectors or random-walk features | Preprocessing per graph |
| Higher-order networks | Messages between node tuples | Memory grows quickly |
| Subgraph methods | Run an MPNN on many node-marked subgraphs | Several times slower |
| Graph transformers | Global attention over all node pairs | Quadratic in node count |
Practical use and configuration
MPNNs support node classification, link prediction and graph classification with the same backbone, changing only the output head. Node tasks use final node states directly, link tasks score pairs of node states, and graph tasks apply the readout function and graph pooling before a classifier.
| Task | Output head | Typical depth | Key consideration |
|---|---|---|---|
| Node classification | Per-node classifier | 2 to 3 layers | Homophily of the graph |
| Link prediction | Dot product or MLP on node pairs | 2 to 4 layers | Negative sampling strategy |
| Graph classification | Readout plus classifier | 3 to 6 layers | Pooling and readout choice |
| Molecular property regression | Readout plus regressor | 3 to 6 layers | Rich edge features |
For large graphs with millions of nodes, full-batch training exceeds GPU memory. Neighbor sampling and partitioning methods such as Cluster-GCN restrict each mini-batch to a subgraph, trading some accuracy for predictable memory use.
Limitations of message passing
- Over-smoothing: with many layers, node states converge and become indistinguishable.
- Over-squashing: information from an exponentially growing neighborhood is compressed into a fixed-size vector, so distant signals are lost.
- Heterophily: when connected nodes tend to have different labels, averaging neighbors can hurt accuracy.
- Limited expressiveness: the Weisfeiler-Lehman bound prevents certain structures from being recognized.
Typical remedies include residual connections, normalization layers, a virtual node connected to all nodes, and graph rewiring that adds shortcut edges to relieve bottlenecks in information flow.
The simple explanation
Picture a group of people standing in a network, each talking only to direct friends. In every round, each person hears from their friends and updates what they know. After a few rounds, everyone knows a summary of their wider neighborhood.
A message passing neural network does the same with data points connected in a graph. The network learns what to say and how to listen. The result can describe one point, a link between two points, or the whole graph.
How it is used in practice
A pharmaceutical research group wants to screen 500,000 candidate molecules for water solubility before running laboratory tests. Each molecule becomes a graph: atoms are nodes with element and charge features, and bonds are edges labeled single, double, triple or aromatic.
The team trains an MPNN with four message passing steps, a GRU update function and a sum readout on roughly 10,000 molecules with measured solubility. Validation uses a scaffold split, so test molecules have core structures unseen during training, which gives a more honest estimate than a random split.
The model ranks the full library in under an hour on a single GPU. Chemists send only the top few hundred candidates to the laboratory, which cuts experimental cost substantially while keeping most of the promising compounds in the shortlist.