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

Source: [Focused-DPO: Enhancing Code Generation Through Focused Preference Optimization on Error-Prone Points](<https://www.sota2.com/research/paper/68fa79141e209131cea7c068>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-04T04:22:56.998Z

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

Published: 2025-02-17T06:16:02.000Z

## 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 error-prone 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.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Code Generation on HumanEval+ v1 (test)](<https://www.sota2.com/research/sota/code-generation-on-humaneval-plus-v1-test.md>): Code Generation; HumanEval+ v1 (test); Pass Rate: 87.8.

- [Code Generation on LiveCodeBench (test)](<https://www.sota2.com/research/sota/code-generation-on-livecodebench-test.md>): Code Generation; LiveCodeBench (test); Pass@1 Overall: 33.9.

- [Code Generation on MBPP Plus (test)](<https://www.sota2.com/research/sota/code-generation-on-mbpp-plus-test.md>): Code Generation; MBPP Plus (test); Accuracy: 76.2.

- [Code Generation on CodeContests (test)](<https://www.sota2.com/research/sota/code-generation-on-codecontests-test.md>): Code Generation; CodeContests (test); Pass@1: 31.7.

- [Code Generation on MBPP (test)](<https://www.sota2.com/research/sota/code-generation-on-mbpp-test.md>): Code Generation; MBPP (test); Pass@1: 78.4.

- [Code Generation on HumanEval 1.0 (test)](<https://www.sota2.com/research/sota/code-generation-on-humaneval-1-0-test.md>): Code Generation; HumanEval 1.0 (test); Pass@1: 0.927.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2502.11475>)

[PDF](<https://arxiv.org/pdf/2502.11475.pdf>)
