Message Passing Neural Networks
1. Graph Representation and Node Features
Graph Representation and Node Features
Message Passing Neural Networks (MPNNs) operate on graph-structured data, where entities are represented as nodes and their relationships as edges. The foundation of MPNNs lies in the mathematical representation of graphs, typically denoted as G = (V, E), where V is the set of nodes and E the set of edges. Each node v ∈ V is associated with a feature vector h_v ∈ ℝ^d, encoding its attributes, while edges may also carry features e_uv ∈ ℝ^k to represent relational properties.
Node Feature Initialization
Node features serve as the initial state for message passing and are often derived from domain-specific data. For molecular graphs, features might include atom types, charges, or hybridization states, encoded as one-hot vectors or continuous scalars. In social networks, node features could represent user demographics or activity metrics. The dimensionality d of h_v is a hyperparameter, often chosen to balance expressiveness and computational efficiency.
Here, x_v is the raw input feature vector, W_{in} is a learnable weight matrix, and b is a bias term. The nonlinearity σ (e.g., ReLU or tanh) introduces expressiveness. For graphs with no predefined features, randomized or constant initializations are sometimes used, though this limits the model’s ability to distinguish nodes a priori.
Edge Features and Adjacency
Edges define the connectivity over which messages are passed. The adjacency matrix A ∈ {0, 1}^{|V|×|V|} encodes binary connections, while weighted variants capture interaction strengths. Directed graphs use asymmetric adjacency matrices, and edge features e_uv can enrich this representation—e.g., bond types in molecules or interaction frequencies in recommendation systems. For edge-aware MPNNs, the message function incorporates e_uv as:
where ϕ is a neural network. In absence of edge features, a simpler form like m_{uv} = h_u^{(t)} suffices, reducing the model to isotropic aggregation.
Spatial vs. Spectral Graph Representations
MPNNs typically adopt a spatial approach, where operations are defined directly on the graph topology via neighbor aggregation. Contrastingly, spectral methods rely on graph Fourier transforms, projecting node features onto the eigenbasis of the graph Laplacian L = D − A, where D is the degree matrix. While spectral methods offer theoretical guarantees, their computational cost and lack of spatial locality limit scalability. Modern MPNNs avoid explicit Laplacian decomposition, instead using learned filters for efficiency.
Practical Considerations
Real-world graphs often exhibit sparsity, with |E| ≪ |V|². Sparse matrix representations (e.g., COO or CSR formats) are essential for efficient storage and computation. Irregular graph structures also necessitate batched processing techniques, such as padding or graph sampling, to handle variable node degrees. Dynamic graphs, where edges evolve over time, further require mechanisms to update node features incrementally without full recomputation.

Message Passing Mechanism
The message passing mechanism is the core operation in Message Passing Neural Networks (MPNNs), enabling information exchange between nodes in a graph-structured data representation. At each step, nodes aggregate messages from their neighbors, update their internal states, and propagate new messages. This process is formalized through three key functions: message, aggregate, and update.
Mathematical Formulation
Let G = (V, E) be a graph with nodes v ∈ V and edges (v, w) ∈ E. Each node v has a feature vector hv(t) at step t, and each edge may have an optional feature vector evw. The message passing mechanism operates as follows:
where Mt is the message function at step t, and 𝒩(v) denotes the neighbors of node v. The aggregated messages are then used to update the node state:
Here, Ut is the update function that combines the previous state with incoming messages.
Message Functions
The message function Mt can take various forms, from simple linear transformations to complex neural networks. A common implementation uses a multi-layer perceptron (MLP) with learnable parameters θM:
where ∥ denotes vector concatenation. This allows the model to learn meaningful interactions between node and edge features.
Aggregation Schemes
The aggregation step combines messages from all neighbors. While summation is most common, other permutation-invariant operations can be used:
- Sum: Σw∈𝒩(v) mw - Preserves information about neighborhood size
- Mean: (1/|𝒩(v)|) Σw∈𝒩(v) mw - Normalizes by degree
- Max: maxw∈𝒩(v) mw - Captures most salient features
Update Functions
The update function Ut determines how a node incorporates new messages into its state. A gated update mechanism, inspired by GRUs or LSTMs, helps control information flow:
This allows nodes to retain relevant information while integrating new messages, addressing the vanishing gradient problem in deep MPNNs.
Multiple Message Passing Steps
By applying T message passing steps, information propagates T hops through the graph. The final node representations capture both local and global structural information. The choice of T depends on the graph diameter and task requirements - too few steps may leave distant nodes uninformed, while too many can lead to over-smoothing.
Edge Features and Directionality
When edge features evw are present, they can modulate message strength or type. For directed graphs, separate message functions can be defined for incoming and outgoing edges. In heterogeneous graphs, different message functions may be used for different edge types.

