The CLRS-Text Algorithmic Reasoning Language Benchmark

Larisa Markeeva, Sean McLeish, Borja Ibarz, Wilfried Bounsi, Olga Kozlova, Alex Vitvitskyi, Charles Blundell, Tom Goldstein, Avi Schwarzschild, Petar VelickovicarXiv 2024 · DOI

Introduction

Evaluating reasoning in Large Language Models (LLMs) remains a significant challenge. Traditional benchmarks often rely on static datasets that may be present in pre-training corpora, leading to an "illusion of progress" where models recall rather than reason. Furthermore, models frequently struggle with out-of-distribution (OOD) inputs, particularly those longer than training examples—a phenomenon known as the "reasoning gap." To address this, researchers from Google DeepMind introduced CLRS-Text, a procedural benchmark that converts classical algorithmic execution traces into textual formats.

Methodology: Trace-as-Text

The core innovation of CLRS-Text is the translation of graph-based execution traces from the original CLRS benchmark into string-based formats suitable for LLMs. Instead of a simple input-output mapping, models are prompted with an "initial trace" and must predict intermediate steps—the "thinking time"—before reaching a final result.

Example of algorithmic execution steps represented as a sequence of states.

The researchers fine-tuned a Gemma 2B model as a "generalist reasoner" on 30 algorithms simultaneously. They also explored Randomized Positional Embeddings (RPE) to evaluate improvements in handling longer sequences. Performance was compared against frontier models like Gemini 1.5 Flash in a two-shot in-context learning setup.

The CLRS-Text Benchmark

CLRS-Text encompasses 30 classical algorithms from the Introduction to Algorithms textbook, covering sorting, searching, graph theory, string matching, and dynamic programming. Unlike static datasets, CLRS-Text allows for the procedural generation of infinite instances with varying lengths, enabling rigorous testing of a model's ability to generalize beyond its training distribution.

Results and Discussion: The Generalization Wall

The study revealed a stark "reasoning gap." While models performed well on problem sizes encountered during training (interpolation), accuracy collapsed as soon as input lengths exceeded training thresholds (extrapolation).

Accuracy vs. test length across various algorithms, showing the performance "cliff" as problem size increases.

Key findings include:

  • The Autoregressive Bottleneck: LLMs' linear, token-by-token prediction makes them prone to error accumulation compared to Graph Neural Networks (GNNs), which can update states in parallel.
  • Limited Extrapolation: Even with RPE, LLMs struggle to generalize to larger inputs, whereas GNNs often handle inputs four times larger than their training set.
  • Fine-Tuning vs. Scale: A fine-tuned 2B parameter model outperformed the much larger Gemini 1.5 Flash, suggesting that algorithmic logic is not yet a guaranteed emergent property of scale.
  • Complexity Hurdles: Higher complexity algorithms ($O(n^2)$ or $O(n^3)$) showed steeper performance declines than linear-time tasks.

Conclusion

CLRS-Text highlights fundamental limitations in current LLM architectures for algorithmic reasoning. Future research may need to explore hybrid architectures that allow for more structured, parallel "thinking" or focus on teaching models to utilize external tools like code interpreters to handle the heavy lifting of algorithmic execution. CLRS-Text is now open-source, providing a standardized environment for developing more robust reasoning models.

Summary updated

BibTeX
@misc{markeeva2024clrs,
  author = {Larisa Markeeva and Sean McLeish and Borja Ibarz and Wilfried Bounsi and Olga Kozlova and Alex Vitvitskyi and Charles Blundell and Tom Goldstein and Avi Schwarzschild and Petar Velickovic},
  title = {{The CLRS-Text Algorithmic Reasoning Language Benchmark}},
  year = {2024},
  eprint = {2406.04229},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.04229},
}
Figure