How to Scientifically Evaluate LLM Capabilities in Software Development

    This article explores a systematic approach to evaluating large language models (LLMs) in software development. It breaks down evaluation into six key capability dimensions, outlines best practices for building a reliable evaluation dataset, provides a reproducible evaluation framework with code examples, and offers strategies for interpreting results and avoiding common pitfalls. This methodology helps engineering teams transition from subjective impressions to data-driven model selection.

    1. Why “Gut Feel” Comparisons Fail to Guide Decisions

    When developers use large language models (LLMs) for coding assistance, they often form subjective impressions: one version might feel “slightly better than the previous generation,” or “roughly on par with another model.” These judgments usually stem from a few ad-hoc tasks and are easily influenced by prompt phrasing, task type, and the developer’s current state. As a result, these conclusions are hard to reuse and difficult to align on across a team.

    To turn subjective feelings into reliable judgments, three things must be clarified: what capabilities to evaluate, what samples to use, and how to quantify the results. Only when all three are defined can comparisons between different models be meaningful.

    2. Breaking Down Capability Dimensions

    Before evaluating, “capability” should be decomposed into observable dimensions. Common software development scenarios can be categorized into the following six classes:

    1. Code Generation Correctness: Given clear requirements, can the generated code pass unit tests and correctly handle edge cases?
    2. Issue Localization and Debugging: Given an error message and relevant code snippets, can the model accurately pinpoint the root cause rather than offering generic troubleshooting advice?
    3. Requirement Understanding and Clarification: Faced with ambiguous requirements, can the model proactively ask critical questions instead of making assumptions and generating large blocks of code?
    4. Long Context Processing: In multi-file and long-document scenarios, can the model maintain consistency and not omit constraints mentioned earlier in the context?
    5. Instruction Adherence: Can the model strictly follow requirements for output format, naming conventions, and dependency version limits?
    6. Complex Task Decomposition: Can the model break down a large task into sequentially ordered sub-steps and complete them step-by-step with verifiable intermediate results?

    Each dimension should correspond to specific metrics. For example, the metric for code generation is the test pass rate; for debugging, it is the root cause hit rate; and for instruction adherence, it is the format validation pass rate. Only when metrics are quantifiable do subsequent comparisons become meaningful.

    3. Building the Evaluation Dataset

    The quality of the evaluation dataset directly determines the credibility of the conclusions. When building one, it is recommended to follow these principles:

    • Real-world Sources: Prioritize samples taken from the team’s historical tickets, production bug records, and daily development issues. Using only classic problems circulating on the internet can lead to overlap with general training data, resulting in inflated scores that fail to reflect real workloads.
    • Balanced Coverage: The number of tasks across different capability dimensions should be roughly equal and categorized into easy, medium, and hard difficulty levels. Otherwise, the total score will be dominated by a single category of tasks.
    • Verifiable Answers: Coding tasks should be judged by unit tests. Text-based tasks (such as requirement clarification or design reviews) should have a predefined rubric that clearly states the criteria for each score point.
    • Prevent Leakage: Evaluation prompts should not appear in prompt templates, examples, or public documentation. If the model has seen them during training or in context, the results will not represent its true capability.
    • Periodic Rotation: Replace a portion of the tasks regularly. This prevents the team from inadvertently optimizing for a fixed test set over time, which would reduce the evaluation’s ability to differentiate models.

    It is recommended to prepare at least several dozen samples per dimension. With too few samples, random fluctuations in a single sampling run could alter the rankings, leading to unstable conclusions.

    4. Designing a Reproducible Evaluation Process

    A reproducible evaluation process typically consists of four steps: preparing samples, standardizing API parameters, executing and recording, and automated scoring with manual spot-checking.

    The key is to use the same prompt template, the same sampling temperature, and the same maximum output length for all candidate models, while recording the model version number and API call timestamp. This ensures that historical results can be reviewed even after model upgrades or environment changes.

    Below is a schematic of a general evaluation framework. It only shows the structure; the actual integration needs to be adjusted based on the team’s inference service interface.

    1. import json
    2. import time
    3. from dataclasses import dataclass, asdict
    4. @dataclass
    5. class EvalCase:
    6. case_id: str
    7. dimension: str # Capability dimension, e.g., "code_gen", "debug"
    8. prompt: str # Unified task description
    9. checker: str # Scoring method: "unit_test" or "rubric"
    10. def run_model(model_name: str, prompt: str) -> str:
    11. """Call the model to be evaluated and return the text result. Implementation depends on the team's inference interface."""
    12. raise NotImplementedError
    13. def judge(case: EvalCase, output: str) -> float:
    14. """Return a score between 0 and 1. Run test cases for coding tasks, score against a rubric for text tasks."""
    15. raise NotImplementedError
    16. def evaluate(models, cases, out_path="results.jsonl"):
    17. with open(out_path, "w", encoding="utf-8") as f:
    18. for model in models:
    19. for case in cases:
    20. start = time.time()
    21. output = run_model(model, case.prompt)
    22. score = judge(case, output)
    23. record = {
    24. "model": model,
    25. "case": asdict(case),
    26. "score": score,
    27. "latency_s": round(time.time() - start, 2),
    28. "ts": time.strftime("%Y-%m-%dT%H:%M:%S"),
    29. }
    30. f.write(json.dumps(record, ensure_ascii=False) + "\n")

    For the scoring phase, a two-tier structure is recommended. Automated scoring handles quantifiable aspects, such as whether tests pass or formats comply with rules. Manual spot-checking handles more subjective aspects, such as the reasonableness of a proposed solution. The spot-check ratio can be set to a certain percentage of random samples, and the consistency between manual and automated scoring should be compared regularly. If the consistency rate drops, the scoring rules should be revised promptly.

    5. Interpreting Evaluation Results

    Once you have the results, it is crucial to read the data from multiple angles to avoid being misled by a single number.

    • Look at dimension-specific results, not just the total score. A total score can mask a significant shortcoming in a specific dimension. A model might lead in code generation but fall behind in instruction adherence, which has a greater impact on pipeline-style automated scenarios.
    • Check if the gap exceeds statistical fluctuation. Sample the same task multiple times to calculate the mean and standard deviation. If the gap between two models is smaller than the fluctuation range, they should be considered roughly equal rather than forcing a ranking conclusion.
    • Consider cost and latency. When scores are close, response time and API cost determine actual usability. Interactive coding scenarios are sensitive to latency, while batch processing scenarios prioritize unit cost.
    • Review failed samples individually. A failure does not necessarily mean the model lacks capability; it could also mean the task description is ambiguous, the test case is flawed, or the rubric is unreasonable. Every failure record should be attributed to a specific cause.

    6. Common Pitfalls

    1. Representing overall capability with a single task. One successful code generation does not prove the model’s debugging or long-context capabilities.
    2. High overlap between evaluation tasks and training data. This distorts scores, and conclusions cannot be generalized to real-world usage.
    3. Ignoring prompt differences. The same model can perform very differently under different prompts. Before comparing, you should standardize the template and record its contents.
    4. Treating subjective preferences as objective conclusions. Personal experience can serve as supplementary clues, but the sample size and usage scenario should be noted. It should not be used directly as the sole basis for model selection.
    5. Comparing only once. Model services iterate continuously, and conclusions are time-sensitive. It is recommended to re-test regularly and retain historical results for trend analysis.

    7. Implementation Recommendations

    Teams can institutionalize the evaluation process as a routine mechanism. Before introducing a new model version or adjusting inference parameters, run it on the fixed evaluation dataset first, compare the results with historical data, and then decide whether to make the switch.

    During model selection, it is advisable to put capability scores, API costs, response latency, and data compliance requirements into a single table for item-by-item comparison. For scenarios involving sensitive code or customer data, you must also ensure that data storage, transmission, and processing methods comply with internal security policies, and clearly define what content is allowed to be sent to external services.

    Through this process, the team will obtain not just a “feels better to use” verdict, but a set of data that is reproducible, explainable, and trackable over time. This data is what truly supports stable technical decision-making.