[Paper Review] Graph Neural Networks are Dynamic Programmers
This paper establishes a rigorous categorical and algebraic foundation linking Graph Neural Networks (GNNs) to dynamic programming (DP), demonstrating that GNNs naturally implement DP through a diagrammatic integral transform. It proposes a novel GNN variant, $V^3$, which respects polynomial spans and achieves state-of-the-art performance on edge-centric algorithmic tasks in the CLRS benchmark, validating improved algorithmic alignment.
Recent advances in neural algorithmic reasoning with graph neural networks (GNNs) are propped up by the notion of algorithmic alignment. Broadly, a neural network will be better at learning to execute a reasoning task (in terms of sample complexity) if its individual components align well with the target algorithm. Specifically, GNNs are claimed to align with dynamic programming (DP), a general problem-solving strategy which expresses many polynomial-time algorithms. However, has this alignment truly been demonstrated and theoretically quantified? Here we show, using methods from category theory and abstract algebra, that there exists an intricate connection between GNNs and DP, going well beyond the initial observations over individual algorithms such as Bellman-Ford. Exposing this connection, we easily verify several prior findings in the literature, produce better-grounded GNN architectures for edge-centric tasks, and demonstrate empirical results on the CLRS algorithmic reasoning benchmark. We hope our exposition will serve as a foundation for building stronger algorithmically aligned GNNs.
Motivation & Objective
- To formally establish and quantify the theoretical connection between GNNs and dynamic programming (DP), moving beyond anecdotal analogies.
- To address the lack of systematic understanding of why certain GNN architectures generalize poorly across algorithmic tasks despite theoretical alignment claims.
- To develop a principled framework using category theory and abstract algebra to identify GNNs that align better with specific classes of DP algorithms.
- To empirically validate that architectures respecting polynomial spans yield superior performance on edge-centric algorithmic reasoning tasks.
- To unify prior findings in neural algorithmic reasoning under a single categorical abstraction, enabling systematic design of better-aligned GNNs.
Proposed method
- Formalize GNNs and DP as diagrammatic computations in category theory, using pullbacks, pushforwards, and commutative monoids to model message passing and subproblem recombination.
- Introduce an integral transform framework that abstracts both GNN message passing and DP recurrence relations as a single categorical construction.
- Define a polynomial span structure to model the dependency structure of subproblems in DP, which informs the design of GNN message and update functions.
- Propose a new GNN variant, $V^3$, whose architecture explicitly respects the polynomial span of the target DP algorithm, enhancing algorithmic alignment.
- Implement $V^3$ using two-layer MLPs with 24-dimensional embeddings and 8/16-wide hidden layers, trained on the CLRS benchmark with out-of-distribution generalization.
- Evaluate performance across 27 tasks in CLRS, comparing $V^3$ to the baseline $V^2$ and state-of-the-art PGN processor, using both edge-centric and non-edge-centric tasks.
Experimental results
Research questions
- RQ1Can the GNN-DP connection be formalized beyond isolated examples like Bellman-Ford using category theory and abstract algebra?
- RQ2How can the categorical structure of DP algorithms be used to design GNNs with improved algorithmic alignment and lower sample complexity?
- RQ3Does enforcing polynomial span structure in GNNs lead to measurable performance gains on algorithmic reasoning benchmarks?
- RQ4To what extent do GNNs that respect the diagrammatic structure of DP generalize better across diverse algorithmic tasks?
- RQ5Can a unified categorical framework unify prior works on algorithmic alignment in GNNs and guide the design of stronger neural algorithmic reasoners?
Key findings
- The proposed $V^3$ GNN variant, which respects the polynomial span of the target DP algorithm, outperforms the baseline $V^2$ across all six edge-centric algorithms in the CLRS benchmark.
- On the Dijkstra algorithm, $V^3$ achieved 68.53% out-of-distribution accuracy, a 9.0% absolute improvement over $V^2$'s 59.58%.
- For the Insertion Sort task, $V^3$ reached 24.67% accuracy, a 9.3% improvement over $V^2$'s 15.39%.
- In the full CLRS benchmark with 27 tasks, $V^3$ improved average performance by 2.73 percentage points (from 35.20% to 37.70%) across all tasks.
- The $V^3$ variant showed consistent gains on edge-centric tasks (average +4.44%) and modest improvements on non-edge-centric tasks (average +1.01%).
- Theoretical analysis via category theory revealed that prior findings in algorithmic alignment emerge naturally as corollaries of the proposed integral transform framework.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.