Building an LLM Evaluation System for Open-Ended Math Problems: A Practical Guide
Evaluating large language models (LLMs) on open-ended math problems requires far more than checking whether the final answer matches. This article walks through how to build a systematic, engineering-grade evaluation framework, covering evaluation goals, dataset construction, a multi-dimensional scoring system, automatic and human review mechanisms, process consistency, robustness testing, engineering pipelines, and a closed-loop workflow that runs from offline baselines to online monitoring. It also outlines common pitfalls and a phased implementation roadmap. It is intended for developers and enterprise teams who want to make math-related model capabilities measurable, reproducible, auditable, and continuously improvable, while controlling inference quality, cost, and security risks.
Building an LLM Evaluation System for Open-Ended Math Problems: A Practical Guide
1. Background: Why Evaluating Open-Ended Math Problems Is Harder
When judging whether an LLM genuinely possesses mathematical ability, a single dimension such as “is the answer correct?” is often not enough. Open-ended math problems differ clearly from traditional single-turn question answering: they usually require the model to complete several steps, including problem parsing, condition extraction, mathematical modeling, formula derivation, numerical computation, boundary verification, and result expression. A model may appear to produce a final answer, yet the intermediate process can hide missed conditions, logical leaps, misused units, improper approximation, or derivations that look plausible but are actually invalid.
For this reason, evaluating open-ended math problems cannot stop at comparing the final answer. A more rigorous evaluation system must assess answer correctness, reasoning-process completeness, result stability, constraint satisfaction, anomaly-detection ability, and cost control at the same time. Only through multi-dimensional assessment can you judge whether a model is suitable for real business scenarios such as complex computation assistance, data-analysis Q&A, engineering parameter validation, and math-tutoring assistance.
For developers and enterprise teams, a reusable evaluation system does more than help identify a model’s capability boundaries; it also reduces uncertainty during later selection, tuning, launch, and operations. In math-related tasks in particular, small deviations in model output can affect business decisions, so the evaluation mechanism must be sufficiently engineered, auditable, and traceable.
2. Evaluation Goals: From “Can It Answer Correctly?” to “Can It Answer Reliably?”
An open-ended math evaluation system should start by defining clear goals. A complete set of goals can be broken down as follows:
Answer correctness
Determine whether the model produces a final result and whether that result matches the reference answer. Numeric problems need a tolerance mechanism; expression problems require equivalence checking; proof problems and open questions require further checks that the key arguments hold.Process credibility
The model should not only give an answer but also provide a checkable process. This includes whether it defines variables, whether it uses appropriate formulas, whether it omits boundary conditions, whether it verifies the result, and whether it makes unjustified leaps in reasoning.Result stability
For the same problem under different prompts, different sampling strategies, and different runs, does the model produce consistent output? A model with poor stability may perform well on individual questions but struggle to support production environments.Constraint recognition
Open-ended math problems often contain hidden conditions, restrictive conditions, or contradictory conditions. The model must be able to identify whether a problem is solvable, whether conditions are missing, whether there are multiple solutions, and whether the problem has no solution, rather than mechanically producing a plausible-looking answer.Robustness
When the problem statement is rewritten, values change, units are adjusted, expression order changes, or distractors are introduced, can the model still reason correctly?Cost and efficiency
Evaluation should address inference cost, not just quality. This includes single-call latency, resource consumption, batch-processing capability, cache hit rate, and the proportion requiring manual review.Security and compliance
For math problems involving sensitive business data, personal information, or restricted content, you need access control, log auditing, data masking, and result-traceability mechanisms.
3. Building the Evaluation Dataset: High-Quality Questions Are the Foundation
The first step in evaluating open-ended math problems is building a high-quality dataset. A dataset should not be merely “questions plus answers”; it should contain structured information that supports both automatic scoring and human review.
3.1 Layered Design of Question Sources
It is recommended to divide questions into several levels:
- Basic computation: arithmetic, equation solving, value substitution, unit conversion, and other foundational skills.
- Multi-step reasoning: problems that require continuous derivation across several steps, such as algebraic transformation, function monotonicity analysis, and probability/combinatorics calculations.
- Comprehensive modeling: problems that require abstracting a mathematical model from a real-world description before solving it.
- Open proof: problems that require proving a proposition, proof by contradiction, induction, or construction.
- Boundary and anomaly: problems that contain missing conditions, contradictory conditions, no solution, multiple solutions, or special-value failures.
- Robustness perturbation: problems derived from original questions by changing the wording, values, order, or units, to observe model stability.
This layered approach avoids skewed conclusions caused by relying on a single question type. Enterprise teams can also add domain-specific questions based on their business scenarios, such as financial calculation, engineering validation, statistical analysis, and supply-chain optimization, but should avoid introducing real sensitive data that has not been desensitized.
3.2 Questions Must Support Verifiable Scoring
Each question should ideally contain the following fields:
{"id": "math-open-0001","domain": "algebra","difficulty": 3,"prompt": "Problem description","answer_type": "numeric_or_expression","gold_answer": "reference answer","tolerance": 1e-6,"key_steps": ["define variables","set up the equation","solve the equation","verify the solution"],"traps": ["misses the negative solution","fails to check the domain"],"tags": ["equation", "verification"]}
For numeric problems, define a tolerance clearly. For expression problems, support normalization to equivalent forms. For proof problems, extract key conclusion points, such as “uses proof by contradiction,” “verifies monotonicity,” “checks boundary values,” and “completes the induction step.”
3.3 Version Management and Anti-Contamination Mechanisms
Once an evaluation set enters model training, prompt optimization, or internal testing, contamination easily occurs. To prevent models from “memorizing” questions, consider the following measures:
- Version-number the evaluation set and retain historical versions on every change.
- Parameterize questions, for example by changing numbers, order, variable names, or units.
- Periodically generate isomorphic questions that keep the same type but differ on the surface.
- Store the evaluation set separately from training data and prompt examples.
- Add private verification fields to key questions so they are not exposed together with public examples.
- Establish a question hash or fingerprint mechanism to prevent duplicate collection.
These steps make evaluation results reflect real capability rather than memorization of a specific question bank.
4. Metrics System Design: A Multi-Dimensional Scoring Framework
Evaluating open-ended math problems requires a quantifiable metrics system. Relying only on “accuracy” loses information, so a combination of metrics is needed.
4.1 Core Metrics
At a minimum, include the following:
Answer accuracy: the proportion of final results that match the reference answer.
Key-step coverage: whether the model output contains the necessary reasoning steps, such as variable definition, formula selection, intermediate derivation, and result verification.
Process consistency: whether the same model, across multiple runs or under different prompt conditions, produces consistent results and similar reasoning paths.
Constraint satisfaction rate: whether it satisfies the domain, range, units, precision, sign, boundary conditions, and other requirements in the problem.
Anomaly recognition rate: accuracy in identifying problems with missing conditions, contradictory conditions, no solution, or multiple solutions.
Hallucination rate: whether the model introduces conditions not given in the problem, or fabricates nonexistent formulas, theorems, or values.
Average response latency: the average time per evaluation request, useful for assessing online availability.
Manual review rate: the proportion of cases that cannot be scored automatically or have low scoring confidence.
4.2 Example of a Composite Score Formula
To balance multiple dimensions, you can build a composite score:
FinalScore =α * AnswerAccuracy+ β * StepCoverage+ γ * Consistency+ δ * ConstraintSatisfaction- ε * HallucinationRate- ζ * AverageLatency
Here, α, β, γ, δ, ε, and ζ are weights that can be tuned per business scenario. For example, in an online real-time Q&A setting, you can assign higher weight to latency and stability; in research assistance or complex proof scenarios, you can assign higher weight to step coverage and constraint satisfaction.
Note that weights should not be set arbitrarily. Teams should first define business tolerance, then calibrate the weights through small-sample replay, human review, and gray testing, so the composite score does not mask critical defects.
5. Scoring Mechanisms: Combining Automatic Scoring with Human Review
The difficulty of scoring open-ended math problems lies in the variety of answer forms. The same result may appear as different expressions, in different units, or at different precision. The scoring mechanism therefore needs a layered design.
5.1 Numeric Answer Scoring
For numeric answers, support the following handling:
- Remove extra spaces and formatting symbols.
- Normalize units.
- Support scientific notation.
- Set a reasonable tolerance, such as relative error or absolute error.
- Check special values such as zero, negative numbers, infinity, and undefined cases.
Pseudocode example:
function evaluate_numeric(response, gold, tolerance):extracted = extract_final_number(response)if extracted is null:return fail("missing numeric answer")normalized = normalize_units(extracted, gold)if absolute_difference(normalized, gold) <= tolerance:return pass("numeric answer correct")else:return fail("numeric answer incorrect")
5.2 Expression Answer Scoring
Expression problems cannot be scored by simple string comparison. Perform normalization, such as unifying symbols, expanding parentheses, combining like terms, and substituting equivalent forms. The scoring logic can be abstracted as:
function evaluate_expression(response, gold):response_expr = extract_expression(response)gold_expr = normalize_expression(gold)candidate_expr = normalize_expression(response_expr)if equivalent(candidate_expr, gold_expr):return pass("expression equivalent")else:return fail("expression mismatch")
In practice, “equivalence checking” usually needs symbolic-computation support. If a full symbolic-computation environment is unavailable, you can first apply rule-based normalization and key-point matching, then bring in human review.
5.3 Proof and Open-Question Scoring
Proof problems and open questions cannot rely entirely on automatic matching, so use a “key-point scoring + human review” model. Extract key proof points in advance:
{"proof_points": ["defines the variables clearly","shows the function is continuous on the interval","applies the monotonicity theorem","verifies boundary values","states the final conclusion"]}
During scoring, check whether the model output covers these key points. For high-quality evaluation, also invite human reviewers to judge logical rigor, clarity of expression, whether there is circular reasoning, and whether conditions are silently swapped.
5.4 Automatic Scoring Flow Example
function evaluate_case(case, response):final_answer = extract_answer(response)if case.answer_type == "numeric":return numeric_evaluation(case, final_answer, response)if case.answer_type == "expression":return expression_evaluation(case, final_answer, response)if case.answer_type == "proof":return proof_evaluation(case, response)if case.answer_type == "open":return open_evaluation(case, response)return human_review(case, response)
The goal of automatic scoring is to reduce human effort, not to fully replace humans. For high-value scenarios, retain a sampling-based manual review mechanism.
6. Process Consistency: Judging Whether a Model Is “Stable and Reliable”
Process consistency is critical when evaluating open-ended math problems. Many models produce the correct result in one run but a different conclusion in another; such models are not suitable for critical business paths.
6.1 Dimensions of Consistency
Process consistency can be measured from the following angles:
- Whether the final answer is consistent across multiple samples of the same question.
- Whether the final answer is consistent under different prompt templates.
- Whether key conclusions remain stable as the temperature parameter changes.
- Whether capability regresses between different model versions.
- Whether key steps recur rather than appear randomly.
6.2 Example of Consistency Calculation
You can define an answer-consistency rate and a key-step consistency rate:
AnswerConsistency =most_frequent_answer_count / total_runsStepConsistency =matching_key_steps_count / expected_key_steps_count
For example, if the same question is run ten times and eight runs give the same result while two differ, the answer-consistency rate is 0.8. If every run completes all four key steps of “define variables, set up the equation, solve, and verify,” the key-step coverage rate is 1.0.
6.3 Output-Structure Constraints Improve Consistency
To improve consistency, you can require the model to output structured content in the prompt, for example:
Please output in the following structure:1. Known conditions2. Variable definitions3. Derivation process4. Key intermediate results5. Final answer6. Self-check notes
Structured output not only simplifies automatic parsing but also eases human review. For enterprise applications, it is recommended to fix the output format into fielded sections such as “Known conditions,” “Unknowns,” “Assumptions,” “Solving process,” “Result,” and “Verification method.” This turns freely generated model text into a manageable evaluation object.
7. Robustness Testing: Verifying Whether a Model Can Handle Variation
In real business settings, math problems rarely appear in standard form. The problem statement may be rewritten, values may change, units may differ, and there may even be distracting information. Evaluation must therefore include robustness testing.
7.1 Common Perturbation Methods
- Numerical perturbation: change the magnitude, sign, decimal places, or order of magnitude of numbers.
- Unit perturbation: convert meters to centimeters, hours to minutes, percentages to decimals.
- Expression perturbation: reorder sentences, add background description, change the way the question is asked.
- Condition perturbation: add hidden constraints, such as “the variable must be a positive integer.”
- Trap perturbation: insert invalid conditions, similar but different concepts, or easily confused definitions.
- Anomaly perturbation: remove necessary conditions so the problem becomes unsolvable or requires additional assumptions.
7.2 Robustness Scoring Method
For each original question, generate several perturbed versions, call the model for each, and compute:
RobustnessScore =correct_results_in_perturbations / total_perturbations
If a model performs well on the original question but drops noticeably on perturbed versions, it likely relies on surface pattern matching rather than genuinely understanding the problem structure.
7.3 Anomaly Questions Should Be Evaluated Separately
In open-ended math problems, it is also important whether the model knows when a problem “cannot be solved.” For example:
- The problem is missing a necessary parameter.
- The conditions contradict each other.
- The problem asks for an extremum under constraints, but the constraints are infeasible.
- The problem has multiple solutions but asks for only one, so the model must state that the solution is not unique.
For such questions, define an “anomaly recognition accuracy” metric. If a model forcibly produces an answer, it should be penalized rather than rewarded. A reliable math-assistance model must not only compute, but also recognize whether a problem even holds.
8. Engineering Implementation: Building a Sustainably Running Evaluation Pipeline
An evaluation system is not a one-off script; it should become a continuously running engineering system. Enterprise teams can break the evaluation workflow into stages and support them with general cloud capabilities.
When building the pipeline on Baidu AI Cloud, you can combine general capabilities: object storage for saving datasets, model outputs, and evaluation reports; a message queue for scheduling batch evaluation tasks; a container platform for running scoring services and symbolic-verification tasks; a logging service for recording requests, responses, and the scoring chain; and monitoring and alerting to track failure rates, latency, resource consumption, and abnormal fluctuations. (The exact availability and naming of these services may vary by region and should be confirmed against the official documentation.)
8.1 Evaluation Pipeline Design
A typical evaluation pipeline can include:
Data ingestion: import questions to be evaluated from the question bank, business sample library, or human-annotation platform.
Version snapshot: pin versions of the dataset, prompt templates, model parameters, and scoring criteria.
Batch inference: submit model inference requests through asynchronous tasks to avoid long tasks blocking.
Result extraction: extract the final answer, key steps, and self-check information from model outputs.
Automatic scoring: run numeric, expression, proof-point, or rule-based scoring according to question type.
Human review: manually review low-confidence samples, proof questions, and disputed questions.
Report generation: produce multi-dimensional reports on accuracy, consistency, robustness, latency, cost, and more.
Alerting and regression: trigger alerts when metrics exceed thresholds, and automatically start regression testing.
8.2 Asynchronous Tasks and Batch Evaluation
Evaluating open-ended math problems often requires multiple samples per question, so a single evaluation can generate several times the number of calls. Using synchronous requests can cause resource queuing and timeouts. It is recommended to make evaluation tasks asynchronous:
evaluation task -> message queue -> inference executor -> result collection -> scorer -> report storage
This allows resources to be scheduled smoothly during evaluation peaks and supports failure retries. For long questions, complex proofs, or multi-round verification tasks, set reasonable timeouts and retry policies to avoid infinite loops.
8.3 Logging and Audit
The evaluation process must be auditable. It is recommended to record the following:
- Question ID and dataset version.
- Model version or inference-configuration ID.
- Prompt template version.
- Request time and response time.
- The model’s raw output.
- The extracted answer.
- Scoring result and scoring rationale.
- Human-review comments.
- Failure reasons and error codes.
For enterprise scenarios, logs should support retrieval by task, by question, and by time range. When sensitive data is involved, apply masking and enforce role-based access by permission level.
9. Evaluation Closed Loop: From Offline Testing to Online Continuous Monitoring
The evaluation system should form a closed loop rather than running a one-time intensive test before launch. A recommended model is “offline baseline, gray validation, online sampling, continuous regression.”
9.1 Offline Baseline Evaluation
In the early stage of onboarding a model, use a fixed evaluation set to establish a baseline. The baseline should cover core question types and typical business scenarios so that every subsequent update can be compared against it.
9.2 Gray Validation
After adjusting the model or prompt strategy, first validate on a small traffic slice. Observe whether accuracy, latency, failure rate, and user feedback behave abnormally. If key metrics drop, roll back the configuration.
9.3 Online Sampling
Online traffic may contain real long-tail problems. Sample a proportion of requests into the evaluation queue to form new test cases. After human confirmation, these can be added to the private evaluation set.
9.4 Continuous Regression
After every change to the model configuration, prompt template, parameter strategy, or scoring rule, run regression tests. Regression testing should automatically compare the current version against historical baselines and output the changed items.
10. Common Pitfalls and How to Avoid Them
10.1 Looking Only at the Final Answer
Many evaluation failures stem from looking only at the final answer. A model may reach a correct result through an incorrect path, or be misjudged due to formatting deviations. Check the answer, the process, and the constraints together.
10.2 Over-Reliance on a Single Prompt
If evaluation uses only one prompt, results tend to be attributed to model capability while ignoring the influence of prompt design. Keep multiple prompt templates for comparison.
10.3 Ignoring Units and Precision
Units, significant figures, and approximation rules in math problems often cause misjudgment. The scorer must support unit normalization and tolerance-based comparison.
10.4 Evaluation Set Leakage
If questions overlap heavily with training data or public examples, evaluation results will be inflated. Use parameterized questions, isomorphic questions, and a private verification set.
10.5 Inconsistent Human Scoring Standards
Without clear scoring guidelines, human review is prone to subjective bias. It is recommended to create a scoring rubric and run consistency training for reviewers. Stability can be improved through cross-review by multiple people or sampling-based arbitration.
10.6 Ignoring Intermediate Errors in Long Reasoning
In long reasoning, a model may make mistakes in intermediate steps yet still reach the correct answer by guessing. Such output should not be treated as high quality. Introduce key-step coverage and process-consistency metrics.
11. Implementation Roadmap: From Minimum Viable to Systematic Operations
Enterprise teams can advance the evaluation system in stages.
Phase 1: Minimum Viable Evaluation
First build a small-scale gold-standard set covering common question types and core business scenarios. Define the question format, answer format, scoring rules, and human-review process. The goal of this stage is to make evaluation runnable and comparable.
Phase 2: Automated Scoring and Structured Output
Change model output to structured fields, introduce an automatic scorer, and support numeric, expression, and rule-based scoring. Keep human review for proof questions and open questions. The goal of this stage is to reduce human effort and improve evaluation efficiency.
Phase 3: Robustness and Anomaly-Scenario Expansion
Add perturbation questions, anomaly questions, trap questions, and multiple-solution questions. Establish robustness scoring and anomaly-recognition metrics. The goal of this stage is to judge whether the model has genuine understanding.
Phase 4: Engineering and Continuous Monitoring
Connect evaluation tasks to scheduling, logging, monitoring, and alerting systems to enable scheduled evaluation, regression evaluation, and online sampling evaluation. The goal of this stage is to make evaluation a long-term operational capability.
12. Summary
Evaluating an LLM’s ability on open-ended math problems cannot depend on whether a single response hits the reference answer. A truly reliable evaluation system should span question design, data governance, scoring mechanisms, process consistency, robustness, anomaly recognition, engineering scheduling, and continuous monitoring. For developers and enterprise teams, the value of building this system lies not only in comparing model quality, but in making math-reasoning capabilities measurable, reproducible, auditable, and continuously improvable.
In practice, it is recommended to first build a structured question format, then establish automatic scoring with human review, and gradually introduce perturbation testing and online regression evaluation. Only by turning evaluation from a one-time experiment into a long-term engineering capability can you use LLMs more robustly in complex math scenarios and effectively control inference quality, cost, and security risks.
