Evaluating and Practicing Mathematical Reasoning in Large Language Models

    This article explains why ranking large language models on math is difficult and proposes a practical alternative: layered evaluation based on task distribution, verifiability, and engineering constraints. It breaks down key dimensions such as answer correctness, reasoning-chain complexity, writing quality, and consistency, then outlines a three-tier reproducible evaluation method with sample grading and budget-control code. It also covers quota management, queuing, caching, fallback strategies, common pitfalls, and deployment recommendations.

    1. The Starting Point: Why “Which Model Is Better?” Is Hard to Answer in One Sentence

    In real projects, teams often face a deceptively simple question: for open-ended math problems, which type of model should we choose? A common approach in community discussions is to line up several models and assign rankings. The problem with this approach is that it compresses multidimensional capability into a one-dimensional sequence, ignoring key variables such as task format, reasoning budget, and output verifiability.

    A more reliable approach is to break “capability” into observable metrics and then weight them according to your own business distribution. Open-ended math problems differ from closed-book calculation tasks: the former have no single correct answer and require the model to define variables, select methods, and provide proofs or derivation paths; the latter only require a correct result. Therefore, evaluation must examine both “whether the conclusion is correct” and “whether the process is verifiable.”

    2. Breaking Down the Evaluation Dimensions

    2.1 Conclusion Correctness and Verifiability

    Conclusions for open-ended problems often depend on assumed premises. During evaluation, models should be required to explicitly state assumptions, variable definitions, and boundary conditions, which are then verified manually or by scripts. Outputs with poor verifiability are hard to move into production, even when the conclusions appear reasonable.

    2.2 Reasoning Chain Length and Complexity

    A model with a longer reasoning chain is not necessarily stronger. Excessively long chains of thought have two side effects: increased latency and cost, and a cumulative probability of errors in intermediate steps. In practice, a “concise and reviewable” reasoning path is more valuable—one that completes the derivation in the minimum necessary steps while retaining key intermediate quantities.

    2.3 Naturalness of Writing and Expression

    When outputs must be read by people, whether the expression reads naturally, whether terminology is accurate, and whether the structure is clear directly affect review efficiency. This dimension carries higher weight in mathematical proofs, technical reports, and solution descriptions.

    2.4 Stability and Consistency

    Whether conclusions remain consistent across multiple runs of the same problem, and whether assumptions drift, are important indicators for engineering deployment. This can be quantified by fixing randomness, repeated sampling, and measuring the consistency rate.

    3. A Reproducible Layered Evaluation Method

    It is recommended to divide evaluation into three layers that converge progressively, avoiding excessive upfront human effort.

    The first layer is automated verification. For problems that can be judged by machines, scripts compare final results and intermediate quantities:

    1. def grade(answer, expected, tol=1e-6):
    2. # Compare result + spot-check key intermediate values
    3. if abs(answer["result"] - expected["result"]) > tol:
    4. return False, "result_mismatch"
    5. for k, v in expected["checks"].items():
    6. if abs(answer["checks"][k] - v) > tol:
    7. return False, f"check_failed:{k}"
    8. return True, "ok"

    The second layer is process review. For proof problems that cannot be judged by machines, two independent reviewers evaluate each output and record three boolean flags: whether assumptions are explicit, whether steps are reviewable, and whether circular reasoning exists.

    The third layer is business weighting. Weight the results of the first two layers according to real traffic distribution to produce a composite score aligned with business goals, rather than chasing general leaderboard rankings.

    4. Stability and Quota Management on the Calling Side

    Beyond capability evaluation, the most common engineering pain point is quotas and queuing. Credit-based or token-based services are prone to queuing during peak periods, causing task timeouts. Feasible mitigation measures include:

    • Task tiering: separate requests into online interactive and offline batch tasks, and run offline tasks during off-peak hours;
    • Budget control: set a maximum number of reasoning steps and a timeout limit per task to prevent long chains of thought from degrading overall latency;
    • Result caching: cache recurring problems and intermediate conclusions to reduce repeated consumption;
    • Fallback strategy: automatically switch to a lower capability tier when the higher tier is unavailable, with a confidence notice;
    • Observability: use logging services and monitoring alerts to record the latency, step count, and failure reasons of each call, forming a traceable chain.

    Illustrative budget-control logic:

    1. def run_with_budget(task, max_steps=12, timeout_s=60):
    2. steps = 0
    3. while steps < max_steps:
    4. if time.monotonic() - start > timeout_s:
    5. return {"status": "timeout", "partial": partial}
    6. partial = step(task, partial)
    7. steps += 1
    8. if partial.done:
    9. return {"status": "ok", "result": partial.result}
    10. return {"status": "budget_exceeded", "partial": partial}

    5. Common Pitfalls

    The first pitfall is treating leaderboard rankings directly as a selection conclusion. The problem distribution of leaderboards often differs from the business distribution, so transferability is limited.

    The second pitfall is looking only at the final answer. The value of open-ended problems lies in reviewable processes; conclusions with non-reviewable processes are hard to enter audit and compliance workflows.

    The third pitfall is ignoring cost structure. Long chains of thought may be necessary for complex problems, but they are wasteful for large volumes of simple requests and should be routed by problem type.

    The fourth pitfall is ignoring failure modes. Queuing, timeouts, and truncation all change output quality, so evaluation must be conducted under real constraints.

    6. Implementation Recommendations

    If a team wants to build this kind of evaluation and calling pipeline on Baidu AI Cloud, it can use a combination of general-purpose capabilities: object storage to save problem and result snapshots, a message queue to stagger offline tasks, a container platform to host evaluation and inference services, and logging services with monitoring alerts for full-chain tracing. This ensures reproducibility while maintaining business continuity when quotas are tight.

    Overall, comparing the mathematical capabilities of models should return to three elements: task distribution, verifiability, and engineering constraints. Replacing a single ranking with layered evaluation, and replacing blind calling with budget and fallback strategies, is the way to achieve stable returns in real business.