Abstract
Standard Neural Algorithmic Reasoning (NAR) models are typically trained to mimic a single, deterministic execution of an algorithm, often ignoring other equally valid solutions. This paper introduces a novel framework to train models on distributions of correct solutions, enabling them to sample multiple valid outputs—such as different shortest paths or depth-first search (DFS) trees—for a single input graph. By moving beyond deterministic tie-breaking, the authors improve the robustness and representational power of NAR models.
Introduction: The Problem of Deterministic Tie-Breaking
Neural Algorithmic Reasoning (NAR) aims to develop neural networks capable of executing classical algorithms while processing high-dimensional, real-world data. However, current benchmarks like CLRS-30 rely on deterministic tie-breaking. When an algorithm encounters multiple equally valid paths, the training data only presents one "correct" answer.
This creates a "brittleness" problem. In real-world applications like traffic routing, having only one shortest path is limiting; alternatives are often necessary for safety, cost, or congestion management. Furthermore, forcing a model to select one arbitrary solution when many exist complicates the learning process and fails to capture the underlying algorithmic logic.
Methodology: From Single Solutions to Distributions
The authors propose a two-part framework to transition from single-solution to multi-solution NAR:
1. Distributional Training
Instead of training on a single ground-truth array, the researchers execute classical algorithms (specifically Bellman-Ford and Depth-First Search) multiple times using randomized tie-breaking. These runs are aggregated into an empirical probability distribution $P$, representing the frequency with which node $u$ serves as the parent of node $v$. The neural network is then trained to minimize the Kullback-Leibler (KL) divergence between its predicted distribution and this empirical target.
2. Stochastic Sampling and Verification
To extract discrete solutions from the predicted distribution, the authors developed algorithm-specific sampling methods:
- Bellman-Ford (BF) Beamsearch/Greedy: These methods sample potential parents and verify path costs to ensure the resulting tree represents actual shortest paths.
- Upwards/AltUpwards Sampling: For DFS, a "bottom-up" approach samples parents for "leaf" nodes (nodes unlikely to be parents) to reconstruct a valid traversal tree.
Because verifying a randomized DFS result is computationally difficult, the authors introduced the RDFSO Verifier (Randomised DFS Recognition) to validate the model's outputs.
Key Insights and Results
The Complexity of DFS vs. Bellman-Ford
The study found that Bellman-Ford (shortest paths) has a structured solution space that Graph Neural Networks (GNNs) handle effectively. In contrast, DFS is highly sequential and sensitive to small errors. Even with the distributional approach, DFS remains a significant challenge for current NAR architectures.
Graph Accuracy vs. Node Accuracy
The authors emphasize "graph accuracy" (where the entire solution must be correct) over "node accuracy" (the percentage of correct parent pointers). On a graph of size 64, a 92% node accuracy might result in 0% graph accuracy, highlighting the high stakes of algorithmic reasoning.
Performance Metrics
- Bellman-Ford Success: For graphs of size $n=16$, the model achieved over 90% accuracy in extracting valid shortest-path trees. At $n=64$ (out-of-distribution), accuracy remained between 40-54%.
- DFS Struggles: While the model learned some diversity, graph-level accuracy for DFS was near 0% for larger graphs, confirming it as a "grand challenge" for the field.
- Diversity: The framework successfully recovered multiple unique valid solutions for the same graph in Bellman-Ford tasks, proving the model can perceive the full space of correct answers.
Conclusion and Future Work
While this framework successfully introduces diversity into NAR, several limitations remain. Performance degrades significantly during out-of-distribution (OOD) scaling, and the current parent-child probability encoding may be insufficient for algorithms with complex sequential dependencies like DFS. Future research will focus on extending this approach to Minimum Spanning Trees and Bipartite Matching, as well as developing loss functions that directly reward the validity of sampled trees.
Summary updated