Most coverage of modern AI assumes data arrives as a sequence: text, tokens, frames, audio. A large share of the world's useful data does not. Molecules are atoms connected by bonds. Recommendations are pins connected to boards, users connected to pins. Proteins are residues that touch each other in three-dimensional space. Graph neural networks (GNNs) are the family of neural architectures built for that relational kind of data, and before language models absorbed the field's oxygen, they were where "deep learning on structured data" meant something.
This explainer covers what a graph neural network is, how message passing works, what the architectures provably cannot do, and where they actually run in production.
What counts as a graph
A graph is a set of nodes (also called vertices) plus a set of edges that record which pairs of nodes are related. Each node can carry a feature vector: an atom's element and charge, a user's profile, a document's embedding. Edges can carry features too, such as a bond type or a measured distance.
The difference between a graph and a spreadsheet row is that a graph has no fixed layout. A grid image always has the same number of neighbors per pixel. A node in a social graph has three neighbors today and ten thousand tomorrow. That irregularity is exactly why convolution, the workhorse of vision models, does not transfer directly: there is no canonical ordering of neighbors to slide a kernel over.
The standard modern formulation came from Scarselli, Gori, Tsoi, Hagenbuchner and Monfardini in a 2009 IEEE Transactions on Neural Networks paper, which defined a neural network module that recursively computes a state for each node from the states of its neighbors, with contraction properties guaranteeing the computation settles. A 2018 survey by Zhou and colleagues later organized the explosion of follow-up models by their core operations: message passing, readout, and graph structure learning.
Message passing, the one mechanism to understand
Nearly all practical GNNs implement some version of three steps, repeated once per layer:
- Message. Every node collects the feature vectors of its neighbors and applies a transformation to each one.
- Aggregate. The node combines those incoming messages with a permutation-invariant function, typically a sum, mean, or max.
- Update. The node concatenates the aggregate with its own previous state and passes it through a neural network to produce its new state.
One layer means a node "sees" its direct neighbors. K layers means a K-hop receptive field. After K rounds, the node embedding summarizes its local substructure, and a final readout step pools node embeddings into a graph-level prediction when the task is about the whole graph, for example whether a molecule is soluble.
Two papers turned this into the dominant recipe. Gilmer and colleagues (2017) framed several quantum-chemistry models under one "message passing neural network" abstraction, with edge-conditioned messages, and it remains the reference vocabulary. Kipf and Welling (2017) proposed the graph convolutional network (GCN), a first-order approximation of spectral graph convolution that just averages neighbor features with a normalization and a learned linear map. It trained well on citation networks and made the field mainstream. Hamilton, Ying and Leskovec (2017) added GraphSAGE, which samples a fixed-size neighborhood and aggregates, letting the model generalize to nodes it never saw during training, a property called inductive inference that matters when the graph changes daily, as in any live social network.

