LLM Evaluation and Selection: From Benchmark Scores to Engineering Costs

    This article presents an engineering-focused framework for evaluating and selecting Large Language Models (LLMs). Moving beyond simple benchmark scores, it breaks down model capabilities into verifiable dimensions: public benchmark trends, comprehensive ability versus token efficiency, coding agent task completion, structured and multimodal generation stability, context length, API costs, and observability. It offers actionable steps for building internal evaluation sets, calculating the cost per successful task, and conducting stability tests for long outputs.

    Recent model releases often spark debates over “which model is stronger.” A more professional approach is not to merely look at an overall score, but to decompose “capability” into verifiable dimensions: public benchmark performance, comprehensive capability and token efficiency, coding agent task completion, structured/multimodal generation stability, context length and API cost, and observability after engineering implementation. Below is an engineering-oriented analysis and selection framework.

    1. Benchmarks Are Trend Signals, Not Replacements for Internal Evaluation

    Public benchmarks have value, but they come with inherent limitations. First, test sets might be indirectly covered by training data, leading to inflated scores. Second, different prompt templates, sampling parameters, and scoring scripts can cause the same model to perform noticeably differently across various leaderboards. Third, benchmark task coverage is limited and rarely represents real enterprise business distributions. Fourth, engineering metrics like output length, retry counts, and failure recovery capabilities are often not reflected in the overall score. Therefore, seeing “a model slightly outperforms its peers on some public benchmarks” should reasonably lead to the conclusion that “their capability intervals are close and further verification is needed,” rather than drawing a definitive conclusion.

    Enterprises should establish their own golden sets: extract high-value tasks from real business scenarios, fix the prompt version, temperature, max output length, and scoring rules, and observe the distribution over multiple runs rather than relying on a single result. A sample evaluation configuration is as follows:

    1. evaluation_config = {
    2. prompt_version: "v1",
    3. temperature: 0,
    4. max_output_tokens: fixed_value,
    5. runs: 5,
    6. metrics: ["task_success_rate", "human_score", "time_to_first_token", "total_latency", "output_tokens", "retry_rate"],
    7. artifacts: ["final_artifact", "execution_log", "diff_patch"]
    8. }

    Evaluation results should be versioned for regression comparisons after model upgrades. Public scores hold strong reference value only when the public benchmark trends align with your internal task distribution.

    2. Evaluate Comprehensive Capability and Token Efficiency Together

    Comprehensive capability scores are usually aggregated results across multiple tasks, where a difference of a few points might fall within the margin of noise. What deserves more attention is the “cost per unit task” and the “effective output rate.” At the same accuracy level, lower output token consumption typically means shorter decoding time, lower API costs, and less context usage. However, you cannot simply compress the reasoning process, or you might sacrifice the success rate of complex tasks.

    A common phenomenon is that two models with similar overall scores might have nearly double the output token consumption when completing the same batch of tasks. This directly impacts three things: inference latency, token-based API costs, and throughput under high concurrency. During evaluation, you should record input tokens, output tokens, time to first token, total latency, success rate, and retry rate, and calculate the “cost per successful task”:

    1. Cost per successful task =
    2. (input_token_cost + output_token_cost + retry_and_human_review_cost) / successful_task_count

    If a model scores slightly higher but consumes nearly double the tokens, it may not be the optimal solution for cost-sensitive businesses. Conversely, if a business is extremely sensitive to accuracy, moderately increasing inference tokens in exchange for a higher success rate might be reasonable. The key is to translate a “score advantage” into “business benefits.”

    3. Why Coding Agent Evaluation Requires a Custom Dataset

    Coding agent capabilities are difficult to measure with a single code completion benchmark. Real-world development tasks involve repository understanding, project building, bug fixing, refactoring, diagnostics, code review, structured artifact generation, and task planning. Public benchmarks are prone to overfitting and may not cover an enterprise’s tech stack. Therefore, some model teams build internal coding evaluation sets: selecting high-difficulty cases from engineers’ real development tasks, covering scenarios like development, bug fixing, refactoring, and diagnostics, accompanied by code repositories, runtime environments, and human scoring standards. They then select a small number of high-quality tasks as a stable evaluation set.

    The value of such evaluations lies in “emphasizing both process and results.” In addition to whether the final tests pass, you should also observe the quality of the diff patch, maintainability, security compliance, interaction rounds, token cost, and failure recovery capability. A sample workflow is as follows:

    1. for task in tasks:
    2. prepare_repo(task)
    3. run_agent(task.prompt)
    4. run_tests()
    5. collect_diff()
    6. human_review()
    7. record_tokens_and_latency()
    8. aggregate(success_rate, review_score, cost_per_task)

    From an industry practice perspective, current coding agents still have a gap compared to top-tier intelligent coding tools. This is not surprising: real repository environments are complex, tool invocation chains are long, and errors accumulate. When evaluating, you shouldn’t just look at “whether it can generate code,” but rather “whether it can stably complete tasks under constraints.”

    4. Focus on Long-Output Stability for Structured and Multimodal Generation

    Tasks like vector graphics, voxel art scenes, and single-file web pages are often used to test spatial reasoning, long instruction following, planning capabilities, and long-output stability. A typical task is to “design and create a creative voxel scene, integrate it into a single web file, and ensure it can be opened in mainstream browsers.” Such tasks require not only generating code but also ensuring that object positions, colors, materials, interactions, and rendering results are fundamentally reasonable.

    Common failure modes include: long output being truncated, context management failures, losing constraints midway through planning, and error accumulation leading to unrunnable final artifacts. Therefore, evaluation cannot merely check “whether content was output,” but must perform automated validation and manual spot-checks: parsing vector structures, rendering screenshots, checking the legality of voxel coordinates, object count, relative positions, and whether colors and materials match the prompt. The following check items can be set:

    • Whether the artifact is a single file and contains complete styles and scripts;
    • Whether it can be opened without errors in mainstream browsers;
    • Whether the scene objects are complete and the relative positions of the main subject and bicycles/props are reasonable;
    • Whether there are obvious truncations, missing closing tags, or undefined variables;
    • Whether long-task failures can be recovered through retries or segmented planning.

    If one model experiences interruptions in complex long-output tasks while another completes them normally, it indicates a difference in long-context management and output stability, which cannot be masked by an average score.

    5. Weight Context Length and API Costs by Business Distribution

    Million-level context capabilities are highly attractive, but they are not a free resource. Long contexts increase caching, bandwidth, and attention computation costs; even with optimizations like hybrid attention, the unit price and latency under long inputs may still rise. Many services use tiered pricing: for input tokens below a certain threshold, one plan is cheaper; above the threshold, another plan might be better. Therefore, you cannot just look at the “price per million tokens,” but must examine the actual input length distribution of your business.

    A sample cost evaluation is as follows:

    1. def estimate_cost(tasks, price_table):
    2. total = 0
    3. for t in tasks:
    4. total += tiered_cost(t.input_tokens, t.output_tokens, price_table)
    5. return total / len(tasks)

    During selection, you should bucket historical requests by input length, calculating the weighted costs for short-context, long-context, and ultra-long-context scenarios, while considering cache hits, streaming output, batch processing, timeout retries, and manual review costs. Beyond pricing, you should also look at SLAs, data compliance, availability, observability, and team familiarity. If using Baidu AI Cloud, you can leverage general container platforms to run evaluation tasks, object storage to save test sets and artifacts, log services to collect inference logs, and monitoring and alerting to track failure rates and latency, thereby establishing evaluation and cost dashboards as a continuous process.

    6. An Actionable Selection Roadmap

    It is recommended to proceed with the following steps: First, clarify your business task distribution and success criteria. Second, build a small-scale, high-quality internal evaluation set, fixing parameters for multiple runs. Third, simultaneously record quality, token efficiency, latency, and failure rates. Fourth, estimate the cost per successful task based on real request distributions. Fifth, conduct specialized stability tests for long-output and structured generation tasks. Sixth, perform a grayscale rollout and continuous regression testing. The final conclusion should be “Model X is more suitable for Task Distribution Y,” rather than a generic “X is stronger.” Look at public leaderboards for trends, internal evaluations for fit, costs per successful task for ROI, and long-output and failure recovery for stability—this is a more rigorous approach to technical evaluation.