Large Language Models (LLMs) have demonstrated remarkable potential in automating software development tasks. While recent advances leverage Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) to align models with human preferences, the optimal training strategy remains unclear across diverse code preference scenarios. This paper systematically investigates the roles of SFT and DPO in aligning LLMs with different code preferences. Through both theoretical analysis and empirical observation, we hypothesize that SFT excels in scenarios with objectively verifiable optimal solutions, while applying SFT followed by DPO (S&D) enables models to explore superior solutions in scenarios without objectively verifiable optimal solutions. Based on the analysis and experimental evidence, we propose Adaptive Preference Optimization (APO), a dynamic integration approach that adaptively amplifies preferred responses, suppresses dispreferred ones, and encourages exploration of potentially superior solutions during training. Extensive experiments across six representative code preference tasks validate our theoretical hypotheses and demonstrate that APO consistently matches or surpasses the performance of existing SFT and S&D strategies. Our work provides both theoretical foundations and practical guidance for selecting appropriate training strategies in different code preference alignment scenarios.


翻译:大语言模型(LLMs)在自动化软件开发任务中展现出显著潜力。尽管近期研究通过监督微调(SFT)和直接偏好优化(DPO)使模型与人类偏好对齐,但在多样化的代码偏好场景中,最优训练策略仍不明确。本文系统研究了SFT和DPO在使LLMs与不同代码偏好对齐中的作用。通过理论分析和实证观察,我们假设:在存在客观可验证最优解的场景中,SFT表现优异;而在缺乏客观可验证最优解的场景中,先应用SFT再结合DPO(S&D)能使模型探索更优解。基于分析与实验证据,我们提出自适应偏好优化(APO),这是一种动态集成方法,能在训练过程中自适应地增强偏好响应、抑制非偏好响应,并鼓励探索潜在更优解。在六个代表性代码偏好任务上的大量实验验证了我们的理论假设,并证明APO持续匹配或超越现有SFT与S&D策略的性能。本研究为不同代码偏好对齐场景中选择适宜训练策略提供了理论基础与实践指导。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
KnowledGPT:基于知识库的检索和存储访问增强大型语言模型
论文浅尝 | GEOM-GCN: Geometric Graph Convolutional Networks
开放知识图谱
14+阅读 · 2020年4月8日
【NeurIPS2019】图变换网络:Graph Transformer Network
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
17+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员