1.3 Aggregation and Update Functions
Mathematical Foundations of Aggregation
In message passing neural networks (MPNNs), aggregation functions combine messages from neighboring nodes into a single representation. Let N(v) denote the neighborhood of node v. The aggregated message m_v is computed as:
Common aggregation functions include:
- Sum aggregation: m_v = ∑_{u∈N(v)} h_u (permutation invariant but sensitive to cardinality)
- Mean aggregation: m_v = (1/|N(v)|) ∑_{u∈N(v)} h_u (normalizes by degree)
- Max pooling: m_v = max({MLP(h_u) ∀ u ∈ N(v)}) (captures dominant features)
Attention-Based Aggregation
Graph Attention Networks (GATs) implement learnable aggregation through attention coefficients α_uv:
where a is a learnable attention vector and W is a weight matrix. The aggregated message becomes:
Update Functions
The node update function combines the aggregated message with the node's previous state:
Common implementations include:
- GRU-based updates: Treats message passing as a sequence modeling problem
- MLP updates: h_v = σ(W[h_v || m_v] + b) with nonlinear activation σ
- Residual updates: h_v = h_v + MLP(m_v) helps mitigate oversmoothing
Edge Feature Integration
When edge features e_uv exist, the message function extends to:
where f is typically implemented as an MLP. The PNA (Principal Neighbourhood Aggregation) framework proposes degree-scaled aggregators:
where ⊕ combines multiple aggregators and δ is a hyperparameter controlling degree normalization.
Practical Considerations
For large-scale graphs, approximate aggregation methods become necessary:
- Neighbor sampling: Randomly subsets neighbors during aggregation
- Cluster-GCN: Partitions graph and aggregates within clusters
- GraphSAGE: Uses fixed-size neighborhood samples with L2 normalization
The choice of aggregation and update functions significantly impacts performance on tasks like molecular property prediction (where sum aggregation excels) or social network analysis (where attention mechanisms prove more effective).

2. Graph Convolutional Networks (GCNs)
Graph Convolutional Networks (GCNs)
Graph Convolutional Networks (GCNs) extend the concept of convolutional neural networks (CNNs) to graph-structured data by leveraging spectral graph theory and localized first-order approximations of spectral convolutions. The core idea is to learn node representations by aggregating features from neighboring nodes, enabling inductive and transductive learning on graphs.
Spectral Graph Convolutions
The foundation of GCNs lies in spectral graph theory, where graph convolutions are defined in the Fourier domain. Given an undirected graph G with adjacency matrix A and degree matrix D, the normalized graph Laplacian is defined as:
where I is the identity matrix. The Laplacian diagonalizes into L = UΛUᵀ, where U contains the eigenvectors and Λ the eigenvalues. A spectral convolution of input signals x with filter gθ is then:
First-Order Approximation
To avoid costly eigen-decomposition, Kipf & Welling (2017) proposed a first-order Chebyshev polynomial approximation, simplifying the filter to operate directly on the graph structure. The layer-wise propagation rule becomes:
where:
- H(l) are the node features at layer l
- W(l) is the trainable weight matrix
- σ is a nonlinear activation (e.g., ReLU)
- Ã = A + I (self-loops added)
- D̃ is the degree matrix of Ã
Message Passing Interpretation
GCNs can be viewed as a special case of message passing where each node aggregates normalized features from its neighbors. For node i, the update rule is:
where di, dj are the degrees of nodes i and j respectively. This formulation shows how GCNs smooth features across graph neighborhoods while maintaining scale invariance through degree normalization.
Practical Considerations
Key implementation details include:
- Sparse matrix operations for efficient computation on large graphs
- Batch normalization to stabilize training in deep architectures
- Dropout applied to the weight matrices during training
- Skip connections to mitigate oversmoothing in deep networks
GCNs achieve state-of-the-art performance on node classification, link prediction, and graph classification tasks while maintaining computational efficiency through localized operations. Their success has spawned numerous variants including GraphSAGE, GAT, and GIN, which extend the basic architecture with attention mechanisms and more sophisticated aggregation functions.
Graph Attention Networks (GATs)
Graph Attention Networks (GATs) extend the standard message-passing framework by introducing attention mechanisms to dynamically weigh the importance of neighboring nodes during aggregation. Unlike Graph Convolutional Networks (GCNs), which use fixed or pre-defined weights, GATs compute attention coefficients αij to determine how much node j contributes to the representation of node i.
Attention Mechanism in GATs
The attention coefficient αij is computed as:
where:
- eij is the raw attention score,
- W is a learnable weight matrix,
- a is a learnable attention vector,
- hi and hj are node features,
- ∥ denotes concatenation.
The coefficients are normalized across all neighbors j ∈ N(i) using softmax:
Multi-Head Attention
To stabilize learning and capture diverse relational patterns, GATs employ multi-head attention, where multiple independent attention mechanisms are used in parallel. The final node representation is either concatenated (for intermediate layers) or averaged (for the final layer):
where K is the number of attention heads.
Advantages Over GCNs
- Dynamic neighborhood weighting: Unlike fixed weights in GCNs, GATs adaptively prioritize relevant neighbors.
- Interpretability: Attention coefficients reveal node influence patterns.
- Scalability: Computes attention only over immediate neighbors, avoiding full graph operations.
Practical Applications
GATs excel in tasks requiring relational reasoning, such as:
- Molecular property prediction: Attention highlights critical atomic interactions.
- Recommendation systems: User-item interactions are weighted dynamically.
- Knowledge graphs: Attention identifies semantically relevant edges.
Implementation Considerations
When implementing GATs:
- Memory efficiency: Sparse matrix operations are preferred for large graphs.
- Normalization: Layer normalization stabilizes multi-head outputs.
- Edge features: Extensions like GATv2 incorporate edge attributes into attention.

