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

ReasonAgain: Using Extractable Symbolic Programs to Evaluate Mathematical Reasoning

Xiaodong Yu, Ben Zhou, Hao Cheng, Dan RotharXiv 2024 · DOI

Abstract

Current benchmarks for evaluating mathematical reasoning in Large Language Models (LLMs), such as GSM8K and MATH, are static, making them vulnerable to data contamination and "shortcut" reasoning. We present ReasonAgain, a pipeline that converts static math problems into executable Python programs to generate numerical perturbations. Our evaluation of state-of-the-art models like GPT-4o reveals that performance is often brittle; models frequently fail on variations of problems they previously solved correctly. This suggests that high benchmark scores may reflect memorization rather than genuine logical understanding.

Introduction

The rapid advancement of Large Language Models (LLMs) has led to impressive scores on standardized math benchmarks. However, these static datasets (e.g., GSM8K, MATH) pose risks of data contamination, where models may have encountered the exact test questions during training. Furthermore, models might employ "shortcut reasoning"—exploiting statistical patterns in the text rather than following a rigorous logical path. To address these issues, we propose ReasonAgain, a framework that shifts the focus from static answer-checking to evaluating the consistency of the underlying reasoning process through symbolic program extraction and parameter perturbation.

The ReasonAgain Pipeline

The ReasonAgain framework transforms a static word problem into a dynamic evaluation suite through a multi-stage process. The core innovation lies in treating mathematical reasoning as a symbolic program that can be executed and verified.

Prompt template for identifying and extracting numerical parameters from word problems.

The pipeline consists of the following steps:

  1. Encapsulation: A "pivot" LLM (e.g., GPT-4o) identifies numerical parameters within a word problem and generates a symbolic Python function representing the solution logic.
  2. Verification: The generated code is executed with the original parameters. If the output matches the ground-truth answer, the program is deemed a valid representation of the problem's logic.
  3. Perturbation: The system generates five new sets of valid input parameters, ensuring they remain within a reasonable domain for the problem context.
  4. Question Update: The original problem is rewritten five times, each incorporating a new set of parameters while maintaining the same narrative structure.
  5. Evaluation: Target LLMs are tested against these five variations. True reasoning is defined by the model's ability to solve all perturbations correctly.
Overview of the ReasonAgain pipeline, illustrating the transition from static questions to dynamic symbolic evaluation.

Experimental Setup

We applied ReasonAgain to subsets of two primary benchmarks:

  • GSM8K: Grade school-level math word problems.
  • MATH: Challenging high school competition-level problems.

From these, we successfully extracted and verified symbolic programs for 1,121 GSM8K cases and 268 MATH cases. This curated set provides a more rigorous "ReasonAgain" version of the original benchmarks.

Results and Analysis

Our evaluation of leading models, including GPT-4o, GPT-4-Turbo, Llama-3.1-8B, and Qwen-2.5-7B, yielded several critical insights:

The Fragility of Performance

Even with Chain-of-Thought (CoT) prompting, models experienced an absolute performance drop of 10% to 20% on perturbed questions compared to the originals. This indicates that a model's "knowledge" of a problem is often tied to specific numerical values rather than the general logic.

The Understanding Gap

We introduced a strict metric: % of Correct, requiring a model to solve all five perturbations of a single problem. For instance, while GPT-4o achieved ~94% accuracy on the original GSM8K set, its "% of Correct" score was only 58.8%. This implies that for nearly 40% of the problems it "solved," the reasoning was inconsistent or flawed.

Human Validation

To ensure the validity of our dynamic test set, human experts reviewed the generated programs. They found that 92% of GSM8K and 83% of MATH programs perfectly captured the required reasoning, confirming that the observed performance drops are due to model limitations, not errors in the test generation.

Conclusion

ReasonAgain demonstrates that current LLMs often rely on brittle shortcuts for mathematical reasoning. By treating reasoning as a symbolic program, we can unmask these behaviors and provide a more honest assessment of model capabilities. Future work will focus on improving automated program extraction and expanding the framework to more complex domains like geometry and abstract proofs.

Summary updated

BibTeX
@misc{yu2024reasonagain,
  author = {Xiaodong Yu and Ben Zhou and Hao Cheng and Dan Roth},
  title = {{ReasonAgain: Using Extractable Symbolic Programs to Evaluate Mathematical Reasoning}},
  year = {2024},
  eprint = {2410.19056},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.19056},
}
Figure