How to Evaluate LLMs for Development: A Practical Framework
A practical framework for evaluating large language models in real development work. Learn how to define measurable metrics, build a small evaluation set, calculate true per-task cost including retries and review time, and use expiring quotas wisely—so you can choose the right model for each task under budget and time constraints.
1. The Core Problem: Matching Tasks to Models Under Constraints
When people evaluate large language models, they often ask “which model is best?” But for developers, the more practical question is: given your existing budget, time, and usage limits, which model fits your specific tasks? Model capability has no absolute ranking—only degrees of fit with a given scenario.
Common constraints in real-world work include:
- Quota constraints: Prepaid credits, points, or quotas often have expiration dates. Once expired, they’re gone.
- Latency constraints: During peak hours, queue times can stretch to several minutes, breaking your development flow.
- Concurrency constraints: Concurrent requests per account are capped, and batch jobs easily hit rate limits.
- Quality constraints: Generated code may look correct but contain edge-case bugs, and human review isn’t cheap.
The first step in evaluation, therefore, is breaking “it works well” down into quantifiable metrics. Saying “it feels good” or “it feels okay” gives you nothing to base the next selection on.
2. Inventory Your Resources Before Deciding What to Do
Before running any tests, build a resource inventory that includes:
- Remaining quota and expiration date: Know exactly how much you have, and calculate a daily usage cap.
- Available service endpoints: Distinguish free credits, paid quotas, and enterprise allocations to avoid mixing them.
- Response time windows: Log average queue and generation times across different times of day to identify off-peak periods.
- Task backlog: List pending work items, noting each one’s priority and deadline.
The purpose of this inventory is to avoid the “quota is about to expire, let’s just use it up” trap. Burning quota aimlessly produces no meaningful results and generates no data for future decisions. A better approach is to treat your quota as a limited budget and invest it in the tasks that create the most value.
3. Define Evaluation Dimensions
To evaluate a model’s performance in development scenarios, work through six dimensions.
3.1 Correctness
Correctness means whether the output actually meets requirements. For code tasks, base judgments on executable tests: unit test pass rates, static analysis errors, and whether runtime results match expectations. For documentation or analysis tasks, define explicit checkpoints—such as whether key information is missing or whether numbers match the source.
3.2 Consistency
Do repeated calls with the same input produce the same result? If the same question yields very different answers each time, the model is hard to adopt in production even if a single response looks good. Measure consistency by running the same test case multiple times and tracking variance or pass rate.
3.3 Latency
Latency includes both queue time and generation time. For interactive development, time-to-first-token matters most; for batch jobs, total wall time and throughput matter more. Measure these separately—don’t let a single average hide the problem.
3.4 Cost per Task
Cost shouldn’t be judged by the price of a single call, but by the total cost of completing one task. Total cost includes:
- Billed input and output tokens;
- Retry overhead after failures;
- Time spent on manual fixes and review;
- Opportunity cost of waiting in queues.
A cheap model that requires repeated revisions may actually cost more than an expensive model that passes on the first try.
3.5 Long-Context Handling
For tasks involving large codebases or long documents, test whether the model misses key information on long inputs, or drops earlier constraints across multi-turn conversations. These problems typically only surface as task size grows.
3.6 Controllability
Controllability covers whether the model reliably produces a specified format (JSON, Markdown tables, fixed fields), whether it respects constraints like “don’t modify this file,” and whether it clearly says “I don’t know” when uncertain. In automated pipelines, uncontrolled formatting is often harder to handle than wrong content.
4. Build a Small Evaluation Set
The evaluation set doesn’t need to be large. Five to ten representative samples per task type is enough to reveal meaningful differences. Sample design principles:
- Cover common scenarios plus a few edge cases;
- Every sample needs an automatically checkable condition, or a clear manual scoring rubric;
- Sample content should come from real work, not fabricated “exam questions”;
- Hold out a portion of samples from tuning, reserved for final validation.
Common task categories include: code completion, code explanation, bug localization, unit test generation, requirements-to-document conversion, log summarization, and configuration file review.
Below is a generic evaluation framework. The model_fn is provided by the caller and wraps the specific service API, keeping evaluation logic decoupled from service details:
import timefrom statistics import meanfrom typing import Callabledef evaluate(model_fn: Callable[[str], str], cases: list[dict]) -> dict:"""Run the model over a set of evaluation samples; return pass rate and average latency."""records = []for case in cases:start = time.perf_counter()output = model_fn(case["prompt"])latency = time.perf_counter() - startpassed = case["check"](output) # each sample carries its own check functionrecords.append({"id": case["id"],"passed": passed,"latency": latency,})return {"total": len(records),"pass_rate": sum(r["passed"] for r in records) / len(records),"avg_latency_s": mean(r["latency"] for r in records),"failed_ids": [r["id"] for r in records if not r["passed"]],}def check_python_function(output: str) -> bool:"""Example check: output parses as Python and contains the expected function name."""import asttry:tree = ast.parse(output)except SyntaxError:return Falsereturn any(isinstance(n, ast.FunctionDef) and n.name == "parse_date"for n in ast.walk(tree))
This script tracks only pass rate and latency. In practice, you can extend it as needed—for example, logging input/output token counts, saving raw outputs for manual review, or running the same sample repeatedly to observe consistency.
5. Calculate Cost with a Consistent Methodology
Suppose a given task consumes a few thousand input tokens and a few hundred output tokens. Per-call cost can be estimated as:
Per-call cost = input tokens × input price + output tokens × output price
Average cost per task must also account for failed retries:
Cost per task = per-call cost × (1 + average retries) + human review time × hourly rate
Consider an example: Model A has a low per-call cost but a pass rate of only 50%, requiring one retry on average; Model B costs more per call but reaches a 90% pass rate. Once retries are included, the real gap between the two may be smaller than the price gap suggests—or even reversed. Cost must always be read alongside pass rate.
For quotas with an expiration date, you can also convert cost into “daily available capacity.” For example, with 2,000 remaining units expiring in 10 days, you have roughly 200 units per day. If a task type consumes 20 units per run with a stable pass rate, you can plan the daily number of tasks accordingly and avoid a last-minute rush as the deadline approaches.
6. How to Use Expiring Quotas Wisely
When your quota is about to expire, the right move is not to burn it as fast as possible, but to spend it where it delivers the most value:
- Rank tasks by value: Sort your backlog into “high-value and verifiable,” “high-value but hard to verify,” and “low-value.” Prioritize the first category.
- Pick low-risk scenarios: Tasks like document cleanup, draft test cases, and code comment writing are cheap to fix when wrong and easy to review manually.
- Avoid aimless consumption: Don’t chat just to “use up the quota.” Every call should have a clear output purpose.
- Record results: Log the task type, duration, and pass/fail outcome of every call. Even after the quota runs out, this data guides your next selection.
- Leave time for review: Don’t cram all your calls into the final hours—reserve time to check output quality.
7. Verification Can’t Rely on “Looks Right”
LLM output is often fluent and well-structured, which breeds unwarranted trust. But fluency is not correctness. Verification should happen at three levels:
- Automated verification: compilation, unit tests, format validation, static analysis. This is the most reliable level—use it first.
- Regression comparison: diff outputs for the same sample across different versions or models to catch newly introduced errors.
- Manual spot checks: for content automation can’t cover, sample a proportion for human review and record error types.
In code generation, common subtle errors include: ignored boundary conditions, missing error handling, calls to nonexistent library functions, and race conditions in concurrent code. These often only surface with knowledge of the specific business logic, so human review is never optional.
8. Common Pitfalls
Pitfall 1: Replacing systematic evaluation with a single experience. One successful conversation doesn’t prove a model fits all tasks; one failure doesn’t mean it’s unusable. Evaluation needs a sufficient sample size.
Pitfall 2: Trusting public leaderboards alone. Public benchmarks can differ significantly from your own work scenarios. Use leaderboards for initial screening, but final conclusions should come from your own evaluation set.
Pitfall 3: Ignoring hidden costs. Queue time, retries, and manual revision time are all real costs—and they’re frequently overlooked.
Pitfall 4: Shipping model output directly to production. Treat model output as a draft. Before it reaches production, it must pass testing and review, with a rollback plan in place.
Pitfall 5: Treating evaluation results as one-time. Model services change over time, and so do task requirements. Rerun your evaluation set periodically to confirm your conclusions still hold.
9. Putting It into Practice
For most development teams, proceed in this order:
- Map your current high-frequency tasks and pick the 3–5 scenarios most worth automating.
- Prepare 5–10 samples with check conditions for each task type, and fix them as your baseline.
- Run candidate models through a unified evaluation script, recording pass rate, latency, and per-task cost.
- Based on the results, assign a primary and fallback model per task type, with explicit switching criteria.
- Rerun the evaluation set monthly or after any model version change, and update your selection records.
The core of this method is turning subjective impressions into reproducible data. Whichever service you use, as long as your evaluation criteria are clear and your records complete, you can make sound decisions on a limited budget—and keep your quota from being wasted on aimless usage.
