Lune

ACL Findings2025

Focused-DPO: Enhancing Code Generation Through Focused Preference Optimization on Error-Prone Points

Kechi Zhang, Ge Li, Jia Li, Yihong Dong, Jia Li, Zhi Jin

Abstract

Code generation models have shown significant potential for automating programming tasks. However, the challenge of generating accurate and reliable code persists due to the highly complex and long-reasoning nature of the task. Even state-of-the-art models often fail in code generation due to small errors, which can drastically affect the overall functionality of code. Our study identifies that current models tend to produce errors concentrated at specific errorprone points, which significantly impacts the accuracy of the generated code. To address this issue, we introduce Focused-DPO, a framework that enhances code generation by directing preference optimization towards these critical error-prone areas. This approach builds on Direct Preference Optimization, emphasizing accuracy in parts prone to errors. Additionally, we develop a method called Error-Point Identification, which constructs a dataset that targets these problematic points without requiring costly human annotations. Our experiments on benchmarks such as HumanEval(+), MBPP(+), and LiveCodeBench demonstrate that Focused-DPO significantly improves the precision and reliability of code generation, reducing common errors and enhancing overall code quality. By focusing on error-prone points, Focused-DPO advances the accuracy and functionality of model-generated code.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

5 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Alignment with Fill-In-the-Middle for Enhancing Code Generation cites CodeDPO: Aligning Code Models with Self Generated and Verified Source Code
  • Alignment with Fill-In-the-Middle for Enhancing Code Generation cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Alignment with Fill-In-the-Middle for Enhancing Code Generation cites Magicoder: Empowering Code Generation with OSS-Instruct
  • Alignment with Fill-In-the-Middle for Enhancing Code Generation cites WizardCoder: Empowering Code Large Language Models with Evol-Instruct
  • CodeDPO: Aligning Code Models with Self Generated and Verified Source Code cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • CodeDPO: Aligning Code Models with Self Generated and Verified Source Code cites WizardCoder: Empowering Code Large Language Models with Evol-Instruct
  • CodeDPO: Aligning Code Models with Self Generated and Verified Source Code cites Self-Instruct: Aligning Language Models with Self-Generated Instructions
  • FGit: Fault-Guided Fine-Tuning for Code Generation cites CodeDPO: Aligning Code Models with Self Generated and Verified Source Code
  • FGit: Fault-Guided Fine-Tuning for Code Generation cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • FGit: Fault-Guided Fine-Tuning for Code Generation cites Magicoder: Empowering Code Generation with OSS-Instruct
  • FGit: Fault-Guided Fine-Tuning for Code Generation cites WizardCoder: Empowering Code Large Language Models with Evol-Instruct
  • FGit: Fault-Guided Fine-Tuning for Code Generation cites Self-Instruct: Aligning Language Models with Self-Generated Instructions
  • Token-level Direct Preference Optimization cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Magicoder: Empowering Code Generation with OSS-Instruct cites Self-Instruct: Aligning Language Models with Self-Generated Instructions
  • Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization cites Direct Preference Optimization: Your Language Model is Secretly a Reward Model
  • Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization cites Magicoder: Empowering Code Generation with OSS-Instruct
  • Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization cites WizardCoder: Empowering Code Large Language Models with Evol-Instruct
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. CodeDPO: Aligning Code Models with Self Generated and Verified Source CodeKechi Zhang, Ge Li, Yihong Dong, Jingjing Xu et al.ACL 2025 · 45 citations
  2. Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency OptimizationMingzhe Du, Anh Tuan Luu, Yue Liu, Yuhao Qing et al.NeurIPS 2025 · 18 citations
  3. Alignment with Fill-In-the-Middle for Enhancing Code GenerationHouxing Ren, Zimu Lu, Weikang Shi, Haotian Hou et al.EMNLP 2025
  4. FGit: Fault-Guided Fine-Tuning for Code GenerationLishui Fan, Zhongxin Liu, Haoye Wang, Lingfeng Bao et al.ASE 2025
  5. Decoding-Unlearning: Fact Forgetting via Entropy-Guided InferenceJingwen Pu, Mingjun Shi, Xinrui Ren, Yizhe Wang et al.ACL 2026

Builds on9

  1. Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning et al.NeurIPS 2023 · 10,924 citations
  2. WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun et al.ICLR 2024 · 945 citations
  3. Self-Instruct: Aligning Language Models with Self-Generated InstructionsYizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu et al.ACL 2023 · 540 citations
  4. Magicoder: Empowering Code Generation with OSS-InstructYuxiang Wei, Zhe Wang, Jiawei Liu, Yifeng Ding et al.ICML 2024 · 246 citations
  5. Token-level Direct Preference OptimizationYongcheng Zeng, Guoqing Liu, Weiyu Ma, Ning Yang et al.ICML 2024 · 136 citations

Related papers

  1. Teaching Your Models to Understand Code via Focal Preference AlignmentJie Wu, Haoling Li, Xin Zhang, Xiao Liu et al.EMNLP 2025
  2. DolphCoder: Echo-Locating Code Large Language Models with Diverse and Multi-Objective Instruction TuningYejie Wang, Keqing He, Guanting Dong, Pei Wang et al.ACL 2024
  3. Process-Supervised Reinforcement Learning for Code GenerationYufan Ye, Ting Zhang, Wenbin Jiang, Hua HuangEMNLP 2025 · 1 citation
  4. Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?Bonan Kou, Shengmai Chen, Zhijie Wang, Lei Ma et al.FSE 2024 · 8 citations
  5. Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled PreferencesMohammad Saqib Hasan, Saikat Chakraborty, Santu Karmaker, Niranjan BalasubramanianACL 2025
Dusk over the sea between two cliffs drawn in fine vertical lines