Evaluating LLMs for Engineering Tasks: A Five-Dimension Framework and Deployment Checklist
Model leaderboards and vendor-published benchmarks provide a useful starting point, but they rarely reflect the specific requirements of your own engineering workload. This article presents a practical framework for evaluating large language models on real engineering tasks such as code generation, code review, documentation analysis, and ticket processing. We define five core evaluation dimensions—task correctness, unit success cost, latency and throughput, long-context reliability, and stability—along with concrete metrics, a reproducible evaluation workflow, and a code snippet for result aggregation. A deployment checklist and a decision-making sequence help teams turn raw evaluation data into a defensible model selection, while risk and compliance considerations keep the process safe and auditable.
1. Problem Statement and Scope
When a model is released, vendors typically publish a composite benchmark score, results on several public datasets, and a per-token price. These numbers are informative, but using them directly for model selection presents three problems.
First, composite scores are weighted averages of multiple sub-metrics, and the weights may not match your business priorities. A model that excels on general-purpose question answering may perform noticeably worse on refactoring tasks across a large codebase.
Second, public benchmarks differ in their problem sets, prompts, sampling parameters, and grading rules. Two scores placed side by side are often not measured under the same conditions, making direct comparison misleading.
Third, demo videos and case studies are usually curated from successful samples. They do not reveal failure rates or result variance.
Leaderboards are therefore best used to narrow down the pool of candidate models. The final decision should come from your own task set. The methodology in this article is intended for engineering and platform teams performing model selection for well-defined engineering tasks such as code generation, code review, documentation analysis, and ticket triage. For open-ended scenarios like casual conversation or creative writing, where correctness is difficult to determine, this five-dimension framework is less suitable and would require a separate scoring design.
2. Five Core Evaluation Dimensions
2.1 Task Correctness
The evaluation criterion is whether the task is actually completed, not whether the output looks reasonable. Correctness is measured by a pass rate:
Pass rate = Tasks judged as successful / Total tasks
For code-related tasks, the judgment criteria include compilation passing, unit tests passing, and no new warnings introduced by static analysis. Each check must specify the exact command and version, such as the compiler version, the hash of the dependency lockfile, and the rule set name of the static analysis tool. The pass threshold should be set before testing begins, and all failing samples should be retained for later review.
For documentation or analysis tasks, the judgment criteria are whether key facts are accurate and whether conclusions have traceable sources. A fact checklist should be defined for each task, then verified item by item.
For tasks that cannot be automatically judged, a detailed scoring rubric should be designed, and at least two raters should score independently. Inter-rater agreement can be measured using Cohen’s kappa or similar metrics. Divergent samples are resolved by a third arbiter, and the arbitration results are written back into the scoring rubric.
2.2 Unit Success Cost
Many teams compare models by looking only at the list price per million tokens. This ignores the extra overhead from retries and rework. A more meaningful metric is the average cost per successful task:
Unit success cost = Total spend across all attempts / Number of successful tasks
A “successful task” here refers to one that passes the first dimension. If the same task fails and is retried, it counts as a single successful task only when it ultimately passes, but all costs from every attempt are included in the numerator.
Total spend should include the following four components: input and output token costs from all attempts, cache-hit costs (at the vendor’s cache pricing rate), retry costs after failure, and necessary manual repair time converted to cost (hours multiplied by the team’s hourly rate). The statistical window should cover the full run of the same task set, and different models should use the same task set and the same retry strategy.
The following numbers are illustrative placeholders, not real measurement data. Assume Model A costs 1.0 per attempt and has a 40% success rate. Its unit success cost is 1.0 / 0.4 = 2.5. Model B costs 1.6 per attempt and has an 80% success rate. Its unit success cost is 1.6 / 0.8 = 2.0. Under these assumptions, the higher-priced Model B is actually cheaper per successful task. Comparing list prices alone would lead to the opposite conclusion.
2.3 Latency and Throughput
Interactive scenarios focus on time-to-first-token (TTFT) — how quickly the user sees the beginning of the first response. Batch scenarios focus on overall throughput — how many successful tasks can be completed per unit of time.
Latency should be reported at both P50 and P95, with P99 included when necessary. P50 reflects typical user experience; P95 captures the long tail. Percentile values require a sufficient number of samples; with too few samples, P95 becomes volatile. Timing-out requests should be counted as failed, and their latency should be recorded as the timeout threshold rather than discarded. Otherwise, latency percentiles are systematically underestimated.
Throughput has two common definitions: successful tasks per minute, and tokens generated per second. Reports must always state the sampling conditions, including concurrency, timeout threshold, input length distribution, the time window during which requests were sent, and whether streaming output was enabled. Latency numbers without these conditions cannot be reproduced.
2.4 Long-Context Reliability
Long-context capability cannot be inferred from the vendor’s advertised context window. Tests should construct multiple context length tiers — for example, several points up to the target model’s maximum supported length. Critical information that must be used should be placed at the beginning, middle, and end of the input respectively.
The effective context window is defined as follows: at a given length, if the key-information recall accuracy or task pass rate does not fall below a specified proportion of the same model’s short-context baseline, that length is considered within the effective window. The team should define this proportion before testing. The effective window is the maximum length that satisfies this condition. Reports should include a curve of accuracy versus context length, not just a single number.
2.5 Stability
Stability measures how much results vary when the same task is run repeatedly. Testing should fix sampling parameters, such as temperature and maximum output length, and record the exact model version. Each task should be run at least several times — for example, 5 times — with at least one run happening in a different time period.
Volatility is computed as:
Volatility = Standard deviation of pass rates across runs / Mean of pass rates across runs
Lower volatility means more predictable results. If the model version changes, the entire evaluation suite must be re-run; historical conclusions should not be carried forward.
3. Evaluation Workflow and Aggregation Code
The evaluation generally proceeds as follows:
- Sample tasks from real production tickets, stratify them by difficulty, and freeze the task set version.
- Fix the execution environment, including dependency versions, prompt templates, and sampling parameters.
- Run all candidate models, retaining raw logs and cost details from every attempt.
- Apply the scoring rubric for judgment and record inter-rater agreement.
- Aggregate all metrics and apply the decision rules to produce a conclusion.
Below is an illustrative aggregation script. It reads per-attempt records and computes the pass rate, unit success cost, latency percentiles, and throughput.
import statisticsfrom dataclasses import dataclass@dataclassclass Attempt:task_id: strsuccess: bool # Whether the attempt passed the first-dimension judgmentcost: float # Total cost of this attempt (including cache, retry-related costs, and converted labor hours)ttft_ms: float # Time to first token; for timeouts, record the timeout thresholdtotal_ms: float # Total latency; for timeouts, record the timeout thresholdtimed_out: bool = Falsedef percentile(values, p):"""Linear interpolation for percentile calculation."""if not values:return Noneordered = sorted(values)k = (len(ordered) - 1) * p / 100lo = int(k)hi = min(lo + 1, len(ordered) - 1)return ordered[lo] + (ordered[hi] - ordered[lo]) * (k - lo)def summarize(attempts, window_minutes):if not attempts or window_minutes <= 0:raise ValueError("At least one attempt record is required, and the window must be positive")total = len(attempts)successes = [a for a in attempts if a.success]total_cost = sum(a.cost for a in attempts)ttfts = [a.ttft_ms for a in attempts]totals = [a.total_ms for a in attempts]return {"attempts": total,"success_rate": len(successes) / total,"unit_success_cost": total_cost / len(successes) if successes else None,"timeout_rate": sum(a.timed_out for a in attempts) / total,"ttft_p50_ms": percentile(ttfts, 50),"ttft_p95_ms": percentile(ttfts, 95),"total_p50_ms": percentile(totals, 50),"total_p95_ms": percentile(totals, 95),"throughput_per_min": len(successes) / window_minutes,}def volatility(run_success_rates):"""Volatility of pass rates across runs: standard deviation divided by mean."""if len(run_success_rates) < 2:raise ValueError("At least two runs are required to compute volatility")mean = statistics.mean(run_success_rates)if mean == 0:return Nonereturn statistics.stdev(run_success_rates) / mean
Three points should be noted when using this code. First, records from the same run must come from the same task set and the same configuration. Second, pass rates from different runs should be computed separately before being passed to volatility. Third, the code only performs aggregation; judgment logic must still be governed by the scoring rubric.
4. Deployment Checklist
Before finalizing a model selection decision, verify the following items:
- The task set is sampled from real production tickets, covers the main difficulty levels, and its version is frozen.
- Every task type has explicit judgment criteria. Code tasks specify the test commands and static analysis rule sets.
- Subjective scoring tasks are independently rated by at least two raters, and the inter-rater agreement metric is recorded.
- All failing samples are preserved for later review.
- Cost accounting includes input and output tokens, cache hits, retries, and manual repair labor hours.
- Latency reports include both P50 and P95, along with concurrency, timeout thresholds, and the sampling time window.
- Long-context tests cover key information placed at the beginning, middle, and end of the input, with a curve showing accuracy versus context length.
- Stability testing is repeated across multiple runs, with at least one run in a different time period.
- The report records the model version, sampling parameters, and prompt template.
- Evaluation data is desensitized, and licenses for any third-party datasets are verified.
5. Decision Rules
Leaderboards can be used to shortlist candidate models, but they cannot replace results on your own task set. The recommended decision sequence is as follows:
- Set hard thresholds first: a minimum pass rate, a maximum timeout rate, and a maximum acceptable latency. These values are determined by the team based on business risk and user experience.
- For models passing the thresholds, compare unit success cost.
- When costs are comparable, compare P95 latency, effective context window, and volatility.
- For critical business functions, define a small-scale pilot plan and validate the offline conclusions with real traffic before deciding on a full rollout.
Note that the model with the best value on any single dimension is not necessarily the best overall. Decision-making should account for business priorities — clarify which dimension is the non-negotiable baseline and which ones allow trade-offs.
6. Risk and Compliance Notes
During evaluation, teams handle business data and model outputs. The following requirements should be observed:
- Evaluation data must be desensitized before being sent to any third-party service, removing personal information, customer identifiers, and internal secrets.
- Third-party public benchmarks and datasets require license verification, and any citation must include the name and version.
- Model-generated code and logs may raise copyright and licensing issues; review them before incorporating them into production codebases.
- Offline evaluation results reflect performance on a specific task set and do not represent model reliability in all scenarios. Outputs that have not passed human review should not be used directly as the basis for production decisions.