What GNNs cannot do, and that is mathematics, not engineering
Three results define the ceiling of this architecture family.
Expressivity. Xu and colleagues (2019) showed that the standard message-passing scheme is at most as powerful as the Weisfeiler-Lehman graph isomorphism test, a 1968 combinatorial procedure that colors nodes by their neighborhood multisets. Consequence: a plain GNN cannot reliably distinguish certain structurally different graphs, such as two small regular graphs that 1-WL confuses, no matter how large you make it. The same paper proved sum aggregation is strictly more discriminative than mean or max, which is why sum-based layers became common.
Over-smoothing. Stack many GCN layers and node representations converge toward nearly identical vectors; deep receptive fields average the whole graph together. A 2020 study of deep GCNs by Yang and colleagues measured the effect and found the collapse is not strictly inevitable, but requires deliberate care with initialization and normalization to avoid; as a result these networks are usually kept shallow.
Over-squashing. Information from many nodes must squeeze through narrow bottlenecks, like a bridge edge between two dense clusters, into a fixed-size vector. In an ICML 2023 analysis, Di Giovanni and colleagues showed the effect depends jointly on network width, message-passing depth and graph topology: widening the network counteracts it only up to a point, and once the depth needed to connect two regions approaches the graph diameter, the sensitivity of one region's embedding to the other's input features drops sharply. This is the structural reason GNNs do not have "context windows" the way transformers do: they see K hops, and K is small.
Where they actually run
Recommendations at Pinterest scale. The PinSage paper (Ying et al., 2018) described the largest deployment of its kind: a GCN variant trained on a graph of 3 billion nodes and 18 billion edges representing pins and boards, using random-walk neighborhood sampling and a MapReduce inference pass to produce embeddings for every pin. The model went live in Pinterest's home feed and related-pin surfaces, validated with offline metrics, user studies, and A/B tests.
Proteins. DeepMind's AlphaFold 2, the system that reached experimental-level accuracy on protein structure prediction at CASP14, is explicit about the framing. Its Evoformer block, in the Nature paper's words, treats prediction "as a graph inference problem in 3D space in which the edges of the graph are defined by residues in proximity," with a pair representation encoding residue-to-residue relations that is refined by triangle updates.
Chemistry. MoleculeNet standardized evaluation for molecular machine learning across 12 dataset collections, more than 800 tasks and 600,000 compounds, and its benchmark results established learned graph representations as the default baseline in the field. Open-source tooling matured around the same model zoo idea: PyTorch Geometric and the Deep Graph Library remain the two libraries most GNN code runs on.
The relationship to language models
The current generation of AI products meets GNNs mostly at the retrieval layer. Microsoft Research's GraphRAG uses an LLM to extract an entity-and-relation graph from a document corpus, communities in that graph are summarized, and answers to corpus-level questions are built from the summaries, a task plain vector retrieval handles poorly. The division of labor is clean: LLMs are strong at the language side of the pipeline, extraction and summarization; graph methods are strong at the structure side, reachability, community detection, multi-hop traversal.
There is also a quiet caution for anyone expecting one architecture to win everything. The limits above are not training-budget problems. A transformer over concatenated node features does not have them either, it just trades them for quadratic context costs on huge graphs. GNNs are not a legacy curiosity; they are the specialized tool for the data that never was a sequence.

Sources
- Scarselli et al., "The Graph Neural Network Model," IEEE Transactions on Neural Networks 20(1), 2009 — https://ieeexplore.ieee.org/document/4700153
- Zhou et al., "Graph Neural Networks: A Review of Methods and Applications," 2018 — https://arxiv.org/abs/1812.08434
- Gilmer et al., "Neural Message Passing for Quantum Chemistry," 2017 — https://arxiv.org/abs/1704.01212
- Kipf & Welling, "Semi-Supervised Classification with Graph Convolutional Networks," 2017 — https://arxiv.org/abs/1609.02907
- Hamilton, Ying & Leskovec, "Inductive Representation Learning on Large Graphs," 2017 — https://arxiv.org/abs/1706.02216
- Xu et al., "How Powerful are Graph Neural Networks?" 2019 — https://arxiv.org/abs/1810.00826
- Yang et al., "Revisiting Over-smoothing in Deep GCNs," 2020 — https://arxiv.org/abs/2003.13663
- Di Giovanni et al., "On Over-Squashing in Message Passing Neural Networks: The Impact of Width, Depth, and Topology," ICML 2023 — https://arxiv.org/abs/2302.02941
- Ying et al., "Graph Convolutional Neural Networks for Web-Scale Recommender Systems" (PinSage), 2018 — https://arxiv.org/abs/1806.01973
- Jumper et al., "Highly accurate protein structure prediction with AlphaFold," Nature 596, 2021 — https://www.nature.com/articles/s41586-021-03819-2
- Wu et al., "MoleculeNet: A Benchmark for Molecular Machine Learning," 2017 — https://arxiv.org/abs/1703.00564
- Fey & Lenssen, "Fast Graph Representation Learning with PyTorch Geometric," 2019 — https://arxiv.org/abs/1903.02428
- Wang et al., "Deep Graph Library: A Graph-Centric, Highly-Performant Package for Graph Neural Networks," 2019 — https://arxiv.org/abs/1909.01315
- Edge et al., "From Local to Global: A Graph RAG Approach to Query-Focused Summarization," 2024 — https://arxiv.org/abs/2404.16130
