How to Evaluate LLM Coding Capabilities and Usage Costs
A real-world algorithm update that consumed approximately 48 million tokens illustrates how to assess coding models beyond isolated code generation. This article examines engineering capability, token cost drivers, and multi-agent configuration strategies, with practical guidance on balancing autonomous development, verification quality, and spending.
Introduction: A Real-World Coding Task
As general-purpose large language models become more capable at generating code, more developers are handing complete development tasks to AI coding tools. That raises a practical question: how does coding capability relate to usage cost? If one task consumes tens of millions of tokens and costs dozens of Chinese yuan, is it worth the expense?
Consider a developer who needed to modify the downsampling algorithm in a plotting library wrapped with Qt. The goal was to resample data whenever the visible plotting window changed, preventing the distortion that can occur when zooming into data that was downsampled only once.
An AI coding tool handled the task automatically, consuming approximately 48 million tokens. The modified code compiled successfully, and the tool committed the changes automatically. This case provides a useful starting point for examining model capability, cost structure, and engineering practice.
1. How to Evaluate LLM Coding Capabilities Objectively
A model’s coding capability cannot be judged solely by its answers in a single conversation. Evaluation should focus on its performance across long-running, multi-step tasks in real engineering environments.
Requirements Understanding and Clarification
A capable model should identify important ambiguities before implementation. For this task, relevant questions included:
- What should trigger resampling?
- Which boundary characteristics must the downsampling algorithm preserve?
- Must the changes remain compatible with existing data interfaces?
The case included a clarification stage before execution. That preparation was essential to the quality of the subsequent automated work.
Code Consistency Across Long Contexts
Real projects contain substantial existing code. A model must understand the project structure and modify the relevant implementation rather than produce an isolated snippet.
Useful evaluation criteria include whether the changes:
- Follow the project’s existing coding style.
- Handle dependencies between modules correctly.
- Preserve existing functionality.
Self-Verification and End-to-End Execution
This is a key distinction between a code generation tool and a coding agent. An ideal workflow is:
Understand requirements → Locate code → Modify implementation → Build → Run tests → Fix issues → Commit changes
In this case, the agent completed the implementation, compilation checks, and version-control commit. That demonstrates a basic level of engineering autonomy, although the reported outcome does not establish that every stage of the ideal workflow was performed.
If a task repeatedly requires a developer to intervene and correct mistakes, the model’s engineering capability remains limited.
2. Breaking Down the Cost: Where Did 48 Million Tokens Go?
A total of 48 million tokens may sound excessive, but multi-agent workflows can accumulate substantial usage. The main sources of token consumption in an automated coding task include:
- Repository exploration: Agents read project files and inspect directory structures and module relationships. This can account for a large volume of input tokens.
- Planning and reasoning: Task decomposition, solution design, and repeated reflection add reasoning overhead.
- Multi-agent coordination: Planning, coding, review, and retrieval roles may run independently, causing the same context to be processed multiple times.
- Build and test feedback loops: Each repair iteration may send error messages and relevant code back to the model.
A practical approximation is:
Total cost ≈ (Exploration tokens + Reasoning tokens + Iteration tokens) × Model price per token
This highlights two broad optimization paths: reduce irrelevant context through more targeted code retrieval, and route subtasks of different complexity to models at different price points.
3. Cost Optimization for Multi-Agent Workflows
A common mistake is to assign a flagship model to every role. A more practical approach is routing work according to task complexity.
| Role | Suggested Model Tier | Rationale |
|---|---|---|
| Architectural planning and complex algorithm changes | Flagship model with a high reasoning setting | Requires deeper reasoning, and mistakes are costly |
| Code retrieval and file exploration | Lightweight, fast model | Work is relatively structured, with an emphasis on throughput and low cost |
| Result review and final decisions | Flagship model | Quality-control stages should not be weakened merely to save money |
| Simple questions and output formatting | Lightweight model | Excess capability adds unnecessary expense |
For the task described here, assigning high-reasoning flagship models to all exploration roles would significantly increase spending. Moving retrieval and straightforward question-answering tasks to lightweight models can substantially reduce the overall bill while preserving quality on the critical path.
Additional cost controls include:
- Set token budgets and alerts. Establish a consumption limit for each task so that an unattended run does not generate an unexpectedly large bill.
- Reduce task size. Split large assignments into smaller, independently verifiable tasks. More focused context also lowers the cost of failed attempts and retries.
- Reuse exploration results. Cache structured repository summaries for repeated work on the same project instead of performing a full scan each time.
4. Balancing Capability and Cost
Evaluation should return to two central questions.
Is the Capability Sufficient?
In this case, a flagship-level model independently completed an algorithm change, compiled the modified code, and committed the result. The outcome supports its usefulness for moderately complex engineering tasks.
The original assessment places its coding capability broadly alongside mainstream models in the same tier. However, a single successful task is not a comprehensive comparison; developers should evaluate performance on their own projects.
Is the Cost Reasonable?
The reported cost was close to CNY 60 for an algorithm modification and verification task that might otherwise have required several hours of developer time. From a labor-substitution perspective, that can be worthwhile.
However, if the model’s unit price is higher than that of alternatives with similar capabilities, tiered routing and task decomposition become important ways to keep spending within a reasonable range.
5. Practical Recommendations
For developers adopting AI coding agents:
- Start with small tasks. Establish how the model performs on your own project type before expanding its responsibilities.
- Maintain a task cost log. Record token consumption and output quality for each assignment to build a cost-effectiveness baseline.
- Keep human review for critical code. Treat agent output as a high-quality initial submission, not a finished deliverable.
- Invest in automated verification. Reliable builds and tests are essential infrastructure for increasing model value and reducing the burden of manual intervention.
LLM-assisted programming is moving beyond the question of whether it can be useful toward how it can be used economically. Evaluating engineering capability and managing cost with equal care is essential to realizing its productivity benefits.
