Selecting and Evaluating Large Language Models for Development: A Practical Guide
This guide explains how developers can select and evaluate large language models using measurable criteria instead of personal impressions. It covers task profiling, eight core evaluation dimensions, building evaluation sets, running fair comparisons, weighted decision-making, and engineering practices for production rollout.
1. Why Model Selection Needs a Systematic Approach
Developers often choose a large language model based on other people’s reviews or their own experience. This approach has two clear problems. First, personal experience depends on the task type, the way prompts are written, and the time of use, so the conclusions are hard to reproduce. Second, models are updated frequently. The capabilities behind the same model name may change as the provider updates the service, so conclusions drawn a few months ago may no longer hold.
Selection also involves engineering constraints. Call cost, response latency, concurrency limits, cross-border data transfer, and whether data is used for training all directly affect whether a project can go live. Therefore, model selection should be broken down into metrics that can be quantified and verified repeatedly, rather than a simple comparison of which model is “smarter.”
2. Define the Scenarios and Task Profiles
The first step is to break the actual workload into specific task categories. Common categories include:
- Code generation and modification: generating functions, completing code, or fixing errors based on requirement descriptions.
- Code understanding: explaining existing logic, reviewing code for risks, and generating comments and test cases.
- Text writing: drafting technical documentation, polishing instructions, and rewriting summaries.
- Structured extraction: extracting fields from unstructured text and producing output in a fixed format.
- Multi-turn dialogue: customer support Q&A, internal knowledge assistants, and other scenarios that need to keep context.
- Multimodal understanding: recognizing information in screenshots, charts, or document layouts.
For each task category, record several profile parameters: input length range, output format requirements, tolerance for errors, and average daily call volume. Only a clear profile makes it possible to decide which metrics matter most. For example, batch structured extraction depends more on format stability and unit cost, while end-user dialogue depends more on first-token latency and tone consistency.
| Task Type | Typical Input | Key Metrics | Error Tolerance |
|---|---|---|---|
| Code generation | Requirement description plus interface definition | Unit test pass rate | Low. Incorrect code cannot be merged directly. |
| Structured extraction | Long text | Field accuracy, valid format rate | Medium. Requires manual spot checks. |
| Document writing | Outline and reference materials | Factual accuracy, structural completeness | Medium |
| Customer support dialogue | Multi-turn user messages | Answer relevance, refusal rate, latency | Medium to high |
3. Core Evaluation Dimensions
Build the evaluation framework around the following eight dimensions.
1. Task accuracy. This is the most basic metric. Prepare a set of samples for each task category and record whether the model output meets the requirements. Code tasks should be judged with unit tests. Text tasks can use a scoring rubric, with reviewers grading against defined criteria.
2. Instruction following. Many business scenarios require a specific output format, such as JSON with fixed fields, tables, or segment markers. Measure the format pass rate, meaning the share of outputs that a parser can read correctly. Format errors often cause downstream failures more easily than content errors.
3. Long-context handling. Models are inconsistent at locating information in long text. To test this, insert key facts at different positions in a long document and then ask questions about them. Measure recall when the information sits at the beginning, middle, or end. This shows whether the model has a clear position bias.
4. Output stability. The same input may produce different results across calls. For business use, fix sampling parameters such as temperature, run each sample three to five times, and measure consistency. Models with poor stability need stronger post-processing and validation.
5. Latency and throughput. User-facing scenarios focus on first-token latency, meaning the time from sending the request to receiving the first character. Batch scenarios focus on total processing time and concurrency capacity. Testing should simulate realistic concurrency and request lengths, since a single test run is not representative.
6. Cost. Most services charge by the amount of input and output data, and output usually costs more per unit. Calculate the average cost per task, then combine it with accuracy to get the “cost per correct result.” Pricing rules vary by provider and version, so use the latest official prices and do not rely on secondhand sources.
7. Data and compliance. Confirm where data is stored, whether it is used for model training, whether private deployment or dedicated instances are supported, and how long logs are retained. These terms are governed by the service contract and privacy policy. The technical team should confirm them with legal or security teams.
8. Integration and ecosystem. This covers whether the model supports function calling, streaming output, batch interfaces, and structured output constraints, and how difficult it is to connect with existing monitoring, permission, and workflow systems. Integration cost is often underestimated, yet it affects maintenance efficiency over time.
4. Building an Evaluation Set
The quality of the evaluation set determines whether the conclusions are reliable. Keep the following points in mind.
- Sample source: prioritize real work data that has been anonymized. Purely hand-written samples tend to be too simple or stylistically narrow.
- Sample size: aim for at least fifty samples per task category, and sample across difficulty levels to cover easy, medium, and hard cases.
- Labeling: each sample should include the input, the expected output or scoring rules, and a task label. Code samples should include test cases.
- Preventing leakage: evaluation data must not enter fine-tuning data or prompt examples. Otherwise, model performance will be overestimated.
- Regular updates: after business changes, add new samples and retire samples that no longer represent real use.
The following is a sketch of a general evaluation framework. Each team implements the model call part according to its own gateway or API wrapper:
import jsonimport timedef call_model(model_name, prompt):# Unified call wrapper implemented by each team, returns the model output textraise NotImplementedErrordef is_valid_json(text):try:json.loads(text)return Trueexcept ValueError:return Falsedef rate(flags):flags = list(flags)return sum(1 for f in flags if f) / len(flags) if flags else 0.0def run_eval(model_name, cases):records = []for case in cases:start = time.perf_counter()output = call_model(model_name, case["prompt"])latency = time.perf_counter() - startformat_ok = is_valid_json(output) if case.get("expect_json") else Truecorrect = case["checker"](output) # e.g., run unit tests or match fieldsrecords.append({"id": case["id"],"format_ok": format_ok,"correct": correct,"latency": latency,})latencies = sorted(r["latency"] for r in records)return {"format_pass_rate": rate(r["format_ok"] for r in records),"correct_rate": rate(r["correct"] for r in records),"p50_latency_s": latencies[len(latencies) // 2],}
The framework reports format, correctness, and latency metrics separately, which makes it easier to locate problems. For code generation tasks, checker can write the model output to an isolated environment and run tests. Restrict execution permissions and resources so that generated code cannot affect the system.
5. Practical Considerations for Running Evaluations
The evaluation process itself can introduce bias. Watch for the following issues.
- Fixed parameters: use the same temperature, maximum output length, system prompt, and time window for all runs. If parameters differ, the comparison is meaningless.
- Repeated sampling: run each sample several times and report the mean and range of variation. A single run can easily mislead due to chance.
- Version tracking: record the exact model version identifier, call date, and region. Re-evaluate after the provider updates the service.
- Blind review: reviewers score outputs without knowing which model produced them. This reduces the influence of brand perception or personal preference.
- Scoring anchors: subjective scores need clear definitions for each level. For example, a score of 3 means “basically correct but missing key details,” and a score of 5 means “correct and ready to use directly.” The more specific the anchors, the higher the agreement between raters.
- Consistency checks: have two reviewers independently score a subset of samples, then calculate an agreement coefficient. If it falls below the preset threshold, recalibrate the criteria.
6. Analyzing Results and Making Decisions
After collecting metrics, do not rank models by total score alone. Combine the metrics with business weights to make the decision.
The composite score can be calculated as follows:
S = Σ wᵢ × sᵢ, where sᵢ is the normalized score for the i-th metric, and wᵢ is its business weight. All weights sum to 1.
Business stakeholders should determine the weights. For example, in a structured extraction service, the format pass rate may carry more weight than latency. In a real-time dialogue service, latency may carry more weight.
Beyond the composite score, also check the following:
- Per-task performance: a model may lead overall but still fall short on a critical task, which makes it unsuitable for that scenario.
- Cost efficiency: the number of correct