GraphSAGE and Inductive Learning
GraphSAGE (Graph Sample and AggregatE) extends traditional message-passing neural networks (MPNNs) by introducing an inductive framework capable of generalizing to unseen nodes or entirely new graphs. Unlike transductive approaches such as GCNs, which require full graph visibility during training, GraphSAGE leverages node feature information and local neighborhood sampling to generate embeddings dynamically.
Inductive Learning Framework
The core innovation of GraphSAGE lies in its ability to learn an aggregation function rather than fixed node embeddings. Given a target node v, its embedding h_v is computed through K iterative aggregation steps, each combining information from a sampled neighborhood. The forward propagation rule at layer k is:
Here, AGGREGATE can be instantiated as mean pooling, LSTM, or max-pooling operators. The sampling of neighbors 𝒩(v) at each step ensures scalability, making GraphSAGE applicable to large-scale graphs.
Neighborhood Sampling and Aggregation
GraphSAGE employs a fixed-size uniform sampling strategy to control computational complexity. For each node, a subset of S neighbors is randomly selected at each layer, reducing memory overhead from O(D^K) to O(S^K), where D is the average node degree. The aggregation step is permutation-invariant, ensuring consistency across different sampling orders. Common variants include:
- Mean Aggregator: Element-wise mean of neighbor features.
- LSTM Aggregator: Bidirectional LSTM over shuffled neighbor features.
- Pooling Aggregator: Feed-forward network with element-wise max pooling.
Loss Function and Training
For unsupervised tasks, GraphSAGE optimizes a graph-based loss function that preserves proximity in the embedding space:
where u is a node co-occurring with v in random walks, P_n is the negative sampling distribution, and Q defines the number of negative samples. Supervised tasks use task-specific losses (e.g., cross-entropy for node classification).
Practical Applications
GraphSAGE's inductive nature makes it ideal for dynamic graphs (e.g., social networks with new users) or systems requiring real-time inference (e.g., recommendation engines). Case studies include:
- Pinterest's PinSAGE: Scaled to 3 billion nodes with hierarchical sampling.
- Fraud Detection: Generalizing to previously unseen transaction patterns.
Limitations and Extensions
While GraphSAGE addresses transductive limitations, its performance depends on the quality of sampled neighborhoods. Recent extensions like GraphSAINT improve stability via subgraph sampling, while Cluster-GCN partitions graphs to minimize inter-partition dependencies.

