Evaluating the Efficiency of LLM-Assisted Programming: Cost, Speed, and Delivery Quality
This article explains why public benchmark scores alone are not enough to choose a model for AI-assisted programming. It proposes evaluating quality, efficiency, cost, and stability across the full task workflow. It also covers how to calculate costs for long tasks, how generation speed affects end-to-end time, how to run parallel experiments with cross-review, how context length and caching matter, and practical steps for building an evaluation process.
1. Why Public Benchmarks Fall Short for Model Selection
Public benchmarks usually measure accuracy on a fixed set of questions. The questions are independent of each other, and the input size is limited. Real software engineering tasks are different. A single feature often goes through several steps: understanding requirements, searching the codebase, modifying multiple files, compiling and running the code, fixing tests, and reviewing the code. Each step may trigger several tool calls.
This means that differences between models on single questions can be amplified or offset over a long workflow. A model that uses more tokens per response may cost several times more after a dozen or more rounds of tool calls. A model that responds faster but misses key constraints may spend more time reworking code during later review. For this reason, model selection should focus on results across the full task workflow, not on the score of a single step.
2. Four Evaluation Dimensions
1. Quality
Quality should be broken down into observable metrics:
- Functional correctness: whether all requirements are implemented and whether tests pass.
- Defect detection rate: the proportion of known defects found during review.
- False positive rate: the proportion of review comments that turn out to be invalid.
2. Efficiency
Efficiency covers the end-to-end time from a feature request to merged code, along with the number of times a human has to intervene. Generation speed, measured in output tokens per second, is only one factor.
3. Cost
Cost includes input tokens, output tokens, the discount on cache-hit tokens, and any charges billed per call. For the same task, the cost ranking may change under different billing models. Costs should therefore be calculated from the actual billing structure, not estimated from unit prices alone.
4. Stability
Stability refers to whether performance degrades with long contexts, multi-turn conversations, or high load. Common problems include forgetting early constraints, repeatedly modifying code that has already been confirmed, and declining output quality as the context approaches its limit.
3. Calculating Cost for Long Tasks
The cost of a single call can be expressed as:
Cost per call = (uncached input tokens × input price) + (cached input tokens × cached price) + (output tokens × output price)
The total cost of a task is the sum of the costs of all its calls. The example below shows how to aggregate results from call logs. The user enters the unit prices according to their own billing contract.
from dataclasses import dataclass@dataclassclass CallRecord:input_tokens: int # Total input tokens for this callcached_tokens: int # Portion of input tokens served from cacheoutput_tokens: int # Output tokensseconds: float # Duration of this calldef task_cost(records: list[CallRecord],price_in: float,price_cached: float,price_out: float) -> float:total = 0.0for r in records:uncached = r.input_tokens - r.cached_tokenstotal += uncached * price_intotal += r.cached_tokens * price_cachedtotal += r.output_tokens * price_outreturn totaldef task_wall_time(records: list[CallRecord]) -> float:return sum(r.seconds for r in records)
This code illustrates two points. First, the cache hit rate directly affects the cost of long tasks, because each round of calls resends a large, identical prefix. Second, the number of calls and the duration of each call together determine total time. A model that uses fewer tokens per call can still cost more overall if it needs more rounds to finish a task.
4. The Real Impact of Speed
Output tokens per second measures generation speed, which is only part of end-to-end time. Total task time can be approximated as:
Total time ≈ Σ (output tokens ÷ generation speed + tool execution time + network overhead)
In multi-step tasks, generation wait time accumulates repeatedly. When a model is slow, developers switch their attention while they wait, which reduces how carefully they review the output. In practice, a common result is that developers look only at the run report, skip the code review, and merge directly. This shortcut shifts the quality risk to later stages.
The value of speed therefore lies not in how fast a single response arrives, but in whether it keeps the verification step at a reasonable pace.
5. Validating Quality with Parallel Experiments
Results from a single model make it hard to judge which one performs better. A more reliable approach is to have several candidates handle the same task, then cross-review their outputs.
Key points of experiment design
- Fixed task: the same requirement description, the same code baseline, and the same acceptance tests.
- Cross roles: the generating model and the reviewing model should be different where possible, to avoid self-review bias.
- Recorded results: defect count, missed defect count, number of rework rounds, and human intervention time.
- Ground truth: regression tests and manual review determine whether a defect actually exists.
A notable finding
In one real case, a new feature had a defect in a module far from the changed files. The defect was triggered by a cross-module call. The review approach that examined only the changed files missed it, while the approach that scanned the whole repository found it. Review scope should therefore cover call chains and dependencies, not just the diff.
6. Long Context and Caching
The impact of context length on performance shows up in three main areas:
- GPU memory and speed: The longer the context, the greater the attention computation and cache memory usage. When GPU memory runs short, inference speed can drop noticeably, so a practical upper limit for context should be set.
- Information retention: Context compression or summarization loses detail. Key task constraints should be stored in a structured form and reinjected in each round.
- Cache efficiency: Prompt caching depends on identical prefixes. Placing system instructions, project conventions, and stable code context at the beginning improves the hit rate. Placing frequently changing content at the end reduces cache invalidation.
7. Practical Recommendations
- Build a private evaluation set: Extract real requirements from past tasks, pair them with acceptance tests, and keep the set non-public. Public exposure can leak test content and distort results.
- Record full workflow data: Save the call count, token usage, duration, and review results for each task to support later analysis.
- Include review in the evaluation: Scores on generated output alone do not reflect delivery quality. Track the defects found during review as well.
- Choose models by scenario: Long, multi-file tasks and single-point Q&A place different demands on a model, so evaluate them separately.
- Re-test regularly: Model versions, billing rules, and deployment configurations all change, so conclusions should be verified periodically.
In short, evaluating AI coding assistants requires measuring quality, efficiency, cost, and stability within the same task workflow. Only controlled experiments using real task data produce conclusions that can guide decisions.
