Benchmarking Local Quantized LLMs for Coding: A Practical Selection Guide

    This article presents a hands-on benchmark of locally deployed, quantized large language models on real coding agent tasks, covering both bug fixing and building applications from scratch. It explains how quantization format shapes agent behavior, why total latency and cost depend on turn count, context length, output length, and cache reuse rather than raw inference speed, and how to choose a configuration for daily iteration, high-quality delivery, prototyping, or unattended batch jobs. It also outlines a reusable evaluation framework and metrics for teams that want to run their own reproducible tests.

    1. Why Benchmark Coding Agents in a Local Environment

    Over the past two years, the role of large language models in software engineering has shifted from “completing snippets” to “taking on entire tasks.” A typical coding agent no longer just answers with a piece of code. It reads the repository, locates defects, modifies multiple files, runs tests, and iterates based on failure output. This shift has two direct consequences. First, the compute cost of a single task is no longer determined by one question-and-answer exchange, but by accumulated multi-turn interaction. Second, evaluation must move from “does the answer look right” to “does the result pass machine verification.”

    At the same time, the appeal of local deployment keeps growing. Data staying inside the internal network, the ability to run offline, and predictable unit cost are especially critical for enterprise R&D scenarios. But local hardware has limited VRAM and bandwidth, so models must be loaded in quantized form, and quantization itself changes a model’s output habits, which in turn affects agent performance on long tasks. As a result, “which model should I choose” is effectively equivalent to “which quantization scheme and which behavior pattern should I choose.”

    2. Benchmark Design: Replacing Subjective Impressions with Machine-Verifiable Metrics

    A valuable horizontal benchmark must first take evaluation authority away from humans. The design of this test can be summarized in four points, and any team can reuse them:

    1. Real tasks: The set includes both defect fixing and building a complete application from scratch, covering the two very different capabilities of “reading old code” and “writing new code.”
    2. Real tools: Models must call more than twenty native tools as an agent, such as reading and writing files, searching symbols, executing commands, and viewing test results, rather than pasting code in a conversation.
    3. Objective scoring: A script runs dozens of checks on the final artifacts (whether functionality is implemented, whether tests pass, whether the structure complies), with no LLM judge involved at any point, avoiding the bias of “models preferring models.”
    4. Controlled variables: Hardware and runtime environment are identical, and the only variable is the model and its quantization format.

    It is worth emphasizing that in the end, all tested models passed every check. This means the conclusion is not “who is stronger,” but “who is more suitable under which constraints,” which is also the most common real question in local deployment selection.

    3. Behavioral Differences Among Three Quantization Schemes

    Different quantization formats make different trade-offs between “precision retention” and “compute efficiency,” and these trade-offs externalize into observable behavioral traits.

    • Low-bit integer quantization (such as 4-bit schemes): Lowest VRAM usage, but underlying inference throughput is often not optimal. If the model itself is extremely restrained in its output, total time may still be the shortest. In testing, this type of model completed application construction with the fewest total output tokens, showing that “talking less” is an advantage in long-chain tasks: each turn has a shorter context and lower accumulated latency.
    • Low-precision floating-point quantization (such as FP8 schemes): A relatively balanced choice between precision and hardware friendliness. This type of model tends to plan first and then execute, with the fewest interaction turns and strong process readability; at the same time, its prompt cache hit rate is very high, repeated context is almost never recomputed, and unit task cost is the lowest, making it suitable for unattended background long tasks.
    • Block-level floating-point quantization (such as NVFP4 schemes): Invests a large amount of internal reasoning per turn and takes the longest, but produces the most standardized code and the most complete test cases, with the highest engineering quality, making it suitable as a “pre-delivery gatekeeper.”

    From this, a general rule can be distilled: total time is not equal to “inference speed × output volume,” but is jointly determined by turn count, input length per turn, output length per turn, and cache reuse. A minimal model can approximate it:

    1. T_total ≈ Σ (T_prefill(ctx_len, cache_hit) + T_decode(out_len))
    2. Cost ≈ Σ (ctx_len * (1 - cache_hit) + out_len)

    This formula explains why “the model with the least output is the fastest” and “the model with the highest cache hit rate is the cheapest” can both hold at the same time, and why “the model that thinks the most has the best quality” is not contradictory either, because they optimize different terms.

    4. A Reusable Selection Framework

    Abstracting the benchmark conclusions into decision rules can cover most R&D scenarios:

    • Daily iteration and defect fixing: Prefer configurations with clear planning, few turns, and high cache reuse, balancing efficiency and cost.
    • High-standard delivery and open-source contributions: Prefer configurations with sufficient internal reasoning and more complete test coverage, trading time for quality.
    • Prototyping and demos: Prefer configurations with restrained total output and the fastest end-to-end time, to quickly obtain a runnable version.
    • Unattended batch processing: Treat “cache hit rate” and “failure recoverability” as first-class metrics; cost scales linearly with task volume, and the effect of caching is multiplied.

    If an enterprise wants to implement similar capabilities on Baidu AI Cloud, it can adopt a general category combination: use a container platform to host the inference service and agent runtime, use object storage to save code repository snapshots and artifacts, use a message queue to decouple long-task scheduling, and use log services and monitoring alerts to track changes in turn count, token consumption, and cache hit rate, turning a one-off benchmark into continuously observable engineering metrics.

    5. Practical Advice for Building Your Own Evaluation

    1. Fix the task set: Prepare three categories of tasks, defect fixing, feature construction, and refactoring, with no fewer than ten samples each.
    2. Fix the scoring script: Use test pass rate, number of passed checks, and number of static-spec warnings as the main metrics.
    3. Record process metrics: turn count, total input and output tokens, cache hit rate, and wall-clock time per task.
    4. Repeat multiple times and take the median: Local inference is affected by temperature and scheduling, so a single run is not enough to draw conclusions.
    5. Pay attention to failure modes: whether it is “editing the wrong file,” “skipping tests,” or “over-engineering”; different failure modes correspond to different improvement approaches.

    6. Conclusion

    The difference in coding ability among local quantized models is essentially not a difference in “intelligence,” but an engineering trade-off formed by the combination of behavioral strategy and quantization characteristics. Understanding the relationship among turn count, output volume, caching, and quality has more long-term value than remembering a single benchmark score. Automating and metricizing evaluation, and making model selection serve specific R&D scenarios, is the path through which local large models truly deliver returns.