3. Loss Functions for Graph Tasks
3.1 Loss Functions for Graph Tasks
Message Passing Neural Networks (MPNNs) require specialized loss functions tailored to graph-structured data, where the learning objective depends on node-level, edge-level, or graph-level tasks. The choice of loss function is critical for optimizing the network's ability to capture relational dependencies and hierarchical patterns in graphs.
Node-Level Classification Loss
For node classification tasks, where each node v in graph G must be assigned a label yv, the cross-entropy loss is commonly used. Given predicted logits zv for node v, the loss over all labeled nodes VL is:
Here, C is the number of classes, and yv,c is a one-hot encoded ground truth vector. For imbalanced node classes, weighted cross-entropy or focal loss can be applied to mitigate bias toward majority classes.
Edge-Level Prediction Loss
Edge prediction tasks, such as link prediction or edge classification, often employ a binary cross-entropy loss with negative sampling. Given an adjacency matrix A and predicted edge probabilities puv, the loss is:
where ℰ is the set of observed edges, and ℰ- is a set of negatively sampled non-edges. For signed or weighted graphs, the loss can be extended to include edge weights or multi-class edge labels.
Graph-Level Regression and Classification
Graph-level tasks, such as molecular property prediction or graph classification, require aggregating node/edge representations into a global graph embedding hG. For regression tasks, mean squared error (MSE) is typical:
where f is a readout function mapping the graph embedding to a scalar. For graph classification, cross-entropy loss is applied to the softmax-normalized output logits.
Contrastive Loss for Self-Supervised Learning
In self-supervised graph representation learning, contrastive loss functions like InfoNCE are used to maximize mutual information between differently augmented views of the same graph:
where hGi and hGi' are embeddings of two augmented views of graph Gi, sim is a similarity metric (e.g., cosine similarity), and τ is a temperature hyperparameter.
Regularization and Auxiliary Losses
Graph tasks often benefit from auxiliary losses that enforce structural constraints. For example, a Laplacian regularization term can preserve local smoothness in node embeddings:
where H is the matrix of node embeddings, L is the graph Laplacian, and λ controls the regularization strength. Other auxiliary losses may include reconstruction losses for autoencoder-based architectures or adversarial losses for generative graph models.
3.2 Regularization Techniques
Dropout in Message Passing Layers
Dropout is a widely adopted regularization technique that randomly deactivates neurons during training to prevent co-adaptation. In Message Passing Neural Networks (MPNNs), dropout can be applied to node and edge features during message aggregation. For a given node v with hidden state h_v, dropout is applied element-wise to the incoming messages:
where p is the dropout probability. This ensures that no single message dominates the aggregation step, promoting robust feature learning. Empirical studies show that dropout rates between 0.2 and 0.5 work well for MPNNs.
Weight Decay and L2 Regularization
Weight decay penalizes large parameter values by adding an L2 norm term to the loss function. For MPNNs with learnable parameters θ, the regularized loss L' is:
where λ controls regularization strength. This is particularly effective in preventing overfitting in graph attention mechanisms, where attention coefficients may otherwise become overly sharp.
Edge Dropout and Graph Augmentation
Unlike standard dropout, edge dropout randomly removes edges during training, acting as a graph-level regularizer. For a graph G = (V, E), a modified adjacency matrix à is generated:
This technique improves generalization by forcing the network to learn from incomplete neighborhood information, mimicking real-world noisy graphs.
Layer Normalization
Layer normalization stabilizes hidden state updates across nodes with varying degrees. For a node v with hidden state h_v, normalization is applied as:
where μ and σ are the mean and standard deviation of h_v, while γ and β are learnable parameters. This is critical in deep MPNNs where node-wise feature scales may diverge.
Early Stopping with Validation Loss
Early stopping monitors validation loss during training and halts optimization when performance plateaus. For MPNNs, validation loss is typically measured on a held-out subgraph. The patience parameter determines how many epochs to wait before stopping, with typical values between 10 and 50 for graph tasks.
Label Smoothing
Label smoothing replaces hard class labels with soft targets, preventing overconfidence in classification tasks. For a binary label y, the smoothed target y' becomes:
where ϵ is typically set to 0.1. This technique is especially useful in graph classification tasks with class imbalance.
3.3 Scalability and Efficiency Considerations
Computational Complexity of MPNNs
The computational cost of a single message-passing step in an MPNN is dominated by the aggregation and update operations. For a graph with N nodes and E edges, where each node has a feature vector of dimension d, the time complexity scales as:
The first term arises from the node update function, typically implemented as a dense neural network layer with d×d weights. The second term comes from edge-wise message computations. In sparse graphs where E ~ N, this reduces to 𝒪(Nd²), but for dense graphs (e.g., complete graphs where E ~ N²), complexity becomes quadratic.
Memory Bottlenecks in Large Graphs
MPNNs face significant memory constraints when processing graphs with millions of nodes. The key memory consumers are:
- Node embeddings: Storing all N node states requires 𝒪(Nd) memory
- Edge messages: Temporary storage of all messages demands 𝒪(Ed) space
- Gradient storage: Backpropagation through multiple message-passing steps creates additional memory overhead
For example, a graph with 10M nodes and d=256 dimensional features consumes ~2.5GB just for node embeddings in float32 precision. This excludes the memory needed for intermediate computations during training.
Approximation Techniques for Scalability
Graph Sampling Methods
Neighborhood sampling strategies reduce computational load by processing subgraphs:
- Node-wise sampling: Each target node samples a fixed number of neighbors per layer
- Layer-wise sampling: Independent sampling at each message-passing layer
- Subgraph sampling: Extracts connected subgraphs via random walks or graph partitioning
The GraphSAGE approach uses node-wise sampling to cap the neighborhood size at k, reducing per-batch complexity to 𝒪(Bkᴸd²) for L layers and batch size B.
Decoupling Propagation from Transformation
Methods like Simplified Graph Convolution (SGC) separate feature transformation from message passing:
where  is the normalized adjacency matrix and W is a learned weight matrix. This avoids repeated nonlinear transformations while still capturing multi-hop dependencies.
Hardware-Aware Optimizations
Modern implementations leverage several hardware optimizations:
- Sparse matrix operations: Utilizing specialized kernels for sparse-dense matrix multiplication (e.g., cuSPARSE)
- Edge batching: Partitioning edge sets to fit within GPU memory limits
- Quantization: Using mixed-precision training with FP16/INT8 representations
Recent work shows that combining these techniques can achieve 10-100× speedups on large-scale graphs compared to naive implementations.
Distributed Training Strategies
For graphs exceeding single-machine capacity, distributed approaches become essential:
- Graph partitioning: Methods like METIS divide the graph across workers while minimizing edge cuts
- Parameter server architectures: Central servers synchronize model parameters while workers process graph partitions
- Full-graph caching: Storing node features in distributed memory with locality-aware placement
The trade-off between communication overhead and computational efficiency becomes critical in distributed settings, with optimal batch sizes typically ranging from 1K-10K nodes per worker.
4. Molecular Property Prediction
Molecular Property Prediction
Message Passing Neural Networks (MPNNs) excel at molecular property prediction by leveraging graph-structured representations of molecules, where atoms are nodes and bonds are edges. The key advantage lies in their ability to capture local and global interactions through iterative message passing, enabling accurate modeling of quantum mechanical properties, solubility, toxicity, and bioactivity.
Graph Representation of Molecules
A molecule is formally represented as a graph G = (V, E), where V is the set of nodes (atoms) and E is the set of edges (bonds). Each node v ∈ V is associated with a feature vector h_v encoding atomic properties such as:
- Atomic number
- Formal charge
- Hybridization state
- Valence electrons
Edges e_uv ∈ E between nodes u and v are annotated with bond features like bond type (single, double, aromatic), bond length, and conjugation.
Message Passing Framework
The MPNN operates in three phases: message passing, node update, and readout. For each iteration t, the message m_v^t for node v is computed as:
where M_t is a message function (typically a neural network), and 𝒩(v) denotes the neighbors of v. The node state is then updated via:
with U_t being a node update function. After T iterations, a readout function aggregates all node states to predict the target property:
Practical Considerations
Effective molecular property prediction requires careful handling of:
- Invariance to graph isomorphism: Predictions must be identical for different atom orderings.
- Long-range interactions: Global attention mechanisms or higher-order message passing can capture non-local effects.
- Data efficiency: Transfer learning from large molecular datasets (e.g., QM9) improves performance on small experimental datasets.
Case Study: Predicting HOMO-LUMO Gaps
For quantum chemical properties like HOMO-LUMO gaps, MPNNs achieve near-density functional theory (DFT) accuracy while being orders of magnitude faster. The model processes 3D molecular conformations by augmenting edge features with spatial distances:
where ⊕ denotes concatenation and r_v are atomic coordinates. This approach captures both electronic and steric effects critical for orbital energy prediction.

