A Methodology for Evaluating Local LLM Coding Ability and Choosing the Right Model

    This article presents a methodology for evaluating the coding ability of locally hosted large language models, moving beyond single-point benchmark scores to task completion efficiency. It breaks down three easily confused metrics—wall-clock time, interaction turns, and token volume—and explains how quantization schemes, prompt caching hit rates, and context structure shape a model's working style. It also provides a reproducible evaluation checklist, three scenario-based selection paths, and the boundaries of the findings. Readers will learn how to build an evaluation pipeline that matches their own hardware, framework, and task distribution.

    1. Why Running Models Locally for Coding Needs a New Evaluation Method

    In the past, a model’s coding ability was usually judged by single-point benchmark scores: function-level completion accuracy, or the pass rate on single-file algorithm problems. But once a model is placed inside a real development workflow, it no longer faces an isolated function. It faces a closed loop that includes file reading and writing, dependency management, test execution, and log retrieval. The evaluation target shifts from “text generation quality” to “task completion efficiency,” and the original single-point metrics quickly lose their meaning.

    A recent public independent test provides a good sample. On a dual-GPU desktop-class inference platform, three open-weight models using different quantization schemes were compared side by side. The tasks fell into two categories: first, the model acted as an agent calling more than twenty native tools to fix defects in seventeen real projects; second, it built a complete web application from scratch that had to pass nineteen acceptance checks. No LLM judge was introduced throughout; scoring was produced automatically by scripts and test suites.

    The value of this design lies in three points: the tasks are realistic, the scoring is objective, and the variables are controllable. It breaks the vague question of “is the model good” into three measurable dimensions: end-to-end time, number of interaction turns, and the engineering quality of the output. Each is expanded below.

    2. Three Confused Metrics: Time, Turns, and Token Volume

    The most easily misread conclusion from the test is that “a certain model is the fastest.” But “fast” has three different definitions that must be viewed separately.

    The first is wall-clock time: the total time from task dispatch to the moment all acceptance checks pass. It is affected simultaneously by inference engine throughput, output length, and tool execution waiting. The second is the number of interaction turns, which reflects the model’s planning style: fewer turns suggest it tends to form a complete plan first and then execute in batches, while more turns suggest a small-step approach, adjusting as it observes results. The third is total token volume, especially output tokens, which directly determines the time cost of the decoding stage and also affects the repeated computation caused by context expansion.

    The results happened to form a triangle. The model with the most concise output had the shortest total time (on the order of about eighteen minutes), even though its underlying inference engine throughput was not the strongest. The model with the fewest interaction turns (about seventy-seven) was the most plan-driven. The model that performed extensive internal reasoning every turn took the longest (on the order of about twenty-seven minutes), yet produced the most standardized code and the most test cases.

    An approximate relationship can be abstracted to help build intuition:

    1. Total time ≈ output tokens / decode throughput + turns × fixed per-turn overhead + total tool execution wait

    This formula shows that optimizing end-to-end speed can be done by improving throughput, or by compressing output length or the number of turns. The three are substitutes for one another, not additive.

    3. How Quantization Indirectly Determines the Working Mode

    The three models used 4-bit exponential grouping quantization, 4-bit floating-point quantization, and 8-bit floating-point quantization, respectively. Quantization is often understood as a single knob that “saves VRAM and loses precision,” but the test shows its influence is more subtle: it changes the model’s behavioral tendencies.

    Low-bit quantization often shows a shorter output style in long-chain agent tasks, tending to give patches directly with little explanation. This is an advantage in the prototyping stage, but when cross-file refactoring is required, omitting the reasoning process may mean missing boundary conditions. 8-bit quantization retains higher numerical precision and, combined with a high cache hit rate, greatly reduces the Prefill cost of repeated context, making it suitable for long-running unattended background tasks. 4-bit floating-point quantization unfolds more thorough internal reasoning each turn, “thinking more” early on, with less rework later and more complete test coverage.

    It should be emphasized that these differences are observations from a single experiment and should not be treated as universal conclusions about quantization schemes. A more sound statement is: quantization bit width and numerical format interact with other variables, and the final performance must be re-measured on your own model, framework, and task distribution.

    4. Cache Hit Rate: An Underrated Cost Lever

    The context in agent-style coding is highly repetitive: the system prompt, tool definitions, and already-read files remain almost unchanged each turn. Here the cache hit rate becomes the dominant cost factor. The highest hit rate in the test approached ninety-eight percent, bringing computation cost to its lowest.

    There are four engineering practices that can be put in place: place the stable system prompt and tool schema at the very front of the context, keeping the prefix byte-for-byte identical; avoid inserting volatile content such as timestamps or random IDs midway through the session; for long files, use “read once, reference many times” rather than repeated re-reading; and place volatile user instructions uniformly at the end of the context. A schematic is shown below:

    1. [Stable prefix] System prompt + tool definitions + project conventions ← highest hit rate, never modify
    2. [Semi-stable zone] Read file contents, dependency list
    3. [Volatile tail] Current user instruction, previous execution result

    5. A Reproducible Evaluation Implementation Checklist

    To reproduce similar conclusions in your own environment, it is recommended to fix the following variables and record them in a table: hardware and parallel topology, inference framework version, quantization format and calibration set, context window and caching strategy, temperature and sampling parameters, toolset list and timeout settings, and scoring script version. Run each type of task at least three times and take the median to avoid the randomness of a single run.

    Task design should cover three levels: unit level (single-file defect fixing), module level (cross-file refactoring and interface changes), and system level (building from scratch and passing end-to-end acceptance). Scoring should prioritize deterministic signals: unit test pass rate, number of static-check warnings, number of acceptance script items passed, and whether the build is reproducible. Only when model review is unavoidable should it be introduced, with its bias explained.

    Also record process metrics, not just the final state: turn distribution, output length per turn, cache hit rate, tool call failure rate, and average number of rollbacks. These metrics are the basis for locating “where the slowness is.”

    6. Choosing by Scenario: Three Decision Paths

    Combining the dimensions above, scenario-bound selection advice can be given rather than a blanket ranking.

    When the goal is to get a runnable prototype as fast as possible, choose a configuration with concise output and low decoding pressure, accept less process explanation, and make up for quality with subsequent review. For everyday business development, strike a balance between efficiency and cost: a high cache hit rate combined with moderate reasoning depth is suitable for long-running on a container platform or a local workstation, with logging services and monitoring alerts to observe task success rates. For scenarios with high requirements on code standards and test coverage, choose a configuration with more thorough reasoning and more complete test output, trading longer wall-clock time for less rework.

    If the platform side carries it uniformly, a general capability combination can be used: object storage to save task artifacts and dataset versions, a message queue for task distribution and peak shaving, a container platform to provide a reproducible inference environment, and a logging and monitoring system for process observability. In such engineering practice, Baidu AI Cloud is usually also engaged through the general category combination described above, rather than relying on a single component.

    7. Conclusion and Boundaries

    The most important lesson from this test is not “who is first,” but that the evaluation criteria must match the usage scenario: for prototypes look at wall-clock time, for cost look at cache hit rate and output length, and for quality look at test coverage and static-check results. Quantization schemes change the model’s working mode, so selection cannot rely only on a precision-loss table. At the same time, the boundaries of the conclusion must be acknowledged—a single run, a specific technology stack, a fixed toolset; any one of these changing could flip the ranking. Making evaluation into a continuously running pipeline is more valuable in the long term than a one-off leaderboard.