Core GNN Architectures
Relevant source files
The following files were used as context for generating this wiki page:
Core GNN Architectures in DGL-LifeSci represent a collection of Graph Neural Network implementations optimized for molecular property prediction, molecule embedding, and chemical reaction modeling. These architectures leverage the Deep Graph Library (DGL) to perform message passing on molecular graphs, where atoms are represented as nodes and bonds as edges.
The primary purpose of these architectures is to update node and edge representations through iterative message-passing rounds. Once updated, these representations are typically passed through a readout function (e.g., pooling) and a Multi-Layer Perceptron (MLP) to predict chemical properties or generate molecular fingerprints. Sources: examples/property_prediction/README.md, python/dgllife/model/gnn/init.py
Architecture Overview and Classification
The library supports several distinct classes of GNNs, ranging from standard spatial convolutions to complex message-passing frameworks that incorporate quantum-mechanical interactions or attention mechanisms.
Supported Model Families
| Model Name | Description | Key Components |
|---|---|---|
| GCN | Graph Convolutional Network | Spectral/spatial graph convolutions with residual and batchnorm support. |
| GAT | Graph Attention Network | Multi-head attention mechanisms for weighted neighbor aggregation. |
| MPNN | Message Passing Neural Network | General framework using message and update functions with bond features. |
| AttentiveFP | Attentive Fingerprint | Attention-based GNN using GRU for graph representation updates. |
| MGCN | Multi-level Quantum Interactions | Hierarchical GNN modeling interactions across different levels. |
| SchNet | Continuous-filter CNN | Models quantum interactions using radial basis functions for distances. |
Sources: examples/property_prediction/csv_data_configuration/README.md:38-55, examples/property_prediction/csv_data_configuration/model_configures/README.md:12-61
Multilevel Quantum Interactions (MGCN)
The MGCNGNN architecture is specifically designed for quantum chemistry datasets, such as Alchemy. It models multilevel interactions by combining node features, edge features, and expanded atomic distances. Sources: examples/property_prediction/alchemy/README.md:21-25, python/dgllife/model/gnn/mgcn.py:214-230
MGCN Data Flow
The architecture uses a VEConv (Vertex-Edge Convolution) layer to update representations. It generates edge types based on the combination of source and destination node types using an unordered pairing function.
The MGCNGNN concatenates the outputs from all GNN layers to form the final node representation. Sources: python/dgllife/model/gnn/mgcn.py:270-280, python/dgllife/model/gnn/mgcn.py:38-60
Interaction Components
- EdgeEmbedding: Maps pairs of atom types to unique embeddings using the formula $type = n_1 \times n_2 + \frac{(|n_1 - n_2| - 1)^2}{4}$. Sources: python/dgllife/model/gnn/mgcn.py:65-71
- VEConv: Combines node features, edge features, and expanded distances via
u_mul_eandcopy_eDGL functions. Sources: python/dgllife/model/gnn/mgcn.py:120-160 - RBFExpansion: Expands continuous edge distances into a high-dimensional representation using radial basis functions. Sources: python/dgllife/model/gnn/mgcn.py:234-237
Standard Spatial and Attention GNNs
The library provides robust implementations of GCN and GAT, which are commonly used for molecule classification and regression on datasets like Tox21 and MoleculeNet. Sources: examples/property_prediction/moleculenet/README.md:23-28
GCN Implementation
The GCN model supports stacked layers with configurable hidden features, residual connections, and batch normalization.
- Parameters:
gnn_hidden_feats,num_gnn_layers,residual,batchnorm,dropout. - Workflow: Node features are transformed via graph convolution, followed by optional activation and normalization.
GAT Implementation
The GAT model utilizes multi-head attention to determine the importance of neighboring atoms.
- Parameters:
num_heads,alpha(LeakyReLU slope),agg_modes(either 'flatten' or 'mean'). - Workflow: Each layer computes attention coefficients for edges and aggregates neighbor features based on these weights.
Sources: examples/property_prediction/csv_data_configuration/model_configures/README.md:12-28, tests/model/test_gnn.py:108-150
Message Passing and Sequence Architectures
Architectures like MPNN and AttentiveFP incorporate edge features and temporal update mechanisms like Gated Recurrent Units (GRU).
MPNN (Message Passing Neural Network)
The MPNN architecture processes both node and edge representations through multiple steps of message passing. It often uses set2set pooling for graph-level representations.
- Message Step: Updates node representations using edge-aware functions.
- Readout: Aggregates node features into a fixed-size graph vector.
AttentiveFP
AttentiveFP updates graph representations iteratively using a GRU. This allows the model to capture long-range dependencies within a molecule.
- Timesteps: Configurable via
num_timesteps. - Logic: Uses attention to aggregate neighbors and a GRU to update the global graph state.
Sources: examples/property_prediction/csv_data_configuration/model_configures/README.md:38-53, tests/model/test_gnn.py:84-106
Configuration and Hyperparameters
Common configurations for these architectures are managed via JSON files in the project.
| Hyperparameter | Type | Description |
|---|---|---|
lr | float | Learning rate for weight updates. |
patience | int | Epochs to wait before early stopping. |
weight_decay | float | L2 regularization strength. |
jk | str | Jumping Knowledge method (concat, last, max, sum) for GIN-based models. |
readout | str | Pooling method (sum, mean, max, attention). |
Sources: examples/property_prediction/csv_data_configuration/model_configures/README.md:3-61
Integration with Molecular Tasks
The GNN architectures serve as the backbone for various life science tasks. The following sequence shows how a GNN model is typically utilized in the property prediction workflow:
Core GNN Architectures provide a comprehensive suite of models tailored for molecular data. By implementing diverse message-passing strategies—from simple convolutions to complex quantum-inspired interactions—the project enables high-performance modeling across chemical and biological domains.