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

资源高效且有效的代码摘要生成

Resource-Efficient & Effective Code Summarization

Saima Afrin, Joseph Call, Khai-Nguyen Nguyen, Oscar Chaparro, Antonio Mastropaolo

AI总结:

本文研究 QLoRA 在代码摘要生成(Code-to-NL)任务中的适用性,通过在 Python 和 Java 上评估 CodeLlama 与 DeepSeek-Coder,证明 QLoRA 能实现代码语言模型的资源高效微调。

摘要:

代码语言模型(CLMs)在自动化软件工程任务(如缺陷修复、代码生成和代码文档编写)中已展现出高效性。这一进展由大规模模型的扩展所驱动,模型参数规模从数百万到数万亿不等(例如 GPT-4)。然而,随着模型规模的增长,可持续性问题也随之出现,因为这些模型极其耗费资源,凸显了对高效、环保解决方案的需求。GreenAI 技术,如 QLoRA(量化低秩适配),为应对大模型的可持续性问题提供了一条有前景的路径,因为它们能够实现资源高效的模型微调。先前的研究已经证明了 QLoRA 在代码相关任务中的有效性,尤其是那些以自然语言为输入、以代码为目标输出的任务(NL-to-Code),例如代码生成。然而,尚无研究探索其在本质上与 NL-to-Code(自然语言到代码)相似但方向相反的任务中的应用,例如代码摘要生成。这留下了一个空白,即对 QLoRA 在 Code-to-NL 任务中的泛化能力了解不足,而这类任务对于支持开发者理解和维护代码同样重要。为填补这一空白,我们研究了 QLoRA 在 NL-to-Code 任务中的能力可以在多大程度上被利用并迁移到代码摘要生成这一具有代表性的 Code-to-NL 任务中。我们的研究评估了两个最先进的代码语言模型(CodeLlama 和 DeepSeek-Coder)在两种编程语言(Python 和 Java)上的表现。我们的研究任务要求模型为 Python 和 Java 代码方法生成描述。结果与先前关于 QLoRA 用于源代码生成的发现一致,表明 QLoRA 能够实现代码语言模型在代码摘要生成任务上的高效微调。

英文摘要:

Code Language Models (CLMs) have demonstrated high effectiveness in automating software engineering tasks such as bug fixing, code generation, and code documentation. This progress has been driven by the scaling of large models, ranging from millions to trillions of parameters (e.g., GPT-4). However, as models grow in scale, sustainability concerns emerge, as they are extremely resource-intensive, highlighting the need for efficient, environmentally conscious solutions. GreenAI techniques, such as QLoRA (Quantized Low-Rank Adaptation), offer a promising path for dealing with large models' sustainability as they enable resource-efficient model fine-tuning. Previous research has shown the effectiveness of QLoRA in code-related tasks, particularly those involving natural language inputs and code as the target output (NL-to-Code), such as code generation. However, no studies have explored its application to tasks that are fundamentally similar to NL-to-Code (natural language to code) but operate in the opposite direction, such as code summarization. This leaves a gap in understanding how well QLoRA can generalize to Code-to-NL tasks, which are equally important for supporting developers in understanding and maintaining code. To address this gap, we investigate the extent to which QLoRA's capabilities in NL-to-Code tasks can be leveraged and transferred to code summarization, one representative Code-to-NL task. Our study evaluates two state-of-the-art CLMs (CodeLlama and DeepSeek-Coder) across two programming languages: Python and Java. Our research tasked models with generating descriptions for Python and Java code methods. The results align with prior findings on QLoRA for source code generation, showing that QLoRA enables efficient fine-tuning of CLMs for code summarization.

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

↑