How to Evaluate and Choose Local LLMs for Coding: A Reproducible Benchmarking Approach

    This article explains how to build a reproducible evaluation framework for local LLMs used in coding tasks, based on a hands-on test across a dual-accelerator setup. It covers a three-layer architecture that decouples tasks, native tools, and scoring; five metrics that go beyond latency; three observed working modes and when to use each; how quantization shapes model behavior rather than just memory usage; and practical cost control through cache hit rate. Readers will learn how to replace subjective impressions with automated assertions and build an internal selection baseline.

    1. Why Reproducible Local Coding Evaluation Matters

    When deploying local LLMs for coding work, the most common problem is not that “the model is not strong enough” but that “the results are not comparable.” Different evaluations vary in hardware specs, quantization schemes, prompts, and scoring criteria, so the resulting rankings have little transfer value. To reach reproducible conclusions, an evaluation design must first answer three questions: whether the tasks reflect real development workflows, whether scoring can be judged reliably by machines, and whether the metrics can break down explainable sources of cost and quality.

    A recent side-by-side test on a dual-accelerator local environment offers a useful sample. The test placed models in an “agent” role, requiring them to call more than twenty native tools inside a controlled runtime, fix seventeen real defects, and deliver a complete application with nineteen checkpoints. No model judge was involved throughout; scripts and test assertions made all decisions automatically. The value of this design is that it replaces the subjective impression of “looks good” with engineering results that can be re-run and audited.

    2. Evaluation Architecture: Decoupling Tasks, Tools, and Scoring

    The key to reproducible evaluation is layering. The first layer is the task layer, covering two categories: defect fixing and end-to-end building. The second is the capability layer, the set of native tools the model can call, spanning file read/write, dependency management, test execution, log retrieval, and process control. The third is the scoring layer, made up of unit tests, static checks, API contract validation, and a checkpoint checklist.

    A schematic evaluation driver looks like this:

    1. for task in tasks: # defect fixing + application building
    2. agent = Agent(model, tools=NATIVE_TOOLS)
    3. trace = agent.run(task, max_turns=200)
    4. report = evaluate(trace) # assertions + static checks + checkpoints
    5. metrics.append(collect(trace, report))

    The direct benefit of this decoupling is that swapping models does not require rewriting tasks, and changing the quantization scheme does not require altering the scoring criteria. This makes the causal relationship between “quantization, behavior, and quality” observable in isolation.

    3. Metric Design: Why Latency Alone Is Not Enough

    In the test, models under three quantization schemes (low-bit integer, low-bit floating point, and 8-bit floating point) all passed every task, yet their working patterns differed markedly. This shows how a single metric can mislead. At least five categories of metrics should be collected:

    • End-to-end latency: the delivery speed users actually perceive.
    • Number of interaction turns: reflects planning granularity and tool-use efficiency.
    • Output volume: total generated tokens, directly tied to decoding overhead.
    • Cache hit rate: the share of repeated context that is reused, which determines compute cost per task.
    • Quality metrics: number of passing tests, number of test cases, and number of static-check warnings.

    The product of “output volume” and “decoding speed” often explains latency differences better than a model’s “nominal throughput.” A model whose inference engine does not lead on throughput may still deliver first if it is extremely concise and produces only around twenty thousand tokens in total. Conversely, if a model performs extensive internal reasoning every turn, total time can stretch to nearly thirty minutes even when each turn is of higher quality.

    4. Three Working Modes and Their Applicability

    Abstracting the observed behavior yields three typical working modes. They are coupled with quantization schemes but not bound one-to-one:

    1. Minimal-delivery mode. Output is sparse, with little explanation and fast production of a runnable prototype. The advantage is the shortest time to a usable first screen; the drawback is little design traceability, so later maintainability depends on the code quality itself.
    2. Plan-driven mode. The model presents a plan first and then executes step by step, with the fewest interaction turns and the best process readability. Combined with a high rate of context reuse, it has the lowest compute cost per task and suits long-running autonomous background execution.
    3. Deep-reasoning mode. The model reasons thoroughly each turn, producing the most standardized code and the richest test cases (eighteen in the test) and the best engineering quality, but at the highest time cost.

    For selection, treat “the task’s time budget” and “the quality threshold” as two orthogonal dimensions: choose minimal-delivery mode for time-sensitive work that allows later refactoring; choose plan-driven mode for unattended batch execution; choose deep-reasoning mode for core modules meant for long-term maintenance.

    5. How Quantization Shapes Behavior, Not Just VRAM

    Quantization is often understood as a way to compress VRAM usage, but the test points to a deeper effect: different numeric formats and bit widths change decoding throughput and long-context stability, which in turn shape a model’s “personality.” The low-bit integer scheme is more aggressive on VRAM and total output control, which tends to encourage a concise style. The low-bit floating point scheme balances throughput while preserving precision, leaning toward thorough reasoning. The 8-bit floating point scheme, given native hardware support, lowers the marginal cost of repeated long-context access, making a stable “plan first, then execute” rhythm more likely.

    The engineering implication is clear: quantization choices should not be judged only by “whether it fits,” but also by their downstream impact on interaction turns and output volume; otherwise both capacity planning and latency budgets will be distorted.

    6. Cost Control: Bring Cache Hit Rate into Capacity Planning

    A high cache hit rate means much repeated prefix content does not need to be recomputed, and it is the core lever for cutting costs in local multi-turn agent tasks. In practice, reuse can be improved by keeping the system prompt stable, fixing the order of tool descriptions, and placing long documents in the prefix rather than at the tail. If a scheme reaches a hit rate of nearly 98% in testing, its compute cost will be significantly lower than other schemes with the same latency, which is the fundamental reason it suits long-running background execution.

    For cloud deployment, model serving can be combined with general capabilities such as container platforms, object storage, log services, and monitoring/alerting: a container platform hosts the inference runtime and evaluation executor, object storage holds datasets and artifacts, log services retain complete interaction traces, and monitoring/alerting tracks latency and failure rates. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as one foundation option for building evaluation and inference platforms.

    7. Automated Scoring: Assertions over Subjective Preference

    Automated scoring should hold to “executable first”: defect fixing is judged by all original tests passing, application building is validated item by item against the checkpoint checklist, code standards are measured by the number of static-analysis warnings, and test quality is measured by the number of test cases and branch coverage. Avoid having models score models, because judge bias grows with task complexity and is hard to reproduce. All traces must be retained in full so that any issue can later be attributed to a specific turn and tool call.

    8. Conclusion and Practical Recommendations

    For everyday development, prefer a plan-driven, cost-controlled configuration that balances efficiency and compute overhead. For long-term maintenance and high-coverage requirements, choose a deep-reasoning configuration. For prototype validation and demos, choose a minimal-delivery configuration. Note that these conclusions rest on a single run and a specific tech stack, so variance and stack dependence exist. It is advisable to repeat multiple rounds with the same evaluation framework in your own environment and to broaden language and framework coverage before forming an internal selection baseline.