CodeUltraFeedback: An LLM-as-a-Judge Dataset for Aligning Large Language Models to Coding Preferences

📄 arXiv: 2403.09032v3 📥 PDF

作者: Martin Weyssow, Aton Kamanda, Xin Zhou, Houari Sahraoui

分类: cs.SE, cs.CL, cs.LG

发布日期: 2024-03-14 (更新: 2024-12-27)


💡 一句话要点

提出CodeUltraFeedback以解决LLM与编码偏好对齐问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 编码偏好 数据集构建 模型对齐 自动化软件工程 反馈优化

📋 核心要点

  1. 现有方法主要依赖自动化指标,无法有效捕捉用户对编码偏好的细微差别,导致对LLM输出的评估不够准确。
  2. 本文提出了CodeUltraFeedback数据集,利用LLM-as-a-Judge的方法论,通过对14个LLM的输出进行评估,提供了更为细致的对齐评估。
  3. 实验结果表明,优化后的CodeLlama-7B-Instruct模型在编码偏好对齐和HumanEval+基准测试中的功能正确性上均优于原始模型。

📝 摘要(中文)

评估大型语言模型(LLMs)与用户定义的编码偏好的对齐程度是一项具有挑战性的任务,现有方法主要依赖自动化指标和静态分析工具,往往无法捕捉用户指令和LLM输出的细微差别。为了解决这一问题,本文提出了LLM-as-a-Judge的方法论,并介绍了CodeUltraFeedback数据集,旨在促进LLM对齐的评估与改进。该数据集包含10,000条编码指令,每条指令附有来自14个不同LLM生成的四个响应,并基于五种编码偏好进行排名。分析结果显示,GPT-3.5和GPT-4的响应普遍优于开放权重LLM,揭示了闭源与开源模型之间的显著对齐差异。通过使用CodeUltraFeedback进行反馈数据,本文进一步优化了CodeLlama-7B-Instruct模型,提升了其在编码偏好对齐和功能正确性方面的表现。

🔬 方法详解

问题定义:本文旨在解决大型语言模型与用户编码偏好之间的对齐问题。现有方法多依赖于自动化评估,无法充分理解用户的具体需求和偏好,导致评估结果的局限性。

核心思路:提出LLM-as-a-Judge的方法,通过引入GPT-3.5作为评判者,对14个不同LLM生成的响应进行评估,从而更全面地捕捉用户的编码偏好。

技术框架:整体流程包括数据集构建、响应生成、评估与反馈三个主要模块。首先,构建包含10,000条编码指令的数据集;其次,利用14个LLM生成响应;最后,使用GPT-3.5对这些响应进行评分和反馈。

关键创新:最重要的创新在于引入了LLM作为评判者的概念,使得对LLM输出的评估更加贴近用户需求,克服了传统方法的局限性。

关键设计:在数据集构建中,采用了多样化的编码指令和响应生成策略;在评估过程中,设置了五种不同的编码偏好,并通过GPT-3.5提供了详细的评分和反馈,确保评估的全面性和准确性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,优化后的CodeLlama-7B-Instruct模型在编码偏好对齐方面优于其他大型LLM,且在HumanEval+基准测试中功能正确性提升显著,展示了该方法在实际应用中的有效性。

🎯 应用场景

该研究的潜在应用领域包括自动化软件工程、智能编程助手和代码审查工具。通过优化LLM与编码偏好的对齐,能够显著提升编程效率和代码质量,未来可能推动智能编程技术的广泛应用。

📄 摘要(原文)

Evaluating the alignment of large language models (LLMs) with user-defined coding preferences is a challenging endeavour that requires a deep assessment of LLMs' outputs. Existing methods and benchmarks rely primarily on automated metrics and static analysis tools, which often fail to capture the nuances of user instructions and LLM outputs. To address this gap, we propose using the LLM-as-a-Judge methodology to evaluate the alignment of LLMs with coding preferences. Based on this approach, we present CodeUltraFeedback, a comprehensive dataset designed to facilitate the evaluation and improvement of LLM alignment. CodeUltraFeedback consists of 10,000 coding instructions, each annotated with four responses generated from a diverse pool of 14 LLMs. These responses are ranked based on five distinct coding preferences using GPT-3.5 as a judge, providing both numerical scores and detailed textual feedback. Our analysis of CodeUltraFeedback reveals that responses from GPT-3.5 and GPT-4 are generally preferred over those from open-weight LLMs, highlighting significant differences in alignment between closed and open-weight models. In turn, we explore the usage of CodeUltraFeedback as feedback data to fine-tune and align CodeLlama-7B-Instruct using supervised fine-tuning (SFT) and reinforcement learning from AI feedback (RLAIF) with direct preference optimization (DPO). The resulting aligned CodeLlama-7B-Instruct model outperforms larger LLMs in terms of alignment with coding preferences and shows improved functional correctness on the HumanEval+ benchmark compared to the original instruct model. Therefore, our contributions bridge the gap in preference tuning of LLMs for code and set the stage for further advancements in model alignment and RLAIF in automated software engineering.