Fixing Edge-Pointer Compositionality in Neural Algorithmic Reasoning

Stjepan Požgaj, Dobrik Georgiev Georgiev, Marin Šilić, Goran Delac, Klemo VladimirCompLearn @ ICML 2026

TL;DR

Researchers have discovered that the poor performance of neural networks on certain classical algorithms isn't due to a lack of "brainpower" in the models, but rather a "blind spot" in how data is fed into them. By fixing a mathematical flaw in the encoder and decoder for edge-pointers, they boosted accuracy on the notoriously difficult Floyd-Warshall algorithm from a mediocre 46% to a near-perfect 95%.

What Problem Does This Paper Address?

Neural Algorithmic Reasoning (NAR) is the quest to build neural networks—usually Graph Neural Networks (GNNs)—that can learn to execute classical algorithms like sorting or shortest-path finding. The gold standard for testing these models is the CLRS-30 benchmark.

While GNNs have become quite good at many of these tasks, the Floyd-Warshall algorithm (used for finding shortest paths between all pairs of nodes in a graph) remained a stubborn outlier. Even though modern architectures were specifically designed with "triplet reasoning" to match the algorithm's structure, they still failed frequently.

The authors of this paper identified a hidden "information bottleneck." They proved that the standard way the CLRS-30 benchmark encodes edge-pointers (data structures that tell you, for example, "to get from A to B, go through C") is non-injective. In plain English: the encoder was mathematically collapsing different algorithmic states into the exact same numerical representation. If the model can't tell two different situations apart at the input level, it has no hope of reasoning about them correctly.

Methods

The authors propose a "compositional" fix that targets the interfaces of the standard encode-process-decode pipeline:

  1. Injective Triplet Encoding: Instead of the standard method—which averages pointer data across different axes and loses information—the authors project the pointer data directly into a "triplet feature stream." This preserves the native $(i, j) \to k$ structure of the pointers.
  2. Recurrent Triplet States: They modified the processor (specifically the Triplet-GMPNN) to maintain these triplet states across time steps. Previously, the model would calculate these relationships and then immediately discard the details, keeping only a summarized version.
  3. Triplet-Augmented Decoding: The decoder was updated to look directly at these preserved triplet states when making predictions, rather than trying to reconstruct the answer from summarized node and edge features.

Crucially, these additions are "lightweight." They use a very small dimension ($d_t = 8$) for the triplet features, meaning they didn't just solve the problem by making the model significantly larger or slower.

Datasets

The study uses the CLRS-30 benchmark, specifically focusing on the three algorithms that rely on edge-pointer probes:

  • Floyd-Warshall: All-pairs shortest paths.
  • Matrix Chain Order: Finding the most efficient way to multiply a sequence of matrices.
  • Optimal Binary Search Tree (BST): Constructing a search tree with minimum expected search time.

The models were trained on small graphs (up to 16 nodes) and tested on much larger graphs (64 nodes) to evaluate Out-of-Distribution (OOD) generalization.

Key Insights and Ideas

  • The "Plumbing" Matters: We often assume that if a model fails, we need a bigger transformer or a more complex processor. This paper shows that the "interfaces" (how data enters and leaves the processor) can be the primary point of failure.
  • The Injectivity Proof: The authors provide a formal proof (and a concrete example for a 2-node graph) showing that the standard CLRS-30 encoder literally cannot distinguish between certain distinct pointer assignments. This is a "silent killer" for model performance.
  • Structural Alignment: The fix works because it aligns the neural network's data flow with the mathematical structure of the algorithm it is trying to emulate. Floyd-Warshall is fundamentally about triplets of nodes; by giving the model a dedicated, non-lossy triplet "memory," the reasoning task becomes trivial.

Key Results

The performance gains were dramatic across the board for edge-pointer tasks:

  • Floyd-Warshall: Jumped from 46.00% (baseline) to 95.00% accuracy.
  • Matrix Chain Order: Improved from 90.71% to 98.08%.
  • Overall Average: The mean OOD accuracy across the three tasks rose from 69.34% to 91.14%.

Perhaps most impressively, their lightweight model (with only ~761K parameters) outperformed much larger, specialized models like FloydNet, which uses hundreds of millions of parameters.

Limitations and Future Work

While the fix was highly effective for Floyd-Warshall and Matrix Chain Order, Optimal BST remains a challenge, sitting at around 80% accuracy. This suggests that while the encoding bottleneck was a major issue, there are still other algorithm-specific hurdles to clear.

The authors also note that their current modifications are specifically tailored for edge-pointers. A natural next step is to see if similar "injectivity fixes" can be applied to other data types (like node-pointers) or if these recurrent triplet features can help GNNs solve other complex graph problems beyond the CLRS-30 benchmark.

Summary updated

BibTeX
@inproceedings{pozgaj2026fixing,
  author = {Stjepan Požgaj and Dobrik Georgiev Georgiev and Marin Šilić and Goran Delac and Klemo Vladimir},
  title = {{Fixing Edge-Pointer Compositionality in Neural Algorithmic Reasoning}},
  booktitle = {CompLearn @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=tFwJ1FMrbZ},
}
Figure