Evaluating Large Language Models: A Practical Framework for Capability Assessment and Model Selection
This article presents a reusable framework for evaluating large language models instead of relying on public leaderboards. It covers six assessment dimensions, including instruction following, coding, reasoning, multimodal generation, long context, and safety, along with a sample evaluation script. It then explains capability trade-offs, cost calculation, a multi-model routing architecture with a unified gateway, a reusable prompt engineering checklist, and common pitfalls to avoid when selecting models for real business systems.
1. Why You Need a Reusable Evaluation Framework Instead of Leaderboards
In real engineering projects, teams often face an awkward situation: models score highly on public leaderboards but deliver a noticeably different experience once integrated into their own business. The reason is that leaderboards typically rely on public, static, single-turn evaluation sets, while real business workloads involve long chains, multiple turns, and private context. A more reliable approach is to define evaluation dimensions first, then run small-scale regression tests with your own sample set.
At a minimum, cover the following six dimensions:
- Instruction following and format stability: whether the model can consistently produce structured output (such as strict JSON) and how often fields are missing.
- Coding capability: cross-file understanding, refactoring, unit test generation, and defect localization.
- Reasoning and math: multi-step derivation, unit conversion, and boundary condition handling.
- Multimodal and asset generation: image understanding, image-text consistency, and the usability of video assets.
- Long context and retrieval augmentation: long-document summarization, citation traceability, and integration with search or knowledge bases.
- Safety and compliance: content filtering strength, refusal boundaries, and data retention policies.
A practical evaluation script skeleton looks like this (illustrative and not tied to any vendor API):
cases = load_cases("my_business_cases.jsonl") # Each entry contains a prompt, expected schema, and scoring criteriafor model in models:for c in cases:out = call_model(model, c.prompt, temperature=0)ok = schema_validate(out, c.schema)score = rubric_score(out, c.rubric) # 0~1report.append((model, c.id, ok, score, latency_ms, tokens))
The key is to turn “subjective impressions” into measurable pass rates, rework counts, and average latency. Only then does model selection have a solid basis.
2. Capability Breakdown: Strengths and Weaknesses by Dimension (Neutral View)
2.1 Code Generation and Engineering Understanding
The gap between leading models on coding tasks is often not about “whether they can write the code,” but about the “first-pass success rate.” In complex tasks that mix text and code, some models require multiple rounds of rework, while others are more likely to produce a usable version on the first attempt. The engineering recommendation is to treat “rework count” as a core metric rather than judging only the first draft.
2.2 Translation and Standardized Writing
A common pain point is translations with “Chinglish” phrasing or inconsistent terminology. A more reliable workflow is to pipeline the process: use a model with strong adherence to standards for the initial translation, then have a model with stronger language expression polish it, while explicitly constraining the terminology list and forbidden symbols in the prompt.
Step 1 (Draft): Strictly preserve the termbase, output plain text, and do not use dashes or exclamation marks.Step 2 (Polish): Adjust only sentence structure and phrasing; do not change terminology or numbers.Step 3 (Validation): Use a script to check consistency of numbers, units, and proper nouns.
2.3 Math and Logical Reasoning
Math performance and reasoning latency do not have a linear relationship. In practice, you can introduce a “dual-channel” approach: a fast channel produces the answer, while a slow channel performs verification and counterexample checks. High-risk conclusions should undergo mandatory second-pass verification.
2.4 Multimodal and Asset Production
Image and video generation have reached a usable stage, but engineering efforts should focus more on copyright compliance, content safety, and asset consistency. It is recommended to decouple asset generation from business systems and make it asynchronous through object storage and message queues to avoid blocking the main workflow.
2.5 Real-Time Information Verification
For verifying trending topics and social platform information, differences in model capability come more from “retrieval source coverage and timeliness” than from the model itself. Architecturally, retrieval, deduplication, and source credibility scoring should be built as independent services, with the model only responsible for summarization and conflict annotation.
2.6 Safety Alignment and Stability
Vendors differ in how strict their alignment policies are. Overly strict policies can mistakenly block legitimate requests, while overly loose ones create compliance risks. Enterprises should set up their own policy layer: input desensitization, output review, and dual-model cross-verification for sensitive scenarios.
3. Cost Structure and Subscription Strategy: Converting “Expensive” into Engineering Metrics
Do not compare only monthly fees. Convert them into “cost per unit of effective output”:
- Effective output = number of tasks passed on the first attempt;
- Hidden cost = rework rounds × latency + manual review time;
- Quota risk = task backlog caused by rate limiting during peak hours.
Illustrative formula:
Unit cost = (subscription fee + API call fee + manual review cost) / number of tasks passed on the first attempt
The usual conclusion is that lightweight tasks should use low-cost channels, while high-value tasks should be routed to high-capability channels. This can significantly optimize overall spending.
4. Recommended Architecture: Multi-Model Routing + Unified Gateway
On the enterprise side, it is recommended to build a unified model gateway that abstracts away differences and enables switching, canary releases, and auditing:
router:default: fast_lanerules:- if: task == "code_refactor"route: strong_reasoning_laneretry: 1- if: task == "translate"pipeline: [draft_model, polish_model, validator]- if: risk_level == "high"require: dual_review
Supporting capabilities can use general cloud product categories: log services for record keeping, monitoring and alerting for observing latency and failure rates, object storage for evaluation sets and artifacts, and container platforms for hosting the gateway and validation services.
5. Prompt Engineering Checklist (Ready to Reuse)
- Define the output mode clearly: JSON schema, required fields, and enum ranges.
- Prohibit vague rhetoric: limit dashes, exclamation marks, and marketing-style expressions.
- Put the termbase upfront: unify translations and abbreviations.
- Require source citations: mark as “unverified” if no source is available.
- Request step-by-step reasoning but output only the conclusion section to reduce noise.
- Set a fallback for failures: automatically retry once on format errors and degrade gracefully.
6. Common Pitfalls and Governance Recommendations
- Looking only at leaderboards without your own samples: make sure to build a business regression set.
- Single-model lock-in: retain switching capability through a gateway to avoid quota and availability risks.
- Ignoring data compliance: design input desensitization, regional deployment, and retention policies upfront.
- Treating generation as search: factual questions must be connected to retrieval and source verification.
- Not measuring rework: rework is the major cost driver.
7. Conclusion
There is no “all-around champion,” only “the combination that best fits the scenario.” Starting with dimension-based evaluation, using routing and pipelines as the backbone, and treating cost and compliance as constraints is the way to maintain engineering certainty in a rapidly evolving model ecosystem. To get started faster, you can build an evaluation, gateway, and monitoring loop based on general capabilities from Baidu AI Cloud, turning model selection from a “feeling” into “data.”
