NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Generalist Neural Algorithmic Learner

Borja Ibarz, Vitaly Kurin, George Papamakarios, Kyriacos Nikiforou, Mehdi Bennani, Róbert Csordás, Andrew Joseph Dudzik, Matko Bošnjak, Alex Vitvitskyi, Yulia Rubanova, Andreea Deac, Beatrice Bevilacqua, Yaroslav Ganin, Charles Blundell, Petar Veličković

Abstract

The cornerstone of neural algorithmic reasoning is the ability to solve algorithmic tasks, especially in a way that generalises out of distribution. While recent years have seen a surge in methodological improvements in this area, they mostly focused on building specialist models. Specialist models are capable of learning to neurally execute either only one algorithm or a collection of algorithms with identical control-flow backbone. Here, instead, we focus on constructing a generalist neural algorithmic learner—a single graph neural network processor capable of learning to execute a wide range of algorithms, such as sorting, searching, dynamic programming, path-finding and geometry. We leverage the CLRS benchmark to empirically show that, much like recent successes in the domain of perception, generalist algorithmic learners can be built by "incorporating" knowledge. That is, it is possible to effectively learn algorithms in a multi-task manner, so long as we can learn to execute them well in a single-task regime. Motivated by this, we present a series of improvements to the input representation, training regime and processor architecture over CLRS, improving average single-task performance by over 20% from prior art. We then conduct a thorough ablation of multi-task learners leveraging these improvements. Our results demonstrate a generalist learner that effectively incorporates knowledge captured by specialist models.

Introduction

While deep learning has achieved remarkable success in perception-based tasks, such as image recognition, it often falters when faced with reasoning tasks that require rigorous, step-by-step logic. A primary challenge in neural algorithmic reasoning is out-of-distribution (OOD) generalization: a model trained to sort small arrays often fails when presented with significantly larger ones. Historically, research has focused on "specialist" models tailored to individual algorithms. This work explores the feasibility of a "generalist" processor—a single Graph Neural Network (GNN) capable of executing a diverse array of algorithms, from string matching to convex hulls, without sacrificing performance.

Methods: The Encode-Process-Decode Architecture

The researchers developed a generalist learner based on the CLRS-30 benchmark, utilizing an encode-process-decode framework. In this architecture, task-specific encoders and decoders map raw data into and out of a shared latent space, while a central GNN processor performs the core reasoning.

The encode-process-decode architecture of the generalist neural algorithmic learner.

Several technical refinements were critical to the model's success:

  • Triplet Reasoning: By considering relationships between triplets of nodes rather than just pairs, the model can better handle algorithms like Floyd-Warshall, where intermediate nodes are essential.
  • Sinkhorn Operator: A Sinkhorn layer was integrated for sorting tasks to enforce a permutation bias, aiding the model in understanding reordering operations.
  • Training Stability: To prevent numerical instabilities common in recursive reasoning, the authors removed "teacher forcing" during intermediate steps, implemented gradient clipping, and utilized Xavier initialization.
  • Chunking: Long algorithmic trajectories were split into smaller "chunks" to manage memory and balance learning signals across the 30 different tasks.

Datasets and Training

The model was evaluated using the CLRS-30 benchmark, which encompasses 30 classic algorithms from the Introduction to Algorithms textbook. To enhance robustness, the authors used online samplers to generate an infinite stream of unique training examples. They also employed "mixed-size" training (e.g., $n=4$ to $n=16$) to improve the model's ability to scale to larger problem sizes during testing.

Key Results

The proposed model, Triplet-GMPNN, achieved a significant breakthrough by outperforming previous state-of-the-art (SOTA) specialist models by over 20% on average across all 30 tasks.

Performance comparison of the Triplet-GMPNN model against previous state-of-the-art across the CLRS-30 benchmark.

Notable gains were observed in challenging domains:

  • String Algorithms: Performance on tasks like Naïve String Matcher increased from ~3% to ~49%.
  • Geometric Algorithms: Accuracy improved from ~73% to ~94%.
  • Generalist Performance: The single multi-task model achieved an average OOD score of 75.98%, effectively matching the collective performance of 30 individual specialist models.

Conclusion

This research demonstrates that a single neural processor can indeed become a "jack of all trades" in the algorithmic domain. By focusing on numerical stability and architectural alignment with algorithmic logic, the generalist learner effectively incorporates knowledge across diverse tasks. Future work will look into optimizing the use of intermediate "hints" and exploring how these generalist processors can be integrated into broader systems for automated software engineering and scientific discovery.

Summary updated

BibTeX
@inproceedings{ibarz2022generalist,
  author = {Borja Ibarz and Vitaly Kurin and George Papamakarios and Kyriacos Nikiforou and Mehdi Bennani and Róbert Csordás and Andrew Joseph Dudzik and Matko Bošnjak and Alex Vitvitskyi and Yulia Rubanova and Andreea Deac and Beatrice Bevilacqua and Yaroslav Ganin and Charles Blundell and Petar Veličković},
  title = {{A Generalist Neural Algorithmic Learner}},
  booktitle = {LoG},
  year = {2022},
  url = {https://openreview.net/forum?id=FebadKZf6Gd},
}
Figure