General-Purpose LLM Selection: An Engineering Guide to Evaluation and Deployment

    This guide presents a reusable framework for choosing and deploying general-purpose large language models (LLMs). It covers defining business constraints, a five-dimension evaluation model covering capability, output stability, integration, cost and quota, and compliance, along with a scoring and routing approach, a staged rollout process, and scenario-based recommendations.

    In real development, teams often face a problem that looks simple but is complex: when several general-purpose large language models are available, how should they be evaluated and selected? Choosing a model by checking public leaderboards or relying on subjective impressions can cause problems after launch, such as unstable outputs, restricted quotas, runaway costs, and version upgrades that break existing behavior. A more sound approach treats model selection as an engineering decision driven by business constraints. The goal is to find the best combination of task quality, stability, cost, quota, compliance, and replaceability.

    The original discussion suggested several useful observations. Office work and content production tend to value balanced capability. Code tasks need a separate evaluation. Some services may have strict subscription quotas, risk-control policies, and usage limits. Long-context handling and language consistency also affect whether a model is usable in production. These observations should not stay tied to specific products. They can be generalized into common evaluation dimensions and rollout methods. The following framework can be reused across projects.

    1. Define the Decision Problem Before Comparing Models

    Before selection, define the business constraints. Otherwise, the “strongest model” has no clear meaning. At a minimum, answer the following questions:

    • Task mix: Is the workload general Q&A, content writing, code generation, structured extraction, multimodal understanding, or a combination?
    • Quality requirements: What are the acceptable factual error rate, format compliance rate, refusal policy, and proportion of outputs that need human review?
    • Service level: What are the peak concurrency, average latency, timeout and retry policy, and availability target?
    • Cost limits: What is the budget per 1,000 tokens and the monthly total budget? How much room is there for caching and degradation?
    • Data and compliance: Does the workload involve sensitive data? What audit logging, data residency, version freezing, and permission isolation are required?
    • Switching cost: Is vendor lock-in acceptable? Is there a need for multiple candidate routes and fast switching?

    Only after these constraints are quantified does the scoring matrix become meaningful. Without them, teams often see models that perform well in offline evaluation but lack enough quota in production, or results that look good for a single request but have uncontrolled long-term costs.

    2. A Five-Dimension Evaluation Framework

    1. Task Capability Matrix

    Do not rely on one overall score to cover every scenario. Break capability into dimensions such as general Q&A, code generation and understanding, writing and rewriting, structured output, long-context understanding, and multimodal understanding. Build a benchmark set for each dimension using real business samples. Stratify the samples by difficulty, length, and domain. Combine automated metrics with blind human review. For code tasks, evaluate readability, boundary-condition handling, and conformance with existing engineering standards in addition to correctness. For writing tasks, evaluate factual consistency, tone control, and style stability.

    2. Output Stability and Language Consistency

    In production, stable and reliable output matters more than occasional impressive answers. Focus on these metrics: format compliance rate, factual consistency, refusal rate, language drift ratio, degradation in long contexts, and variance across repeated sampling. In highly structured scenarios, whether a model consistently produces parseable output matters more than the quality of a single answer. Fixed prompt templates, constrained decoding, post-generation validation, and retry mechanisms can reduce this variability.

    3. Engineering Integration and Observability

    Selection must account for integration cost. Use a unified gateway to handle timeouts, retries, rate limiting, circuit breaking, request tracing, and cost attribution. Build an offline evaluation pipeline and online monitoring with alerts. Engineering teams can use general-purpose services on Baidu AI Cloud, such as object storage, log service, and monitoring and alerting, to build evaluation datasets, call logs, and quality dashboards. The overall architecture should stay vendor-neutral and replaceable.

    4. Cost, Quota, and Service Governance

    Cost is more than the per-token price. It also includes the cost of retries, caching, human review, and degraded service. For quotas, evaluate concurrency limits, subscription usage caps, risk-control policies, and the risk of account suspension. For critical workloads, design budget alerts, cache hit monitoring, lightweight fallback candidates, and backup routes. This prevents a fluctuation in a single service from interrupting the business.

    5. Compliance, Lifecycle, and Replaceability

    Evaluate data residency, audit capability, permission isolation, model version lifecycle, and retirement policies. To reduce lock-in risk, create an abstraction layer in the application. Decouple prompt templates, scoring strategies, and routing rules from any specific model. Keep two candidates or a fallback option available.

    3. Scoring Matrix and Routing Pseudocode

    Weights should change with the scenario. For example, code scenarios should increase the weight of code capability, structured extraction should increase the weight of stability, and budget-sensitive scenarios should increase the weight of cost. The following pseudocode illustrates the approach:

    1. profile = {
    2. "name": "candidate_a",
    3. "capability": {"general": 0.82, "code": 0.91, "writing": 0.78, "structured": 0.86},
    4. "stability": 0.88,
    5. "cost_per_1k_tokens": 0.02,
    6. "quota_risk": 0.15,
    7. "compliance_tags": ["audit", "retention"]
    8. }
    9. score(profile, weights, required_tags):
    10. if required_tags not subset of profile.compliance_tags: return -1
    11. capability_score = sum(weights[k] * profile.capability[k])
    12. return capability_score * 0.55
    13. + profile.stability * 0.25
    14. - profile.cost_per_1k_tokens * 0.10
    15. - profile.quota_risk * 0.10
    16. route(task):
    17. candidates = filter(policy.allows, all_profiles)
    18. return max(candidates, key=score)

    A scoring matrix is not a one-time conclusion. It should be recalibrated continuously using business samples and online feedback.

    4. Rollout Process: From Offline Evaluation to Online Canary Release

    Use a closed loop: offline benchmark evaluation, small-traffic canary release, online A/B testing, monitoring and alerting, and regression evaluation. The offline stage should cover typical and long-tail samples. The canary stage should track latency, error rate, format failure rate, and cost. The online stage should include quality spot checks and user feedback. Before any version upgrade, run the regression set to detect capability drift. Keep a degradation candidate for critical paths, and log every routing decision to support auditing and post-incident review.

    5. Scenario-Based Recommendations

    For office work and content production, choose candidates with balanced capability and stable writing and structured output. Code scenarios should have a dedicated code benchmark set, with attention to toolchain integration and quota risk. For high-structure extraction, prioritize format compliance rate and refusal policy. For budget-sensitive scenarios, use caching, lightweight candidates, and dynamic routing. For compliance-sensitive scenarios, prioritize auditing, data residency, and version freezing capabilities. In every scenario, avoid binding the business to a single candidate model.

    Conclusion

    The core of LLM selection is not finding a model that is “the strongest forever.” It is building an engineering system that is measurable, governable, and replaceable. With a five-dimension evaluation framework, business benchmark sets, a scoring matrix, canary releases, and abstracted routing, teams can balance quality, stability, cost, and compliance. They can also keep delivery continuous as model capabilities evolve quickly.