4.2 Social Network Analysis
Graph Representation of Social Networks
Social networks are naturally modeled as graphs G = (V, E), where nodes v ∈ V represent individuals and edges e ∈ E denote interactions or relationships. Message Passing Neural Networks (MPNNs) operate on these graphs by propagating information along edges, updating node states iteratively. The adjacency matrix A encodes connectivity, while node features X ∈ ℝ^{|V|×d} capture attributes such as demographics or activity patterns.
Here, ϕ and ψ are differentiable update and message functions, respectively, and h_v^{(t)} is the hidden state of node v at step t. The aggregation over neighbors 𝒩(v) enables nodes to incorporate contextual information from their social circles.
Attention Mechanisms in Social MPNNs
Standard MPNNs treat all neighbors equally, but social interactions often exhibit varying influence. Graph Attention Networks (GATs) address this by learning attention weights α_{uv} for each edge:
where W is a learnable weight matrix and 𝐚 is an attention vector. This allows nodes to dynamically prioritize influential connections, mimicking real-world social dynamics like opinion leadership or information cascades.
Temporal Extensions for Dynamic Networks
Social networks evolve over time, necessitating models that handle dynamic graphs. Temporal Graph Networks (TGNs) extend MPNNs by incorporating time embeddings and memory modules:
The memory m_v(t) stores compressed node histories, updated upon new interactions. This captures phenomena like friendship decay or bursty communication patterns.
Applications in Social Network Analysis
- Community Detection: MPNNs learn latent representations that cluster nodes with similar structural roles or interaction patterns, outperforming traditional methods like modularity maximization.
- Influence Prediction: Attention weights directly quantify node influence, enabling applications in viral marketing or misinformation containment.
- Link Prediction: Pairwise scores σ(h_v^T h_u) predict future connections, useful for friend recommendation systems.
Case Study: Political Polarization
A 2022 study applied MPNNs to Twitter data, revealing that cross-ideological message passing drops sharply when polarization exceeds a threshold. The model quantified echo chamber effects by measuring the drop in attention weights between opposing groups:
where A and B are partisan clusters. This demonstrated MPNNs' ability to uncover nonlinear societal dynamics from raw interaction data.

Message Passing Neural Networks for Recommendation Systems
Graph-Based Collaborative Filtering
Traditional collaborative filtering methods rely on user-item interaction matrices, but they struggle with sparsity and cold-start problems. Message Passing Neural Networks (MPNNs) model these interactions as a bipartite graph, where users and items are nodes, and edges represent interactions. The key advantage is the ability to propagate latent features through the graph structure, capturing higher-order relationships.
Here, hu(l) denotes the embedding of user u at layer l, 𝒩(u) is the neighborhood of user u (interacted items), and W1, W2 are learnable weight matrices. A similar update applies to item embeddings.
Attention Mechanisms in MPNNs
Standard MPNNs treat all neighbors equally, but attention mechanisms dynamically weight contributions. The attention coefficient αui between user u and item i is computed as:
where a is a learnable attention vector and ∥ denotes concatenation. This allows the model to focus on more relevant interactions.
Practical Implementation
In practice, MPNNs for recommendation systems often use a two-tower architecture: one tower for users and another for items. The final prediction score for a user-item pair (u, i) is computed via dot product or a learned similarity function:
Training is performed using Bayesian Personalized Ranking (BPR) loss, which maximizes the margin between observed and unobserved interactions:
where 𝒟 is the set of training triples (u, i, j), with i being an observed interaction and j a negative sample.
Case Study: Pinterest's PinSage
PinSage, a large-scale MPNN-based recommender, leverages random walks to sample neighborhoods efficiently. It employs a novel importance pooling mechanism to aggregate features from neighbors, combined with a curriculum training strategy to handle billions of nodes. Key innovations include:
- Random walk sampling to approximate graph convolutions without full-batch training.
- Importance pooling to weight neighbors by visit counts from random walks.
- Hard negative mining to improve ranking performance.
Scalability Challenges
Training MPNNs on large graphs requires specialized techniques:
- Subgraph sampling: Mini-batch training via neighborhood sampling or graph partitioning.
- Distributed training: Parameter servers or federated learning for decentralized data.
- Inductive learning: Techniques like GraphSAGE generalize to unseen nodes by learning aggregation functions.

