Benchmarking LLMs for Coding Tasks: Balancing Output Quality and Cost

    This article compares three anonymized large language models on a standardized front-end coding task: building a browser-based market simulation game with iterative feature requests. It explains the scoring rubric, shows how token counts and costs were calculated, summarizes the strengths and limitations observed for each model, describes a deployment check procedure, and proposes a method for calculating effective cost per working feature. All cost figures are illustrative sample data, not vendor pricing.

    As model pricing changes frequently, choosing a model based on parameter count alone is no longer sufficient. Individual developers and small teams care about two questions: how much working code the budget buys, and whether rework will consume the savings. For a direct comparison, this article uses a standardized coding task. Three models receive the same instructions, build the same application, and are evaluated on both their process and their token consumption.

    1. Test Task and Scoring Dimensions

    Benchmark scores on coding problems often overstate a model’s real capability. A high score on algorithm exercises does not mean a model can turn a vague requirement into a working engineering project. This article therefore uses a lightweight, browser-based interactive game as the test case. The game requires the model to complete three types of work:

    1. Understand the business scenario. The game simulates a simplified market microstructure with one market maker and several retail bots that follow specific trading styles. The retail bot design is based on the noise traders in the Kyle model (see the appendix).
    2. Build the front end. The model must output complete HTML, CSS, and JavaScript code, including a dynamic price chart, a buy and sell panel, trading logic, and operation feedback.
    3. Run multiple iterations. After the first stage, the model receives additional “target mode” requirements in the same session. Examples include “push the price up near the closing price” and “accumulate positions when the price is below the volume-weighted average price (VWAP).”

    The test has two stages. Stage one is a single-turn generation. The model receives the full instructions once and makes no revisions. Stage two is a multi-turn iteration within the same session, and every prompt and output is recorded. The two stages measure different things. Stage one measures the quality of the first delivery, while stage two measures how efficiently the model handles revision requests.

    The evaluation uses six rubric items. The author set the weights based on the characteristics of this task. Readers can adjust them for their own use cases.

    Scoring Item Weight What It Measures
    Functional completeness 25 Whether trading, the chart, and the retail bots all run
    Instruction compliance 20 Whether each requirement is implemented accurately, including target mode
    Code quality 15 Whether the structure is clear and free of obvious redundancy or errors
    Interaction and chart details 15 Whether animations are smooth and operation feedback is timely
    Iteration efficiency 10 How many revision rounds and how much rework follow each added requirement
    Deployment usability 15 Whether the code runs directly in a local environment and in a cloud sandbox

    2. Models Tested and Cost Basis

    To keep the article from becoming outdated as version numbers change, the three models are anonymized as Alpha, Beta, and Gamma. The table lists their reasoning intensity and runtime environment. The figures are sample data that illustrate the calculation method. They do not represent any vendor’s actual pricing or test results.

    Model Reasoning Intensity Test Environment Token Consumption Sample Cost
    Alpha (flagship edition) Deep thinking Local sandbox About 1.5 million About $8.00
    Beta (Flash edition) Default Cloud sandbox About 600,000 About $0.08
    Gamma (performance edition) Deep thinking Cloud sandbox About 800,000 About $0.15

    The table shows that Alpha consumed about 2.5 times as many tokens as Beta, but its sample cost was about 100 times higher. The gap comes mainly from the unit price, not the token count. Per million tokens, the sample cost is about $5.33 for Alpha, $0.13 for Beta, and $0.19 for Gamma. These unit prices were back-calculated from the table figures. They are not published vendor price lists.

    Cost tracking requires a consistent basis. In this article, token counts are the sum of input and output tokens. They include the context that is resent across multiple iterations. The sample table does not report cache hit rates. Anyone reproducing the test should record cache hit rates separately. Without them, cost conclusions lack a reliable basis.

    3. Performance of the Three Models

    1. Alpha (flagship edition): High completeness, high cost

    Output quality. Alpha delivered the most complete code in the first-stage generation. It implemented a basic trading panel and drew a candlestick chart on its own. Its interface layout was also clear. In target mode, Alpha rebuilt the matching logic around the target function. This was the strongest result among the three models.

    Cost. Across multiple iterations, the share of repeated context grew, and token consumption rose with each round. In the sample data, Alpha’s cost was about 100 times Beta’s. Deep thinking mode noticeably lengthened response times. This test did not measure the exact difference, so it needs to be measured under the same hardware and concurrency conditions.

    Failures and limitations. After Alpha heavily rewrote the matching logic, its changes went beyond what was requested. Each large rewrite needs manual review, or it may introduce regressions that are hard to detect.

    Reproduction requirements. Record the prompt, token count, response time, and runtime environment for each round.

    2. Beta (Flash edition): Low cost, suited to trial and error

    Output quality. Beta covered all the required features, but its engineering structure was less rigorous than Alpha’s. In rapid iteration, it responded fastest and adjusted code quickly based on feedback.

    Cost. The sample cost was only $0.08. Developers can ask the model to generate several implementation options and then choose among them. The low cost lowers the barrier to experimentation, which makes Beta suitable for one-off scripts and non-core features.

    Failures and limitations. The code structure was loose. Core logic needs separate testing and review, so Beta is not suitable for direct use in high-risk business systems.

    Reproduction requirements. Record the number of implementation options generated for each requirement and the acceptance results for each option.

    3. Gamma (performance edition): Good stability, weaker details

    Output quality. In first-stage generation, Gamma’s logic was rigorous, its comments were clear, and its code style was consistent. In target mode, however, it struggled more and needed additional prompts to complete the details. Its handling of chart animation and interaction feedback was also less smooth than Alpha’s.

    Cost. The sample cost was about $0.15, placing Gamma in the middle of the three models. For projects that require stable output and high controllability, its cost-performance balance is reasonable.

    Failures and limitations. Complex target mode requirements needed extra manual prompts, and interaction details needed to be added later.

    Reproduction requirements. Record the content and number of each supplementary prompt, and count the rounds needed to complete the details.

    4. Deployment Verification Steps

    Generated code counts as delivered only if it runs directly. The deliverable in this article is a single HTML file. The verification steps are as follows:

    1. Save the file as index.html in an empty directory. Make sure the file contains no keys or test accounts.
    2. Open the file directly in a browser, or run python -m http.server 8000 in the directory and visit http://localhost:8000.
    3. Open the browser developer tools console, confirm there are no errors, and check each item one by one: trading, the chart, and target mode.
    4. Repeat these steps in the cloud sandbox, and record the browser version, operating system, and network conditions.
    5. If the code references an external charting library, record the CDN address and version number.
    6. If something fails, roll back. Save each round’s output as a separate snapshot. When a problem appears, revert to the last working version, and do not overwrite files that have already been verified.

    5. Building Your Cost-Efficiency Measurement System

    To build a measurement system, follow these three steps.

    Step 1: Classify the task.

    • Level 1: Pattern-based tasks, such as create, read, update, and delete (CRUD) pages and simple scripts.
    • Level 2: Multi-step logic tasks, such as matching rules, state machines, and data transformation.
    • Level 3: Architecture design tasks, such as coordinating multiple modules and integrating across services.

    Step 2: Set quality thresholds.

    • Maintainability: clear structure, consistent naming, and necessary comments.
    • Performance: no noticeable lag in chart refreshes or interaction response at the target data volume.
    • Security: input is validated, and keys and sensitive configuration are not written into front-end code.

    Step 3: Calculate effective cost.

    Cost per effective feature = total cost across all rounds ÷ number of feature points that pass all acceptance items

    Tokens consumed by rework must be included in the total cost. A model with a low unit price can still end up with a higher cost per effective feature if it requires many rounds of rework.

    6. Model Selection Recommendations and Limits

    Core code for production environments. Consider the flagship model first, since it completes complex logic more fully. Pair it with strict multi-round code review, and set a cost cap that stops API calls automatically when the budget is exceeded. This approach does not suit frequent small changes or projects with tight budgets.

    Routine business logic, CRUD pages, and batch refactoring. The Flash edition has a clear cost advantage. It suits fast output and exploring options. Its output still needs testing, and it should not carry critical business logic on its own.

    Commercial delivery that balances quality and cost. The performance edition produces relatively stable output and works well as the default choice for long-term projects. Complex requirements such as target mode may still need extra prompts and manual completion.

    Model prices change quickly. Re-run the same task set every quarter, and keep complete prompt and cost records so results from different periods can be compared.

    Appendix: Background on the Kyle Model

    The game task draws on Albert Kyle’s 1985 paper “Continuous Auctions and Insider Trading,” published in Econometrica. The model describes three types of participants: informed traders, market makers, and noise traders. Noise trader orders are random. A market maker cannot tell whether an order comes from an informed trader or a noise trader, so it sets prices based on total order flow. The more informed trading there is, the more strongly prices respond to order flow. This sensitivity is commonly called Kyle’s lambda.

    The market maker and retail trading bots in the game are built on this framework.