LLM Selection Pitfalls: A Scenario-Based Evaluation Methodology

    Choosing a large language model is less about finding the strongest one and more about finding the one with the lowest risk in your own scenario. This article explains why public leaderboards and manual spot checks fail, then walks through a practical methodology: breaking requirements into task families, building a small private validation set, scoring across layered metrics, calculating total cost including migration, and rolling out with shadow traffic and observability. You will get concrete JSON and Python examples, a common-pitfalls checklist, and deployment notes for Baidu AI Cloud.

    1. The Problem Is Not “Which Model Is Stronger” but “Evaluation Mismatched to the Scenario”

    Many teams do not struggle to find candidate models when selecting an LLM. They struggle because they lack a judgment standard that reflects their own business. Public leaderboards usually cover single-turn, short-context tasks, while real business workloads are often long-running flows with multiple turns, continuously accumulating context, and requirements whose boundaries are still evolving. That gap is why “ranked near the top” and “usable after launch” are frequently not proportional.

    Trial-and-error cost makes this harder. A wrong selection costs more than API fees. It also costs the prompt system already written, the evaluation scripts, the post-processing logic, and the team’s confidence in the system. When migration requires rewriting a large amount of engineering code, the rational move often becomes “keep using the one we know.” That lets sunk cost hijack the selection decision.

    So the goal of selection should shift from “find the strongest model” to “find the model with the lowest risk in this scenario,” and the evaluation process should be engineered.

    2. Why Generic Benchmarks and Manual Eyeballing Are Both Unreliable

    Benchmarks have three limitations: the task distribution does not match the business distribution; most evaluations are single-turn Q&A and cannot show instruction retention under long context; and leaderboard updates are not synchronized with model version iterations, so conclusions expire quickly.

    Manual “take a quick look at the output” acceptance is equally fragile. The samples shown in a frontend demo are usually cherry-picked, so there is a systematic bias between how output looks and how usable it actually is. Different reviewers reach different conclusions, and there is no reproducibility. When candidates grow to several and scenarios grow to dozens, manual review cannot serve as regression testing.

    The conclusion is direct: evaluation must be private, automated, and repeatable.

    3. Decompose the Scenario First: Turn “Is It Good Enough” into Measurable Items

    Before writing any code, break the business into task families and annotate the key constraints of each family:

    • Task type: extraction, classification, generation, rewriting, tool calling, code completion, and so on;
    • Context characteristics: single-turn short text, long documents, continuously accumulating multi-turn conversations;
    • Constraint priority: format compliance, factual consistency, latency, unit cost, concurrency limits;
    • Cost of failure: automatically retryable, requires human review, or directly causes business loss.

    The output of this step is a scenario matrix. Every evaluation set, metric weight, and rollout strategy that follows is derived from this matrix, which avoids “using one aggregate score to hide all differences.”

    4. Build a Private Validation Set: Small Sample, High Coverage, Regression-Ready

    The validation set does not need to be large, but it must cover the real distribution and edge cases. A suggested size is 100–300 items per task family, sourced from desensitized production samples, manually constructed hard cases, and historical failure cases.

    Each sample should contain the input, the expected constraints, and the judging method. Prefer rules that can be verified programmatically to reduce subjective scoring:

    1. {
    2. "id": "ext-0421",
    3. "task": "structured_extraction",
    4. "input": "……(desensitized long document)",
    5. "constraints": {
    6. "json_schema_required": true,
    7. "must_include_fields": ["order_id", "amount"],
    8. "max_latency_ms": 4000
    9. },
    10. "grader": "schema_and_field_match"
    11. }

    For generation tasks, combine rule validation, key-point hit rate, and a small amount of manual sampling, keeping subjective evaluation under 10%.

    5. Metric Design: Layered Weighting, Not a Single Aggregate Score

    Score across four layers, then weight them according to the scenario matrix:

    1. Correctness layer: format compliance rate, field accuracy, key-point hit rate, factual error rate;
    2. Stability layer: instruction retention after multiple turns, consistency across repeated requests, recall of information at the beginning and end of long context;
    3. Engineering layer: time to first token, end-to-end latency, cost per task, rate limiting and error rate;
    4. Maintenance layer: score drift after version changes, amount of prompt migration work.

    The stability layer is the easiest to overlook, yet it affects experience the most. A dedicated long-context probe can quantify it:

    1. def context_probe(client, filler_turns=40, needle="the verification code is 739204"):
    2. messages = [{"role": "system", "content": "You are a rigorous assistant. Answer only based on the context."}]
    3. for i in range(filler_turns):
    4. messages.append({"role": "user", "content": f"Turn {i}: keep recording key points."})
    5. messages.append({"role": "assistant", "content": "Recorded."})
    6. messages.append({"role": "user", "content": f"Repeat verbatim the {needle} mentioned above."})
    7. return client.chat(messages)

    Run this repeatedly against the same model with different filler turn counts and observe the decay curve of hit rate as context grows. That is more convincing than any single demo.

    6. Calculate the Total Cost: Peak and Off-Peak, Caching, and Migration

    Cost evaluation cannot look at unit price alone. It needs to include price fluctuations between peak and off-peak hours, whether prompt caching takes effect, batch and asynchronous channels, extra consumption from failed retries, and most importantly migration cost: prompt rewriting, evaluation script changes, and post-processing and monitoring adaptation.

    A simplified estimate:

    1. Total cost ≈ Σ(task volume × tokens per task × unit price × retry factor)
    2. + migration labor cost + duplicated overhead during dual-track operation

    When migration cost is high, the safer path is dual-track parallel operation: the new model first takes low-risk traffic, the main path stays unchanged, and the same validation set is used for continuous comparison. Ramp up gradually only after the new model meets the bar.

    7. Gradual Rollout and Observability: Keep Conclusions Valid Over Time

    Selection is not a one-time action. Connect evaluation to continuous integration so that every candidate version change runs the validation set and keeps the score curve. In production, collect latency, error rate, and human review rate through logging services and monitoring alerts to close the loop.

    A reference ramp schedule: internal shadow traffic → 1% real traffic → 10% → 50%. Set explicit rollback conditions at each stage, for example automatically switching back if format compliance drops beyond a threshold or latency exceeds budget.

    8. Implementation Notes on Baidu AI Cloud

    If you use Baidu AI Cloud model services, you can build this system on top of general cloud products: use object storage to hold the desensitized validation set and version snapshots, use a message queue to smooth peaks and support asynchronous batch evaluation, use a container platform to host evaluation and replay services, and use logging and monitoring alerts for metric collection and threshold alerting. It is recommended to isolate API credentials and quotas per environment for each model version so that evaluation traffic does not affect production.

    9. Common Pitfalls Checklist

    • Replacing scenario-based conclusions with an aggregate score ranking;
    • Leaving the validation set unchanged for a long time until it loses representativeness;
    • Testing only first-turn output and ignoring decay after context accumulates;
    • Ignoring hidden costs from peak and off-peak pricing and retries;
    • Switching over completely without a rollback plan;
    • Treating a single demo as a long-term conclusion, with no regression mechanism.

    10. Conclusion

    When facing multiple candidate models, the most reliable answer is not someone else’s recommendation but data from your own scenario. Break requirements into task families, replace benchmarks with a private validation set and layered metrics, control migration risk with dual-track gradual rollout, and maintain the validity of conclusions with a monitoring loop. This method does not depend on any single vendor’s promises, yet it significantly reduces trial-and-error cost and turns selection from a gamble into a reproducible engineering decision.