5. Handling Dynamic Graphs
5.1 Handling Dynamic Graphs
Traditional Message Passing Neural Networks (MPNNs) assume static graph structures, but many real-world systems involve graphs that evolve over time—social networks, financial transaction networks, or molecular dynamics. Handling dynamic graphs requires extending MPNNs to process temporal dependencies and structural changes.
Temporal Message Passing
For dynamic graphs, node and edge features become time-dependent: hv(t) and evu(t). The message passing update rule must incorporate temporal information:
where fθ is a learnable function (e.g., MLP) and t denotes the timestep. The node update then becomes:
Here, a Gated Recurrent Unit (GRU) or LSTM maintains a memory of past states, allowing the model to capture temporal dependencies. This approach is foundational in architectures like DySAT and TGAT.
Graph Rewiring Strategies
When graphs change structure (e.g., nodes/edges added/removed), MPNNs must adapt without retraining. Two key strategies are:
- Continuous-Time Dynamic Graphs (CTDGs): Model edge creation/deletion as a Poisson process, updating embeddings via temporal point processes.
- Discrete-Time Snapshots: Process graphs as a sequence of static snapshots, using methods like jump or wait time embeddings to handle irregular intervals.
Case Study: Traffic Prediction
In traffic networks, road segments (nodes) and connections (edges) may experience congestion changes or closures. A dynamic MPNN might:
- Encode traffic speed as time-varying node features.
- Use attention mechanisms to weigh messages from neighboring roads differently during peak hours.
- Employ a temporal skip-connection to remember periodic patterns (e.g., rush hour).
where αvu(t) is the attention weight between nodes v and u at time t, and W, a are learnable parameters.
Implementation Challenges
Key practical considerations include:
- Memory Efficiency: Storing all historical states is infeasible for large graphs. Techniques like memory banks or gradient checkpointing are essential.
- Training Stability: Temporal MPNNs suffer from vanishing gradients. Orthogonal regularization or skip connections mitigate this.
- Irregular Time Steps: Methods like Neural Ordinary Differential Equations (Neural ODEs) can interpolate between observations.
Advanced Architectures
Recent work extends MPNNs for dynamic graphs with:
- Graph Neural Ordinary Differential Equations (GNN-ODEs): Model node dynamics as continuous-time processes.
- Temporal Graph Networks (TGNs): Combine memory modules with graph attention for streaming graphs.
- Meta-Learning: Adapt message passing rules dynamically via hypernetworks.

5.2 Interpretability and Explainability
Challenges in MPNN Explainability
Message Passing Neural Networks inherit the black-box nature of deep learning models, but their graph-structured computations introduce additional complexity. Unlike convolutional networks operating on grid-like data, MPNNs process arbitrary graph topologies where node interactions are dynamically computed through message functions. This makes traditional attribution methods like Grad-CAM or saliency maps insufficient, as they cannot capture the relational dependencies between nodes.
The key challenges in MPNN interpretability include:
- Dynamic computation graphs: The message passing steps create transient computational paths that vary per input graph
- Non-local dependencies: Node representations depend on multi-hop neighbors through iterative aggregation
- Permutation invariance: Graph isomorphism makes it difficult to assign fixed importance scores to nodes/edges
Attention Mechanisms as Interpretability Tools
Graph Attention Networks (GATs) provide a natural pathway for interpretability by learning attention coefficients αij during message passing:
These coefficients form an attention matrix that can be visualized to show which edges contributed most to the final prediction. For molecular graphs, this reveals chemically meaningful substructures, while in social networks it highlights influential connections.
GNNExplainer: Post-hoc Interpretation
The GNNExplainer framework provides model-agnostic interpretation by optimizing a subgraph mask and feature mask that maximize mutual information with the prediction:
Where GS is the explanatory subgraph and FS are the relevant node features. This approach identifies both important graph topology and node attributes through:
- Edge mask learning via sigmoid activation
- Feature importance scoring through gradient-based attribution
- Approximation of the mutual information objective via Monte Carlo sampling
Concept-based Explanations
Recent work extends interpretability beyond edge/node importance to higher-level concepts. The Graph Concept Explainer (GCE) method discovers latent concepts by clustering node embeddings across layers:
Where Ck represents concept k, ck is the concept prototype, and τ is a similarity threshold. This reveals how molecular toxicity predictions might depend on functional groups or how fraud detection relies on specific transaction patterns.
Practical Considerations
When implementing MPNN interpretability methods, several practical factors must be considered:
- Computational overhead: GNNExplainer requires separate optimization runs for each input
- Stability: Explanation variance across different initializations should be measured
- Faithfulness: Explanations should be validated through edge perturbation tests
- Human evaluation: Domain experts must assess whether explanations match known mechanisms
In drug discovery applications, MPNN explanations have successfully identified toxicophores that match known chemical reactivity patterns, while in physics they've revealed meaningful interaction terms in particle systems.

5.3 Integration with Other AI Paradigms
Message Passing Neural Networks (MPNNs) exhibit strong synergies with other AI paradigms, enabling hybrid architectures that leverage complementary strengths. Graph attention mechanisms, for instance, enhance MPNNs by dynamically weighting neighbor contributions during message aggregation. The attention coefficients αij for node i attending to neighbor j are computed as:
where W is a learnable weight matrix and a is an attention vector. This integration allows MPNNs to focus on relevant graph substructures, improving performance in tasks like molecular property prediction.
Combining MPNNs with Geometric Deep Learning
When processing 3D molecular graphs, MPNNs integrate naturally with geometric deep learning frameworks. By augmenting messages with 3D spatial information—such as interatomic distances dij and directional vectors—the message function becomes:
where φ is a learned function (e.g., MLP) and ri denotes atomic coordinates. This approach underpins breakthroughs in quantum chemistry, achieving DFT-level accuracy in materials modeling.
Integration with Reinforcement Learning
MPNNs serve as powerful function approximators in graph-based reinforcement learning. In molecular design, the MPNN encodes the molecular graph state St, while a policy network selects actions (e.g., bond additions):
The REINFORCE algorithm then updates both components end-to-end. This hybrid approach has generated novel drug candidates with validated bioactivity in wet-lab experiments.
MPNNs in Neuro-Symbolic Systems
Recent work combines MPNNs with symbolic reasoning via differentiable theorem provers. The MPNN processes grounded knowledge graphs, while a symbolic module handles abstract rules. For a knowledge graph G and rule set R, the joint inference is formulated as:
where z are latent graph embeddings. This paradigm achieves human-level performance on benchmarks like CLUTRR for relational reasoning.
Case Study: MPNN-Transformer Hybrids
State-of-the-art architectures now marry MPNNs with Transformer self-attention. The GraphGPS framework processes local structure via MPNN messages while capturing global dependencies through attention:
This hybrid set new records on the OGB-LSC PCQM4Mv2 quantum chemistry dataset (0.0719 MAE), demonstrating the value of cross-paradigm integration.

