LLM Quantization Comparison and Best Practices for Local AI Coding

    This article compares mainstream LLM quantization approaches—4-bit integer (GPTQ/EXL), FP8, and hardware-native formats like NVFP4—and presents a reproducible local evaluation framework for agentic coding, covering task design, unified tool environments, and fully automated scoring. Based on benchmark results across three quantized models, it distills goal-driven selection guidance on speed, cost (prompt cache hit rate), and code quality, along with engineering practices for observability and output constraints.

    LLM Quantization Comparison and Best Practices for Local AI Coding

    As open-source large language models improve rapidly, more development teams are experimenting with deploying models on local workstations for code generation, bug fixing, and even end-to-end application building. However, there is a wide gap between “the model runs” and “the model works well”: How should you choose a quantization scheme? How do you design an objective evaluation? What do differences in model working styles mean for real-world productivity? Drawing on a reproducible local agentic coding evaluation, this article breaks down these questions systematically.

    1. The Technical Essence of Quantization: The Trade-off Triangle of Precision, Memory, and Speed

    In local deployment scenarios, GPU memory capacity is often the first constraint. The core idea of quantization is to represent model weights with lower-bit-width numeric formats, thereby compressing memory footprint and improving throughput. The mainstream approaches each have their own focus:

    1. 4-bit integer quantization (e.g., GPTQ/EXL-family formats)

    Weights are compressed to 4 bits, reducing memory requirements to roughly one quarter of FP16, allowing large models to fit on a single GPU or even consumer-grade cards. The trade-off is that inference kernels require additional dequantization computation, so per-token generation speed may lag behind higher-bit-width schemes. Its advantages are the lowest hardware barrier and a mature ecosystem, making it well suited for prototyping and resource-constrained environments.

    2. FP8 quantization

    Using 8-bit floating-point representation, FP8 incurs far less precision loss than 4-bit schemes and can achieve significant native acceleration on hardware with FP8 tensor core support. FP8 strikes a good balance between fidelity and performance, and is currently a popular choice for production-grade local inference.

    3. Native low-precision formats for new hardware (e.g., NVFP4)

    A new generation of inference chips is beginning to support 4-bit floating-point formats, aiming to achieve near-FP8 precision on top of 4-bit memory efficiency. These formats are highly dependent on hardware generations, so when selecting one you must verify the maturity of support in the inference stack.

    Selection key point: There is no universally superior quantization scheme—only how well it matches your hardware, model architecture, and task type. Evaluation should consider four metrics together: memory footprint, time-to-first-token, sustained throughput, and downstream task accuracy, rather than focusing on any single number.

    2. Evaluation Methodology: How to Objectively Measure Agentic Coding Ability

    Traditional approaches—manual scoring or using an LLM as a judge—are both expensive and prone to preference bias. A credible local coding evaluation should follow these design principles:

    1. Task design close to real engineering

    Evaluation tasks should cover two levels. The first is fine-grained bug fixing: given a set of codebases containing known defects (17 function-level bugs in this practice), the model must locate and fix them in an agentic manner. The second is end-to-end application building: implementing from scratch a web application with multiple acceptance checks (19 in this case). The former tests code comprehension and precise modification ability; the latter tests architectural planning and long-horizon execution.

    2. A unified tool-calling environment

    The model should operate as an agent invoking a unified set of native tools (file read/write, terminal execution, test running, etc.—about 21 capabilities), ensuring that all evaluated models face exactly the same environmental constraints. Tool permissions, timeouts, and output truncation policies must be identical; otherwise, the comparison is meaningless.

    3. Fully automated machine scoring

    All acceptance checks are performed through executable test scripts and static checks, with no LLM judges or subjective human evaluation involved. The resulting metrics—pass rate, elapsed time, token consumption—are reproducible and auditable.

    3. Interpreting the Results: Working Style Differences Across Three Quantization Routes

    Under this framework, three open-source models with different quantization schemes were benchmarked. All three completed every test, but their process characteristics differed significantly, revealing behavioral divergence driven by the combination of model traits and quantization:

    The ultra-concise type (4-bit integer quantization route): This model completed the application build in 18.4 minutes—the fastest of the three. Interestingly, its underlying inference engine’s raw speed was not the best; it won through extremely restrained output, generating only about 20,000 tokens in total. This highlights that end-to-end time = per-token speed × total token count, and output verbosity is a seriously underestimated efficiency variable. For rapid prototyping scenarios, a “talk less, do more” model style is extremely valuable.

    The plan-driven type (FP8 quantization route): This model used the fewest interaction rounds—only 77—and exhibited a clear “plan first, execute later” pattern. More importantly, its prompt cache hit rate reached 98%: because the context was heavily reused, actual computation cost was compressed to a very low level. For long-running, unattended batch tasks (such as bulk code migration or overnight automated fixes), the cache hit rate directly determines the bill, making this type of model the first choice for cost-sensitive scenarios.

    The deep-thinking type (native low-precision route): This model included extensive internal reasoning in every interaction round, resulting in the longest total time (27.6 minutes). But slow work yields refined results: its code was the most standards-compliant, it automatically wrote 18 test cases, and its engineering quality clearly led the pack. When deliverables need to enter a formal codebase and pass code review, this “slow but steady” mode actually reduces the cost of subsequent manual corrections.

    4. Practical Selection Guidance and Supporting Engineering Practices

    Combining the results above, we can distill a goal-driven selection path:

    • Prioritizing prototype speed: Choose a concise-output 4-bit scheme to validate ideas in the shortest time;
    • Balancing efficiency and operating cost: Choose an FP8 scheme, with close attention to its cache hit capability;
    • Prioritizing delivery quality: Choose a scheme with deep reasoning capability, accepting longer runtimes in exchange for higher code and test quality.

    In addition, regardless of which scheme you choose, the following engineering practices are worth adopting. First, build a unified observability system that records per-round token consumption, cache hit rate, and tool call success rate, turning model behavior into data. Second, set explicit output constraints for the agent (such as limiting explanatory text and enforcing structured plans), which directly shortens end-to-end time. Third, use general-purpose cloud capabilities—object storage, logging services, and monitoring/alerting—to persistently archive the process data and artifacts of local evaluation tasks, making cross-comparison and regression verification easier. General-purpose storage and monitoring services, such as those offered by Baidu AI Cloud, can serve as the data foundation for this kind of evaluation pipeline.

    Conclusion

    Local LLM-powered coding has moved from the “can it run” stage to the “how to choose the best” stage. The quantization scheme determines the resource foundation, the evaluation methodology determines the quality of your understanding, and insight into model working styles is the key to turning benchmark scores into real productivity. We hope the framework in this article helps teams build their own reproducible model selection methodology.