Skip to main content
QUICK REVIEW

[Paper Review] The CLRS Algorithmic Reasoning Benchmark

Petar Veličković, Adrià Puigdomènech Badia|arXiv (Cornell University)|May 31, 2022
AI-based Problem Solving and PlanningComputer Science5 citations
TL;DR

This paper introduces CLRS-30, a comprehensive benchmark of 30 classical algorithms from CLRS's 'Introduction to Algorithms,' providing input-output trajectories with intermediate 'hint' states for training and evaluation. It evaluates multiple neural network architectures on out-of-distribution generalization, revealing that graph neural networks (especially PGN) outperform others, yet even top models achieve only ~51% micro-F1 on OOD generalization, highlighting significant challenges in algorithmic reasoning beyond distribution shift.

ABSTRACT

Learning representations of algorithms is an emerging area of machine learning, seeking to bridge concepts from neural networks with classical algorithms. Several important works have investigated whether neural networks can effectively reason like algorithms, typically by learning to execute them. The common trend in the area, however, is to generate targeted kinds of algorithmic data to evaluate specific hypotheses, making results hard to transfer across publications, and increasing the barrier of entry. To consolidate progress and work towards unified evaluation, we propose the CLRS Algorithmic Reasoning Benchmark, covering classical algorithms from the Introduction to Algorithms textbook. Our benchmark spans a variety of algorithmic reasoning procedures, including sorting, searching, dynamic programming, graph algorithms, string algorithms and geometric algorithms. We perform extensive experiments to demonstrate how several popular algorithmic reasoning baselines perform on these tasks, and consequently, highlight links to several open challenges. Our library is readily available at https://github.com/deepmind/clrs.

Motivation & Objective

  • To unify disparate algorithmic reasoning benchmarks by creating a standardized, comprehensive dataset based on classical algorithms from 'Introduction to Algorithms'.
  • To evaluate neural network models on out-of-distribution generalization across diverse algorithmic reasoning tasks.
  • To enable systematic comparison of architectures like GNNs, Transformers, and memory networks on algorithmic execution and reasoning.
  • To lower the barrier to entry for algorithmic reasoning research by providing a reusable, well-documented dataset with intermediate supervision.
  • To identify persistent challenges in neural network generalization, especially for recursive, long-range, and string-matching algorithms.

Proposed method

  • The benchmark constructs trajectories for 30 classical algorithms, including inputs, outputs, and intermediate 'hint' states representing algorithmic steps.
  • Each algorithm is encoded as a sequence of operations, with inputs and outputs formatted as tensors for model consumption.
  • The dataset supports both in-distribution and out-of-distribution (OOD) evaluation, with OOD test sets using larger input sizes than training.
  • Models are trained on training splits and evaluated on OOD generalization, with performance measured via micro-F1 score on prediction tasks.
  • A variety of architectures are evaluated: Deep Sets, GAT, Memory Networks, MPNN, and PGN, enabling cross-model comparison.
  • The benchmark includes algorithm-specific inductive biases, such as graph structure for graph algorithms and sequence modeling for strings.

Experimental results

Research questions

  • RQ1How well do modern neural network architectures generalize to out-of-distribution inputs in algorithmic reasoning tasks?
  • RQ2Which architectural inductive biases (e.g., graph attention, memory networks) best align with the structure of classical algorithms?
  • RQ3To what extent can models trained on one algorithm generalize to related algorithms with shared subroutines?
  • RQ4Why do certain models fail on recursive or long-range reasoning tasks like Quicksort or DFS?
  • RQ5How does intermediate supervision (hints) affect model performance and learning efficiency?

Key findings

  • The PGN model achieves the highest overall OOD micro-F1 score at 50.84%, significantly outperforming other architectures.
  • MPNNs perform poorly on larger graphs, indicating limited OOD generalization despite strong in-distribution performance.
  • Memory networks and Deep Sets struggle across most algorithm classes, especially on sorting and string matching, with F1 scores below 15%.
  • GNN-based models (PGN, GAT) consistently outperform non-GNN baselines, especially on graph and dynamic programming tasks.
  • String matching algorithms (e.g., KMP) remain highly challenging, with all models scoring below 3.5% micro-F1, indicating a need for specialized inductive biases.
  • Even the best models achieve only ~51% micro-F1 on OOD generalization, revealing a substantial gap in algorithmic reasoning generalization.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.