mlsanityData to 13 Oct 2026

Graph neural networks extrapolate out-of-distribution for shortest paths

arXiv 2503.19173 ↗First posted 24 Mar 2025cs.LG cs.DScited by 10

Not on the map. Why?

Abstract (arXiv)

Neural networks (NNs), despite their success and wide adoption, still struggle to extrapolate out-of-distribution (OOD), i.e., to inputs that are not well-represented by their training dataset. Addressing the OOD generalization gap is crucial when models are deployed in environments significantly different from the training set, such as applying Graph Neural Networks (GNNs) trained on small graphs to large, real-world graphs. One promising approach for achieving robust OOD generalization is the framework of neural algorithmic alignment, which incorporates ideas from classical algorithms by designing neural architectures that resemble specific algorithmic paradigms (e.g. dynamic programming). The hope is that trained models of this form would have superior OOD capabilities, in much the same way that classical algorithms work for all instances. We rigorously analyze the role of algorithmic alignment in achieving OOD generalization, focusing on graph neural networks (GNNs) applied to the canonical shortest path problem. We prove that GNNs, trained to minimize a sparsity-regularized loss over a small set of shortest path instances, exactly implement the Bellman-Ford (BF) algorithm for shortest paths. In fact, if a GNN minimizes this loss within an error of ε, it implements the BF algorithm with an error of O(ε). Consequently, despite limited training data, these GNNs are guaranteed to extrapolate to arbitrary shortest-path problems, including instances of any size. Our empirical results support our theory by showing that NNs trained by gradient descent are able to minimize this loss and extrapolate in practice.

Key facts. Cited by 10 papers in the map (data through 13 Oct 2026). Builds on 33 of its 39 references that are in the map. First posted on arXiv 24 Mar 2025.

Builds on

33 of 39 references.

References · 33

  1. 2017Inductive Representation Learning on Large Graphscited by 6,303
  2. 2017Neural Message Passing for Quantum Chemistrycited by 3,471
  3. 2019A Comprehensive Survey on Graph Neural Networkscited by 2,911
  4. 2018Graph Neural Networks: A Review of Methods and Applicationscited by 1,574
  5. 2017MoleculeNet: A Benchmark for Molecular Machine Learningcited by 1,043
  6. 2020Learning to Simulate Complex Physics with Graph Networkscited by 873
  7. 2017Learning Combinatorial Optimization Algorithms over Graphscited by 557
  8. 2021Towards Out-Of-Distribution Generalization: A Surveycited by 432
  9. 2021Combinatorial optimization and reasoning with graph neural networkscited by 267
  10. 2022Transformers Learn Shortcuts to Automatacited by 261
  11. 2020How Neural Networks Extrapolate: From Feedforward to Graph Neural Networkscited by 219
  12. 2019What graph neural networks cannot learn: depth vs widthcited by 198
21 more
  1. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
  2. 2019What Can Neural Networks Reason About?cited by 158
  3. 2020From Local Structures to Size Generalization in Graph Neural Networkscited by 120
  4. 2019Neural Execution of Graph Algorithmscited by 118
  5. 2020Erdos Goes Neural: an Unsupervised Learning Framework for Combinatorial Optimization on Graphscited by 115
  6. 2022The CLRS Algorithmic Reasoning Benchmarkcited by 103
  7. 2021Neural Algorithmic Reasoningcited by 93
  8. 2022Domain-Adjusted Regression or: ERM May Already Learn Features Sufficient for Out-of-Distribution Generalizationcited by 69
  9. 2019Approximation Ratios of Graph Neural Networks for Combinatorial Problemscited by 68
  10. 2023Length Generalization in Arithmetic Transformerscited by 65
  11. 2022Theory of Graph Neural Networks: Representation and Learningcited by 61
  12. 2022Graph Neural Networks are Dynamic Programmerscited by 55
  13. 2020Learning Algebraic Multigrid Using Graph Neural Networkscited by 54
  14. 2023A graphon-signal analysis of graph neural networkscited by 29
  15. 2023Limits, approximation and size transferability for GNNs on sparse graphs via graphopscited by 17
  16. 2023Asynchronous Algorithmic Alignment with Cocyclescited by 13
  17. 2024Recurrent Aggregators in Neural Algorithmic Reasoningcited by 6
  18. 2022Learning Graph Algorithms With Recurrent Graph Neural Networkscited by 5
  19. 2025Subsampling Graphs with GNN Performance Guaranteescited by 4
  20. 2024Help Me Help You: The Aggregate Value of Source and Target Data in Transfer Learningcited by 3
  21. 2024Accelerating data-driven algorithm selection for combinatorial partitioning problemscited by 2

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2025: 4; 2026: 6.

10 papers.