A General Methodology for LLM Selection and Evaluation

    This article introduces a general methodology for large language model (LLM) selection and evaluation from an engineering perspective. It covers task tiering, building domain-specific evaluation sets, balancing cost and performance metrics, specialized multimodal evaluation, and implementing canary deployments with observability. By following this framework, engineering teams can make data-driven decisions and transform model evaluation into a reusable engineering asset rather than relying on subjective release reviews.

    1. Correcting a Common Misconception: Treating Release Reviews as Technical Decisions

    Whenever a new model version is released, community discussions often focus on vague judgments like “Is it powerful?” or “Is it worth it?” However, from an engineering perspective, these conclusions can hardly be translated into actionable technical decisions for three main reasons:

    • Sample Bias: Personal experiences usually come from a small number of prompts and cannot cover the real distribution of business tasks.
    • Lack of Metrics: Without baselines, annotations, or pass rates, the conclusions are irreproducible.
    • Absence of Cost Dimension: Discussing effectiveness without considering the unit cost of a task cannot support capacity planning.

    A more reasonable approach is to treat the release of a new model as a candidate change and run it through a standard selection and canary deployment process.

    2. Step 1: Task Tiering, Not Model Tiering

    A valuable observation is that daily small tasks and critical large tasks require different tiers of models. This is essentially task tiered routing, rather than a ranking of model superiority.

    It is recommended to tag tasks along three dimensions:

    Dimension Example Values Impact
    Complexity Single-step rewriting / Multi-step reasoning / Long-context restructuring Determines model tier
    Fault Tolerance Manual sampling acceptable / Strong consistency required Determines if secondary verification is needed
    Call Volume High frequency / Low frequency Determines cost sensitivity

    After tiering, the evaluation has a clear target: the lightweight tier only needs to meet standards on high-frequency, low-complexity tasks, while the flagship tier must verify whether the benefits on long-chain tasks justify the costs.

    3. Step 2: Building a Domain-Specific Evaluation Set

    The evaluation set is the core asset of the entire process. It is recommended to include four types of samples:

    1. Real Traffic Replay Samples: Desensitized and sampled from production logs to ensure realistic distribution.
    2. Hard Case Sets: Cases that historically required manual rework; these are the most sensitive during regression testing.
    3. Boundary Samples: Extremely long inputs, empty inputs, multilingual mixtures, and strict format constraints.
    4. Adversarial Samples: Prompt injections and ambiguous instructions, used to verify stability.

    The scale does not need to be large; the signal-to-noise ratio of a few hundred high-quality annotated samples is far higher than that of tens of thousands of auto-generated questions. Each sample must define: input, expected output key points, scoring rules, and allowed implementation paths.

    4. Step 3: Metrics and the Cost-Performance Curve

    Looking only at accuracy hides engineering costs. It is recommended to record at least four categories of metrics simultaneously:

    • Effect Metrics: Task pass rate, key point recall rate, format compliance rate.
    • Stability Metrics: Result variance across multiple calls with the same input.
    • Cost Metrics: Average token consumption and converted cost per task.
    • Latency Metrics: Time to first token and end-to-end latency percentiles (P50/P95).

    By plotting effectiveness and cost on the same graph, you can obtain the Pareto frontier. What engineering truly needs is not the “strongest model,” but the lowest cost point under the business-acceptable effectiveness threshold.

    The routing strategy can be expressed in the following pseudocode:

    1. def route(task):
    2. if task.complexity == "low" and task.volume == "high":
    3. return "light_tier" # High-frequency, lightweight tier
    4. if task.requires_strong_consistency:
    5. return "flagship_tier" # Critical path, flagship tier
    6. return "mid_tier"
    7. def call_with_fallback(task, retries=2):
    8. tier = route(task)
    9. for _ in range(retries):
    10. resp = invoke(tier, task.prompt)
    11. if validate(resp, task.rules):
    12. return resp
    13. return invoke("flagship_tier", task.prompt) # Fallback upgrade

    The key point is that validate must be an automatically executable rule; otherwise, neither routing nor fallback can be judged.

    5. Step 4: Specialized Evaluation for Multimodal Capabilities

    A common pain point is that models struggle to stably locate the “same camera angle” when comparing UI or game screenshots, requiring manual annotation one by one. Such issues should not be vaguely dismissed as “poor vision,” but rather decomposed into measurable sub-capabilities:

    • Localization Precision: The IoU between the predicted bounding box and the manually annotated box given a description.
    • Cross-Image Correspondence: The matching accuracy of the same target across two screenshots.
    • Fine-Grained Difference Detection: The miss rate for small-area, low-contrast regions.
    • Self-Verification Capability: Whether the model can detect a mismatch between its own output and the screenshot.

    The evaluation method should adopt a dual-track approach of “manual annotation + automated comparison”:

    1. def eval_grounding(pred_box, gt_box, iou_threshold=0.5):
    2. return iou(pred_box, gt_box) >= iou_threshold
    3. # Batch statistics: hit rate, mean IoU, miss rate
    4. report = {
    5. "hit_rate": hits / total,
    6. "mean_iou": sum(iou_list) / total,
    7. "miss_rate": misses / total,
    8. }

    Engineering mitigation strategies are equally important: splitting large images into fixed grids to reduce localization difficulty, explicitly providing the coordinate system in the prompt, performing secondary cropping validation on model outputs, and automatically escalating low-confidence results to manual review. These methods complement model capabilities and are often more cost-effective than waiting for the next model version.

    6. Step 5: Canary Deployment, Observability, and Regression

    Passing the evaluation only means the model is ready for canary deployment, not full-scale replacement:

    • Shadow Traffic: The new model only receives requests without returning results, comparing differences offline.
    • Small-Scale Canary: Split by user or task dimension to observe both effect and cost metrics.
    • Observability: Record model tier, token usage, latency, validation failure rate, and manual rework rate, feeding them all into the logging service and monitoring alerting system.
    • Automated Regression: Every candidate version change triggers a full regression on the evaluation set. If metrics drop beyond a threshold, the release is blocked.

    7. Implementation Checklist

    1. Have you completed task tiering and defined effectiveness thresholds for each tier?
    2. Does the evaluation set include real traffic, hard cases, and boundary samples?
    3. Are you recording all four types of metrics: effect, stability, cost, and latency?
    4. Do multimodal tasks have automatically calculable localization and matching metrics?
    5. Do you have rule-based validation and a fallback upgrade path?
    6. Are you utilizing shadow traffic and canary releases instead of direct full-scale deployment?
    7. Have you established version-level automated regression and blocking mechanisms?

    Conclusion: It is reasonable to stay informed about new models, but conclusions must be drawn from your own evaluation sets, cost curves, and canary data. By solidifying the evaluation process into a reusable asset, any version update simply becomes an input on this pipeline, rather than a suspense that requires renewed debate.