2024-12-11 · 进阶 · 自然语言处理

Evaluating and Aligning CodeLLMs on Human Preference

这篇论文提出了一个新的代码大模型评估基准CodeArena,该基准侧重于评估模型生成的代码是否符合人类偏好,并构建了一个大型合成指令语料库SynCode-Instruct用于改进模型与人类偏好的对齐。

更新于 2024-12-11。作者:Jian Yang、Jiaxi Yang、Ke Jin、Yibo Miao、Lei Zhang、Liqun Yang、Zeyu Cui、Yichang Zhang、Binyuan Hui、Junyang Lin。

中文摘要

代码大型语言模型 (codeLLMs) 在代码生成方面取得了显著进展。大多数之前的代码相关基准测试,包括各种编程练习及其相应的测试用例,被用作评估 codeLLMs 性能和能力的常用指标。然而,当前的 codeLLMs 侧重于合成正确的代码片段,而忽略了与人类偏好的匹配,其中查询应来自实际应用场景,模型生成的响应应满足人类偏好。为了弥合模型生成的响应与人类偏好之间的差距,我们提出了一个严格的人工策划基准 CodeArena,以模拟现实世界编码任务的复杂性和多样性,其中包含 397 个高质量样本,涵盖 40 个类别和 44 种编程语言,这些样本都仔细地从用户查询中整理而来。此外,我们通过扩展网站上的指令,提出了一个多样化的合成指令语料库 SynCode-Instruct(近 200 亿个 tokens),以验证大规模合成指令微调的有效性,其中完全基于合成指令数据训练的 Qwen2.5-SynCoder 实现了开源代码 LLMs 的顶级性能。结果发现基于执行的基准测试和 CodeArena 之间存在性能差异。我们对 40 多个 LLMs 在 CodeArena 上进行的系统实验揭示了开源 SOTA 代码 LLMs(例如 Qwen2.5-Coder)和专有 LLMs(例如 OpenAI o1)之间显著的性能差距,这突显了人类偏好匹配的重要性。\url{https://codearenaeval.github.io/ }

英文摘要

Code large language models (codeLLMs) have made significant strides in code generation. Most previous code-related benchmarks, which consist of various programming exercises along with the corresponding test cases, are used as a common measure to evaluate the performance and capabilities of code LLMs. However, the current code LLMs focus on synthesizing the correct code snippet, ignoring the alignment with human preferences, where the query should be sampled from the practical application scenarios and the model-generated responses should satisfy the human preference. To bridge the gap between the model-generated response and human preference, we present a rigorous human-curated benchmark CodeArena to emulate the complexity and diversity of real-world coding tasks, where 397 high-quality samples spanning 40 categories and 44 programming languages, carefully curated from user queries. Further, we propose a diverse synthetic instruction corpus SynCode-Instruct (nearly 20B tokens) by scaling instructions from the website to verify the effectiveness of the large-scale synthetic instruction fine-tuning, where Qwen2.5-SynCoder totally trained on synthetic instruction data can achieve top-tier performance of open-source code LLMs. The results find performance differences between execution-based benchmarks and CodeArena. Our systematic experiments of CodeArena on 40+ LLMs reveal a notable performance gap between open SOTA code LLMs (e.g. Qwen2.5-Coder) and proprietary LLMs (e.g., OpenAI o1), underscoring the importance of the human preference alignment.\url{https://codearenaeval.github.io/ }

解读

一句话总结

这篇论文提出了一个新的代码大模型评估基准CodeArena,该基准侧重于评估模型生成的代码是否符合人类偏好,并构建了一个大型合成指令语料库SynCode-Instruct用于改进模型与人类偏好的对齐。

问题1:这篇论文想要解决什么具体问题?

• 问题背景:现有的代码大模型评估基准主要关注代码的正确性,忽略了代码是否符合人类偏好这一重要因素。 • 现有方案不足:现有的代码基准测试主要基于代码执行结果,缺乏对人类偏好的考量,无法全面评估代码大模型的性能。 • 研究目标:构建一个基于人类偏好的代码大模型评估基准,并研究如何提升代码大模型与人类偏好的对齐度。

问题2:论文的核心创新点是什么?

• 技术创新:提出了一个名为CodeArena的人工标注的代码评估基准,包含397个高质量样本,涵盖40个子类别和44种编程语言,以及一个近200亿token的大型合成指令语料库SynCode-Instruct。 • 方法改进:通过人工标注和GPT-4o作为评判者,对模型生成的代码进行人类偏好评估,而非仅仅依赖代码执行结果。使用SynCode-Instruct对模型进行微调,提升模型对人类偏好的对齐度。 • 优势:CodeArena更全面地评估了代码大模型的性能,特别是关注了模型与人类偏好的对齐度,SynCode-Instruct提高了开放源码代码LLM的性能。

问题3:实验结果如何验证了方法的有效性?

• 关键实验:在CodeArena上对40多个LLM进行了系统评估,并与其他基准测试(如HumanEval,MBPP,MultiPL-E)进行了比较。分析了不同规模的模型在CodeArena上的表现,以及SynCode-Instruct对模型性能的影响。 • 性能提升:论文中对Qwen2.5-SynCoder模型进行了性能提升的描述,该模型在合成指令数据上进行训练后,在CodeArena上取得了顶尖的性能,超过了大多数开源代码LLM。具体数值需要参考论文中的表格数据。 • 对比结果:实验结果显示,在CodeArena上,开源SOTA代码LLM(如Qwen2.5-Coder)与闭源LLM(如OpenAI o1)之间存在显著的性能差距,表明人类偏好对齐的重要性。与其他基准测试的对比结果也验证了CodeArena的有效性,但具体数值需要参考论文中的表格数据。

问题4:这个研究的实际应用价值是什么?

• 应用场景:CodeArena可用于评估各种代码大模型的性能,帮助开发者改进模型,提升代码生成质量和用户体验。SynCode-Instruct可以用于训练和微调代码大模型。 • 实施建议:建议开发者使用CodeArena评估其模型的性能,并利用SynCode-Instruct改进模型,提升与人类偏好的对齐度。 • 局限与展望:论文指出,收集人类偏好数据成本高昂,未来可以探索更有效的数据收集方法。此外,CodeArena目前样本数量有限,未来可以进一步扩大样本规模,并增加更多编程语言和任务类型。

来源

机器可读索引:llms.txt