With the remarkable progress of Code Large Language Models (Code LLMs) in achieving semantic correctness, execution efficiency has become an increasingly important dimension for evaluating their practical utility. However, existing approaches typically treat full programs as a single optimization target during training, without explicitly modeling the structural factors that influence efficiency. As a result, although these models can generate semantically correct code, they fail to learn, at a fine-grained level, the underlying skeleton features that lead to efficient implementations. To address this limitation, we propose SkelDPO (Skeleton-Guided Direct Preference Optimization), a skeleton-guided preference optimization framework that systematically enhances the efficiency of code generation. SkelDPO first identifies efficient and inefficient implementations from the code dataset and, through comparative analysis, locates their efficiency-prone and inefficiency-prone points, forming alignment signals between efficiency and inefficiency skeletons. During training, a joint code and skeleton preference loss is introduced, enabling the model to learn semantic correctness while reinforcing its understanding of efficiency-critical components in code. Results show that SkelDPO consistently surpasses existing methods: compared with SOTA method that relies solely on efficient and inefficient code preference optimization, it improves Pass@1, Beyond@1, and Effi@1 by 3-6%, 3-7%, and 2-5%, with greater improvements observed on complex tasks. Overall, SkelDPO provides a new perspective on skeleton-level efficiency alignment, breaking the limitation of conventional preference optimization that relies solely on correctness or efficiency pairs. All datasets and source code are publicly available at: https://github.com/icpcSkelDPO/SkelDPO.


翻译:随着代码大语言模型(Code LLMs)在语义正确性方面取得显著进展,执行效率已成为评估其实用价值的重要维度。然而,现有方法通常将完整程序视为单一优化目标进行训练,未能显式建模影响效率的结构性因素。因此,尽管这些模型能生成语义正确的代码,却无法在细粒度层面学习导致高效实现的底层骨架特征。为解决这一局限,我们提出SkelDPO(骨架引导的直接偏好优化)——一种系统性提升代码生成效率的骨架引导偏好优化框架。SkelDPO首先从代码数据集中识别高效与低效实现,通过对比分析定位其效率敏感点与非效率敏感点,形成效率骨架与非效率骨架之间的对齐信号。在训练阶段,引入联合代码与骨架偏好损失,使模型在学习语义正确性的同时强化对代码中效率关键组件的理解。实验结果表明,SkelDPO持续超越现有方法:与仅依赖高效与低效代码偏好优化的最先进方法相比,其在Pass@1、Beyond@1和Effi@1指标上分别提升3-6%、3-7%与2-5%,且在复杂任务上改进幅度更大。总体而言,SkelDPO为骨架级效率对齐提供了新视角,突破了传统偏好优化仅依赖正确性或效率对的局限。所有数据集与源代码均公开于:https://github.com/icpcSkelDPO/SkelDPO。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
什么是后训练?大语言模型训练后优化方法综述,87页pdf
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
《大型语言模型代码生成》综述
专知会员服务
70+阅读 · 2024年6月4日
【NeurIPS2023】直接偏好优化,代替RLHF
专知会员服务
44+阅读 · 2024年1月7日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Arxiv
0+阅读 · 5月18日
VIP会员
最新内容
《量子技术的军事任务技术适配与利用》
专知会员服务
0+阅读 · 7分钟前
美国从乌克兰无人机战争中学习经验
专知会员服务
7+阅读 · 6月21日
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
5+阅读 · 6月21日
学习数据的几何:形状空间分析数学综述
专知会员服务
10+阅读 · 6月17日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员