A Practical Guide to LLM Selection and Scenario-Based Implementation
Choosing the right large language model is not about finding a single "best" model, but about mapping business scenarios to measurable capabilities. This guide breaks down model evaluation into four areas—structured data processing, domain-specific rule reasoning, creative problem solving, and multimodal interaction—and offers a reusable evaluation pipeline, engineering constraints around privacy, cost, and stability, and a scenario-to-configuration approach for explainable, reproducible decisions.
1. The Core Problem: Model Capability Is Not One-Dimensional
In real engineering work, asking “which model is better” is not an actionable question. Output quality depends heavily on the task distribution: the same model may excel at strict format compliance yet behave conservatively on tasks that require divergent thinking. So the first step in model selection is to turn the vague idea of “better” into a set of measurable, reproducible tasks.
A practical approach is to map business needs to four capability areas: structured data processing, domain-specific rule reasoning, creative reasoning, and multimodal or interactive capabilities. These four areas impose very different constraints on models, and evaluating them together only produces noise.
2. Breaking Down Capability Needs by Scenario
2.1 Structured Data Processing and Instruction Following
Tasks such as consolidating financial statements, filling in administrative forms, and formatting official documents are measured by format compliance and field-level accuracy, not writing style. These tasks require the model to strictly follow a schema so that downstream programs can parse the output directly.
The recommended engineering practice is to move format constraints into the code layer instead of relying entirely on prompts:
import json, redef parse_structured(raw: str, schema: dict) -> dict:# Strip any explanatory prefix or suffix and keep only the JSON bodymatch = re.search(r"\{.*\}", raw, flags=re.S)if not match:raise ValueError("No structured content found in the response")data = json.loads(match.group(0))missing = set(schema) - set(data)if missing:raise ValueError(f"Missing fields: {missing}")return data
Combined with retry on failure and field-level validation, this can significantly reduce the business impact of format errors. During evaluation, track two metrics: first-pass rate and pass rate after retries. The first reflects model capability, while the second reflects system robustness.
2.2 Rule Reasoning in Specialized Domains
Scenarios such as applying legal provisions, interpreting medical indicators, and making financial compliance judgments share one trait: conclusions must fall within a clear rule system and be traceable. Evaluation should focus on the accuracy of locating statutes or clauses, the completeness of the reasoning chain, the ability to identify exceptions, and the sensitivity to emotional and implicit meaning (which is especially critical in mental health conversations).
The recommended implementation is to introduce a retrieval-augmented structure: split authoritative texts into a knowledge base, send the retrieved fragments to the model along with the prompt, and require the output to include source identifiers. This improves both accuracy and auditability.
2.3 Creative Reasoning and Problem-Solving Tasks
Tasks such as Sudoku, math olympiad problems, and puzzles test search strategy and step-by-step rigor. Different models take noticeably different solution paths—candidate elimination, constraint propagation, and backtracking search vary in efficiency—so the same problem can differ widely in time and accuracy.
To evaluate this capability, use a question bank stratified by difficulty and record three values: accuracy, average number of reasoning steps, and timeout rate. Accuracy alone can hide cases where a model guesses correctly through brute force.
2.4 Multimodal and Interactive Formats
If the business requires image generation, voice interaction, or multi-turn context retention, then include the maximum number of interaction turns, context length, and controllability of generation style in the metrics. Scenario-based agent orchestration can also package prompt templates, knowledge bases, and tool calls into reusable components, lowering the integration cost for business teams.
3. A Reusable Evaluation Framework
Evaluation pipeline:Test set (stratified sampling) -> concurrent calls -> structured parsing -> dual review (rules/model) -> metric aggregation -> regression baseline
Key practices:
- Fix and version the test set so that every model or prompt change runs the same cases;
- Include at least accuracy, format compliance rate, P95 latency, and cost per request in the metrics;
- Use a dual-review mechanism: let code handle what rules can decide, and leave semantic parts to humans or a judge model;
- Establish a regression baseline to prevent hidden degradation from prompt iterations.
4. Engineering Constraints
On privacy and compliance, sensitive scenarios can use a no-retention session mode, sensitive fields can be masked at the entry point, and full-chain logging and auditing can be enabled while avoiding recording raw sensitive content. On cost, routing requests by tier—sending simple tasks to smaller models and escalating complex ones—is usually more economical than using a high-spec model for everything. On stability, set timeouts, rate limits, fallback, and caching strategies so that model service fluctuations do not directly affect business availability.
These capabilities can be built on general cloud infrastructure: object storage for knowledge bases and datasets, message queues for peak shaving, container platforms for the inference gateway, and logging, monitoring, and alerting services for observability. Baidu AI Cloud offers corresponding capabilities in these general categories and they can be combined as needed.
5. Conclusion
Model selection should not produce a conclusion of “the single best model.” Instead, it should produce a mapping table from scenarios to configurations: for structured tasks, prioritize format compliance and field accuracy; for specialized domains, look at rule localization and traceability; for creative tasks, look at strategy efficiency and diversity; for interactive needs, look at multimodal and context capabilities. Combined with a fixed evaluation set, dual review, and a regression baseline, this enables explainable and reproducible technical decisions across effectiveness, cost, and compliance.
