LLM Inference Performance and Model Selection: A Practical Evaluation Guide

    Choosing a large language model based on benchmark reputation or community hype often leads to poor engineering decisions. This guide explains how to run a reproducible evaluation by freezing model, decoding, and serving configurations, building a small private test set from real traffic, and measuring quality, latency, and stability together. It covers four core dimensions—inference reliability, modality and context behavior, cost structure, and engineering fit—plus common pitfalls and a layered routing strategy for balancing quality, latency, and budget.

    1. Why Benchmark Impressions Are Not Enough

    Vendors are releasing new model generations in quick succession, and community discussions are full of claims that one version “beats” another, or that a lightweight release “overtakes” the previous flagship, often followed by jokes about pricing strategy. This kind of discussion spreads fast and carries strong emotion, but it offers almost no guidance for engineering work, for three reasons.

    First, comparison conditions are inconsistent. Parameter count, context length, inference precision, whether chain of thought is enabled, sampling temperature, and decoding strategy all cause significant swings in output quality. Any claim about which model is “stronger” is not reproducible once the configuration is left out.

    Second, task distributions differ. General-purpose leaderboards measure average performance across a broad distribution, while real business traffic is long-tailed and highly concentrated—structured extraction, long-document question answering, code completion, multi-turn customer support. A lead in average score may not hold at all in your core scenario.

    Third, cost is ignored. Unit token price, first-token latency, throughput ceiling, and retry failure rate together determine total cost of ownership. A model with slightly better quality but limited throughput can actually be more expensive under high concurrency.

    The right approach is to treat model selection as a quantifiable engineering experiment, not as a statement of opinion.

    2. Building a Reproducible Evaluation Baseline

    The first step is to freeze variables. Split each evaluation into three configuration layers: the model layer (version, context window, modality support), the decoding layer (temperature, top_p, max output length, whether reasoning mode is enabled), and the serving layer (concurrency, timeout, retry policy). Record any change in any layer, otherwise the data cannot be attributed.

    A schematic request wrapper is shown below; the point is to make configuration explicit so runs can be replayed in batches:

    1. EVAL_CONFIG = {
    2. "model": "candidate_model_id", # assigned by the platform; do not hardcode a specific model
    3. "temperature": 0.2, # low temperature recommended for objective tasks
    4. "max_tokens": 1024,
    5. "stream": True, # streaming makes first-token latency measurable
    6. }
    7. def run_case(client, prompt: str, cfg=EVAL_CONFIG):
    8. resp = client.chat.completions.create(
    9. model=cfg["model"],
    10. messages=[{"role": "user", "content": prompt}],
    11. temperature=cfg["temperature"],
    12. max_tokens=cfg["max_tokens"],
    13. stream=cfg["stream"],
    14. )
    15. return resp

    The second step is to build a private test set. It does not need to be large—200 to 500 items is enough—but it must come from real production traffic and be de-identified. Sample in layers by business intent, for example 30% information extraction, 25% long-document summarization, 25% multi-turn dialogue, and 20% code and tool calling, and compute metrics per layer so a total score cannot hide weaknesses.

    The third step is to fix the metrics. On the quality side, use accuracy, field-level F1, and human preference win rate. On the performance side, track first-token latency (P50/P95), end-to-end latency, and output tokens per second. On the stability side, track timeout rate, truncation rate, and format non-compliance rate. Present all three groups together as a radar-style comparison rather than a single ranking.

    3. Four Core Evaluation Dimensions

    3.1 Inference Quality and Stability

    Repeat the same prompt multiple times and observe output variance. A model with high variance is a poor fit for automated pipelines even with a high average score, because downstream parsing logic has to handle more exception branches. For structured output scenarios, measure the “first-pass rate”—the share of outputs a parser can consume without repair—which is closer to engineering reality than human scoring.

    3.2 Modality and Context Capability

    Multimodal support should be judged against actual requirements: if the business handles plain text only, multimodality is a non-benefit and adds calling cost. For long context, distinguish “fits” from “usable” by inserting a key fact in the middle of a long document as a retrieval-style check, and see whether the model loses mid-document information.

    3.3 Cost Structure

    Do not look at unit price alone. A rough model for estimating monthly spend:

    1. monthly cost ≈ (input tokens × input unit price) + (output tokens × output unit price)
    2. + retry and failed-call overhead + vectorization, storage, and other adjacent costs

    This is where lightweight models often prove their value: when the quality gap is acceptable, a lower unit cost multiplies the ceiling on business scale.

    3.4 Engineering Fit

    This includes whether rate-limiting policy is clear, whether streaming output is supported, whether error codes distinguish retryable from non-retryable failures, and whether logging and monitoring are easy to integrate. Poor engineering fit forces teams to spend large amounts of time on wrapping and troubleshooting, which is a very high hidden cost.

    4. Common Pitfalls and How to Avoid Them

    • Replacing self-testing with community reputation: reputation is heavily influenced by prompting tricks and does not transfer.
    • Treating one evaluation as final: models keep iterating, so set up a quarterly regression evaluation.
    • Ignoring prompt migration cost: switching models requires retuning prompts and post-processing, which belongs in total cost.
    • Overlooking the fallback path: prepare a backup model and timeout circuit breaker for core paths to avoid single-point dependency.

    5. Implementation Recommendations

    Use a layered routing strategy: route high-value, low-concurrency requests to quality-first models; route high-frequency, fixed-format requests to lightweight models; and split and summarize very long documents before inference. If your team already uses Baidu AI Cloud capabilities, you can host a self-built evaluation service on the container platform, store de-identified test sets in object storage, and track latency and failure rates continuously through log and monitoring services—turning selection from a one-time decision into ongoing operations.

    Overall, a faster release cadence does not make selection harder. As long as evaluation criteria, a private dataset, and a cost model are solid, you can find a stable balance among quality, latency, and budget instead of being swayed by single benchmark scores and emotional discussion.