A Practical Guide to Selecting Large Language Models and Matching Them to Real-World Use Cases
Choosing a large language model is not a leaderboard ranking exercise. This guide explains a four-layer evaluation framework (task, constraints, cost, engineering), seven capability archetypes, scenario-to-metric mappings, prompt engineering and RAG practices, a three-tier evaluation system, cost and latency optimization, common anti-patterns, and a four-week rollout roadmap.
1. Why Model Comparisons Should Not Rely on Leaderboards
Now that generative AI has entered the engineering phase, one of the most common mistakes teams make is reducing model selection to a single capability ranking. In real production work, the same model may perform consistently on summarization yet drift on fields when extracting structured data from long documents. The same model may be extremely cheap in low-concurrency offline batch jobs yet become unusable in high-concurrency online paths because of time-to-first-token latency and rate limiting. The first principle of selection is therefore: define the task and the constraints first, then evaluate model capability.
Break the evaluation into four layers and narrow the candidate pool layer by layer:
- Task layer: generation, understanding, extraction, rewriting, conversation, or multimodal parsing.
- Constraint layer: latency, concurrency, context length, data residency, and compliance requirements.
- Cost layer: per-call cost plus the hidden overhead of retries and evaluation.
- Engineering layer: API stability, structured output support, observability, and canary release capability.
Only when a model passes all four layers does it qualify for a production path.
2. A Neutral Summary of Seven Capability Archetypes
To avoid framing the discussion around any specific product, the positioning differences among mainstream large models are described below using seven capability archetypes. The benefit of this abstraction is that the selection framework still holds when specific service versions iterate.
- General conversation archetype: broad coverage and strong instruction following; a good default entry point and router for complex tasks.
- Multimodal understanding archetype: strong at mixed text-and-image layouts, scanned documents, and chart parsing; suited to document digitization and content moderation support.
- Long-context reasoning archetype: emphasizes long-context consistency, structured writing, and code comprehension; suited to contract review and codebase Q&A.
- High cost-efficiency archetype: clear per-unit cost advantage; suited to large-scale offline processing and high-frequency simple classification.
- Ecosystem integration archetype: tightly integrated with office suites, search, and knowledge bases; suited to internal enterprise knowledge assistants.
- Lightweight real-time archetype: low latency and high-concurrency friendly; suited to on-device or real-time interaction scenarios.
- Strong reasoning archetype: outstanding math, logic, and multi-step planning ability; suited to complex problem decomposition and automated agent orchestration.
A common practice in engineering is “routing plus fallback”: a lightweight model handles high-frequency simple requests, a strong reasoning model handles requests judged to be difficult, and a long-context model handles very long inputs, producing the best tradeoff between cost and quality.
# Example: rule- and confidence-based model routingdef route(task, text_len, need_json, budget_ms):if need_json and text_len > 60000:return "long_context_model"if task in ("math", "plan") :return "reasoning_model"if budget_ms < 800:return "light_model"return "general_model"
3. Scenario Matching: From Requirements to Metrics
The key to scenario matching is translating vague requirements into measurable metrics. Common mappings include:
- Customer support Q&A: focus on intent recognition accuracy, answer actionability, and human handoff rate; add knowledge retrieval and answer citations.
- Document extraction: focus on field-level precision and recall and format compliance; constrain output to a strict structured format.
- Content production: focus on factual consistency, style consistency, and rework rate; build a style sample library and a banned-word list.
- Code assistance: focus on first-pass acceptance rate, unit test coverage improvement, and review defect density; combine static analysis with sandbox execution.
- Data analysis: focus on metric definition consistency and chart selection rationale; move metric definitions upstream as searchable metadata.
For structured output, use a two-part safeguard of constrained decoding plus validation retries:
{"task": "invoice_extract","schema": {"invoice_no": "string","amount": "number","currency": "string"},"retry_on_invalid": 2}
4. Combining Prompt Engineering with Retrieval Augmentation
Prompt engineering is not about writing longer prompts; it is about stating the task boundary, the input/output contract, and failure handling clearly. A reusable prompt skeleton has five parts: role and goal, input description, output format, constraints and prohibitions, and examples. Examples should cover edge cases such as empty values, overly long fields, and multi-value fields.
Retrieval-augmented generation (RAG) addresses the problem of the model not knowing your private knowledge. Key implementation points:
- Chunking strategy: split by semantics and structure, preserving heading hierarchy and table relationships.
- Hybrid retrieval: run keyword search and vector search in parallel, then rerank.
- Citation and provenance: attach source snippets to answers so humans can verify them.
- Incremental updates: trigger incremental indexing on document changes instead of full rebuilds.
- Evaluation loop: use a question set to regress recall and answer correctness.
# Example: reranking after hybrid retrievalcandidates = keyword_search(q, top_k=20) + vector_search(q, top_k=20)reranked = rerank(q, dedup(candidates))[:5]answer = llm.generate(prompt_with(q, reranked), require_citation=True)
5. Evaluation Systems: Turning “Feels Good” into Data
Selecting a model without evaluation is gambling. Build a three-tier evaluation system:
- Offline evaluation set: covers the real distribution, includes hard cases and adversarial samples, with metrics tailored per task.
- Online canary: small-traffic comparison, tracking conversion rate, human takeover rate, and complaint rate.
- Regression monitoring: automatically run regressions on every prompt or model version change to prevent capability regression.
Evaluation sets should be version controlled, with data anonymization and authorization status recorded. For generative tasks, in addition to automatic metrics, introduce human spot checks and double-review consistency checks to avoid inflated scores.
6. Cost, Latency, and Stability Engineering
Cost is not just unit price; it also includes retries, long contexts, evaluation, and human review. Optimization options include input compression and deduplication, caching frequent Q&A, batching offline tasks, routing by difficulty tier, and capping maximum output length. For latency, use streaming output, prefetching knowledge snippets, parallel retrieval, and timeout-based degradation. For stability, use multi-model fallback, rate limiting and circuit breaking, idempotency key design, and thorough logging and tracing.
On the cloud, you can compose general-purpose capabilities: object storage for corpora and artifacts, a message queue for peak shaving, a container platform to host the inference gateway, log and monitoring services for observability, and a key management service for unified credential custody. If you need managed model services, Baidu AI Cloud offers related general capability categories that can be integrated and governed uniformly according to compliance and cost requirements.
7. Common Anti-Patterns and Fixes
- Using one model for everything: replace with routing and tiering.
- Assuming longer prompts are better: replace with contract-based prompts and example-driven design.
- Shipping first and adding evaluation later: replace with evaluation first, then gradual canary rollout.
- Ignoring data compliance: move data classification, anonymization, and residency strategy to the front.
- Treating hallucination as a rare incident: replace with citation provenance, rule validation, and human fallback.
8. Rollout Roadmap
Week 1: finish the scenario inventory and metric definitions. Week 2: build the offline evaluation set and a prompt baseline. Week 3: integrate retrieval and structured validation. Week 4: launch the canary and establish regression and cost dashboards. For ongoing iteration, drive version upgrades with data and keep the selection framework evolving in step with business goals.
