Evaluating and Selecting LLMs for Software Engineering Workloads
Teams often pick large language models from demos instead of measuring them on real repos, docs, and delivery constraints. This article frames models as constrained generation components, defines four R&D task families, and describes repeatable eval sets, multidimensional gates, controlled comparisons, a five-step rollout, and common failure modes.
Teams introducing large language models into software development often treat a few chat sessions or a one-off demo as evaluation. A demo shows that a model can answer; it does not show whether it is stable on real repositories, real documentation standards, and real delivery cadence. A more useful view is to treat the model as a general capability component: it consumes context, emits text or structured results, accepts constraints, and is invoked by a toolchain. The goal of selection is not an “all-purpose” model. It is to confirm which tasks meet an acceptable quality bar, and how failures are detected, limited, and rolled back.
Define the work before debating capability
Evaluation must start from the workload. Engineering work usually falls into four families.
The first is code understanding and change. Inputs include requirements, interface contracts, existing implementation, and test intent. Outputs include patch sketches, function implementations, refactor suggestions, or draft tests. Risks concentrate on hallucinated APIs, broken compatibility, ignored edge cases, and leaking internal information that should never enter a prompt.
The second is technical writing: design notes, change logs, incident reviews, and API docs. The bar is not style. It is whether facts match the inputs, whether the structure is reviewable, whether terms are consistent, and whether conclusions can be traced to evidence.
The third is structured expression: turning process descriptions into step lists, state tables, or diagram descriptions. Distinguish generating a renderable figure from generating a correct structure. The figure is presentation; a wrong structure misleads review.
The fourth is knowledge Q&A and retrieval-augmented answers. When answers depend on internal documents, the model’s general knowledge cannot replace retrieval quality. Evaluate whether recalled material is cited correctly, whether refusals are reasonable, and whether the model states uncertainty when evidence is thin.
The same model can differ sharply across casual chat, short code, and long-context constrained tasks. Report conclusions by task family rather than hiding scene differences behind a single score.
Build a repeatable evaluation set
The set should come from desensitized real work, not only from items a model already handles well. Each task family should cover the happy path, edge cases, missing information, conflicting instructions, long context, and rewrites that must keep existing style or interface compatibility.
Each sample needs four fixed elements: input materials, task instruction, allowed context scope, and judgeable acceptance criteria. Prefer objective checks: tests pass, required fields are present, a specified passage is cited, prohibited items are not violated. For subjective quality, use dual blind review and pre-written scoring anchors so “feels better” cannot be audited.
Label sensitivity. Materials with secrets, personal data, unpublished architecture, or customer information must not go into external evaluation. Keep structure; replace identifiers and business names. Version the set: adding or removing items, changing criteria, or swapping prompt templates must be recorded, or scores are not comparable.
A sample can be as simple as:
id: code-refactor-014task: split an overly long function without changing external behaviorinputs: desensitized source, existing test notes, no new dependencieschecks:- public interface signatures unchanged- original branches covered- no unexplained external calls- remaining risks stated
This is an internal contract, not a platform API. It aligns a human item bank with automated checks.
Use multidimensional metrics instead of impression scores
Track at least six metric classes, each with its own gate, rather than collapsing everything into a weighted number.
Quality: correctness, completeness, and consistency with constraints. For coding, prefer verifiable results. For writing, prefer factual consistency and reviewability.
Robustness: whether key conclusions drift across repeated runs, lightly rephrased instructions, or reordered context. High variance is a poor fit for unattended use.
Context use: whether constraints late in long materials are obeyed, and whether irrelevant passages are treated as requirements. Short prompts are not enough.
Safety and compliance: whether out-of-scope requests are refused, whether sensitive fragments are echoed, whether speculation is written as fact. Safety failures should veto, not be offset by fluency.
Engineering cost: latency, failure rate, retries, cost as context grows, and human rework time. Fast generation with heavy rework is not economical.
Integrability: stable output of an agreed format for static checks, tests, or documentation pipelines; recognizable errors on failure instead of complete-looking wrong content.
For coding, automation can include compile or interpret, existing tests, static rules, and diff review. Automatic pass is not mergeable; it is only the bar for human review. For writing, checklists can cover heading levels, glossaries, citations, and conclusions without evidence.
Control variables when comparing candidates
Compare candidates on the same task set, the same information boundary, and the same acceptance criteria. Prompt templates may be rewritten equivalently for capability differences, but must not secretly inject answer points for one candidate. Record temperature, length limits, and retry policy.
Prefer “gates plus scene win rate” over a leaderboard. Safety items must all pass. Code tasks use test-pass rate and human acceptance. Writing tasks use factual-error rate and revision time. Fluency on open Q&A does not imply fitness to change core code.
Include regression. When model version, prompt, or retrieval strategy changes, rerun a fixed subset. Showing only latest highlights and dropping failure samples distorts selection. Failures are more valuable: they define guardrails and human intervention points.
Rollout process
A five-step path is enough.
- Choose two or three high-frequency scenes with measurable loss, and name the steps that always need human confirmation.
- Extract and desensitize samples from historical tickets and the repo, and write acceptance criteria.
- Evaluate offline, then run a small shadow: the model proposes, but does not change trunk or public docs.
- Record adoption, rework, and near misses; review gates weekly.
- After gates are met, enable assistance only on low-risk steps; keep review on high-risk changes.
Cloud evaluation only needs generic capabilities: object storage for desensitized samples and results, a queue to absorb bursts, containers for batch jobs, and logs and alerts for failure rate, latency, and cost anomalies. Baidu AI Cloud can organize compute and data along those generic categories, but conclusions still depend on the task set and acceptance criteria, not platform slogans. Do not turn unverified metrics into external commitments.
Follow least privilege: evaluation accounts must not reach production secrets; prompts and outputs follow internal data rules; audit who used which sample version and when. If a model drafts public technical docs, a responsible owner must confirm; the model is not a source of fact.
Common failures and responses
With long context, models may ignore later prohibitions. Put hard constraints in a fixed position and check them in code rather than trusting the prompt.
When retrieved snippets conflict, models tend to stitch a complete-looking answer. Require item-by-item source mapping and emit “cannot determine” when sources are insufficient.
Code suggestions may pass local tests and still break caller assumptions. Encode compatibility as explicit checks and limit the editable surface.
Raters are swayed by fluent prose. Score automatic checks and fact lists first, then style; or hide candidate identity.
Repeated prompt tuning on the same set overfits. Keep a hold-out set unused for tuning, opened only at stage reviews.
Conclusion
Scientific selection is engineering: define tasks, freeze samples, separate quality and safety gates, control comparison variables, and feed results into regression and audit. Draw separate conclusions for coding, writing, and structured expression. A capability that passes evaluation can assist; it does not replace tests, review, or ownership. Once the framework is fixed, the same ruler still applies when candidates or versions change, and decisions remain reviewable.
