How to Evaluate LLMs for Engineering Model Selection
When choosing a coding-oriented large language model, leaderboard rank is a weak proxy for delivery. This article explains how to define strict pass criteria, compare cost–quality curves under real repository constraints, build a representative task set, route models by risk, and keep selection reproducible after launch.
A common mistake when adopting a coding-oriented large language model is to treat “newest and strongest” as the selection decision. Marketing materials often highlight overall leaderboard rank. Engineering delivery looks at something else: under your real repository constraints, test standards, and latency budget, can the model consistently pass checkpoints, and how much compute and wait time does each passed task cost? Scores packed into a narrow band are common, while cost can differ by several times. Raising the inference budget does not guarantee a higher strict-pass count. Selection should therefore be treated as a repeatable engineering experiment, not a one-time product trial.
Define “pass” before comparing models
Multi-stage coding tasks are closer to day-to-day development than single-turn Q&A. A task usually includes reading the requirements, editing multiple files, running tests, patching from failure output, and verifying again. A strict pass means every checkpoint succeeds—not that the code “looks right” or that most cases pass. Partial passes can be tracked separately to see where the model gets stuck, but they must not be mixed with strict passes.
Write four things into the evaluation protocol. First, input boundaries: whether the full repository is visible, whether build commands are provided, and how many rounds of failure logs are available. Second, stop conditions: maximum rounds, maximum output length, and maximum thinking or tool-call budget. Third, scoring rules: whether compile failure, test failure, hidden-case failure, or style or security-check failure is an automatic reject. Fourth, the cost basis: input and output tokens, number of calls, or end-to-end wall-clock time. If the basis is inconsistent, score gaps are not comparable.
A plain result record is enough if the fields stay stable and regression-friendly:
task_id, stage_passed, strict_pass, retries,input_tokens, output_tokens, latency_ms, cost_units
When aggregating, look at strict pass rate, median latency, cost per pass, and the distribution of failure stages together. A single total score blends “cheap but fragile” and “expensive but stable” into one number.
When score gaps are small, decide from the cost curve
When frontier models are run on the same multi-stage task set, strict pass rates often fall in a narrow band. A difference of a few checkpoints may be statistically unstable: change the random seed, task order, or how failure logs are truncated, and the ranking can flip. Using “a few tenths of a percentage point higher” as a purchasing conclusion then carries more risk than benefit.
A cost–quality curve is more informative. On a fixed task set, run low, medium, and high inference or retry budgets and plot strict passes against cost. If the curve flattens early, extra budget is mostly buying latency and bills. A sudden jump at one tier is when a premium is worth paying for a critical path. Also watch cases that get worse as budget increases. Longer reasoning can over-edit code that was already correct, introduce unrelated refactors, or go further down a wrong assumption, so the strict-pass count falls instead of rising. Inference intensity is a parameter to measure, not a switch that should default to maximum.
Compare cost with ratios, not absolute slogans. If model A passes slightly more tasks but each success costs several times what model B costs, put A on the main path only when failure is extremely expensive and retests confirm a stable lead. Most internal tools, draft generation, and test completion belong near the knee of the curve.
The task set should represent your failures, not a leaderboard
General coding tasks can expose syntax, algorithms, and tool use, but they cannot replace a business repository. A custom set should be layered: short functions and boundary conditions, cross-file refactors, dependency upgrades and compile fixes, minimal patches from failure logs, and spec implementations with hidden tests. Each layer need not be large, but it must have stable automatic scoring so “feels better” does not replace judgment.
Guard against leakage and gaming. Do not write the answer pattern into the prompt. Keep hidden cases separate from public ones. Rephrase non-functional wording of the same task and retest; large score swings mean the model is memorizing the prompt rather than following the spec. Also record shortcut successes, such as deleting tests, loosening assertions, or hard-coding return values. Those should count as failures and as safety or integrity defects. Otherwise the pass rate is inflated by shortcuts.
Version the evaluation prompts themselves. System instructions, available tools, and whether network access or retrieval is allowed all change difficulty. Changing the prompt changes the exam, so historical scores cannot be compared directly over time.
Route by scenario instead of replacing everything
The usual conclusion is not “the whole company uses one model,” but a routing policy. Grade by risk:
- Low-risk drafts: comments, boilerplate, and log copy. Prefer low cost and low latency.
- Medium-risk edits: local patches protected by a full test suite. Choose the cost–quality knee.
- High-risk changes: permissions, money, data migration, and concurrency correctness. Raise the budget, require human review, and consider a cross-check with a second model.
Start routing with simple rules—for example by language, lines changed, or whether a sensitive directory is touched—rather than a complex classifier on day one. Log the model tier, cost, and whether the output was accepted. Review weekly whether the expensive tier actually reduces rework. If its acceptance rate has no clear advantage, remove it from the default path.
Cache hygiene and context hygiene also affect the bill. Repeated specification text and long, irrelevant file trees raise cost and dilute attention. If static analysis or retrieval can narrow the context to relevant files, do not stuff the whole repository into the prompt. That is an engineering optimization and does not depend on any one vendor’s proprietary capability.
Regression and process after launch
Model services change weights, default parameters, and rate limits. Put the evaluation set into continuous integration and periodically rerun a small smoke set on candidate configurations. Watch whether strict pass rate and cost per pass drift. Expand the sample only when drift exceeds an agreed threshold, instead of rerunning the full set every time.
Keep a human veto. An automatic pass only means the tests are green, not that the design is maintainable. Code review should still cover interface semantics, error handling, and security boundaries. Treat model output as a patch suggestion and send it through the same branch protection, static scans, and release gates as human commits.
Maintain a short selection memo: task-set version, pass counts and cost at three budget tiers, main failure stages, and directories where the choice does and does not apply. Date the memo and record the data source so oral lore does not replace the experiment. If you use cloud model inference, object storage for evaluation artifacts, a message queue to dispatch jobs, and monitoring alerts on cost and failure rate, treat those as generic capabilities to orchestrate. The evaluation protocol remains yours.
A minimal loop you can run
Within a week: pick twenty to forty internal tasks that can be scored automatically; define strict pass and a maximum retry count; compare candidate models at two inference budgets; record latency and cost; put only the combination that leads and is cheaper on the low-risk path, and keep human confirmation on the high-risk path. After two weeks, validate with acceptance rate and rework count, not with impression.
Keep the conclusion restrained. On hard coding tasks, frontier models often have modest strict pass rates, and the gaps between them can be smaller than the gaps in cost. Raising inference intensity can fix a critical error or amplify a wrong path. Writing down the evaluation protocol, the cost curve, and the routing policy improves delivery more reliably than chasing rank.
