Methodology for Selecting Large Language Models in Mathematical Reasoning and Engineering Tasks

    Selecting the right large language model (LLM) for specific tasks requires moving beyond subjective individual experiences. This article outlines a systematic methodology for LLM selection, covering the distinction between divergent and convergent tasks, key dimensions for evaluating mathematical reasoning, and the construction of a reproducible evaluation pipeline. It also explores how to measure cost-effectiveness using cost per successful task, implement multi-model routing, optimize inference infrastructure, and ensure secure enterprise deployment.

    I. Why Individual Experience Fails to Guide Model Selection

    Large language models exhibit significant performance variations across different tasks. Performing well in a single conversation does not guarantee stability in batch processing. Individual evaluations typically suffer from three types of biases:

    • Sample Bias: Testing only familiar or interesting problems tends to overestimate strengths while ignoring weaknesses.
    • Prompt Bias: Rephrasing the same question can significantly alter the output quality, meaning a single result is rarely representative.
    • Environment Bias: Differences in account quotas, context length, inference modes, and output display methods make direct comparisons between experiences impossible.

    Therefore, before making a selection, teams must standardize the task set, unify prompts and sampling parameters, and retain complete execution logs. Only under these conditions can the results of different models be comparable.

    II. Distinguish Task Types First

    Different workloads require different model capabilities and should be evaluated separately. They can generally be divided into two categories.

    2.1 Divergent Tasks

    These include brainstorming, drafting proposals, topic exploration, and copywriting alternatives. The core metrics for these tasks are coverage and inspiration. A certain degree of imprecision is acceptable, but rapid response is usually required to facilitate multi-turn follow-ups and quick filtering.

    2.2 Convergent Tasks

    These include code modification, structured information extraction, data format conversion, strict reasoning, and proof checking. The core metrics are correctness and verifiability. The cost of errors is high, and the output usually needs to conform to a fixed format that can be automatically verified by a program.

    The cost-effectiveness of the same model across these two task types can be entirely different. A model with slightly weaker reasoning capabilities but significantly faster speed may be more valuable in execution tasks. The reason is that when the latency of a single generation drops significantly, teams can complete more iterations within the same timeframe and filter out erroneous results through automatic verification. In such cases, the benefits of increased throughput can outweigh the gap in single-pass quality.

    III. Dimensions for Evaluating Mathematical Reasoning

    When evaluating mathematical reasoning capabilities, the assessment can be broken down into four dimensions:

    1. Logical Correctness: Whether each derivation step is valid and whether the conclusion relies on unproven assumptions.
    2. Completeness: Whether all scenarios are covered, such as boundary conditions, degenerate cases, and special values.
    3. Verifiability: Whether the derivation can be converted into a checkable format, such as being handed over to a formal proof assistant or verified through independent numerical checks.
    4. Originality and Reproducibility: Distinguishing between “reproducing existing public results” and “exploring open problems.” The former can be compared point-by-point with authoritative literature, while the latter requires in-depth review by domain experts.

    For propositions with existing public proofs, the model’s output can be compared step-by-step with the arguments in the literature. If the literature has not yet provided a proof, any conclusion given by the model must undergo independent verification and should not be accepted as correct simply because the text is fluent. The criterion is always whether each inference has a clear basis.

    Below is a simple scoring rubric example for manual review:

    1. Scoring Rubric (Score each problem on three criteria, 0 to 2 points each)
    2. - Conclusion Correctness: 0 Incorrect / 1 Partially correct / 2 Completely correct
    3. - Derivation Traceability: 0 Severe skipped steps / 1 Occasional skipped steps / 2 Complete steps
    4. - Citation Accuracy: 0 Fabricated citations / 1 Vague citations / 2 Verifiable citations

    IV. Building a Reproducible Evaluation Pipeline

    A reproducible evaluation pipeline typically consists of the following three stages.

    4.1 Define the Task Set

    • Stratify by difficulty. For example, reproduction problems with known conclusions, standard exercises, and small open-ended problems should each occupy a certain proportion to prevent results from being dominated by a single difficulty level.
    • Attach standard answers or review guidelines to each problem to unify the evaluation scale.
    • Use version control for the task set. Any modifications must log the reason for the change.

    4.2 Fix Experimental Conditions

    • Standardize the prompt template, including system instructions, output format requirements, and examples.
    • Unify sampling parameters, and record the model version, invocation time, and context settings.
    • Run each problem multiple times and calculate the pass rate, rather than drawing conclusions based on a single run.

    4.3 Blind Review and Aggregation

    Reviewers should not know which model generated the output to reduce subjective bias. After the review is complete, aggregate the results grouped by model and difficulty.

    The pseudocode below illustrates the main steps of this pipeline:

    1. for task in task_set:
    2. for model in candidates:
    3. for run in range(N):
    4. output = call_model(model, task.prompt, params)
    5. record(task.id, model, run, output, latency, tokens)
    6. blind_records = shuffle_and_hide_model_names(records)
    7. scores = human_review(blind_records, rubric)
    8. report = aggregate(scores, group_by=["model", "difficulty"])

    V. Measuring Cost-Effectiveness via Cost Per Successful Task

    The price of a single query does not reflect the true cost. A more reasonable metric is the cost per successful task:

    Cost per Successful Task = Total Expenditure / Number of Tasks Passed Verification

    Additionally, you can calculate the effective throughput:

    Effective Throughput = Number of Tasks Passed Verification / Total Time

    Below is a set of hypothetical numbers used solely to illustrate the calculation method, not representing data from any actual product.

    • Model A: Pass rate 90%, time per task 120 seconds, cost per task 1.0 USD. Cost per successful task is approximately 1.0 / 0.9 ≈ 1.11 USD.
    • Model B: Pass rate 80%, time per task 15 seconds, cost per task 0.3 USD. Cost per successful task is 0.3 / 0.8 = 0.375 USD.

    In this hypothetical scenario, Model B has a lower pass rate but a lower cost per successful task, and it takes less time to complete the same workload. Note that if retries after failed automatic verification are included in the cost, the above formulas still apply, as the number of retries will naturally be reflected in the total expenditure and the number of passed tasks.

    VI. Routing Tasks Across Multiple Models

    In practical systems, a single model often struggles to handle all scenarios. A more robust approach is to route tasks based on type and introduce automatic verification as a fallback.

    • Divergent Tasks: Use fast, low-cost models that allow manual filtering after multiple generations.
    • Critical Reasoning Tasks: Directly use models with stronger reasoning capabilities and require verifiable derivation processes in the output.
    • Execution Tasks: First use a fast model to generate a draft, then use automatic verification to judge the result. If it fails, escalate to a stronger model.

    Below is a schematic of the routing logic:

    1. def route(task):
    2. if task.type == "brainstorm":
    3. return FAST_GENERAL_MODEL
    4. if task.requires_proof:
    5. return STRONG_REASONING_MODEL
    6. draft = FAST_EXECUTION_MODEL.run(task)
    7. if verify(draft, task.checks):
    8. return draft
    9. return STRONG_REASONING_MODEL.run(task)

    Here, verify can be unit testing, format validation, or numerical review. The coverage of the verification determines the reliability of the routing strategy. If the verification phase is too weak, erroneous results will be passed directly, rendering the escalation mechanism meaningless. Therefore, verification rules should align with business risk.

    VII. Impact of Inference Infrastructure on Speed

    Inference speed is influenced by multiple factors, including model size, quantization methods, batching strategies, memory bandwidth, and multi-GPU interconnect capabilities. The throughput improvement of a multi-GPU cluster is typically not linear, as communication overhead increases with scale.

    There is also a clear trade-off between throughput and latency. Batching can improve overall throughput but increases the wait time for individual requests. For interactive scenarios, controlling time-to-first-token should be prioritized; for offline batch tasks, maximizing total throughput should be prioritized.

    In terms of cost accounting, the metrics for self-hosted deployments differ from those of external service APIs. Self-hosting requires accounting for hardware purchase or leasing, electricity, operations and maintenance personnel, and idle time. When calling external services, you need to focus on billing rules, quota limits, and rate limits. Both methods should be compared using the same cost per successful task metric to avoid drawing incorrect conclusions due to inconsistent accounting scopes.

    VIII. Considerations for Enterprise Adoption

    1. Data Security: Clearly define which data is allowed to be sent to external APIs and which must be restricted to an internal network environment.
    2. Logging and Auditing: Retain input and output records for traceability, while desensitizing personal information and sensitive fields.
    3. Version Management: When a model version is updated, the evaluation set should be re-run; conclusions from older versions should not be carried over.
    4. Human Review: High-stakes outputs such as mathematical proofs, contract clauses, and code deployments require human oversight.