CV Courseversity

Graph Neural Networks and Geometric Deep Learning

Covers why graph-structured data breaks the grid and sequence assumptions behind CNNs and RNNs, how message-passing and graph convolutional networks learn from graphs instead, and why stacking too many GNN layers causes node representations to over-smooth.

“A pharmaceutical researcher wants a model to predict whether a candidate molecule will bind to a target protein. The molecule is a graph of atoms connected by bonds — there is no natural left-to-right order to feed into a sequence model, and no way to lay the atoms out on a fixed pixel grid for a convolutional network. How could a neural network learn anything useful from data that is not a sequence or an image at all, but an arbitrary network of nodes and edges of varying size and shape?”

Non-Euclidean Data and the Case for a New Architecture · 15 min

Convolutional and recurrent networks owe much of their success to a convenient property of the data they were built for: images sit on a fixed pixel grid, and sentences form an ordered sequence. Both structures have a global coordinate system, a natural notion of neighboring elements, and shift-invariance, meaning a pattern learned in one part of the input transfers directly to another part. Michael Bronstein and colleagues coined the term geometric deep learning for the broader research program of extending deep learning beyond this comfortable setting to non-Euclidean domains such as graphs and manifolds, and they were explicit about why this is hard: such domains lack a familiar global parameterization, a common system of coordinates, a vector space structure, or shift-invariance. Their examples of non-Euclidean data span an unusually wide range of real applications, including social networks, sensor networks, functional brain networks, genetic regulatory networks, and meshed surfaces in computer graphics. A molecule, a citation network, and a road network are all graphs in exactly this sense, and none of them can be reshaped into a grid or a sequence without either discarding structure or inventing an arbitrary, unjustified ordering.

The specific obstacle this creates for a graph neural network is concrete rather than merely philosophical. A convolutional filter can rely on every pixel having exactly eight neighbors arranged in a fixed spatial pattern, and a recurrent network can rely on each word having exactly one predecessor and one successor. A node in a graph, by contrast, may have any number of neighbors, and those neighbors come with no canonical order at all: there is no meaningful sense in which one neighboring atom in a molecule is the network's first input and another is its second. Stanford's CS224W course materials make the resulting design constraint explicit, stating that a graph neural network's aggregation function over a node's neighbors needs to be order invariant, achieved through symmetric functions such as elementwise maximum or elementwise average. Any function a GNN uses to combine information from a node's neighborhood must therefore produce the same output regardless of the order in which those neighbors happen to be listed, since a graph carries no inherent ordering for a model to depend on.

The idea of building a neural network that operates directly on graphs predates the current wave of graph convolutional architectures. Scarselli, Gori, Tsoi, Hagenbuchner, and Monfardini's 2009 paper, The Graph Neural Network Model, proposed extending existing neural network methods to process graph-structured data directly, describing a model that can handle acyclic, cyclic, directed, and undirected graphs alike, in both graph-focused and node-focused tasks, without the ad hoc preprocessing earlier approaches required. Their mechanism worked through an information-diffusion process, in which each node maintains a state vector that is repeatedly updated as a function of its neighbors' states until the whole system settles into a stable equilibrium, rather than being computed by a fixed number of feedforward layers as most modern GNNs are. That recurrent, fixed-point formulation looks quite different from the layered, message-passing architectures common today, but it established the foundational premise that a neural network's computation could be organized around a graph's own connectivity rather than around a grid or a sequence, and it is that premise the rest of this module builds on.

Message Passing and Graph Convolutional Networks · 16 min

Gilmer, Schoenholz, Riley, Vinyals, and Dahl's 2017 paper, Neural Message Passing for Quantum Chemistry, gave the field a unifying vocabulary for describing how a wide range of graph neural network variants actually compute. They reformulated several existing graph-based models into a single common framework they called Message Passing Neural Networks, in which the model learns a message-passing algorithm and an aggregation procedure that together compute a function of the entire input graph. Concretely, in each round of message passing, every node in the graph sends a message to its neighbors that is a function of its own current hidden state and, where relevant, the features of the connecting edge; every node then aggregates the messages it receives, using an order-invariant function so the result does not depend on the order those messages arrived in, and uses that aggregate to update its own hidden state. Because a node's updated state after one round only reflects its immediate neighbors, and its state after two rounds reflects neighbors of neighbors, stacking additional rounds of message passing — equivalently, stacking additional GNN layers — is what allows information to propagate further across the graph, expanding each node's effective receptive field by one hop per round.

