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

SelfCodeAlign:面向代码生成的自对齐方法

SelfCodeAlign: Self-Alignment for Code Generation

University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Northeastern University(东北大学);University of California, Berkeley(加利福尼亚大学伯克利分校);ServiceNow Research(ServiceNow研究院);Hugging Face;Roblox;Cursor AI

Yuxiang Wei, Federico Cassano, Jiawei Liu, Yifeng Ding, Naman Jain, Zachary Mueller, Harm de Vries, Leandro von Werra, Arjun Guha, Lingming Zhang

AI总结:

本研究提出无需人工标注与蒸馏的代码大模型自对齐流水线SelfCodeAlign,通过自生成任务与沙箱验证构建训练数据,微调后模型在多基准上超越同类最优方法,还催生了高性能开源自对齐代码模型StarCoder2-Instruct。

摘要:

指令微调是一种有监督微调方法,可显著提升大语言模型(LLM)遵循人类指令的能力。我们提出SelfCodeAlign,这是首个无需大量人工标注或蒸馏、用于代码大语言模型自对齐的完全透明且许可宽松的流水线。SelfCodeAlign在整个数据生成过程中使用同一基础模型进行推理。它首先从高质量种子代码片段中提取多样化的编码概念以生成新任务,随后为每个任务采样多个响应,将每个响应与测试用例配对,并在沙箱环境中验证它们,最后选择通过验证的样本用于指令微调。在主要实验中,我们将SelfCodeAlign与CodeQwen1.5-7B结合,生成了包含7.4万条指令-响应对的数据集。在该数据集上微调得到的模型在HumanEval+上的pass@1达到67.1,尽管模型规模小10倍,性能仍超过CodeLlama-70B-Instruct。在所有基准测试中,该微调模型的性能始终优于采用OctoPack训练的原始版本,而OctoPack是此前无需人工标注或蒸馏的指令微调的最优方法。此外,我们证明SelfCodeAlign在3B到33B不同规模的大语言模型上均有效,且基础模型能从适配自身数据分布的对齐中获益更多。我们进一步验证了流水线中每个组件的有效性,结果表明SelfCodeAlign的性能优于GPT-4o直接蒸馏,以及OSS-Instruct、Evol-Instruct等主流基于GPT-3.5的蒸馏方法。SelfCodeAlign还促成了StarCoder2-Instruct的诞生,这是首个完全透明、采用宽松许可协议且自对齐的代码大语言模型,具备当前最优的代码生成性能。

英文摘要:

Instruction tuning is a supervised fine-tuning approach that significantly improves the ability of large language models (LLMs) to follow human instructions. We propose SelfCodeAlign, the first fully transparent and permissive pipeline for self-aligning code LLMs without extensive human annotations or distillation. SelfCodeAlign employs the same base model for inference throughout the data generation process. It first extracts diverse coding concepts from high-quality seed snippets to generate new tasks. It then samples multiple responses per task, pairs each with test cases, and validates them in a sandbox environment. Finally, passing examples are selected for instruction tuning. In our primary experiments, we use SelfCodeAlign with CodeQwen1.5-7B to generate a dataset of 74k instruction-response pairs. Finetuning on this dataset leads to a model that achieves a 67.1 pass@1 on HumanEval+, surpassing CodeLlama-70B-Instruct despite being ten times smaller. Across all benchmarks, this finetuned model consistently outperforms the original version trained with OctoPack, the previous state-of-the-art method for instruction tuning without human annotations or distillation. Additionally, we show that SelfCodeAlign is effective across LLMs of various sizes, from 3B to 33B, and that the base models can benefit more from alignment with their own data distribution. We further validate each component's effectiveness in our pipeline, showing that SelfCodeAlign outperforms both direct distillation from GPT-4o and leading GPT-3.5-based distillation methods, such as OSS-Instruct and Evol-Instruct. SelfCodeAlign has also led to the creation of StarCoder2-Instruct, the first fully transparent, permissively licensed, and self-aligned code LLM that achieves state-of-the-art coding performance.

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

↑