Function-Level Execution Feedback for Code Preference Optimization
Organizations: Department of Electrical and Computer Engineering, Seoul National University · Department of Computer Science and Engineering, Konkuk University
Abstract
Process supervision has improved mathematical reasoning, where intermediate steps are naturally expressed as chains of thought. In code generation, however, process supervision remains underexplored because there is no standard notion of a step. Supervision can target lines, reasoning traces, or program states, making it unclear what to label and optimize. We propose STEP-KTODER, a framework for code preference optimization that defines steps as module-level functions in decomposed multi-function programs and assigns binary correctness labels via automatically generated unit tests. Our method provides a code-specific instantiation of stepwise KTO, combining function-level process supervision with outcome-level feedback on the full program. We evaluate on HumanEval(+), MBPP(+), BigCodeBench, and LiveCodeBench, showing that STEP-KTODER improves over outcome-only KTO and DPO. Further analysis shows that execution-based labels are essential: LLM-as-a-judge annotations systematically over-predict function failures, corrupt positive step labels, and degrade downstream preference optimization. Code is available at: https://github.com/inechnech/STEP-KTODER.
Figures & tables
| Qwen-1.5B | Qwen-3B | DeepSeek | |
| Dataset composition | |||
| Total rows | 11,397 | 11,440 | 6,573 |
| GT rows | 5,018 | 5,018 | 0 |
| Generated rows | 6,379 | 6,422 | 6,573 |
| Step supervision | |||
| Step-supervised | 9,376 | 9,455 | 5,157 |
| Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| Qwen2.5-Coder-1.5B-Instruct | 0.689 | 0.604 | 0.664 | 0.556 | 0.240 | 0.054 | 0.052 |
| w/ DPO | 0.695 | 0.610 | 0.664 | 0.563 | 0.245 | 0.054 | 0.056 |
| w/ Target-DPO | 0.683 | 0.628 | 0.664 | 0.558 | 0.245 | 0.068 | 0.019 |
| w/ KTO | 0.701 | 0.610 | 0.648 | 0.542 | 0.245 | 0.061 | 0.052 |
| w/ Step-KTOder | 0.701 | 0.616 | 0.656 | 0.548 | 0.248 | 0.068 | 0.056 |
| Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| Conflict-handling policy | |||||||
| KTO (no step loss) | 0.878 | 0.835 | 0.741 | 0.624 | 0.367 | 0.115 | 0.116 |
| Step-KTOder + mask conflicts | 0.878 | 0.835 | 0.741 | 0.624 | 0.367 | 0.115 | 0.119 |
| Step-KTOder + keep conflicts (default) | 0.878 | 0.835 | 0.746 | 0.630 | 0.367 | 0.128 | 0.127 |
| Step loss weight | |||||||
| Replacement target | Repair rate |
|---|---|
| Local-negative ( ) | 74.9% |
| Random observed | 32.9% |
| Local-positive ( ) | 1.2% |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| KTO | |||||||
| Step-KTOder | |||||||
| Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| Qwen2.5-7B-Instruct | 0.811 | 0.768 | 0.839 | 0.704 | 0.366 | 0.135 | 0.134 |
| w/ DPO | 0.817 | 0.768 | 0.844 | 0.706 | 0.362 | 0.149 | 0.142 |
| w/ Target-DPO | 0.799 | 0.744 | 0.796 | 0.677 | 0.376 | 0.108 | 0.138 |
| w/ KTO | 0.823 | 0.780 | 0.847 | 0.709 | 0.361 | 0.155 | 0.138 |
| w/ Step-KTOder | 0.829 | 0.787 | 0.844 | 0.717 | 0.362 | 0.162 | 0.142 |
| Source | Difficulty | # Problems | % |
|---|---|---|---|
| TACO | easy | 8,904 | 35.0 |
| medium | 3,244 | 12.7 | |
| medium_hard | 2,745 | 10.8 | |
| hard | 3,162 | 12.4 | |
| very_hard | 2,374 | 9.3 | |
| unknown_difficulty | 5,014 | 19.7 |
| Source | Difficulty | Total | Validated | Pass rate |
| TACO | easy | 4,112 | 2,141 | 52.1% |
| medium | 1,200 | 225 | 18.8% | |
| medium_hard | 520 | 193 | 37.1% | |
| Total | 5,832 | 2,559 | 43.9% | |
| APPS | introductory | 2,325 | 2,069 | 89.0% |
| interview | 442 | 390 | 88.2% |
| Qwen2.5-Coder family | DeepSeek-Coder | ||||
| Source | Difficulty | Ground truth anchors | 1.5B gen. | 3B gen. | 6.7B gen. |
| TACO | easy | 2,141 | 2,671 | 2,695 | 2,748 |
| medium | 225 | 271 | 278 | 301 | |
| medium_hard | 193 | 245 | 237 | 260 | |
| APPS | introductory | 2,069 | 2,643 | 2,657 | 2,661 |
| interview | 390 | 549 | 555 | 603 | |
| TACO | APPS | |
| Decomposition scale | ||
| Validated problems | 2,559 | 2,459 |
| Total functions | 7,199 | 6,926 |
| Testable functions | 7,144 | 6,920 |
| Unit-test generation | ||
| First-pass parse success | 98.8% | 99.6% |
| Configuration | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| (default) | 0.878 | 0.835 | 0.746 | 0.630 | 0.367 | 0.128 | 0.127 |
| 0.878 | 0.835 | 0.746 | 0.624 | 0.365 | 0.122 | 0.127 | |
| 0.878 | 0.835 | 0.746 | 0.624 | 0.365 | 0.122 | 0.049 | |
| Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| KTO only | 0.878 | 0.835 | 0.741 | 0.624 | 0.367 | 0.115 | 0.116 |
| Step only | 0.866 | 0.823 | 0.741 | 0.630 | 0.360 | 0.100 | 0.112 |
| Step-KTOder (default) | 0.878 | 0.835 | 0.746 | 0.630 | 0.367 | 0.128 | 0.127 |
| Training data | Method | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | |||
| On-policy (default) | KTO | 0.793 | 0.726 | 0.749 | 0.640 | 0.347 | 0.122 | 0.127 |
| On-policy (default) | Step-KTOder | 0.799 | 0.732 | 0.754 | 0.648 | 0.347 | 0.128 | 0.131 |
| Off-policy (Qwen 3B-generated) | KTO | 0.805 | 0.735 | 0.749 | 0.640 | 0.345 | 0.115 | 0.112 |
| Off-policy (Qwen 3B-generated) | Step-KTOder | 0.805 | 0.735 | 0.751 | 0.648 | 0.347 | 0.122 | 0.127 |
| Step labels | HumanEval | MBPP | BigCodeBench | LiveCodeBench | |||
|---|---|---|---|---|---|---|---|
| Base | Plus | Base | Plus | Full | Hard | ||
| KTO baseline | 0.878 | 0.835 | 0.741 | 0.624 | 0.367 | 0.115 | 0.116 |
| Step-KTOder + execution (default) | 0.878 | 0.835 | 0.746 | 0.630 | 0.367 | 0.128 | 0.127 |
| Step-KTOder + LLM-as-a-judge (GPT-5.4 mini) | 0.860 | 0.817 | 0.746 | 0.635 | 0.354 | 0.095 | 0.112 |
| Relative change vs. execution | -2.1% | -2.2% | +0.0% | +0.8% | -3.5% | -25.8% | -11.8% |
Code Generation
Code generation studies methods for turning natural-language, visual, or formal specifications into executable programs and code edits.
See all 316 papers