更环保但功能强大:使用Quantization驯服大型代码生成模型
Greener yet Powerful: Taming Large Code Generation Models with Quantization
摘要:
ML驱动的代码生成旨在通过基于自然语言提示智能地生成代码块来帮助开发人员以更高效的方式编写代码。最近,大型预训练深度学习模型已经大大推动了代码生成的边界,并取得了令人印象深刻的性能。尽管它们的功能很强大,但大量的模型参数对在常规软件开发环境中调整它们构成了重大威胁,在常规软件开发环境中,开发人员可能使用标准笔记本电脑或中型服务器来开发代码。这样的大型模型会导致大量的资源使用(在内存、延迟和美元方面)以及碳足迹。模型压缩是解决这些挑战的一种很有前途的方法。提出了几种技术来压缩通常用于视觉或文本数据的大型预训练模型。在许多可用的压缩技术中,我们确定量化最适用于代码生成任务,因为它不需要显著的再训练成本。由于量化表示具有较低位整数的模型参数(例如,int8),模型大小和运行时延迟都将受益于这种int表示。我们广泛研究了量化模型对不同维度的代码生成任务的影响:(i)资源使用和碳足迹,(ii)准确性,(iii)鲁棒性。为此,通过系统的实验,我们找到了一个配方的量化技术,甚至可以运行一个$6$ B模型在一个普通的笔记本电脑没有显着的准确性或鲁棒性退化。我们进一步发现,该方法也适用于代码摘要任务。
英文摘要:
ML-powered code generation aims to assist developers to write code in a more productive manner, by intelligently generating code blocks based on natural language prompts. Recently, large pretrained deep learning models have substantially pushed the boundary of code generation and achieved impressive performance. Despite their great power, the huge number of model parameters poses a significant threat to adapting them in a regular software development environment, where a developer might use a standard laptop or mid-size server to develop her code. Such large models incur significant resource usage (in terms of memory, latency, and dollars) as well as carbon footprint. Model compression is a promising approach to address these challenges. Several techniques are proposed to compress large pretrained models typically used for vision or textual data. Out of many available compression techniques, we identified that quantization is mostly applicable for code generation task as it does not require significant retraining cost. As quantization represents model parameters with lower-bit integer (e.g., int8), the model size and runtime latency would both benefit from such int representation. We extensively study the impact of quantized model on code generation tasks across different dimension: (i) resource usage and carbon footprint, (ii) accuracy, and (iii) robustness. To this end, through systematic experiments we find a recipe of quantization technique that could run even a $6$B model in a regular laptop without significant accuracy or robustness degradation. We further found the recipe is readily applicable to code summarization task as well.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。