Abstract
Large Language Models (LLMs) have recently achieved remarkable progress in mathematical reasoning. To enable such capabilities, many existing works distill strong reasoning models into long chains of thought or design algorithms to construct high-quality math QA data for training. However, these efforts primarily focus on generating correct reasoning paths and answers, while largely overlooking the validity of the questions themselves. In this work, we propose Math Question Verification (MathQ-Verify), a novel five-stage pipeline designed to rigorously filter ill-posed or under-specified math problems. MathQ-Verify first performs format-level validation to remove redundant instructions and ensure that each question is syntactically well-formed. It then formalizes each question, decomposes it into atomic conditions, and verifies them against mathematical definitions. Next, it detects logical contradictions among these conditions, followed by a goal-oriented completeness check to ensure the question provides sufficient information for solving. To evaluate this task, we use existing benchmarks along with an additional dataset we construct, containing 2,147 math questions with diverse error types, each manually double-validated. Experiments show that MathQ-Verify achieves state-of-the-art performance across multiple benchmarks, improving the F1 score by up to 25 percentage points over the direct verification baseline. It further attains approximately 90% precision and 63% recall through a lightweight model voting scheme. MathQ-Verify offers a scalable and accurate solution for curating reliable mathematical datasets, reducing label noise and avoiding unnecessary computation on invalid questions.
Introduction
The current "gold rush" in Large Language Models (LLMs) for mathematics relies heavily on synthetic data—QA pairs generated by other models. However, there is a fundamental "garbage in, garbage out" risk: if a synthetically generated question is ill-posed (e.g., asking for the perimeter of a square with a negative area) or logically inconsistent, the resulting training signal is noisy and harmful.
Existing verification methods focus almost exclusively on the reasoning path or the final answer. We identify a major gap: the lack of a systematic way to validate the questions themselves. Without this, models waste compute on unsolvable problems, and training sets become contaminated with "hallucinated" math logic.
The MathQ-Verify Pipeline
We propose MathQ-Verify, a structured, five-stage pipeline designed to filter out flawed questions by breaking them down into their constituent parts.
The pipeline consists of the following stages:
- Contaminated Instruction Detection: Filters out "meta-talk" (e.g., "Please rewrite this...") or leaked answers within the prompt that often appear in synthetic data generation.
- Linguistic Error Detection: Uses models like Qwen-2.5-7B to catch typos, grammar issues, and broken LaTeX formatting.
- Atomic Condition Error Detection: The question is decomposed into "Atomic Conditions" (foundational facts like $x \in \mathbb{Z}$). Each condition is checked against mathematical principles (e.g., ensuring a physical length isn't negative).
- Cross-condition Conflict Detection: Checks if multiple valid-looking conditions contradict each other when combined (e.g., $x > 5$ and $x < 2$).
- Condition Completeness Validation: A goal-oriented check to ensure the provided conditions are actually sufficient to solve the target query.
To make the system more robust, we also implement a Multi-Model Voting Strategy, where multiple models (such as GPT-4o, Gemini, and DeepSeek) must reach a consensus before a question is deemed "valid."
Evaluation and Results
We evaluated MathQ-Verify on several fronts, including existing benchmarks like MathClean-GSM8K and MathClean-MATH. Additionally, we introduce ValiMath, a dataset containing 2,147 math questions sampled from a pool of 10,000 synthetic problems. Each sample in ValiMath is manually double-validated by experts and annotated with fine-grained labels indicating exactly which of the five stages the question failed.
Key Insights
- Decomposition is Essential: Directly asking a model "Is this question valid?" is a difficult task. Breaking the question into atomic conditions and target goals makes the verification task significantly more manageable and accurate for LLMs.
- Specialized Reasoning Models: While standard models excel at catching linguistic errors (Stages 1 & 2), specialized reasoning models (like DeepSeek-R1 or QwQ) are significantly better at catching logical conflicts and incompleteness (Stages 4 & 5).
- Precision via Voting: By using a "unanimous" voting scheme (requiring 3 out of 3 models to agree), the system reached 91.42% precision, ensuring a nearly pristine dataset for high-stakes model training.
- Distributional Consistency: Filtering does not bias the dataset toward "easy" questions; the filtered dataset maintains a similar difficulty and category distribution to the original human-annotated set.
Conclusion
MathQ-Verify offers a scalable and accurate solution for curating reliable mathematical datasets. While the computational cost of a five-stage pipeline with multi-model voting is higher than simple checks, the gain in data quality is substantial. Future work will explore more granular decomposition methods and the integration of MathQ-Verify directly into reinforcement learning loops to enable real-time self-correction during question generation.
Summary updated