arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.13588cs.SEcs.CL
收藏

面向预训练代码智能语言模型的遗传自动提示学习

Genetic Auto-prompt Learning for Pre-trained Code Intelligence Language Models

College of Computer Science, Sichuan University(四川大学计算机学院);University of Exeter(埃克塞特大学);Huazhong University of Science and Technology(华中科技大学)

Chengzhe Feng, Yanan Sun, Ke Li, Pan Zhou, Jiancheng Lv, Aojun Lu

AI总结:

针对预训练代码智能模型计算成本高且现有提示设计依赖人工或受限的问题,提出基于遗传算法的无梯度自动提示方法GenAP,支持理解与生成任务,在缺陷预测等三项任务上优于现有方法。

摘要:

随着预训练语言模型(PLMs)作为代码智能的一种流行方法,其规模不断增大,其使用的计算成本已变得极其昂贵。提示学习作为自然语言处理领域的最新进展,成为解决这一挑战的潜在方案。本文研究了提示学习在代码智能任务中的有效性。我们揭示了它对人工设计提示的依赖,这通常需要大量的人力与专业知识。此外,我们发现现有的自动提示设计方法由于梯度依赖、高计算需求和有限的适用性等因素,在代码智能任务中非常受限。为了有效解决这两个问题,我们提出了Genetic Auto Prompt(GenAP),它利用一种精心设计的遗传算法来自动设计提示。借助GenAP,非专家人员能够毫不费力地生成比精心人工设计的更优的提示。GenAP无需梯度或额外的计算成本即可运行,使其具备无梯度和成本效益的特点。此外,GenAP同时支持理解型和生成型两类代码智能任务,展现出极大的适用性。我们在三种流行的代码智能PLMs上,结合缺陷预测、代码摘要和代码翻译这三项典型的代码智能任务对GenAP进行了实验。结果表明,GenAP能够有效地自动化提示设计过程。具体而言,GenAP在所有三项任务中均优于其他所有方法(例如,在缺陷预测任务中平均提高了2.13%的准确率)。据我们所知,GenAP是首个为代码智能PLMs自动设计提示的工作。

英文摘要:

As Pre-trained Language Models (PLMs), a popular approach for code intelligence, continue to grow in size, the computational cost of their usage has become prohibitively expensive. Prompt learning, a recent development in the field of natural language processing, emerges as a potential solution to address this challenge. In this paper, we investigate the effectiveness of prompt learning in code intelligence tasks. We unveil its reliance on manually designed prompts, which often require significant human effort and expertise. Moreover, we discover existing automatic prompt design methods are very limited to code intelligence tasks due to factors including gradient dependence, high computational demands, and limited applicability. To effectively address both issues, we propose Genetic Auto Prompt (GenAP), which utilizes an elaborate genetic algorithm to automatically design prompts. With GenAP, non-experts can effortlessly generate superior prompts compared to meticulously manual-designed ones. GenAP operates without the need for gradients or additional computational costs, rendering it gradient-free and cost-effective. Moreover, GenAP supports both understanding and generation types of code intelligence tasks, exhibiting great applicability. We conduct GenAP on three popular code intelligence PLMs with three canonical code intelligence tasks including defect prediction, code summarization, and code translation. The results suggest that GenAP can effectively automate the process of designing prompts. Specifically, GenAP outperforms all other methods across all three tasks (e.g., improving accuracy by an average of 2.13% for defect prediction). To the best of our knowledge, GenAP is the first work to automatically design prompts for code intelligence PLMs.

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

↑