Evaluating Open-Ended Math Problems: A Practical Guide to Model Selection and Testing

    This article explains how to objectively evaluate large language models on open-ended math problems and turn the results into model selection decisions. It covers evaluation metrics beyond final-answer accuracy, common model behavior patterns, a four-step selection strategy, a Python routing example with threshold calibration, and common mistakes to avoid.

    1. Introduction: Why Open-Ended Math Problems Are Hard

    Large language models have made significant progress in natural language processing and code generation. However, they still make errors on open-ended math problems. Unlike formula-based exercises, these problems usually require extensive mathematical knowledge, multi-step planning, construction of intermediate lemmas, and the ability to self-correct after detecting errors. Therefore, open-ended math problems are often used to test a model’s reasoning ability.

    For developers and enterprises, there are two main challenges. First, how to objectively compare different models on a specific task. Second, how to turn comparison results into model selection decisions. Public leaderboards provide reference points, but each leaderboard uses different test sets, prompts, and scoring rules, so conclusions may not transfer to your own business scenario. This article focuses on three topics: solving open-ended math problems, evaluating chain-of-thought reasoning, and selecting models.

    2. Evaluation Metrics: Do Not Look Only at the Final Answer

    When evaluating, whether the final answer is correct is a basic metric. Whether the solution process is traceable, how redundant it is, the time and cost, and whether the expression is easy to read also affect practical usability. The following table suggests a scoring system.

    Metric Meaning Calculation Method
    Final answer accuracy Proportion of conclusions matching the standard answer or human judgment Correct questions / Total questions
    Step traceability Whether each step can be logically derived from prior conditions Human scoring on a 0–2 scale, averaged
    Reasoning redundancy Proportion of redundant steps or repeated loops among all steps Redundant steps / Total steps
    Time and token cost End-to-end time per question and total input/output token count Record P50 and P90 percentiles
    Expression readability Clarity of writing and consistency of terminology Two reviewers score independently on a 1–5 scale

    When measuring, follow these rules. Prepare at least 50 questions per question type. Run the same question three times and report the average. Report a 95% confidence interval for accuracy, which can be calculated using the Wilson interval. Before scoring, reviewers should agree on scoring guidelines. If the two reviewers diverge significantly, revise the guidelines and re-score.

    For proof-style questions, tools can assist with verification. Intermediate steps of algebraic identities can be checked with symbolic computation libraries, and formal proofs can be checked with proof assistants such as Lean. Steps verified by tools have higher credibility, but tools cannot cover all arguments, so human review is still necessary.

    3. Common Model Behavior Patterns

    The table below groups models into three common behavior categories based on typical characteristics. These categories are for description only; they do not represent a ranking of any specific model. Actual performance must be confirmed on your own test set.

    Type Typical Behavior Suitable Scenarios Main Cost
    Rigorous derivation Complete derivation steps, long logical chains, fewer errors Formal verification, complex algorithm derivation High latency, high unit price
    Concise expression Shorter chain-of-thought, direct focus, natural writing Standard advanced math problems, solution explanations May miss key paths for extremely hard open problems
    Long-chain exploration Generates many intermediate steps, tries multiple paths Difficult problems requiring search of the solution space High token consumption, may get stuck in long contexts

    The same model can show significant differences across versions, temperature settings, or prompt templates. Model capabilities also change with version updates. Therefore, evaluation reports should record the model version, call date, parameter configuration, and prompt template. After upgrading a model, re-test and do not reuse old conclusions.

    4. Model Selection Strategy

    Step 1: Build a private test set. Collect questions from real business scenarios, stratify them by difficulty, and label each question with a standard answer and a reference solution. Test questions should not appear in public training data. To reduce leakage risk, you can write your own questions or update the question bank periodically.

    Step 2: Calculate unit correct cost. Comparing only accuracy can lead to expensive choices. We recommend calculating “total cost / number of correct answers” and comparing cost-effectiveness across models using the same criteria.

    Step 3: Monitor chain-of-thought quality. If the service provider supports it, enable chain-of-thought output during calls. Count the number of steps and repeated fragment ratios per question to detect redundant reasoning, then adjust prompts or switch models accordingly.

    Step 4: Use hybrid routing. First use a lightweight model to estimate question difficulty. Route high-difficulty questions to rigorous derivation models, and route routine questions to more cost-effective models. After derivation, use a model with strong expression ability to polish the output.

    5. Implementation Example and Threshold Calibration

    Prerequisites for running:

    • Python 3.10 or higher, with the SDK of the chosen model installed.
    • The example assumes that the SDK’s call methods support the timeout parameter. If not, set a timeout when initializing the client.
    • API keys are injected through environment variables; do not hard-code keys in the code.
    • Logs only save the hash and length of the problem text. Problems may contain customer data, so the original text should not enter logs.

    Threshold calibration method: Run the lightweight model’s difficulty estimation on a labeled set of questions with human difficulty tags to obtain estimated scores. Choose a threshold so that the recall of high-difficulty questions reaches a target value, for example 90%. A threshold that is too low increases cost; a threshold that is too high misses difficult questions. Re-calibrate the threshold when the model is changed or the question distribution shifts.

    1. import hashlib
    2. import logging
    3. import time
    4. logger = logging.getLogger("math_router")
    5. HIGH_THRESHOLD = 0.7 # calibrated on labeled set; see text
    6. TIMEOUT_SECONDS = 120
    7. MAX_RETRIES = 2
    8. def _mask(text: str) -> str:
    9. """Log only the hash prefix and length of the problem, not the original text."""
    10. digest = hashlib.sha256(text.encode("utf-8")).hexdigest()[:16]
    11. return f"sha256={digest}, len={len(text)}"
    12. def _call_with_retry(fn, *args):
    13. last_error = None
    14. for attempt in range(MAX_RETRIES + 1):
    15. try:
    16. return fn(*args, timeout=TIMEOUT_SECONDS)
    17. except TimeoutError as exc:
    18. last_error = exc
    19. logger.warning("timeout, attempt=%d", attempt)
    20. except ConnectionError as exc:
    21. last_error = exc
    22. time.sleep(2 ** attempt) # exponential backoff
    23. raise RuntimeError("model call failed after retries") from last_error
    24. def solve_math_problem(problem_text, clients):
    25. if not problem_text or not problem_text.strip():
    26. raise ValueError("problem_text is empty")
    27. logger.info("request %s", _mask(problem_text))
    28. # If difficulty estimation fails, default to the rigorous model.
    29. # This costs more but avoids quality degradation.
    30. try:
    31. difficulty = _call_with_retry(
    32. clients["lightweight"].estimate_difficulty, problem_text
    33. )
    34. except RuntimeError:
    35. difficulty = None
    36. if difficulty is None or difficulty > HIGH_THRESHOLD:
    37. derive_client = clients["advanced"]
    38. else:
    39. derive_client = clients["balanced"]
    40. try:
    41. raw_proof = _call_with_retry(derive_client.derive, problem_text)
    42. except RuntimeError:
    43. logger.error("derivation failed, %s", _mask(problem_text))
    44. return None # return None; caller should handle manually
    45. # If polishing fails, return the raw derivation to keep the main flow usable
    46. try:
    47. return _call_with_retry(clients["writer"].polish, raw_proof)
    48. except RuntimeError:
    49. logger.warning("polish failed, returning raw proof")
    50. return raw_proof

    This code is a skeleton. Replace the client objects with actual SDK calls and test on real problems before deployment.

    6. Common Mistakes

    • Blindly trusting leaderboards. The question distribution and scoring rules of a leaderboard may not match your business. Conclusions drawn from a leaderboard’