How to Evaluate LLM Coding Capabilities: From Prompts to Cost Accounting
This article describes a repeatable method for evaluating AI coding tools. It separates model capability from end-to-end delivery workflows, outlines five types of practical tasks, and sets out fair test conditions and acceptance criteria. It also provides prompt templates and explains how to measure first-pass acceptance, rework, and total cost per validated delivery.
1. Defining What We Are Evaluating
Faced with tools that can generate code, modify files, and run tests, developers easily assume that giving the same requirement to each tool and seeing which one finishes first reveals which is more capable.
The reality is more complicated. One tool may understand requirements well but lack convenient file operations. Another may use a complete toolchain to make changes quickly but produce code with edge-case problems. If you compare only the final demo, you mix together the effects of the model, context management, tool permissions, and manual work.
A rigorous evaluation should therefore first distinguish between two objects.
The first is model capability. Focus on requirement understanding, code reasoning, constraint compliance, error localization, and how well the model expresses uncertainty. In this type of evaluation, input materials, tool conditions, and resource budgets should be kept as consistent as possible.
The second is the end-to-end development solution. Focus on the full process from receiving a task to delivering a change that can be accepted. This includes file search, code modification, test execution, recovery from failures, and manual takeover. The benefits of the toolchain count toward the result, but any conclusion must be limited to the overall performance of the current configuration. It cannot be attributed directly to the underlying model.
This distinction shapes the core approach of this article. Rather than judging a specific product, it establishes a validation process that teams can reuse.
2. Start With Real Tasks, Not Leaderboards
“Strong coding ability” is not a clear enough standard for purchasing or engineering decisions. Teams have very different requirements. Some need to prototype interfaces quickly, some need to maintain complex business logic, and others care most about safe changes to existing systems.
It is recommended to organize the task set into the following five categories.
1. Requirement understanding and solution breakdown
Provide a business requirement with moderate ambiguity, then check whether the model can identify missing conditions, ask necessary questions, and separate what must be implemented from what is out of scope for now.
For example, “add a batch import feature” is incomplete. The input format, handling of duplicate records, rollback on failure, permission control, and result feedback all affect the implementation. Starting to code immediately does not necessarily mean efficiency. The model may have skipped critical analysis.
2. Local feature implementation
Choose small tasks with clear inputs and outputs that can be verified automatically, such as summing amounts, validating fields, handling state transitions, or handling pagination boundaries.
These tasks help verify basic coding ability, but they cannot replace the evaluation of complex projects. A correct single-file implementation does not show that the model understands cross-module dependencies.
3. Modifying existing code
Provide a code fragment or project copy of meaningful size, and require changes that preserve the original behavior.
For this category, focus on the scope of the change. Check whether the model followed the existing structure, whether it introduced duplicate logic, and whether it broke a shared interface to complete a local feature.
4. Defect localization and repair
Provide the failure symptoms, relevant logs, and necessary code. Ask the model to explain the root cause and submit a fix.
Acceptance should not rely only on whether the original failing case now passes. Add adjacent boundary tests to avoid “patching for the sample.” A sound fix should explain the trigger conditions, the error mechanism, and the regression risk.
5. Test completion and security review
Ask the model to add tests for an existing implementation, or to identify risks such as missing permission checks, sensitive information leakage, or improper input handling.
These tasks check whether the model only reasons along the normal path. For enterprise development, exception paths and permission boundaries often matter more than the ideal path shown in a demo.
The task set does not need to be large at the start, but it should cover real work. Prioritize tasks the team performs frequently, where rework is expensive, and where acceptance criteria are clear. Avoid collecting problems simply because they make the results look good.
3. Build Fair and Repeatable Test Conditions
When evaluation conditions are inconsistent, even a true result is hard to interpret.
1. Fix the initial state
Start every run from the same project snapshot. Keep file contents, dependency states, and test data consistent. Patches, caches, and notes produced by one run should not accidentally carry into the next evaluation.
If you reuse existing work, label the run clearly as “continued development based on existing material.” Do not mix these results with runs that were completed “from scratch.”
2. Specify tool permissions
Record whether the tool is allowed to read the entire project, modify files, run tests, access the network, and install dependencies.
If one solution can run tests automatically while another can only output text, the difference in end-to-end efficiency includes the effect of tool access. In that case, you can compare overall delivery value, but you should not claim a gap in pure model capability based on that comparison.
3. Fix the context materials
All candidate solutions should receive the same requirements, interface constraints, project documentation, and key files. When materials are too long, define a uniform truncation or retrieval rule in advance. Do not let people select more favorable information for one solution.
4. Control manual intervention
Manual hints can significantly change task difficulty. “Keep checking” and “the problem is in the amount rounding logic” provide very different amounts of information.
Define in advance which types of intervention are allowed and how many times they can occur, and record the content of each one. If you discover that a requirement was incomplete during the evaluation, add the same clarification to all candidate solutions.
5. Run independent repetitions
Generation results vary between runs, so a single success does not prove reliability. For key tasks, run several independent trials to observe the distribution of results.
Report at least the number of successful runs, the total number of runs, and the level of manual intervention. When the sample is small, state clearly that the conclusion applies only to the current task set and should not be generalized into a universal ranking.
4. Design Acceptance Before Writing Prompts
A common mistake is to let the model generate code first and then decide whether the result “looks reasonable.” This approach is easily influenced by output length, explanation style, and visual polish.
A more reliable method is to write the acceptance rules before the evaluation begins.
Take “order amount summary” as an example. At minimum, you need to define:
- what an empty order should return;
- whether quantities can be zero or negative;
- how amounts are represented;
- the order in which discounts and additional fees are calculated;
- at which step rounding occurs;
- whether invalid input should raise an error or be ignored.
For monetary amounts, use integers in the smallest currency unit or an appropriate decimal calculation method, according to business rules. Do not assume that binary floating-point arithmetic meets precision requirements by default. At the same time, do not hide all key rules and then mark the model as failed for not guessing them.
Hidden test cases do not all need to be public. However, they should verify the stated contract, not introduce new requirements.
Divide acceptance into three layers:
Basic checks: Can the code load, build, or start in the agreed environment? Does it stay within the allowed modification scope?
Functional checks: Does the code meet the requirements for normal, boundary, and error inputs?
Engineering checks: Does it add unnecessary dependencies? Does it break existing behavior? Does it contain sensitive information? Does it leave hard-to-maintain duplicate implementations?
These three layers correspond to “it runs,” “it is correct,” and “it is suitable for the engineering workflow.” All three are required.
5. Reusable Prompt Templates: Making Task Boundaries Verifiable
The purpose of a prompt is not to guarantee success on the first attempt. Its purpose is to reduce wasted trial and error caused by missing information. The templates below suit local development tasks in existing projects.
Template 1: Feature implementation
You are a developer responsible for maintaining an existing project. Complete the following task without breaking existing behavior.[Business goal]Describe the problem this change should solve and the result users can observe.[Existing materials]Provide relevant files, directory descriptions, call relationships, and necessary business rules.[Implementation scope]List the modules that may be modified, and state explicitly what is outside the scope of this task.[Technical constraints]Follow the existing style of the project. Do not add dependencies without confirmation. Do not modify unrelated files. Do not write example keys or sensitive information into the code.[Acceptance criteria]List normal scenarios, boundary scenarios, error handling, and compatibility requirements item by item.[Working method]First check whether the requirements contain ambiguities that affect implementation. If they do, ask the necessary questions. If they do not, provide a short plan and then implement it.[Deliverables]Provide a summary of the changes, key design trade-offs, the verification steps actually executed, the verification results, and remaining risks. If tests cannot be run, state this clearly. Do not describe suggested execution as completed.
Template 2: Defect repair
Analyze the following defect and complete the minimum necessary fix.[Expected behavior]Describe the correct result.[Actual behavior]Provide the error symptoms, reproduction steps, and relevant logs.[Related code]Provide the materials needed to analyze the problem.[Constraints]Do not hard-code a fix for a single example. Do not hide the problem by skipping tests or relaxing validation. Keep the behavior of unrelated interfaces unchanged.[Deliverables]Explain the root cause and the evidence for it, provide the fix, add regression tests that cover the problem, and distinguish verified conclusions from assumptions that still need confirmation.
Compared with a generic request such as “write the best code,” these templates are more useful. They turn goals, permissions, and delivery evidence into agreements that can be checked.
6. Measure More Than Generation Speed
Fast code generation does not mean fast delivery. An evaluation should cover at least the following dimensions.
1. First-pass acceptance rate
Observe whether the first submission passes the full acceptance process. A pass should be determined by tests and review, not by the model’s own claim.
2. Repair rounds and manual time
Record how many rounds of feedback the model needs, and how many minutes developers spend on prompting, review, patch changes, and result confirmation.
A solution with low output cost can still be economically inefficient if it requires a lot of manual rework.
3. Scope of change and maintainability
Check for unrelated refactoring, duplicate functions, excessive abstraction, and unnecessary dependencies. A larger change is not necessarily better. A minimal, well-scoped change is usually easier to review and roll back.
4. Credibility of results
Check whether the model accurately distinguishes between “actually executed,” “inferred from the code,” and “suggested for later checking.” This is an important engineering metric. Claiming that tests passed without running them weakens trust in the entire delivery chain.
5. Stability
Beyond average performance, pay attention to the types of failures and variation in response time. For critical business work, a solution that occasionally performs very well but often violates constraints may be less suitable than one with more consistent results that is easier to take over.
If you use a composite score, set admission conditions for security and correctness first, then calculate a weighted score only for results that pass those conditions. Clear explanations or faster speed should never offset serious permission defects or incorrect business results.
7. Cost Accounting Should Cover the Full Delivery Chain
Different usage models may involve subscriptions, pay-per-use billing, or a combination of both. Comparing bill amounts directly can be misleading. Trial credits, temporary discounts, and shared subscriptions can further distort the apparent cost.
A more meaningful measure is the cost per validated delivery:
Cost per validated delivery = Total cost ÷ Number of tasks that pass acceptance
Total cost should include at least:
Total cost = Model usage fees + Execution environment fees + Manual operation costs + Review and rework costs
Manual costs can be estimated from the time invested and an internal hourly rate. However, note whether this figure represents an opportunity cost or a management accounting view. It does not necessarily correspond to new cash spending.
For subscription fees, explain how they are allocated. For free credits, present the amount actually paid separately from the cost estimated under normal usage conditions. Otherwise, a short-term promotion may be mistaken for a long-term cost advantage.
Costs from failed tasks must also stay in the total. The goal of the evaluation is to calculate how much it takes to complete valid deliveries, not to display only the expense of successful cases.
8. Making Evaluation Results Useful for Deployment
A final report should not only state which option is “stronger.” It should also clearly state the following:
- which tasks the current conclusions apply to;
- which context and tool permissions were used;
- which tasks can be completed independently;
- which tasks require manual review;
- what the main failure modes are;
- whether the cost advantage comes from the model itself, the toolchain, or temporary usage conditions.
When moving into a real development workflow, continue to apply the principle of least privilege. Use masked data and isolated copies in the evaluation environment whenever possible, and do not expose unnecessary credentials to the model. For high-risk operations such as deleting files, changing permissions, or modifying data, require manual confirmation and set up a rollback mechanism.
Adopting a tool does not necessarily mean using the same solution for every task. Teams can layer their use according to task risk and complexity. Low-risk tasks with clear acceptance criteria can be automated to a greater degree. High-risk, cross-module tasks should keep stricter review and verification.
What matters most is not how much code a demo produces. It is whether, under clear constraints, the tool can consistently deliver changes that are correct, maintainable, and verifiable. Including prompts, tests, manual effort, and cost in one evaluation framework makes LLM-assisted programming a manageable engineering practice rather than a subjective impression.
