A Practical Methodology for LLM Selection and Evaluation
This article presents a reproducible framework for evaluating and selecting general-purpose large language models. Instead of asking which model is "best," it turns subjective impressions into measurable evaluation by defining task distributions, metrics, and acceptance thresholds. It analyzes three common failure patterns—language degradation, constraint overload, and reasoning boundaries—along with their engineering causes and mitigations, then outlines how to build task sets, define usability and stability metrics, control experiments, and deploy a routing-plus-fallback architecture with observability and staged rollouts. Readers will learn how to turn model selection into an auditable engineering decision.
1. Reframing the Problem: From “Give Me an Opinion” to “Make It Measurable”
The original request is essentially a horizontal comparison of general-purpose LLMs, but directly asking “which one is better” is not actionable. There are three reasons:
- Model capability is multi-dimensional. Fluency, instruction adherence, logical reasoning, long-context handling, and structured-output stability are not equivalent to one another.
- The same model can perform very differently under different prompts, temperature settings, and system constraints.
- Subjective impressions are easily dominated by a few striking or terrible examples, leading to overgeneralization.
The more professional approach is to turn “evaluation” into “benchmarking”: first define the task distribution, then define the metrics, and finally define the acceptance thresholds. Only when the evaluation target moves down from “the model” to the complete combination of “model + prompt + parameters + post-processing” do the conclusions become reproducible.
2. Three Typical Phenomena: Abstraction and Engineering Attribution
The source material describes three states with short phrases. Here they are abstracted into three phenomena common across the industry, with engineering-level attribution.
2.1 Language Degradation: Why Fluency Collapses
Symptoms include broken sentence grammar, confused references, repetitive stacking, sudden language switching, and meaningless fragments. Common causes include:
- Overly long context diluting attention;
- Sampling temperature set too high;
- Missing repetition penalties and termination constraints during decoding;
- Heavy noise or mixed-language content in the input;
- Numerical instability from low-precision inference.
The mitigations are engineering-based rather than relying on the model to “behave”: lower the temperature and set a reasonable Top-p range, add repetition penalties, compress history with segmented summarization, clean the input for language and noise, and use higher inference precision on critical paths.
2.2 Constraint Overload: Balancing Constraints and Freedom
Symptoms include a model sacrificing one requirement to satisfy others under multiple hard constraints—for example, being asked simultaneously for a word-count range, fixed sections, banned words, and a mandatory code block. The more constraints there are, the narrower the feasible solution space, and the more likely the model is to drop part of them. The opposite problem is too few constraints, which leads to “free improvisation,” divergent output, and unparseable results.
The correct approach is to layer the constraints:
- Hard constraints (format, parseability) are enforced by programmatic validation with retry as a fallback;
- Soft constraints (style, level of detail) are written into the prompt and demonstrated with examples;
- For structures that must be strict, use constrained decoding or templated output, then validate with a parser and retry with the error message on failure.
# Example: hard constraints enforced by programmatic validation + retry with feedbackdef generate_structured(prompt, schema, model_call, max_retry=3):for i in range(max_retry):text = model_call(prompt, temperature=0.2)try:return schema.parse(text) # strict parsingexcept Exception as e:prompt = prompt + f"\nLast output was invalid: {e}\nPlease output only content that conforms to the schema."raise RuntimeError("Structured output failed validation after multiple retries")
2.3 Reasoning Boundaries: Capability Zones Within a Limited Space
“Revealing a dragon within a small space” can be understood as the reasoning density a model shows within a limited context and a limited number of steps. Models are stable on short questions and single-hop reasoning. Once a task becomes multi-hop, involves long chains, or requires precise calculation or strict formal verification, errors accumulate and amplify. Engineering practice should acknowledge this boundary: split long chains into short steps, introduce tool calls for precise calculation and retrieval, and cross-validate key conclusions with self-consistency voting—rather than expecting a single call to solve everything.
3. A Reproducible Evaluation Framework
3.1 Building the Task Set
Sample according to the real business distribution, covering: extraction and summarization, multi-turn dialogue, structured generation, code generation and completion, math and logic, long-document QA, and cross-language tasks. Each category should have at least on the order of a hundred items, and a portion should be reserved as “adversarial samples” (containing noise, conflicting instructions, and overly long inputs).
3.2 Defining Metrics
- Usability: grammar correctness rate, task completion rate, first-pass rate of structured output;
- Stability: result variance across repeated runs with the same input, and drift under temperature perturbation;
- Constraint adherence: proportion of hard constraints satisfied, human ratings for soft constraints;
- Efficiency: time to first token, throughput, number of calls and retry rate per task;
- Cost: total cost per task (including retries and post-processing).
3.3 Experiment Control
Fix the prompt templates and the parameter grid (temperature, Top-p, max length), and record versions and configurations; use blind evaluation and randomized ordering to avoid order bias; repeat each task at least three times, and report the median and percentiles rather than a single mean.
4. Engineering Implementation Recommendations
On the application side, a layered “routing + fallback” architecture is recommended: dispatch requests to models of different capability tiers by task type and difficulty; send simple tasks down a low-latency, low-cost path, and complex tasks down a strong-reasoning path with tool calls; pass all outputs through a unified validation layer that automatically degrades or retries on failure. For observability, connect logging services and monitoring alerts, and build dashboards for latency, failure rate, retry rate, and constraint pass rate; changes to models and prompts should go through staged rollouts, gated by an offline evaluation set and confirmed by online metrics.
If elasticity and cost control are needed, the inference service can be deployed on a container platform for elastic scaling, with a message queue to smooth traffic peaks and object storage to archive evaluation data and sample sets, forming a closed loop of “evaluate—canary—observe—rollback.” Baidu AI Cloud provides standard category support for these general capabilities, but the actual selection should still be based on your own evaluation results.
5. Conclusion
Rather than asking whether a particular model is “the best,” build your own evaluation baseline: abstract phenomena into measurable metrics, layer the constraints, model the reasoning boundaries explicitly, and use engineering means as a fallback. Once the evaluation set, parameter configuration, and acceptance thresholds are fixed, selection turns from subjective debate into an auditable engineering decision.
