arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.09665cs.SE
收藏

量化是决定性障碍吗?来自大型代码模型的实证见解

Is Quantization a Deal-breaker? Empirical Insights from Large Code Models

Saima Afrin, Bowen Xu, Antonio Mastropaolo

AI总结:

本研究通过将AWQ量化技术应用于CodeLlama和DeepSeekCoder生成Java与Python代码,并利用静态分析工具评估圈复杂度等指标,发现量化不仅保持功能正确性,还保留了可维护性等关键代码质量属性。

摘要:

大型语言模型(LLMs)不断增长的规模不仅需要大量的计算资源,而且由于其不断增加的碳足迹而引发了环境问题。模型量化作为一种有效的方法应运而生,它通过降低参数精度(例如从16位降至4位)来减少LLMs的资源需求,同时不会对其性能产生实质性影响。尽管最近的研究已将量化确立为优化大型代码模型(LCMs,专为自动化软件工程定制的LLMs子集)的一种有前景的方法,但其发现仅对其在实际应用中的影响提供了有限的见解。具体而言,当前的调查仅关注量化模型生成代码的功能正确性,却忽略了量化如何影响代码质量的关键方面,如可靠性、可维护性和安全性。为了弥补这一空白,我们的研究调查了量化对自动生成代码定性方面的影响。我们将Activation-aware Weight Quantization(AWQ,激活感知权重量化)应用于两种广泛使用的代码模型CodeLlama和DeepSeekCoder,以生成Java和Python代码。我们使用最先进的静态分析工具,评估了软件质量指标和静态特征,包括圈复杂度、认知复杂度和代码行数。我们的研究结果表明,量化是一种稳健的技术,它不仅保持了功能正确性,还保留了开发者所追求的关键定性代码属性,如可维护性和结构简单性。

英文摘要:

The growing scale of large language models (LLMs) not only demands extensive computational resources but also raises environmental concerns due to their increasing carbon footprint. Model quantization emerges as an effective approach that can reduce the resource demands of LLMs by decreasing parameter precision without substantially affecting performance (e.g., 16 bit to 4 bit). While recent studies have established quantization as a promising approach for optimizing large code models (LCMs), a specialized subset of LLMs tailored for automated software engineering, their findings offer only limited insights into its practical implications. Specifically, current investigations focus only on the functional correctness of the code generated by quantized models, neglecting how quantization impacts critical aspects of code quality such as reliability, maintainability, and security. To bridge this gap, our study investigates the effects of quantization on the qualitative aspects of automatically generated code. We apply Activation-aware Weight Quantization (AWQ) to two widely used code models, CodeLlama and DeepSeekCoder, to generate Java and Python code. Using state-of-the-art static analysis tools, we evaluate software quality metrics and static features including cyclomatic complexity, cognitive complexity, and lines of code. Our findings reveal that quantization is a robust technique that not only preserves functional correctness, but also retains key qualitative code attributes sought after by developers, such as maintainability and structural simplicity.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