对比预训练与微调模型的对齐效果,发现预训练模型对齐提升更大但原始性能较差。
Reward-Free Code Alignment from Pretrained or Fine-Tuned LLM: Unpacking the Trade-offs for Code Generation

- 用DPO和BoNBoN两种免奖励机制对齐代码模型
- 预训练模型对齐后在功能评测上提升更显著
- 微调模型对齐后易退化,适合追求稳定性的开发者
大型语言模型(LLM)对齐通过偏好数据训练模型生成更符合质量标准的输出。尽管非代码任务的对齐技术已有研究,但其在代码生成中的作用尚不明确:是否能同时满足功能性(可执行、正确)与非功能性(可读性、风格、可维护性)要求?以及对齐应从预训练还是指令微调版本开始?本文通过实证研究回答上述问题。我们选取五种SOTA LLM,使用DPO和BoNBoN两种免奖励对齐方法,在预训练与微调两个版本上进行实验。每条训练样本通过SelfCodeAlign管道生成接受与拒绝的偏好对。评估功能需求采用HumanEval+、MBPP+、EvalPerf、EvoEval四个基准,评估非功能需求使用CODAL基准,涵盖软件工程实践中五个维度的代码质量。结果表明:预训练→对齐路径在对齐后提升幅度更大;但预训练模型原始准确率普遍低于微调模型。而微调→对齐路径提升较小,甚至出现性能下降。
原文摘要 · Abstract (English)
Large Language Model (LLM) alignment trains an LLM using preference data to produce outputs that better meet established quality standards. While LLM alignment techniques are studied for non-coding tasks, we know little about their usefulness for coding tasks. It is unclear whether LLM code alignment could support both functional requirements (producing executable, correct code) and non-functional requirements (code readability, style, maintainability). It is also unknown whether alignment for a code LLM should begin with base pretrained version or the finetuned (i.e., instruction-tuned) version of the LLM. In this paper, we offer insights on the above two research questions by conducting an empirical study. We studied five state-of-the-art (SOTA) LLMs using two widely used LLM alignment techniques: Direct Preference Optimization (DPO) and BoNBoN. For each training record, we created a preference pair as accepted and rejected instances by using the SelfCodeAlign pipeline. DPO and BoNBoN are reward-free models, i.e., they eliminate the need for multiple reward scores for output preferences. We tuned each LLM using the two alignment techniques in two settings: pretrained and finetuned versions of an LLM. We evaluated functional requirements using four SOTA benchmarks (HumanEval+, MBPP+, EvalPerf, EvoEval) and non-functional requirements using the CODAL benchmark, which evaluates code quality across five dimensions derived from software engineering practices. We find that pretrained-to-aligned pathways achieve larger improvements in the aligned variant over its pretrained variant. But the pretrained variant is generally less accurate than its finetuned variant. However, finetuned- to-aligned offers smaller performance improvements or, in some cases, degradation in the aligned variant than its finetuned variant.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。