Evaluating LLM Mathematical Reasoning for Model Selection: A Reproducible Workflow
This article explains how to build a reproducible evaluation pipeline for LLM mathematical reasoning, covering open-ended problem types, contamination checks, metrics, chain-of-thought length trade-offs, verifiable-reward training, CoT control approaches, and selection criteria. It is intended to help developers validate model reliability on their own problem sets before choosing a model.
Mathematical ability is a common indicator for testing the logical rigor of large language models (LLMs). However, many public conclusions are difficult to reproduce. The usual reasons are that the test problems have already entered the training corpus, or that the test conditions were not recorded. This article does not rank specific products. Instead, it explains how to build a reproducible evaluation workflow and how chain-of-thought length affects results. Developers can use this method to verify whether a model is reliable on their own problem types before making a selection decision.
What Are Open-Ended Mathematical Problems?
Open-ended mathematical problems are problems without a single standard solution method. Their conditions may be incomplete, multiple solution paths may exist, and the model may sometimes need to propose intermediate conclusions itself. In contrast, closed problems have fixed answers and relatively clear solution methods.
Closed problems are prone to data contamination. If a problem and its answer have already appeared in the training corpus, the model may simply reproduce memorized content rather than genuinely derive the answer. Therefore, evaluation should prioritize the following problem sources:
- A self-built problem bank written by domain experts and never publicly released.
- New problems from recent competitions or courses, with publication dates confirmed to be later than the model’s training cutoff.
- Rewritten versions of public problems, such as changing numerical values, modifying conditions, or replacing variable names, to test whether the model relies on surface patterns.
Open-ended problems usually use three types of answer judging:
- For problems with a unique numerical answer, use automatic comparison. Before comparison, normalize formats, such as converting between fractions and decimals, converting units, and normalizing symbols.
- For proof problems, use human review or formal verification tools to check every step of the derivation. Formal verification is costly but provides the most reliable conclusions.
- For construction problems, such as requiring a sequence or graph structure that satisfies given conditions, use code execution results to check whether the construction satisfies all constraints.
Evaluation metrics should include at least the following four items:
- Final-answer accuracy: the proportion of problems answered correctly out of all problems.
- pass@k: the proportion of problems for which at least one sample is correct when the same problem is sampled k times. This metric reflects the model’s upper bound when multiple attempts are allowed.
- Step correctness: reviewers sample and check derivations, then count the proportion of steps that are correct. This can reveal cases where the answer happens to be correct but the process is wrong.
- Consistency: whether multiple runs on the same problem produce the same conclusion. Models with unstable conclusions are not suitable for direct use in automated workflows.
Every test should record the test conditions, including model version, call date, sampling temperature, maximum output length, whether tool calling is enabled, and the prompt template. Results missing this information cannot be reproduced or compared horizontally with other tests.
Relationship Between Chain-of-Thought Length and Accuracy
Chain of thought is the intermediate reasoning process a model outputs before giving the final answer. There is no fixed relationship between its length and accuracy.
Longer chain-of-thought reasoning has advantages on difficult problems. When a problem requires trying multiple paths, backtracking, and eliminating incorrect hypotheses, fully developing the reasoning can improve the success rate. But on simple problems, overly long reasoning increases the number of output tokens, prolongs response time, and provides more opportunities for errors. Every step can go wrong, and the more steps there are, the higher the cumulative error probability.
Long reasoning can also cause attention dilution. After outputting very long content, the model may forget key conditions given at the beginning of the problem. This issue is especially noticeable in word problems with many conditions.
Therefore, the choice of chain-of-thought style depends on three factors: task difficulty, model architecture, and budget. Concise reasoning is more efficient on routine problems, while exhaustive reasoning may be more stable on extremely difficult problems.
To determine which style suits a model, test as follows:
- Divide problems into three tiers: easy, medium, and hard.
- For each tier, calculate accuracy, average output tokens, median latency, and P95 latency.
- Plot the curve of accuracy against output tokens. The point where accuracy growth clearly slows is usually the reasoning length with better cost-effectiveness.
This tiered data is more useful than a single overall accuracy figure. Overall accuracy can mask obvious weaknesses in a particular difficulty tier.
Building a Reproducible Evaluation Workflow
A complete evaluation workflow can be divided into five steps.
Step 1: Organize the problems. Label each problem with domain, difficulty, problem type, and source. The number of problems should be no fewer than 300, and each difficulty tier should have enough samples.
Step 2: Check for data contamination. Calculate the n-gram overlap rate between problems and known public corpora, or use vector similarity for near-duplicate detection. Problems whose overlap rate exceeds a set threshold should be removed or separately marked and excluded from the main metrics.
Step 3: Fix prompts and parameters. All models should use the same problem text, system prompt, and output length limit. Sample each problem at least 5 times so that pass@k and consistency can be calculated.
Step 4: Judge and review. Automatically judged results need sampled human review. It is recommended to randomly sample about 20% of each batch and calculate the agreement rate between automatic and human judgments. If agreement is low, revise the judging rules first, then calculate the results.
Step 5: Aggregate and attribute. In addition to accuracy, count failure types. Common categories include calculation errors, skipped logical steps, misread problem statements, and output-format errors. The distribution of failure types can guide subsequent optimization. For example, if calculation errors dominate, consider letting the model call code execution; if misread problem statements dominate, optimize the prompt or the problem wording.
The effect of sample size should also be explained. Suppose 100 problems are tested and the model accuracy is 80%. Using the Wald approximation at a 95% confidence level, the accuracy margin of error is about ±8 percentage points. When the number of problems is small, a difference of a few percentage points between two models may be only random fluctuation. When comparing two models, confirm that the gap exceeds the margin of error.
Verifiable Rewards and Reinforcement Learning
Among training methods for improving mathematical ability, one category matches mathematical scenarios closely. Reinforcement learning from human feedback (RLHF) relies on human-labeled preference data to train a reward model and is suitable for tasks such as open-ended dialogue where standard answers are difficult to provide. In mathematical scenarios, verifiable-reward reinforcement learning (RLVR) is more commonly used, where rewards come directly from rules or programmatic judgments. For example, a positive reward is given when the model’s final answer matches the standard value, or when generated code passes all test cases.
Using verifiable rewards has several prerequisites:
- The answer must be automatically verifiable. Proof problems that cannot be automatically judged are difficult to use directly as reward signals.
- Reward design must prevent gaming. For example, a model may learn to output numbers that “look like answers” or exploit loopholes in output formatting to obtain rewards. The design should also check consistency between the derivation process and the final answer.
- A portion of held-out problems not used in training should be reserved to monitor whether the model is only overfitting to training problems.
Having the model verify derivations through code execution is also a common practice. The model generates Python scripts, calculates intermediate results or checks answers, and returns the execution results to itself. In deployment, note that code should run in an isolated sandbox with execution timeouts and memory limits; execution results should be written back into the context in a structured form to avoid misinterpretation by the model.
Technical Directions for Chain-of-Thought Control
Letting a model decide how long to think based on problem difficulty is a direction receiving considerable attention. This idea can be implemented in two ways.
The first is adaptive reasoning depth. The system first uses a difficulty discriminator module to estimate problem difficulty, then allocates a corresponding reasoning budget to the model, such as setting a maximum number of thinking tokens. The implementation cost mainly lies in the discriminator module. It requires labeled training data, and its judgments directly affect the final outcome. Discriminator bias can lead to two types of failure: difficult problems judged as easy, causing reasoning to end too early; and easy problems judged as difficult, causing unnecessary token consumption.
The second is a routing strategy. The system maintains multiple models with different reasoning styles or different scales and routes requests to suitable models based on problem type. The accuracy of the router also needs separate evaluation; otherwise, the overall result may be worse than consistently using a single model.
In engineering practice, these two approaches are mostly implemented as reasoning budget parameters and routing rules rather than by modifying the model’s underlying computation structure. To judge whether a technique is feasible, check whether its inputs, outputs, and failure modes can all be tested.
Selection Recommendations and Comparison Dimensions
Selection should not rely only on public rankings. Testing should be completed on a self-built problem bank. The table below lists recommended dimensions to compare and their evaluation methods.
| Dimension | Description | Evaluation method |
|---|---|---|
| Mathematical accuracy | Final-answer accuracy and pass@k on the self-built problem bank | Sample the same problem set multiple times and calculate |
| Chain-of-thought length and cost | Average output tokens and cost per problem | Read the usage field returned by the API |
| Latency | Time to first token and overall completion time | Calculate P50 and P95 |
| Verifiability | Whether the model can output executable code or structured derivation steps | Sample and execute code, then conduct human review |
| Deployment mode | Cloud API, private deployment, or local open-source model | Compare against internal operations and compliance requirements |
| Data privacy | Whether problem text and intermediate results leave the jurisdiction, and whether they are used for retraining | Review service agreements and data processing terms |
| Fine-tuning support | Whether instruction tuning and parameter-efficient fine-tuning are supported | Pilot with small-scale data and compare results |
When making trade-offs by scenario, the following conditions can be used as references.
- Scientific derivation and complex algorithm scenarios. Prioritize accuracy and accept higher cost and slower response speed. Outputs need human review or formal verification; a single output should not be trusted directly.
- Report logic validation and data analysis scenarios. Models with concise reasoning and low latency are more suitable. Key numbers should be recalculated with code and cross-checked against model conclusions.
- Local fine-tuning for vertical-domain scenarios. An open-source base model can be selected and instruction-tuned on a self-built problem bank. After fine-tuning, use a general test set to check whether model capabilities have declined, and retain control results from before fine-tuning.
Frequently Asked Questions
Is a longer chain of thought always better? No. The benefit of length is more obvious on difficult problems. On routine problems, it may only increase cost and error probability. Measure by difficulty tier and find the length at which returns begin to slow.
Is a top-ranked model necessarily suitable for me? Not necessarily. Rankings are based on specific test sets, and the problem types, difficulty, and contamination conditions may differ greatly from your business.
Is looking only at the final answer enough? Usually not. If the final answer is correct but the derivation is wrong, the risk is high in scenarios where derivations need to be reused, such as using derivation results in papers or engineering calculations.
How many problems are needed to obtain reliable conclusions? When the number of problems is small, the error in results is larger. A 100-problem test has an error of about ±8 percentage points, so when comparing two models, confirm that the gap clearly exceeds the error range.