Kipf and Welling's 2016 paper, Semi-Supervised Classification with Graph Convolutional Networks, introduced a specific and highly influential instantiation of this general pattern. Their Graph Convolutional Network, or GCN, is motivated as a localized first-order approximation of spectral graph convolutions, and its central practical advantage is that it scales linearly in the number of graph edges rather than requiring the far more expensive computations that exact spectral methods demand. A GCN layer updates every node's representation by combining that node's own features with a normalized aggregate of its immediate neighbors' features, which is precisely message passing under Gilmer et al.'s later framework, using a specific, efficient choice of message and aggregation functions. Kipf and Welling evaluated their model on semi-supervised node classification over citation networks, where each node is a document, edges represent citation links, and only a small fraction of nodes have known labels, as well as on knowledge graph datasets, reporting that GCNs outperformed related methods by a significant margin on these benchmarks.

The same underlying computational pattern — aggregate messages from neighbors, then update — supports strikingly different applications depending on what the nodes and edges represent. Gilmer et al. applied their message-passing framework to molecular graphs, where nodes are atoms and edges are chemical bonds, and reported state-of-the-art results on an important molecular property prediction benchmark used in computational chemistry and drug discovery. Kipf and Welling applied essentially the same style of computation to citation networks, where nodes are papers and edges are citation links, to classify documents by topic. In both cases, the model never sees a grid or a sequence; it only ever sees a graph's connectivity together with per-node and per-edge features, and it is precisely because message passing and graph convolution are defined purely in terms of a node's local neighborhood, with no assumption about neighbor count or order, that the same architecture transfers so directly between chemistry and citation analysis.

Depth, Over-Smoothing, and the Receptive-Field Trade-off · 14 min

Because each additional GNN layer lets information travel one more hop across the graph, stacking layers is what determines how far a node's final representation can "see." Stanford's CS224W lecture materials on GNN design make this receptive field concrete: a one-layer GNN's receptive field for a given node covers only that node's immediate neighbors, a two-layer GNN's receptive field extends to neighbors of neighbors, and by three layers the receptive field can already cover almost all the nodes in a moderately sized graph. This might seem like an unambiguous argument for building deep GNNs, by analogy with how deep convolutional networks build increasingly abstract visual features layer by layer, since a node with a larger receptive field has access to information from a larger portion of the graph.

In practice, however, GNNs run into a distinct failure mode as they get deeper, one that CS224W's materials describe directly: over-smoothing, in which all the node embeddings converge to the same value. This is a serious problem specifically because the entire point of computing node embeddings is to differentiate nodes from one another; embeddings that have converged to nearly identical values carry no useful node-specific information for a downstream classifier to exploit. The underlying mechanism is receptive-field overlap: if two nodes have highly overlapping receptive fields, their embeddings end up highly similar, because they are built by aggregating information from largely the same set of neighboring nodes. As CS224W's slides put it, stacking many GNN layers causes nodes to have highly overlapped receptive fields, which in turn causes their embeddings to become highly similar, and because shared neighbors grow quickly as the number of hops increases, this overlap — and the resulting smoothing — becomes severe well before a graph neural network reaches anything like the depth of a modern deep CNN.

The practical consequence is that depth in graph neural networks behaves very differently from depth in image or language models, where adding more layers is frequently, though not unconditionally, beneficial. Most graph neural networks used in practice today stay comparatively shallow, commonly on the order of two to four message-passing layers, precisely to keep receptive fields from overlapping so heavily that node representations collapse together. Counteracting over-smoothing while still allowing information to travel further across a graph, for instance through skip connections that let earlier, less-smoothed representations bypass later layers, remains an active area of graph representation learning research rather than a fully closed problem, and any specific GNN architecture's effective depth is best understood as a deliberate trade-off between receptive-field size and representational distinctiveness, not simply as a hyperparameter to maximize.

Practice

Message Passing and Receptive Fields

A B C D E 1-hop: in A's receptive field after Layer 1 2-hop: added to A's receptive field after Layer 2 (via B)

