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

探索面向代码生成的大语言模型数据高效适配

Exploring Data-Efficient Adaptation of Large Language Models for Code Generation

Key Laboratory of High Confidence Software Technologies (Peking University), Ministry of Education(高可信软件技术重点实验室(北京大学));School of Computer Science, Peking University, Beijing(计算机学院(北京大学))

Xue Jiang, Yihong Dong, Zhiyuan Fan, Zhi Jin, Wenpin Jiao, Ge Li

AI总结:

针对少数据场景下 LLM 代码生成适配难题,本文提出 DEED,利用模型自身错误并通过 Self-Revise 迭代修正与微调,在多个基准上以少量数据实现 Pass@1 平均相对提升 46.2%。

摘要:

尽管大语言模型(LLM)在代码生成方面已取得显著进展,但它们在特定场景中的代码生成任务上仍存在困难。这些场景通常需要对 LLM 进行适配以满足特定需求,然而实践中可用的训练数据有限,导致代码生成性能较差。因此,如何利用少量训练数据使 LLM 有效适配新场景,是当前代码生成面临的一项主要挑战。本文提出一种名为 DEED 的新型适配方法,其全称为 Data-Efficient adaptation with Error-Driven learning for code generation(面向代码生成的基于错误驱动学习的数据高效适配)。DEED 将 LLM 所犯的错误用作学习机会,通过错误修正来克服其自身不足,从而实现高效学习。具体而言,DEED 包括识别 LLM 生成的错误代码、采用 Self-Revise 进行代码修正、使用修正后的代码优化模型,以及迭代式地调整该过程以持续改进。实验结果表明,与其他主流微调方法相比,DEED 在少量训练数据下取得了更优性能,在多个代码生成基准上的 Pass@1 平均相对提升为 46.2%。我们还验证了 Self-Revise 的有效性;与来自数据集的代码样本相比,它生成的修正代码能够更高效地优化模型。此外,DEED 在各种 LLM 上持续表现出强劲性能,凸显了其适用性。

英文摘要:

Although Large Language Models (LLMs) have made significant progress in code generation, they still struggle with code generation tasks in specific scenarios. These scenarios usually necessitate the adaptation of LLMs to fulfill specific needs, but the limited training data available in practice leads to poor code generation performance. Therefore, how to effectively adapt LLMs to new scenarios with few training data is a major challenge for current code generation. In this paper, we propose a novel adaptation approach named DEED, which stands for Data-Efficient adaptation with Error-Driven learning for code generation. DEED leverages the errors made by LLMs as learning opportunities, using error revision to overcome their own shortcomings, thus achieving efficient learning. Specifically, DEED involves identifying error code generated by LLMs, employing Self-Revise for code revision, optimizing the model with revised code, and iteratively adapting the process for continuous improvement. Experimental results show that, compared to other mainstream fine-tuning approaches, DEED achieves superior performance with few training data, showing an average relative improvement of 46.2% in Pass@1 on multiple code generation benchmarks. We also validate the effectiveness of Self-Revise, which generates revised code that optimizes the model more efficiently compared to the code samples from datasets. Moreover, DEED consistently demonstrates strong performance across various LLMs, underscoring its applicability.

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

↑