6. Foundational Papers
6.1 Foundational Papers
- PDF Do we need to Improve Message Passing? Improving Graph Neural Networks ... — Abstract We investigate graph neural networks (GNNs) with modified message passing and propose novel graph transformations that allow standard message passing to achieve state-of-the-art expressiveness and predictive performance. Message passing graph neural networks (MPNNs) are known to have limited expressiveness in distinguishing graphs.
- Chapter 6 Message passing | Topological Deep Learning: Going Beyond ... — Theorem 6.3 (Message-passing neural networks and tensor diagrams) Message-passing neural networks defined on simplicial complexes, cell complexes or hypergraphs can be expressed in terms of tensor diagrams and their computations can be realized in terms of the three elementary tensor operators.
- Polarized message-passing in graph neural networks — In this paper, we present Polarized message-passing (PMP), a novel paradigm to revolutionize the design of message-passing graph neural networks (GNNs). In contrast to existing methods, PMP captures the power of node-node similarity and dissimilarity to acquire dual sources of messages from neighbors.
- PDF ACMP: Allen-Cahn Message Passing for Graph Neural Networks with ... — This induces an Allen-Cahn message passing (ACMP) for graph neural networks where the numerical iteration for the solution constitutes the message passing propagation and GNN prediction that enables node classification due to the formation of multi-clusters, helped by the phase transition of particles.
- Building attention and edge message passing neural networks for ... — Abstract Neural Message Passing for graphs is a promising and relatively recent approach for applying Machine Learning to networked data. As molecules can be described intrinsically as a molecular graph, it makes sense to apply these techniques to improve molecular property prediction in the field of cheminformatics. We introduce Attention and Edge Memory schemes to the existing message ...
- A novel message passing neural network based on neighborhood expansion — Most message passing neural networks (MPNNs) are widely used for assortative network representation learning under the assumption of homophily between connected nodes. However, this fundamental assumption is inconsistent with the heterophily of disassortative networks (DNs) in many real-world applications. Therefore, we propose a novel MPNN called NEDA based on neighborhood expansion for ...
- GitHub - cvignac/SMP — This paper contains code for the paper Building powerful and equivariant graph neural networks with structural message-passing (Neurips 2020) by Clément Vignac, Andreas Loukas and Pascal Frossard. Link to the paper Abstract: Message-passing has proved to be an effective way to design graph neural networks, as it is able to leverage both permutation equivariance and an inductive bias towards ...
- A modified GNN architecture with enhanced aggregator and Message ... — Graph neural networks (GNN) uphold the essence of irregularly structured information embedded in a graph via message passing among the nodes and aggregating the node features at various levels of the graph. In the past, researchers have extensively used the GNN models for several semi-supervised node classification tasks.
- Graph convolutional network with tree-guided anisotropic message passing — Graph Convolutional Networks (GCNs) with naive message passing mechanisms have limited performance due to the isotropic aggregation strategy. To remedy this drawback, some recent works focus on how to design anisotropic aggregation strategies with tricks on feature mapping or structure mining.
6.2 Books and Surveys
- Chapter 6 Message passing | Topological Deep Learning: Going Beyond ... — Chapter 6 Message passing. In this section, we explain the relation between the notion of the merge node introduced in Section 5.2 and higher-order message passing. In particular, we prove that higher-order message passing on CCs can be realized in terms of the elementary tensor operations introduced in Section 5.3.Further, we demonstrate the connection between CCANNs (Section 5.5) and higher ...
- Introduction to Graph Neural Networks - Academia.edu — ACM Computing Surveys, 2022. Graph neural networks (GNNs) have recently grown in popularity in the field of artificial intelligence (AI) due to their unique ability to ingest relatively unstructured data types as input data. ... attention mechanism, and skip connections. Gilmer et al. [2017] propose the message passing neural network (MPNN ...
- PDF Do we need to Improve Message Passing? Improving Graph Neural Networks ... — Abstract Weinvestigategraphneuralnetworks(GNNs)withmodifiedmessagepassingandpropose novelgraphtransformationsthatallowstandardmessagepassingtoachievestate-of-the-art
- A Theoretical Formulation of Many-body Message Passing Neural Networks — The MA CE (Message passing neural network. for Atom-Centered Potentials) framework (Batatia et al., 2022), symbolized by the correlation order. ... A survey on. oversmoothing in graph neural ...
- PDF A Degree: Comparing Graph Onvolutional Networks in The Message-passing ... — labels [Jaume et al., 2019]. We refer to [Sato, 2020] for an in-depth survey on the expressive power of graph neural networks. In this paper we start from the observation that many popular GNNs fall outside of the class of GNNs considered in previous work [Xu et al., 2019, Morris et al., 2019]. Prominent examples of such GNNs are the so-called ...
- PDF Message-passing in stochastic processing networks — Given the nature of 'message-passing' constraints and the form of optimization problems, the primal-dual algorithm provides the ap-propriate solution. This message-passing algorithmic solution is quite general and provides implementation of α-fair policy for any instance of stochastic pro-cessing network considered in this survey.
- Curvature constrained MPNNs: Improving message passing with local ... — Graph representation learning is a rapidly expanding research field that focuses on the development of versatile methods for effectively learning representations from graph-structured data [1], [2], [3], [4].The majority of Graph neural networks GNNs are based on the message passing paradigm [5], in which the information is propagated by the iterative exchange of information (messages) between ...
- PDF Distributed Algorithms for Message-Passing Systems - Inria — graduate courses are suggested in the section titled "How to Use This Book" in the Afterword. Content As already indicated, this book covers algorithms, basic principles, and foundations of message-passing programming, i.e., programs where the entities communicate by sending and receiving messages through a network. The world is
- PDF CHAPTER Neural Networks - Massachusetts Institute of Technology — We can view neural networks from several different perspectives: View 1 : An application of stochastic gradient descent for classication and regression with a potentially very rich hypothesis class. View 2 : A brain-inspired network of neuron-like computing elements that learn dis-tributed representations.
- (PDF) Chapter 6: Neural Networks and Deep Learning - ResearchGate — MA TLAB's neural network toolbox, much like T ensorFlow in python, has a wide range of features which makes it exceptionally powerful and convenient for building NNs.
6.3 Open-source Implementations
- Open MPI: Open Source High Performance Computing — A High Performance Message Passing Library. The Open MPI Project is an open source Message Passing Interface implementation that is developed and maintained by a consortium of academic, research, and industry partners. Open MPI is therefore able to combine the expertise, technologies, and resources from all across the High Performance Computing community in order to build the best MPI library ...
- Creating Message Passing Networks — pytorch_geometric documentation — PyG provides the MessagePassing base class, which helps in creating such kinds of message passing graph neural networks by automatically taking care of message propagation. The user only has to define the functions \(\phi\), i.e. message(), and \(\gamma\), i.e. update(), as well as the aggregation scheme to use, i.e. aggr="add", aggr="mean" or ...
- Polarized message-passing in graph neural networks — Message-passing graph neural networks (MPGNNs) [1], [2] are prominent tools for analyzing graph-structured data. MPGNNs heavily rely on a two-stage message-passing paradigm to learn representations for diverse downstream tasks. In the first stage, messages (i.e., node features) are conveyed to each central node from all of its neighbors.
- PDF MPI: A Message-Passing Interface Standard — The goal of the Message-Passing Interface, simply stated, is to develop a widely used standard for writing message-passing programs. As such the interface should establish a practical, portable, e cient, and exible standard for message-passing. This is the nal report, Version 1.0, of the Message-Passing Interface Forum. This document contains ...
- A Theoretical Formulation of Many-body Message Passing Neural Networks — We open-source our code at https://github. com/JThh/Many-Body-MPNN. 1. Introduction We study a generic graph setting where no information on distances between nodes or rotations of edges is available. We construct many-body message to increase the receptive field of a single message-passing step, than the two-body
- PDF A High-Performance, Portable Implementation of the MPI Message Passing ... — The process of creating a standard to enable portability of message-passing applica-tions codes began at a workshop on Message Passing Standardization in April 1992, and the Message Passing Interface (MPI) Forum organized itself at the Supercomputing '92 Conference. During the next eighteen months the MPI Forum met regularly, and Version
- A novel message passing neural network based on neighborhood expansion ... — Most message passing neural networks (MPNNs) are widely used for assortative network representation learning under the assumption of homophily between connected nodes. However, this fundamental assumption is inconsistent with the heterophily of disassortative networks (DNs) in many real-world applications. Therefore, we propose a novel MPNN called NEDA based on neighborhood expansion for ...
- GitHub - benedekrozemberczki/PDN: The official PyTorch implementation ... — A PyTorch implementation of "Pathfinder Discovery Networks for Neural Message Passing" (WebConf 2021). Abstract In this work we propose Pathfinder Discovery Networks (PDNs), a method for jointly learning a message passing graph over a multiplex network with a downstream semi-supervised model.
- ænet-PyTorch: A GPU-supported implementation for machine learning ... — Multiple MLP approaches have been proposed in the literature; some examples include artificial neural network-based potentials (ANN-based MLPs), 19-21 Gaussian approximation potentials, 22-24 kernel-based methods, 25-27 message-passing networks, 28-30 or spectral neighbor analysis potentials 31,32 among many others. In this case, our focus lies on the first group, ANN-based MLPs, which ...
- Source code for torch_geometric.nn.conv.message_passing - Read the Docs — @abstractmethod def message_and_aggregate (self, edge_index: Adj)-> Tensor: r """Fuses computations of :func:`message` and :func:`aggregate` into a single function. If applicable, this saves both time and memory since messages do not explicitly need to be materialized. This function will only gets called in case it is implemented and propagation takes place based on a :obj:`torch_sparse ...