Each round of message passing lets node A absorb information from one hop further away: after one layer, A's representation reflects only B, C, and D; after a second layer, it also reflects E, because B's own updated state now carries E's information into A's neighborhood.

  • Graph nodes have no natural order or fixed neighbor count, so a GNN's aggregation function over a node's neighbors must be order invariant (sum, mean, or max) — this single constraint is the central architectural difference that separates graph neural networks from CNNs and RNNs.
  • Message passing (Gilmer et al., 2017) unifies many GNN variants into one pattern: each round, every node aggregates incoming messages from its neighbors and updates its own hidden state, so stacking k rounds expands every node's effective receptive field to its k-hop neighborhood.
  • Depth is a trade-off, not a free upgrade: stack too many GNN layers and nodes' receptive fields start overlapping so heavily that their embeddings converge toward the same value — over-smoothing — which is why most practical GNNs stay shallow, commonly two to four layers.

Recall Practice

Non-Euclidean dataClick to reveal
What does it mean for data to be "non-Euclidean" in Bronstein et al.'s sense, and why does that break a standard CNN's assumptions?
Non-Euclidean data — graphs and manifolds — lacks a global parameterization, a common coordinate system, vector space structure, and shift-invariance, all properties that images (grids) and text (sequences) have and that CNNs and RNNs rely on directly.
Permutation invarianceClick to reveal
Why must a GNN's neighbor-aggregation function be order invariant, per CS224W?
Because a graph node's neighbors have no natural order and no fixed count — unlike pixels in a grid or words in a sentence — so the aggregation function's output cannot be allowed to depend on the arbitrary order in which neighbors are listed.
One round of message passingClick to reveal
In the Message Passing Neural Network framework, what happens during a single round of message passing?
Every node sends a message to its neighbors based on its current hidden state (and any edge features), every node aggregates the messages it receives using an order-invariant function, and each node then updates its own hidden state from that aggregate.
Over-smoothingClick to reveal
What is over-smoothing, and what causes it to worsen as more GNN layers are stacked?
Over-smoothing is node embeddings converging to nearly the same value; it worsens with depth because stacking more layers makes nodes' receptive fields overlap more heavily, so increasingly many nodes end up aggregating information from largely the same neighborhood.

Glossary

Non-Euclidean data
Data such as graphs or manifolds that lack a global parameterization, a common coordinate system, vector space structure, or shift-invariance — properties that grid-shaped (image) or sequential (text) data possess.
Geometric deep learning
Bronstein et al.'s umbrella term for techniques that generalize deep neural network models to non-Euclidean domains such as graphs and manifolds.
Message passing (MPNN)
Gilmer et al.'s unifying framework in which each graph node repeatedly sends messages to and aggregates messages from its neighbors, updating its own hidden state each round; stacking rounds expands each node's receptive field.
Graph Convolutional Network (GCN)
Kipf and Welling's efficient GNN layer, motivated as a localized first-order approximation of spectral graph convolutions, that scales linearly in the number of graph edges.
Permutation (order) invariance
The property that a function's output does not change when the order of its inputs is permuted — required of a GNN's neighbor-aggregation function since graph neighbors have no canonical order.
Over-smoothing
The phenomenon in which stacking many GNN layers causes node embeddings to converge toward similar values, as increasingly overlapping receptive fields cause nodes to aggregate largely the same neighborhood information.
Practical Activity

Trace Two Rounds of Message Passing by Hand

A virtual, paper-based worksheet exercise (no software, no real graph library or GPU execution). Learners are given a small supplied 5-node graph (nodes A through E, with A connected to B, C, and D, and B additionally connected to E) along with toy scalar 'features' for each node. Working entirely by hand, they compute node A's updated value after one round of message passing (aggregating B, C, and D's features using a stated order-invariant function such as elementwise average) and then after a second round (in which B's updated value, now itself reflecting E, is folded into A's neighborhood). Learners then identify, on paper, exactly which nodes fall inside A's receptive field after one layer versus after two layers, and write two or three sentences explaining, in their own words, why stacking many more rounds on a small graph like this one would risk over-smoothing.

Ready to test yourself?

5 questions on this module.

Start Quiz