How to Choose a Large Language Model: Evaluation Across Four Dimensions and Cost Estimation

    The right model should be selected using your own business data rather than benchmark scores alone. This guide explains how to evaluate format compliance, quality, latency, unit cost, deployment options, and operational requirements across common LLM workloads, with practical testing procedures and cost formulas.

    The short answer is simple: test format pass rate, P50 and P95 latency, and unit cost on your own business data before choosing a model. If all three meet your requirements, only then decide whether upgrading to a larger model is necessary.

    A model that performs well in conversational question answering may be unstable when used through an API or for data cleaning. A single benchmark score reflects performance on a specific test set, which may not match your business inputs, output formats, or concurrency requirements.

    This article presents a reproducible evaluation process covering task types, four evaluation dimensions, latency measurement, cost estimation, and the decision between hosted and self-deployed models.

    1. Distinguish Between Two Types of Tasks

    Most model use cases fall into two broad categories.

    The first is divergent generation, such as writing marketing copy, proposing solutions, or brainstorming ideas. These tasks allow variation in the output. Larger models may provide more perspectives, and human review is usually part of the workflow.

    The second is deterministic execution, such as generating runnable code, calling an API with a fixed schema, or converting unstructured text into JSON. These tasks require stable formatting and predictable results.

    For execution-oriented tasks, focus on three metrics:

    • Format pass rate
    • Per-request latency
    • Cost per call

    Internal tests conducted by some teams show that lightweight models can outperform larger models on these three metrics. The additional capabilities of a larger model may only be useful in a small number of scenarios. Whether you need a larger model should be determined by measurements from your own workload.

    The following table can serve as a starting point. “Lightweight or Flash-class models” refers to smaller, lower-priced models designed for low latency. The exact classification should follow each provider’s product documentation.

    Use case Model type to consider first Core metrics Important considerations
    Batch data cleaning and format conversion Lightweight or Flash-class model Format pass rate, unit cost Sample boundary cases manually
    Code completion and simple API calls Lightweight model; upgrade for complex logic Compilation pass rate, time to first token Use unit tests as a safety net
    Copywriting and solution brainstorming Larger model Output diversity, human evaluation Human selection is required
    Long-document understanding and complex instructions Mid-range or high-end model Instruction-following rate, context cost Long inputs can significantly increase cost
    Difficult reasoning and proof generation Reasoning-focused flagship model Correctness, response time Correctness requires human review

    These recommendations are only starting points. After collecting results from your own data, first determine whether format pass rate and unit cost meet your requirements. Then decide whether the quality metrics justify using a more capable model.

    2. Four Evaluation Dimensions

    2.1 Everyday Development

    Everyday development includes code completion, API calls, and script generation. Prepare a fixed set of real development tasks. Each task should include the input, the expected output format, and its acceptance criteria.

    Record at least three types of results:

    • Format pass rate: Whether the output can be read successfully by the target parser, such as a JSON parser or regular expression.
    • Compilation or execution pass rate: Whether generated code compiles and passes unit tests.
    • Repair cost: The average number of minutes required to manually fix one output.

    Unit tests are essential as a safety net. Code that compiles is not necessarily logically correct.

    2.2 Complex Instructions

    Complex instructions contain multiple constraints. For example:

    Output five fields in a fixed order, use null for missing values, and do not add explanations.

    Break each instruction into individual checks and record whether each constraint is satisfied. You can then calculate the instruction-following rate.

    Use a fixed prompt template to reduce uncontrolled variables. The template should clearly specify:

    • The task objective
    • The output format
    • Prohibited content
    • Examples

    Use the same template and sample set for every model so that the results remain comparable.

    2.3 Mathematical Reasoning

    Consider the generation of mathematical proofs. The input contains only a theorem statement, and the model must produce a complete proof in an English LaTeX document. This type of task has two difficulties:

    1. The theorem may not have a publicly available standard proof, so the model must derive the result itself.
    2. The output must compile successfully and have a complete document structure.

    Use the following process.

    1. Fix the prompt template. Clearly define the theorem, the required output format—an English LaTeX document—and prohibited behavior, such as omitting derivation steps or citing undefined symbols.

    2. Require a complete document structure. The output should include \documentclass, the required packages—at least amsmath, amssymb, and amsthm are recommended—and both \begin{document} and \end{document}.

    3. Record the compilation environment. Specify the TeX distribution and version, the compiler and version—such as pdflatex or xelatex—and use the same machine or container image for all tests.

    4. Compile the document. Compile the source file with pdflatex -interaction=nonstopmode and retain the .log file.

    5. Parse errors. Extract error messages beginning with ! and line-number fields beginning with l. from the .log file. Also capture five lines of code before and after the reported error line.

    6. Allow limited retries. If compilation fails, return the error message and the relevant code fragment to the model and ask it to modify only the problematic section. Limit retries to two. This means a maximum of three calls per sample: one initial generation and up to two repair attempts. If the document still does not compile after three calls, record the sample as a failure.

    Record the following metrics:

    • First-attempt compilation pass rate: The percentage of samples that compile after the initial generation.
    • Final compilation pass rate: The percentage of samples that compile within the retry limit.
    • Average number of calls: The average number of model calls per sample, which is needed for realistic cost calculations.
    • Repeated sampling per theorem: Run each theorem with the same prompt at least five times to reduce the risk of drawing conclusions from a single result.

    Successful compilation only proves that the document structure is valid. It does not prove that the proof is mathematically correct. Manually review a sample of all compilable outputs, with a review rate of at least 20%. Results involving important conclusions or content intended for teaching or publication should be reviewed individually.

    2.4 Self-Deployment

    Self-deployment means running an open-source model on your own servers or in a private cloud. In addition to format pass rate, latency, and unit cost, evaluate the following:

    • Hardware utilization: Whether GPU memory usage and compute utilization are reasonable.
    • Operational burden: Who is responsible for model upgrades, incident recovery, monitoring, and alerting, and how much staff time is required.
    • Security responsibility: Who manages access control, audit logs, and the storage location of the model and data.
    • Scaling lead time: How long it takes to purchase or rent hardware and bring additional capacity online when traffic grows.

    Self-deployment keeps data within the internal network and may reduce unit cost when request volume is stable and high. However, it also introduces fixed costs and operational responsibilities. For small workloads, these costs often represent a large share of the total.

    3. How to Measure Latency

    Latency must be measured in your own environment. Do not rely directly on provider-published figures or apply a fixed multiplier. The same model may behave very differently under low and high concurrency, so testing should use a load profile close to production.

    Test Parameters

    For each test group, fix and record the following parameters:

    • Input length: Use at least two levels, such as approximately 500 tokens and 4,000 tokens. Choose values that reflect the actual workload.
    • Output limit: Set a maximum output token count and record the distribution of actual output lengths.
    • Concurrency: Include both low concurrency, such as one request, and concurrency close to the production peak.
    • Sampling parameters: Keep temperature, top_p, and other sampling parameters consistent, and record their values.
    • Sample count: Run at least 100 requests per test group. With too few samples, P95 can fluctuate substantially.

    Metrics and Calculation

    • Time to first token (TTFT): The time from sending the request to receiving the first output token. This measures how long users wait before seeing the first part of the response.
    • Total duration: The time from sending the request to receiving the complete response.
    • P50: Sort all request durations from shortest to longest and take the middle value. This represents a typical request.
    • P95: Take the value at the 95th percentile of the sorted durations. This represents the behavior of slower requests.

    Average latency alone can hide long-tail problems. A model with a low average duration may still stall noticeably on a small number of requests. P95 reveals this behavior.

    Recording Template

    Model Concurrency Input length Output limit Sampling parameters TTFT P50 TTFT P95 Total duration P50 Total duration P95 Failure rate
    Example Model A 1 500 tokens 512 temperature=0 To be filled To be filled To be filled To be filled To be filled
    Example Model A Close to production peak 4,000 tokens 512 temperature=0 To be filled To be filled To be filled To be filled To be filled

    Once results are recorded in this format, the difference between low-load and high-load performance becomes clear. Model selection should be based on the row corresponding to the expected production peak.

    4. Cost Estimation Formulas

    Per-Request Cost for Hosted Models

    Providers typically charge per million tokens, with different prices for input and output tokens. The per-request cost is:

    1. Per-request cost =
    2. (Input tokens / 1,000,000 × Input price)
    3. + (Output tokens / 1,000,000 × Output price)

    The monthly cost is:

    1. Monthly cost = Monthly request volume × Average cost per request

    If requests involve retries or multiple model calls, include the average number of calls:

    1. Monthly cost =
    2. Monthly request volume × Average number of calls × Cost per call

    Example

    The following figures are hypothetical and are intended only to demonstrate the calculation. They do not represent any provider’s actual pricing:

    • Each request contains 2,000 input tokens and produces 500 output tokens.
    • The input price is assumed to be 1 currency unit per million tokens.
    • The output price is assumed to be 4 currency units per million tokens.
    • Per-request cost:
    1. 2,000 / 1,000,000 × 1
    2. + 500 / 1,000,000 × 4
    3. = 0.002 + 0.002
    4. = 0.004 currency units
    • Monthly request volume is 100,000.
    • The average number of calls is 1.2, including retries.
    1. Monthly cost = 100,000 × 1.2 × 0.004 = 480 currency units

    Measurement Rules

    • Use the token count returned in the provider’s usage field or billing records. Do not estimate token counts from character counts. The conversion ratio between characters and tokens differs significantly between Chinese and English.
    • Include retries and failed requests in the cost calculation. Failed requests may still incur charges, depending on the provider’s terms.
    • Prices may change. Record the date on which each price was checked and review the values regularly.

    Monthly Cost for Self-Deployment

    Self-deployment has a different cost structure:

    1. Monthly unit cost =
    2. (GPU rental or depreciation
    3. + electricity
    4. + data center or cloud resource costs
    5. + allocated operations labor)
    6. / Monthly effective processing volume

    Monthly effective processing volume means the number of requests actually completed each month while meeting the required latency target.

    Self-deployed unit cost depends heavily on utilization. When utilization is low, fixed costs are spread across fewer requests, and the unit cost can be significantly higher than that of a hosted service.

    5. Hosted Service or Self-Deployment?

    Consider the following five factors when deciding whether to self-deploy.

    1. Data sensitivity: Can the data leave the internal network? If compliance or confidentiality requirements prohibit external processing, self-deployment or private deployment may be easier to justify.

    2. Request volume: Is monthly request volume stable and sufficiently high? Hosted services generally have an advantage when usage is small or highly variable because of their elasticity.

    3. Latency requirements: Do you need fine-grained control over network paths and hardware resources?

    4. Operational capability: Can your team handle model deployment, monitoring, upgrades, and incident recovery? Without relevant experience, operational costs are often underestimated.

    5. Cost structure: Compare fixed and variable costs. Amortize self-deployment costs monthly and compare the resulting expense with the monthly hosted-service cost under the same workload.

    A practical decision sequence is:

    1. Determine whether the data is allowed to leave the internal network.
    2. If external processing is permitted, evaluate whether the request volume and traffic variability fit a hosted service.
    3. If volume is stable and sufficiently high, and the team has the required operational capabilities, calculate self-deployment unit cost and compare it with hosted service costs.

    6. Evaluation Checklist

    Before finalizing model selection, verify the following:

    • Divergent generation and deterministic execution tasks have been evaluated separately.
    • Format pass rate has been measured on your own data, with the sample count recorded.
    • P50 and P95 TTFT and total duration have been recorded using a consistent template, including both low concurrency and concurrency close to the production peak.
    • Unit cost has been calculated using provider-reported token counts and includes retries.
    • Code and mathematical tasks include recorded compilation environment versions and manual sampling for correctness.
    • The five factors for hosted versus self-deployed models have been evaluated.

    7. Risk Considerations

    • Data redaction: Remove personal information, credentials, secrets, and non-public business data before sending content to an external API.
    • Cost volatility: Providers may change prices or free quotas. Leave room in the budget and review assumptions regularly.
    • Self-deployment responsibility: Clearly assign responsibility for operations, security, and compliance. Otherwise, incidents and security events may take longer to resolve.
    • Correctness: Successful compilation and format compliance do not prove that the content is correct. Outputs involving substantive conclusions must be reviewed by humans.

    Conclusion

    Large language models should be selected based on real business requirements rather than isolated benchmark scores. Start by identifying whether the task is divergent generation or deterministic execution. Then evaluate format pass rate, P50 and P95 latency, and unit cost across everyday development, complex instructions, mathematical reasoning, and self-deployment scenarios.

    Use explicit formulas for cost estimation, and include retries, failed requests, and possible price changes. Whether data can leave the internal network, whether request volume is stable, and whether the team can operate the infrastructure will determine whether a hosted service or self-deployment is more appropriate.

    Following this process usually makes it possible to identify a model that fits the workload while keeping testing costs manageable and producing a more credible cost forecast.