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

Semi-Instruct:为代码大型语言模型桥接自然指令与自指令

Semi-Instruct: Bridging Natural-Instruct and Self-Instruct for Code Large Language Models

Harbin Institute of Technology(哈尔滨工业大学);Du Xiaoman (Beijing) Science Technology Co., Ltd.(度小满(北京)科技有限公司)

Xianzhen Luo, Qingfu Zhu, Zhiming Zhang, Xu Wang, Qing Yang, Dongliang Xu, Wanxiang Che

AI总结:

提出 Semi-Instruct,融合 natural-instruct 的多样正确代码与 self-instruct 的自动配对能力,并通过执行正确代码生成测试用例验证代码,显著提升 Code LLM 程序合成性能。

摘要:

指令微调在代码大型语言模型(Code LLMs)的程序合成任务中发挥着关键作用。目前,收集微调数据主要有两种范式:natural-instruct(人工编写)和 self-instruct(自动生成)。natural-instruct 包含多样且正确的代码,但缺少指令-代码对,并且存在嵌套单行代码等不规范代码格式。相比之下,self-instruct 可自动生成规范的成对数据,却因生成重复内容而多样性较低,且无法保证代码正确性。为桥接这两种范式,我们提出 Semi-Instruct。它首先通过类似 self-instruct 的方法,将 natural-instruct 中多样但不规范的代码转换为规范的指令-代码对。为验证生成代码的正确性,我们设计了一种构建测试用例的新方法:生成测试用例输入,并执行 natural-instruct 中的正确代码以获得输出。最终保留多样且正确的指令-代码对用于指令微调。实验表明,semi-instruct 显著优于 natural-instruct 和 self-instruct;此外,随着数据规模增加,性能稳步提升。

英文摘要:

Instruction tuning plays a pivotal role in Code Large Language Models (Code LLMs) for the task of program synthesis. Presently, two dominant paradigms for collecting tuning data are natural-instruct (human-written) and self-instruct (automatically generated). Natural-instruct includes diverse and correct codes but lacks instruction-code pairs, and exists improper code formats like nested single-line codes. In contrast, self-instruct automatically generates proper paired data. However, it suffers from low diversity due to generating duplicates and cannot ensure the correctness of codes. To bridge the both paradigms, we propose \textbf{Semi-Instruct}. It first converts diverse but improper codes from natural-instruct into proper instruction-code pairs through a method similar to self-instruct. To verify the correctness of generated codes, we design a novel way to construct test cases by generating cases' inputs and executing correct codes from natural-instruct to get outputs. Finally, diverse and correct instruction-code pairs are retained for instruction tuning. Experiments show that semi-instruct is significantly better than natural-instruct and self-instruct. Furthermore, the performance steadily improves as data scale increases.

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

↑