ReverseMath: Answer Inversion for Scalable and Verifiable Mathematical Problem Generation

Raoyuan Zhao, Yihong Liu, Yupei Du, Hinrich Schütze, Michael A. HeddericharXiv 2026

TL;DR

ReverseMath introduces a scalable "answer inversion" framework that automatically transforms existing math problems into new, verifiable variants by swapping a problem's input numbers with its final answer. This approach serves a dual purpose: it exposes hidden model memorization during evaluation and acts as a high-quality data augmentation source for reinforcement learning, significantly boosting LLM reasoning performance.

What Problem Does This Paper Address?

Standard mathematical reasoning benchmarks (like GSM8K or MATH) have become static targets in the AI community. Because these datasets are publicly available, large language models (LLMs) are repeatedly exposed to them during pre-training and fine-tuning, leading to severe benchmark contamination. Consequently, high accuracy scores may reflect rote memorization of problem-answer pairs rather than genuine reasoning.

While existing methods try to fix this by changing surface details or substituting numbers (e.g., GSM-Symbolic), they preserve the original reasoning direction. ReverseMath tackles this by flipping the inference target entirely, making it harder for models to rely on memorized shortcuts.

Methods

The authors propose ReverseMath, a generate-and-verify framework that flips the input-output relationship of a math problem:

  1. Generator: It takes an original problem and its ground-truth answer, masks one of the numerical values inside the problem statement, treats the original answer as a known condition, and prompts an LLM (Gemini-3-Flash) to rewrite the text into a natural-sounding question where the masked value is now the target answer.
  2. Verifier: To ensure the new problem is valid, solvable, and doesn't accidentally leak the answer, a verifier LLM solves the candidate question. A final rule-based check ensures the verifier's answer perfectly matches the originally masked value.

This pipeline allows for two primary use cases: controlled evaluation using paired original/reversed problems, and verifiable data augmentation for reinforcement learning from verifiable rewards (RLVR).

Figure 2: Overview of REVERSEMATH. Starting from an original math problem and its answer, REVERSEMATH masks a numerical value and conditions on the original answer to construct an intermediate inverse problem. A generator LLM rewrites it into a natural reversed problem, and a verifier checks whether the problem is uniquely solvable, free of answer leakage, and has an answer matching the masked value. See details in Appendix B.

Datasets

The framework was evaluated across six diverse math benchmarks:

  • GSM8K: Grade-school arithmetic word problems.
  • MATH-500: Competition-level multi-step math problems.
  • AIME 2024/2025: Advanced, high-difficulty competition problems.
  • MGSM: Multilingual grade-school math.
  • AgentCoMa: A blend of mathematical and commonsense reasoning.

Key Insights and Ideas

  • Aggregate Accuracy Lies: Models often show stable overall accuracy before and after inversion, but instance-level analysis reveals massive instability. A model might fail a reversed problem it easily solved in its original form, or vice versa.
  • Answer Anchoring: A prominent failure mode is "answer anchoring," where a model correctly sets up the math for the reversed problem but ultimately outputs the original problem's answer. This post-hoc rationalization strongly indicates memorized problem-answer associations overriding actual logic.
  • Older Benchmarks are More Fragile: Answer anchoring is significantly more pronounced on older datasets (like MATH-500 and GSM8K) than on newer ones (like AIME 2025), supporting the hypothesis that older problems have leaked into LLM training sets.
  • Family-Level Weaknesses: Reversal failures (True-to-False transitions) cluster strongly within model families (e.g., Qwen or LLaMA variants), suggesting shared training data biases or behavioral inheritance from distillation.
Figure 3: Behavioral transition patterns induced by RE- VERSEMATH on MATH-500 across models. The pres- ence of both TF and FT cases shows that answer inver- sion changes which examples models solve, revealing instance-level instability hidden by aggregate accuracy.

Key Results

  • Exposing Robustness Gaps: ReverseMath exposed failures that standard symbolic perturbations missed. Even when models remained 100% correct under numerical variations (GSM-Symbolic), flipping the reasoning direction caused widespread failures.
  • RL Training Boost: Using just 1,000 ReverseMath-augmented problems to train models via Group Relative Policy Optimization (GRPO) yielded substantial performance gains. The augmented training outperformed simple data duplication in 17 out of 24 model-benchmark combinations, showing particular strength in transferring to harder, out-of-domain tasks like MATH-500 and AIME.
Figure 4: Additional Failures revelaved by rule-based reversal and REVERSEMATH. Among examples that models solve correctly after symbolic rewriting (the full bar in the chart), reversal-based methods reveal many additional failures, showing that robustness to symbolic perturbations does not imply robustness to changed reasoning targets.

Limitations and Future Work

  • Source Material Dependency: If the original benchmark contains errors or ambiguities, ReverseMath will fail to verify the reversed problem, discarding potentially good data.
  • Trivial Masking Targets: Randomly selecting numbers can sometimes mask semantically trivial values (like identifiers, constants, or dates), leading to ill-posed questions and computational overhead during retries.
  • Suggestive Memorization Claims: While behaviors like answer anchoring strongly point to memorization, definitive proof requires access to proprietary pre-training datasets, which are rarely available to researchers.

Summary updated

BibTeX
@misc{zhao2026reversemath,
  author = {Raoyuan Zhao and Yihong Liu and Yupei Du and Hinrich Schütze and Michael A. Hedderich},
  title = {{ReverseMath: Answer Inversion for Scalable and Verifiable Mathematical Problem Generation}},
  year = {2026},
  eprint = {2605.27709},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.27709},
}
Figure