Leveraging Classical Algorithms for Graph Neural Networks
Jason Wu, Petar Veličković
TL;DR
This work addresses the generalization gap of neural networks on graph-structured molecular data by injecting inductive biases from classical algorithmic reasoning. It pretrains CLRS models on 24 algorithms and transfers their weights to a Graph Neural Network for molecular property prediction, freezing selected layers during downstream training on ogbg-molhiv and ogbg-molclintox. The results show notable gains, with Segments Intersect achieving about $6\%$ absolute improvement on MolHIV and Dijkstra yielding around $3\%$ on MolClintox, illustrating that algorithmic priors can meaningfully boost real-world graph tasks. This approach offers a computationally efficient and principled way to combine algorithmic reasoning with graph learning, complementing large-scale pretraining strategies and guiding future exploration of multi-algorithm pretraining for diverse graph domains.
Abstract
Neural networks excel at processing unstructured data but often fail to generalise out-of-distribution, whereas classical algorithms guarantee correctness but lack flexibility. We explore whether pretraining Graph Neural Networks (GNNs) on classical algorithms can improve their performance on molecular property prediction tasks from the Open Graph Benchmark: ogbg-molhiv (HIV inhibition) and ogbg-molclintox (clinical toxicity). GNNs trained on 24 classical algorithms from the CLRS Algorithmic Reasoning Benchmark are used to initialise and freeze selected layers of a second GNN for molecular prediction. Compared to a randomly initialised baseline, the pretrained models achieve consistent wins or ties, with the Segments Intersect algorithm pretraining yielding a 6% absolute gain on ogbg-molhiv and Dijkstra pretraining achieving a 3% gain on ogbg-molclintox. These results demonstrate embedding classical algorithmic priors into GNNs provides useful inductive biases, boosting performance on complex, real-world graph data.
