How to Choose an LLM: Replace Marketing Claims with Cost Per Successful Run

    Choosing a large language model by price or benchmark ranking often leads to the wrong call. This article walks through a practical selection method: defining tasks with measurable criteria, building an evaluation table with a strict success rate, calculating cost per successful run, and routing requests across model tiers by latency, security, and deployment constraints.

    1. Define the Task and the Cost of Failure First

    Before comparing models, write down each task in measurable terms. At minimum, specify the following for every task:

    • Task type: for example, requirement summarization, code modification, meeting minutes extraction, or contract clause comparison.
    • Input length: track both P50 (median) and P90 (90th percentile). Looking only at the average will hide long-tail inputs.
    • Output length: track P50 and P90 as well. Output length drives output cost and affects latency.
    • Pass criteria: the conditions a result must meet to count as a success, such as all required fields present, numbers matching the source, or all unit tests passing.
    • Cost of failure: how much a single failure costs, whether it’s a few minutes of rework or a wrong decision with compliance implications.
    • Call volume: how many calls per day or month. Cost differences get amplified for high-frequency tasks.
    • Latency requirement: how long users can wait. Real-time conversation and offline batch processing have very different requirements.

    The cost of failure determines how much human review is needed. The higher the cost of failure, the less acceptable it is to let model output flow directly into downstream systems.

    Public leaderboards are useful for an initial shortlist. But their test sets, scoring rules, and runtime parameters usually don’t match your workload, so the final decision still has to come from your own testing.

    2. Evaluation Table and Strict Success Rate

    Each row in the evaluation table is a test sample, and each column is a standardized field. At minimum, include the following fields:

    Field Description
    task_id Sample ID, for traceability
    task_type Task type
    input_tokens Input token count, from the API’s usage field
    output_tokens Output token count
    cached_input_tokens Input tokens served from cache
    model_version Model name and version
    run_index Run number, for tracking repeated results
    pass_flag Whether all pass criteria were met, 0 or 1
    review_minutes Time spent on human review
    failure_type Failure category, e.g., formatting error, factual error, timeout, refusal
    latency_ms End-to-end latency

    The strict success rate is defined as:

    Strict success rate = number of runs meeting all pass criteria ÷ total number of runs

    “Strict” means partial correctness doesn’t count as success. For example, if a contract summary omits one key clause, it’s a failure even if everything else is correct. Pass criteria must be machine-verifiable or judged by explicit human rules. If the criterion is written as “the answer should be good,” two reviewers will reach different conclusions, and the resulting number is meaningless.

    Keep the following in mind during testing:

    1. Use a fixed task set, and hold out some tasks from prompt tuning to avoid overfitting the results.
    2. Run each task at least 3 times and record the variance in outcomes. A success rate based on a single run is not reliable.
    3. Fix sampling parameters such as temperature, and record the test date. Providers may update models, so results under the same model name can change over time.
    4. Prefer the usage fields returned by the API for input and output length. If that field isn’t available, estimate using the same tokenizer consistently and note this in the evaluation table.

    3. The Cost-Per-Successful-Run Formula

    Cost per successful run is the average total spend required to obtain one successful result. Calculate it as follows.

    Step 1: Calculate the cost per inference run

    Cost per inference run = uncached input tokens × input price + cached input tokens × cache price + output tokens × output price

    Step 2: Calculate the cost per successful run

    Cost per successful run = (cost per inference run + cost per human review) ÷ strict success rate

    This formula assumes failures can be detected and will trigger a rerun or be routed to human handling. So, on average, obtaining one successful result costs 1 ÷ strict success rate times the inference and review cost.

    Retries must also be counted. If timeouts, rate limits, or formatting errors trigger automatic retries, those retries should be included in the inference cost. Undetected failures are not captured by this formula; their impact must be estimated separately:

    Undetected failure loss = cost of failure × undetected failure rate × number of calls

    The example below illustrates the calculation. The prices used here are illustrative and don’t represent actual pricing from any provider.

    Task parameters: 8,000 input tokens, 1,500 output tokens, no cache hit, human review cost estimated at 0.5 yuan per run.

    Item Model A Model B
    Input price (yuan per million tokens, illustrative) 10 2
    Output price (yuan per million tokens, illustrative) 40 8
    Cost per inference run (yuan) 0.08 + 0.06 = 0.14 0.016 + 0.012 = 0.028
    Strict success rate 0.75 0.55
    Cost per successful run (yuan) (0.14 + 0.5) ÷ 0.75 ≈ 0.85 (0.028 + 0.5) ÷ 0.55 ≈ 0.96

    Model B’s cost per inference run is only one-fifth of Model A’s, but its cost per successful run is higher. That’s because its strict success rate is lower, requiring more retries and review. Comparing unit prices alone would lead to the opposite conclusion.

    4. Three Model Categories and Their Suited Tasks

    Models within the same category tend to have similar capabilities and are suited to similar tasks. For specific model names, release dates, and parameters, refer to each provider’s official documentation.

    General Reasoning and Multimodal Models

    These models typically accept both text and image input, making them suitable for long-document analysis, code comprehension, mixed text-and-image Q&A, and moderately complex logical reasoning. Typical use cases include analyzing requirement documents, screenshots, and code together, untangling complex business rules, and comparing technical approaches to identify risks.

    Cost is driven mainly by input, output, and review. If a task generates large amounts of content, such as full code files or test reports, output tokens become the main cost driver, so output length should be constrained. Some providers offer a faster tier with lower latency at a higher price. Real-time interaction fits the faster tier; batch tasks that can be queued typically work fine on the standard tier.

    Agentic Coding and Knowledge Work Models

    These models are suited to multi-step execution. Take modifying a code repository as an example: a complete workflow typically includes reading the project structure, analyzing dependencies, editing multiple files, writing or updating tests, fixing issues based on test failures, generating a change summary, and self-checking the result.

    When evaluating these models, use the full workflow as the unit of testing, rather than single-turn coding questions. A snippet of code can look correct in isolation while violating unwritten project constraints, such as interface compatibility or naming conventions. In production use, pair these models with sandboxed execution, automated tests, and permission isolation. The model should not modify production environments directly.

    Long-Context and Omni-Modal Models

    These models can accept very long inputs and support text, image, audio, video, and PDF formats, with output primarily in text. They suit tasks like condensing lengthy meeting transcripts, interpreting specification documents with embedded charts, extracting action items from audio or video, and cross-checking facts across multiple sources.

    Context window size only indicates how much content a model can accept, not whether it attends equally to every part of that content. Information placed in the middle of a long input is often more likely to be missed. When evaluating these models, test retrieval, localization, and citation accuracy separately: place known facts at different positions within a long input and check whether the model can find and correctly cite them. A larger context window alone is not sufficient grounds for choosing a model.

    5. Tiered Routing by Latency, Security, and Deployment

    A single model rarely satisfies cost, latency, and security requirements at once. The tiered routing approach assigns simple tasks to a cheaper, faster model and escalates harder tasks to a stronger model.

    A recommended tier structure:

    • Tier 1: Rules and small models, handling format validation, classification, and simple extraction tasks with high certainty.
    • Tier 2: General-purpose models, handling most routine tasks.
    • Tier 3: Flagship or long-context models, handling high-difficulty, low-frequency tasks.

    Routing rules should be written as explicit conditions, not based on intuition. Consider the following rules:

    1. Sensitive data rule: requests containing personal data, trade secrets, or regulated data may only be sent to a private deployment or a channel that has passed compliance review.
    2. Latency rule: for user-facing real-time interaction, if a candidate model’s P90 latency exceeds the product’s requirement, switch to a faster tier or a smaller model. Batch tasks are not subject to this rule.
    3. Length rule: when input exceeds 70% of a model’s effective context window, perform retrieval or chunking first rather than feeding the entire input at once. Set this threshold based on the localization test results described in Section 3.
    4. Escalation rule: if Tier 1 output fails format or rule validation, escalate to the next tier. Cap the number of escalations; beyond that cap, route to a human and log the reason.
    5. Review rule: tasks with a high cost of failure, such as those involving payments, legal terms, or production configuration, must have human review and cannot be fully automated.

    Each rule should map to a field in the evaluation table. For example, the latency rule uses the P90 of latency_ms, and the escalation rule relies on pass_flag and failure_type. This way, rule effectiveness can be audited using the same dataset.

    6. Common Mistakes

    • Relying only on leaderboards: benchmark test sets and scoring rules usually don’t match your workload.
    • Comparing unit prices only: ignoring retry, cache, and review costs underestimates total cost.
    • Using averages for decisions: average latency and average length hide long-tail problems; use P90 or higher percentiles instead.
    • Treating context window size as capability: window size doesn’t equal effective comprehension, and needs separate testing.
    • Overlapping test and tuning sets: repeatedly tuning prompts and rules on the same sample batch inflates the measured success rate.
    • Not recording model versions: results change after model updates, and numbers without version and date information can’t be reproduced.

    7. Implementation Checklist

    • Every task has a defined type, input/output length distribution, pass criteria, cost of failure, and latency requirement.
    • Pass criteria can be machine-verified or judged by explicit human rules.
    • Strict success rate is calculated on a fixed task set, with each task run at least 3 times.
    • Cost per successful run includes inference, cache, retry, and review costs.
    • Every routing rule maps to a corresponding evaluation field, with an escalation path and a cap in place.
    • Price, model version, and test date are all recorded. Prices must reflect the provider’s current official rates.

    Once you’ve built this evaluation table and run a full test cycle, you can compare the true cost of different models on the same basis and use that to design a tiered routing system.