Abstract
Neural Algorithmic Reasoning (NAR) aims to train neural networks to execute classical algorithms. However, traditional supervised approaches struggle with solution validity, multiple correct outputs, NP-hard complexity, and a strict dependency on expert demonstrations. This paper introduces GNARL (Graph Neural Algorithmic Reasoning with Reinforcement Learning), which reimagines algorithm execution as a Markov Decision Process (MDP). By shifting from supervised imitation to reinforcement learning, GNARL produces valid-by-construction solutions and can learn novel strategies without expert labels. Experimental results across CLRS-30 benchmarks and NP-hard problems like the Traveling Salesperson Problem (TSP) show that GNARL achieves state-of-the-art accuracy and robust zero-shot generalization to larger graphs.
Introduction
Neural Algorithmic Reasoning (NAR) is an emerging field that trains neural networks to execute classical algorithms, such as shortest paths or sorting. Traditionally, this is treated as a supervised learning task where the network mimics step-by-step "hints" from an expert algorithm. However, this approach faces four major "GNARLy" limitations:
- Validity: Supervised models often output illegal solutions (e.g., paths using non-existent edges) requiring heavy post-processing.
- Multiplicity: Many problems have multiple valid solutions, but supervised learning forces a model to pick just one.
- Complexity: Standard NAR struggles with NP-hard combinatorial problems.
- Expert Dependency: Training is impossible without a pre-existing expert algorithm to provide labels.
The GNARL Framework
The researchers propose GNARL (Graph Neural Algorithmic Reasoning with Reinforcement Learning), which reframes algorithm execution as a Markov Decision Process (MDP). In this framework, the algorithm is viewed as a sequence of decisions where the state consists of graph features and internal variables, and actions involve selecting specific nodes or edges.
GNARL replaces the traditional "Encode-Process-Decode" architecture with an "Encode-Process-Act" pipeline. It utilizes a Message-Passing Neural Network (MPNN) to process graph data and a "proto-action" mechanism to select nodes regardless of graph size. Training is conducted via Behavioral Cloning (BC) when an expert is available, or Proximal Policy Optimization (PPO) to learn from scratch via reward signals. This MDP structure ensures solutions are valid by construction through action masking, eliminating the need for external clean-up heuristics.
Experimental Evaluation
The authors evaluated GNARL across three distinct categories: the CLRS-30 benchmark, NP-hard problems (Minimum Vertex Cover and TSP), and Robust Graph Construction (RGC).
Key Results
- CLRS-30: GNARL achieved 100% graph accuracy on BFS and DFS, significantly outperforming the standard TripletMPNN baseline. On Bellman-Ford, it reached ~81.6% accuracy, a massive improvement over the baseline's ~12.4%.
- NP-Hard Performance: On the Traveling Salesperson Problem, GNARL achieved results only 2.2% worse than optimal, outperforming both the classic Christofides heuristic and previous NAR-based approaches. It also demonstrated significantly faster inference speeds on large instances (1000 nodes) by avoiding expensive beam searches.
- Discovery in RGC: In the Robust Graph Construction domain—which lacks a known expert algorithm—GNARL matched or exceeded the performance of specialized RL baselines like RNet-DQN.
- Zero-Shot Scaling: Models trained on small graphs (16 nodes) successfully generalized to graphs up to 1024 nodes without further training.
Discussion and Future Work
While GNARL addresses several core limitations of NAR, it introduces new challenges. Currently, a human must define the MDP's steps and actions, requiring domain knowledge. Furthermore, because GNARL processes actions sequentially, it can be slower than parallel NAR models for certain polynomial problems like Bellman-Ford.
Future research may involve using "world models" to allow networks to learn the MDP structure itself from raw execution traces, potentially removing the need for human-defined transitions and further automating the discovery of efficient algorithms.
Summary updated