ArXiv: 2409.19715
🎯 Pitch
Open-source 7B models trained with PPO in this new RL environment generate feedback that boosts a code editor’s bug-fix rate by over 13 points, matching GPT-4-Turbo’s effectiveness. Remarkably, the paper reveals that standard unit-test-based rewards actually misalign with feedback helpfulness unless the editor is first fine-tuned to leverage feedback instead of ignoring it.
1. Executive Summary
This paper introduces COFFEE-GYM, a comprehensive reinforcement learning environment for training open-source models that generate natural language feedback to guide code editing. Built around a dataset of human-written code edit traces (COFFEE) and a unit-test-driven reward function (COFFEEEVAL), the environment addresses the reliance on closed-source LLMs for feedback generation by enabling RL-based alignment—specifically PPO—to produce feedback that faithfully improves downstream code correctness. Feedback models trained with COFFEE-GYM on DeepSeekCoder-7B achieve a 13.4 percentage-point improvement on HumanEvalFix over the base editor (73.8% vs. 60.4% Pass@1), making open-source feedback models comparable to GPT-4-Turbo, while establishing that COFFEEEVAL provides more accurate reward signals than GPT-4-based evaluation only when paired with a code editor explicitly trained to reflect feedback helpfulness rather than defaulting to correct edits.
2. Context and Motivation
The Core Problem: Feedback-Enhanced Code Editing Needs Open-Source Alternatives
Large language models have demonstrated remarkable progress in code generation tasks, with some models approaching human-level performance on standard benchmarks like HumanEval (Chen et al., 2021b). This success has made them valuable tools for assisting human programmers in everyday development workflows (Köpf et al., 2023). However, as the paper notes in Section 1, these models still produce errors with meaningful frequency — a fact documented by both academic analysis and the practical experience of developers who use coding assistants. When an LLM generates buggy code, the natural next step is code editing: the process of taking an incorrect solution and transforming it into a correct one (Muennighoff et al., 2023).
The key insight that motivates this work is that natural language feedback — descriptive explanations of what went wrong and how to fix it — can substantially improve code editing outcomes for code LLMs. The paper points to Self-Refine (Madaan et al., 2023) as evidence: when GPT-4's own natural language feedback is provided alongside erroneous code, downstream editing performance improves significantly. The feedback acts as a bridge between the error and the correction, giving the editing model explicit reasoning about what needs to change rather than forcing it to deduce the problem implicitly from test failures alone.
But this success comes with a critical limitation that the paper identifies immediately: the ability to generate genuinely helpful feedback is currently restricted to powerful closed-source models like GPT-4. As stated in the introduction:
"abilities to generate helpful feedback, as they report, are limited to powerful closed-source LLMs (e.g., GPT-4)"
This dependence creates three concrete problems that Section 1 lays out:
-
High computational cost: Continuous API calls to closed-source models for feedback generation are expensive, especially for organizations that need feedback at scale — think automated code review pipelines, educational tools that provide real-time guidance to students, or CI/CD systems that annotate pull requests with natural language suggestions.
-
Security risks: Sending proprietary or confidential code to external APIs raises concerns about data exposure. As the paper notes, citing Siddiq and Santos (2023) and Greshake et al. (2023), this can introduce indirect prompt injection vulnerabilities and privacy violations. For companies working on closed-source software, sensitive algorithms, or competitive codebases, routing code through third-party APIs is often prohibited by security policy — rendering GPT-4-based feedback generation unavailable in the very settings where it would be most valuable.
-
Limited applicability: The reliance on external services means feedback generation is not available in air-gapped environments, on-device deployments, or scenarios requiring low latency without network calls.
The paper therefore frames its central goal directly: "This work aims to foster building open-source feedback models that produce effective feedback for code editing" (Section 1). The ambition is not merely to replicate closed-source performance but to create a reproducible, self-contained pipeline — including the dataset, training environment, and reward signals — that the community can build upon without external dependencies.
Why This Problem Matters
The importance of open-source feedback models extends beyond cost savings and security. There are several structural reasons why this problem has broader significance:
Feedback generation is a teachable skill, not just an emergent capability. The paper's approach rests on the assumption that generating helpful code feedback is not an exotic ability that only emerges at massive scale (like GPT-4), but rather a skill that can be learned through appropriate training data and reward design. If true, this means the open-source community can close the gap with closed-source models in this specific capability without needing to match their parameter counts — a finding with implications for other specialized LLM applications.
Code editing is fundamentally different from code generation. While code generation asks "produce a correct solution from scratch," code editing asks "given an existing (incorrect) solution, identify what's wrong and fix it." The paper argues that natural language feedback is particularly valuable for the latter because it provides explicit reasoning about the edit, making the correction process more interpretable and potentially more reliable. An open-source feedback model makes this capability available broadly, not just to users of premium APIs.
RL for natural language generation is under-explored in code domains. While reinforcement learning from human feedback (RLHF; Ouyang et al., 2022) has been widely applied to align LLMs for general instruction following, its application to training models that provide feedback on code — where the ultimate metric of success is whether the downstream code passes unit tests — is much less studied. The paper positions COFFEE-GYM as an environment specifically designed to enable this class of RL experiments, with the potential to accelerate research on a broader set of code-oriented feedback tasks.
Where Prior Approaches Fall Short
The paper identifies several existing strategies for providing feedback to code LLMs, each with significant limitations that motivate the need for a new approach:
Supervised Fine-Tuning on GPT-4-Generated Feedback (Zheng et al., 2024)
An intuitive approach is to take an open-source code LLM, collect a dataset of feedback generated by GPT-4 on code editing examples, and fine-tune the open-source model to imitate that feedback. Zheng et al. (2024) created the Code-Feedback dataset along these lines and trained the OpenCodeInterpreter model. This is the supervised fine-tuning (SFT) baseline that the paper evaluates against (Table 3).
The problem, as Section 2.2 articulates, is that SFT optimizes a superficial objective — the probability of the target feedback token sequence — without any signal about whether that feedback actually helps fix code:
"simply training to optimize the probability of the target sequence does not achieve much improvement for code editing, because it does not consider the impact of feedback on code editing (Liu et al., 2022)"
The evidence for this failure is visible in the bottom of Figure 1: the SFT model trained on Code-Feedback achieves only 62.1% Pass@1 on HumanEvalFix when paired with DeepSeekCoder-7B as the editor — barely above the 60.4% achieved by direct editing without any feedback at all. The 1.7 percentage-point gain from SFT feedback is dramatically smaller than what GPT-4-Turbo feedback provides (+14.0 points). This gap — between imitation and genuine helpfulness — is the core motivation for moving beyond SFT.
The deeper issue is a misalignment between the training objective and the downstream goal. SFT rewards the model for producing feedback that looks like GPT-4's output, but the evaluation metric cares only about whether the edited code passes unit tests. A piece of feedback can read fluently, use appropriate technical vocabulary, and closely resemble the training distribution while being useless or even harmful for actual code editing. Conversely, feedback that looks different from the training data could be highly effective. SFT has no mechanism to distinguish these cases.
Execution Feedback (Chen et al., 2023)
Execution feedback is the most straightforward alternative: rather than natural language, provide the raw output of running the code — stack traces, error messages, assertion failures. Section 5 lists this as a baseline. Table 3 shows that execution feedback does provide consistent improvements over no feedback (e.g., +7.9 points on DeepSeekCoder-7B, +7.9 points on CodeGemma-7B), and this is consistent with prior work showing that LLMs can use runtime error information productively.
However, execution feedback has fundamental limitations that natural language can address:
- It tells you that something went wrong, not why. A stack trace points to a line of code where execution failed but doesn't explain the logical misconception that produced the error. For semantic bugs — where code runs without crashing but produces wrong outputs — execution feedback may provide no signal at all beyond a test failure.
- It requires an executable environment. Compilation errors, runtime exceptions, and test failures all assume you can actually run the code. For partial code snippets, code that requires unavailable dependencies, or pseudocode, execution feedback is unavailable.
- It doesn't teach. A human learning from execution feedback needs to already understand the language and the problem to interpret the error. Natural language feedback can explain the reasoning in a pedagogical way, making it more valuable for educational and assistive contexts.
The paper acknowledges execution feedback as useful but insufficient — the natural language feedback from their best model outperforms execution feedback by substantial margins across all tested editor models (e.g., 73.8% vs. 68.3% on DeepSeekCoder-7B for HumanEvalFix, Table 3).
Self-Feedback (Madaan et al., 2023)
Self-feedback refers to having the same code LLM that generated the code also generate natural language feedback on its own errors — essentially asking the model to self-critique. The paper tests this baseline by having each code editor model generate its own feedback.
The results in Table 3 are striking: open-source code LLMs struggle dramatically with self-feedback. On DeepSeekCoder-7B, self-feedback provides +7.3 points on HumanEvalFix but actually hurts on COFFEE-TEST (-5.5 points). On CodeGemma-7B, self-feedback is essentially neutral (+2.2 on COFFEE-TEST, -0.7 on HumanEvalFix). On OpenCodeInterpreter-DS-Coder-7B, self-feedback substantially degrades performance (-9.4 points on COFFEE-TEST, -3.7 on HumanEvalFix).
The paper attributes this to the difficulty of generating helpful feedback:
"open-source code LLMs, despite their capabilities in the code domain, struggle to generate helpful NL feedback for code editing (Self-Feedback), highlighting the complexity of producing effective feedback"
This finding is important because it directly challenges the assumption — common in the self-refinement literature — that models can productively critique their own outputs. The paper's data suggests that for code editing specifically, the ability to generate effective natural language feedback is a distinct capability from the ability to generate or edit code, and it does not emerge automatically in open-source models at the 7B parameter scale. This makes the case for dedicated feedback models trained specifically for this purpose.
GPT-3.5/4-Turbo Feedback (Closed-Source Baselines)
The paper uses GPT-3.5-Turbo and GPT-4-Turbo as upper-bound references throughout. Their feedback achieves strong results: GPT-4-Turbo feedback paired with DeepSeekCoder-7B reaches 74.4% Pass@1 on HumanEvalFix (Table 3), the best result in that table. But as discussed above, these models are not open-source, incur API costs and latency, and raise data privacy concerns. The paper's goal is explicitly to match or approach this performance level with fully open models.
The Reinforcement Learning Gap: What's Missing for Feedback Training
Section 2.2 introduces what the paper sees as the natural solution: apply reinforcement learning to align feedback models with the actual helpfulness of their output, following the RLHF paradigm (Ouyang et al., 2022). The logic is straightforward:
- Start with an SFT model that has basic feedback generation capability (acquired by imitating GPT-3.5-Turbo's feedback on human-written code edits — the COFFEE dataset's
c*annotations). - Use RL (specifically PPO or DPO) to further train the model so that it generates feedback that actually improves code editing outcomes, not just feedback that looks similar to the training data.
But this immediately runs into practical challenges. The paper identifies three specific gaps that prevent the straightforward application of RL to feedback generation for code editing (Section 2.3, elaborated in Section 3):
Gap 1: Limited error scenarios in existing datasets. SFT initialization requires a dataset of (problem, wrong code, feedback, correct code) examples. Existing datasets (like Code-Feedback from Zheng et al., 2024) are based on model-generated code with synthetic errors. As Figure 2 illustrates, these datasets have limitations:
- They are biased toward errors that current LLMs actually make, missing error patterns that human programmers commonly produce but that models avoid.
- They lack problems at the highest difficulty levels, since model-generated errors require the model to attempt the problem at all — for problems where even GPT-4 fails (Figure 5c, Pass@1 of 16.6% on Gold-level problems), there are fewer model-generated wrong solutions to work with.
- The diversity of errors is limited: Figure 5b shows that machine-generated wrong codes from ChatGPT and GPT-4 have higher embedding similarity (i.e., are more homogeneous) than human-generated wrong codes from competitive programming platforms.
Gap 2: Lack of pairwise (correct vs. wrong) feedback data. Both PPO (which requires training a reward model) and DPO (which directly optimizes from preference pairs) need datasets where each (problem, wrong code) instance is annotated with both a helpful and an unhelpful piece of feedback, with a known preference ranking. Without this, the model cannot learn what distinguishes good feedback from bad. Existing datasets provide only a single feedback per instance (typically GPT-4's output), which is insufficient for preference-based training.
Gap 3: Absence of validated reward models. PPO requires a reward model that can score generated feedback during training. The standard approach in RLHF is to train a separate reward model on human preference judgments, but for code editing feedback, the ground-truth reward should ideally be based on whether the feedback leads to correct code — a property that can be measured objectively via unit tests. However, as the paper discovers (Section 4.2, Table 2), simply using a general code LLM as the editor and measuring whether its output passes unit tests does not produce an accurate reward signal, because powerful code LLMs tend to ignore feedback quality and produce correct edits regardless. This means a reliable reward model requires a specially trained editor that faithfully reflects feedback helpfulness — something no prior work had developed.
How This Paper Positions Itself
The paper frames COFFEE-GYM as addressing all three gaps simultaneously, making it the first comprehensive environment for RL-based training of code feedback models:
For the dataset gap: COFFEE collects human-authored code edit traces from an online competitive programming platform (identified as ACM-ICPC style, Section 3.1.1), gathering submission histories where human programmers iteratively submit solutions until passing hidden test cases. This provides natural (q, wrong_code, correct_code) triplets across five difficulty levels, from beginner to expert, including problems that even GPT-4 cannot reliably solve (Figure 5c). The dataset includes approximately 4,800 problem sets with an average of 2.7 submissions per user and approximately 36 test cases per problem for evaluation.
For the pairwise feedback gap: Rather than collecting only one piece of feedback per instance, COFFEE annotates both correct feedback (c*) — describing the differences between a wrong solution and the correct solution — and incorrect feedback (~c) — describing the differences between two consecutive wrong solutions. This creates natural preference pairs where c* ≻ ~c for any given (q, y), providing exactly the data needed for DPO and reward model training without requiring human annotators to explicitly rank feedback.
For the reward modeling gap: COFFEEEVAL introduces a specially trained code editor ϕ that is taught to faithfully follow feedback — generating correct edits when given helpful feedback and incorrect edits when given unhelpful feedback — by training on both (correct feedback → correct code) and (incorrect feedback → incorrect code) pairs with explicit [Correct]/[Wrong] keyword conditioning (Section 3.2.1, Equation 2). By using this editor to produce edited code and measuring its correctness against a suite of unit tests (Equation 1), COFFEEEVAL provides a reward signal that the paper shows (Table 2) is more correlated with ground-truth feedback helpfulness than GPT-4-based evaluation methods like G-Eval (Liu et al., 2023c).
The paper explicitly positions itself within the broader RLHF tradition (Section 2.2):
"Inspired by the success of RLHF (Ouyang et al., 2022), we reformulate feedback modeling with reinforcement learning (RL), where we align feedback models with the helpfulness of feedback during training."
But it also distinguishes its approach from standard RLHF by noting that the reward in this setting is objective and task-driven (unit test pass rates) rather than subjective and human-judged (preference ratings). The paper connects to prior work on using unit test results as rewards for code generation RL (Le et al., 2022; Liu et al., 2023a; Shen et al., 2023) but argues that directly applying this approach to feedback evaluation fails because code LLMs do not faithfully reflect feedback quality in their edits — a finding demonstrated empirically in Table 2 and discussed at length in Section 4.3. COFFEEEVAL's editor training is therefore presented as the key innovation that makes unit-test-driven reward modeling viable for feedback training.
The paper also positions itself relative to concurrent work by Ni et al. (2024) on building feedback models for code, noting that while that work explores a similar direction, it does not release the dataset or model checkpoint — making COFFEE-GYM's public release a contribution to reproducibility and community-driven progress in the area.
3. Technical Approach
3.1 Reader Orientation
COFFEE-GYM is a reinforcement learning training environment — a bundled combination of a dataset, a reward function, and training infrastructure — designed specifically to let researchers train open-source language models that generate natural language feedback to help fix buggy code. The problem it solves is the misalignment between what supervised fine-tuning optimizes (producing feedback that looks correct) and what actually matters (producing feedback that causes downstream code editors to produce correct programs). The solution takes the form of a unit-test-driven reward function paired with a specially trained code editor that faithfully translates feedback helpfulness into measurable editing outcomes, enabling PPO-based RL training that directly optimizes for the property we care about: does this feedback help fix the bug?
3.2 Big-Picture Architecture (Diagram in Words)
The system has five major components, arranged in a pipeline that flows from raw data collection through to a trained feedback model:
-
COFFEE Dataset — human-authored code edit traces scraped from a competitive programming platform, annotated with pairwise (correct vs. incorrect) natural language feedback via GPT-3.5-Turbo and augmented with synthetic unit tests. This provides the raw material for both SFT initialization and reward modeling.
-
SFT Feedback Model (θ_init) — the base DeepSeekCoder-7B model fine-tuned on COFFEE's (problem, wrong_code, correct_feedback) pairs. This produces a model that can generate plausible feedback, but is not yet aligned with downstream editing effectiveness.
-
COFFEEEVAL Reward Function — a pipeline that takes generated feedback, feeds it alongside the problem and wrong code to a specially trained editor model (ϕ), runs the editor's output through a suite of unit tests, and returns the fraction of passed tests as a scalar reward. The critical sub-component is the editor model itself, which is trained to faithfully reflect feedback helpfulness rather than reflexively producing correct code.
-
RL Training Loop (PPO) — takes the SFT model as the initial policy, generates feedback for training problems, scores each piece of feedback via COFFEEEVAL, and updates the model parameters to maximize expected reward, using PPO's clipped surrogate objective with a KL penalty against the initial SFT policy.
-
Trained Feedback Model (θ_final) — the output artifact: an open-source model that, given a problem description and incorrect code, produces natural language feedback that meaningfully improves subsequent code editing.
Information flows as follows: human code submissions are collected from the platform → GPT-3.5-Turbo annotates correct and incorrect feedback on each edit pair → the SFT model is initialized on correct feedback → PPO training begins: the current policy generates feedback → the feedback is concatenated with the problem and wrong code and fed to the COFFEEEVAL editor → the editor produces edited code → unit tests evaluate the edited code → the pass rate becomes the reward → PPO updates the policy to increase expected reward → the cycle repeats with the updated policy generating new feedback.
3.3 Roadmap for the Deep Dive
-
First, the COFFEE dataset construction pipeline (Section 3.1), because it is the foundation that enables everything else: SFT initialization data, pairwise preference data for DPO/reward modeling, and test cases for COFFEEEVAL all come from COFFEE. Understanding what data is collected and how it is annotated is prerequisite to understanding the training procedures.
-
Second, the COFFEEEVAL reward function (Section 3.2), including the critical editor model training procedure (Section 3.2.1), because COFFEEEVAL is the mechanism that makes RL possible — without a reliable reward signal, PPO cannot align the feedback model with editing outcomes. The editor training is the key innovation that distinguishes COFFEEEVAL from naive unit-test-based evaluation.
-
Third, the SFT initialization procedure, because it provides the starting policy for RL and establishes the baseline that PPO must improve upon. Understanding what the SFT model learns (and what it misses) is essential context for the RL results.
-
Fourth, the PPO training setup, including how the reward is computed during training, what objective the policy optimizes, and what hyperparameters control the alignment process.
-
Fifth, the DPO and Rejection Sampling alternatives, because the paper benchmarks these against PPO in Section 5.2, and understanding their different data requirements and optimization mechanisms illuminates why PPO proves most effective.
3.4 Detailed, Sentence-Based Technical Breakdown
This is an infrastructure and methodology paper whose core idea is that training feedback models with RL requires (a) a dataset that captures diverse, real human errors with pairwise feedback annotations, and (b) a reward function that measures actual downstream code correctness rather than surface-level feedback quality — and that neither of these existed before COFFEE-GYM.
COFFEE Dataset: Human-Written Code Edit Traces with Pairwise Feedback
The COFFEE dataset is constructed in three sequential stages: collecting raw edit traces from human programmers, annotating those traces with correct and incorrect feedback, and augmenting each problem with synthetic test cases for downstream evaluation.
Stage 1: Collecting Code Edit Traces from Human Programmers
The paper sources code submission data from an online competitive programming platform — specifically the Korean platform at acmicpc.net, as confirmed by the footnote in Section 3.1.1. This platform operates like many competitive programming sites: users are given a problem description (q), they write and submit solutions, the platform runs hidden test cases against each submission, and the user iterates until all test cases pass.
What makes this platform valuable for COFFEE is that it preserves complete submission histories. For a given user solving a given problem, the platform records every submission — not just the final correct one. This yields natural trajectories of the form:
where each $\tilde{y}_k$ is an incorrect submission (one that failed at least one hidden test case) and $y^*_n$ is the final correct submission that passed all tests. The paper then decomposes these trajectories into edit pairs: for each incorrect submission $\tilde{y}_k$, the pair $(\tilde{y}_k, y^*_n)$ represents the edit from that particular wrong state to the correct solution. This produces a dataset of $(q, \tilde{y}, y^*)$ triplets — problem description, wrong code, correct code.
Why this design over alternatives? The paper contrasts this human-authored data with model-generated code editing datasets (such as Code-Feedback from Zheng et al., 2024) in Figure 2. Model-generated data has two key limitations:
-
Difficulty ceiling: Models can only generate wrong code for problems they actually attempt. Figure 5c shows that GPT-4-Turbo achieves only 16.6% Pass@1 on Gold-level problems (the hardest tier on the platform). This means model-generated datasets systematically underrepresent hard problems — the very problems where feedback is most valuable because the model needs the most help.
-
Error diversity: Figure 5b uses CodeBERT embeddings to measure the similarity of wrong code samples from humans versus from ChatGPT and GPT-4. The human-generated wrong codes show a broader spread of embedding similarities (histogram bars shifted left toward lower cosine similarity), indicating more diverse error patterns. Machine-generated errors tend to cluster — they share structural similarities because they arise from the same model's biases and failure modes. A feedback model trained only on machine-generated errors may not generalize to the more varied mistakes humans actually make.
To ensure the dataset spans difficulty levels comprehensively, the paper collects an equal number of problems from each of five difficulty tiers used by the platform (ranging from beginner to expert). It also collects submission histories from 100 different users per problem to capture solution diversity, since different programmers approach the same problem with different algorithms, data structures, and coding idioms.
The resulting dataset statistics (Figure 4): approximately 44,782 total instances, with an average of 2.7 submissions per user per problem, 4.19 error lines per wrong code on average, 35.5 test cases per problem (added in Stage 3), and feedback averaging 269.0 characters in length. Problem descriptions average 674.1 characters, wrong codes average 649.4 characters, and correct solutions average 674.1 characters.
Design choice: submission history length varies. Figure 5a shows the distribution of average edit trace length by difficulty level. Higher difficulty tiers show progressively longer average edit traces — meaning programmers at harder levels make more incorrect submissions before arriving at a correct solution. This validates that the difficulty tiers capture genuine complexity differences and that the dataset contains richer edit histories for harder problems, providing more training data where it is most needed.
Stage 2: Annotating Pairwise Feedback Data
Given the raw $(q, \tilde{y}, y^*)$ triplets, the paper needs natural language feedback that explains what edits are needed to transform $\tilde{y}$ into $y^*$. Rather than hiring human annotators (which would be expensive at this scale), the paper uses GPT-3.5-Turbo with a carefully designed prompting strategy to generate both correct and incorrect feedback automatically.
Correct feedback $c^*$: For each edit pair $(\tilde{y}_k, y^*_n)$, GPT-3.5-Turbo is prompted to describe how the correct solution $y^*_n$ differs from the wrong code $\tilde{y}_k$. The prompt (Appendix D.1) provides the problem description, input/output format, the incorrect code, and the correct code, and asks the model to generate an explanation that guides the refinement from the wrong state to the correct state. The generation uses top-p sampling with p = 0.95 and temperature T = 0.7, with a maximum of 500 tokens.
Why use GPT-3.5-Turbo instead of GPT-4? The paper does not explicitly justify this choice, but the context suggests two reasons. First, cost: COFFEE contains tens of thousands of instances, and generating feedback for all of them with GPT-4 would be substantially more expensive. Second, consistency with the SFT initialization: the SFT model is trained on exactly this data, so the feedback style it learns matches what GPT-3.5-Turbo produces, which is the same model family available for comparison. Using GPT-4 annotations would create a quality gap between training data and what the SFT model can actually produce, potentially making the SFT baseline look worse for reasons unrelated to the feedback's actual helpfulness.
Quality validation of annotated feedback. The paper conducted a human evaluation of the GPT-3.5-Turbo feedback on 100 sampled instances from the COFFEE test set (Appendix A.1.2). Workers from Amazon Mechanical Turk who passed a Python proficiency qualification rated feedback on a 1–5 Likert scale. The average score was 3.88 with standard deviation 0.91, and the distribution (Table 4) shows that 69% of feedback received a 4 or 5 ("mostly correct" or "completely correct"), with only 7.6% receiving a 1 or 2. This validates that the automated annotation produces feedback of acceptable quality for training, though the paper is transparent that it is not perfect — the 3.88 average leaves room for improvement that RL training can potentially address.
Incorrect feedback $\tilde{c}$: This is where the paper's design becomes notably clever. Rather than generating arbitrary unhelpful feedback, the paper uses the sequential nature of human edit traces to create naturally contrasting feedback pairs. For two consecutive incorrect submissions $\tilde{y}_{k-1}$ and $\tilde{y}_k$ in a user's submission history, GPT-3.5-Turbo is prompted to describe the difference between them — producing feedback $\tilde{c}$ that describes the edit from one wrong state to another wrong state. This feedback is "incorrect" in the sense that it does not lead to a fully correct solution, but it is not random noise — it describes a real edit that a human programmer actually made, which means it reflects plausible but insufficient corrections. The prompt template for this is in Appendix D.2.
Why this matters for RL training. Both PPO (which requires training a reward model on preference pairs) and DPO (which directly optimizes from preference pairs) need datasets where each (q, y) instance has both a preferred and a dispreferred feedback with a known ranking $c^+ \succ c^-$. By construction, COFFEE provides this: $c^* \succ \tilde{c}$ for any edit pair, since $c^*$ describes the path to a correct solution while $\tilde{c}$ describes a transition between two incorrect states. The paper also constructs longer preference chains implicitly: for a trajectory with multiple incorrect submissions, there are multiple $(\tilde{y}_k, y^*_n)$ pairs, each yielding $c^* \succ \tilde{c}$ for different wrong-code baselines.
Data filtering. The paper applies two filtering steps to maintain data quality (Appendix A.1.1). First, it removes submission histories where GPT-3.5-Turbo fails to identify any errors — these cases would produce vacuous or irrelevant feedback. Second, it removes solutions from different users that are identical, since identical correct solutions usually indicate copying (the user didn't go through an editing process, they just pasted a known answer), which would produce misleading edit traces.
Scale of the pairwise data. The paper does not report the exact number of $(c^*, \tilde{c})$ pairs, but it can be inferred: for a submission history of length $n$ (where $n-1$ submissions are incorrect and the $n$-th is correct), there are $n-1$ correct edit pairs $(\tilde{y}_k, y^*_n)$ yielding correct feedback, and $n-2$ consecutive wrong-wrong pairs $(\tilde{y}_k, \tilde{y}_{k+1})$ yielding incorrect feedback. With an average of 2.7 submissions per user, a typical trajectory has 1.7 incorrect submissions, yielding 1.7 correct feedback instances and 0.7 incorrect feedback instances per user-problem pair, across 44,782 total instances.
Stage 3: Augmenting Synthetic Test Cases
The final component of COFFEE is a suite of test cases for each problem, which are necessary for COFFEEEVAL to measure code correctness but are not provided by the competitive programming platform (which keeps test cases hidden).
Generation procedure (Appendix A.1.3). For each problem description q, GPT-3.5-Turbo is prompted to generate input values $x_i$ that would be valid for the problem. The prompt (Appendix D.3) includes the input format specification and asks for "at least 30 challenging test input values." The paper uses three demonstration examples (few-shot prompting) to guide the generation format. For each generated input $x_i$, the system executes the known correct code $y^*$ on $x_i$ to obtain the expected output $z_i$. If execution succeeds (no runtime errors), the $(x_i, z_i)$ pair is added to the test suite $T$. If execution fails, the input-output pair is discarded. On average, this produces 35.5 test cases per problem (Figure 4).
Why synthetic test cases? The alternative — manually writing test cases — would be prohibitively labor-intensive at this scale (hundreds of problems, each requiring dozens of test cases). Using an LLM to generate inputs leverages the model's understanding of the problem specification to produce diverse, challenging test inputs automatically. The execution-based filtering (discarding inputs that crash the correct solution) ensures that all retained test cases are valid — the correct solution, by definition, must produce the expected output for every retained input.
Validity check: do incorrect solutions pass all test cases? This is a critical concern: if a wrong solution happened to produce correct outputs for all generated test cases, COFFEEEVAL would incorrectly treat it as correct, providing a misleading reward signal. The paper addresses this with an empirical analysis (Appendix A.1.4, Table 5). They randomly sampled 200 wrong code instances from the COFFEE evaluation set and measured each one's pass ratio (fraction of test cases passed). The results:
- Maximum pass ratio: 0.985 — no wrong solution passed every test case. The highest any incorrect solution achieved was 98.5%, meaning at least one test case in the suite caught the error.
- Mean pass ratio: 0.342 — on average, wrong solutions fail the majority of test cases (nearly 66% of tests detect the error).
- The distribution is right-skewed: the 25th percentile is 0.000 (many wrong solutions fail all tests), the 50th percentile is 0.162, and the 75th percentile is 0.693.
This provides strong evidence that the synthetic test suites are sufficiently discriminating — they successfully identify incorrect solutions as incorrect, even if some wrong solutions coincidentally pass a subset of tests. The paper also specifically verified on COFFEE-TEST (the held-out evaluation set) that no wrong solutions pass all test cases. The right-skewed distribution (many failures, a few high-but-not-perfect pass ratios) is exactly what we would expect from well-designed test suites: trivial errors (syntax mistakes, completely wrong logic) are caught by most tests, while subtle logical errors might pass many but not all test cases.
Diversity of test case difficulty. Appendix A.1.4 includes a kernel density estimation plot (Figure 9) showing the pass ratio distribution for incorrect solutions to five specific problems. Different problems show different distributions, with some having tighter clustering (most wrong solutions achieve similar pass ratios) and others showing broader spread. This indicates that the test case generation process produces suites with varying difficulty discrimination — some problems have test suites where wrong solutions consistently fail many tests, while others have suites where wrong solutions occasionally pass a substantial fraction. For COFFEEEVAL's purposes, what matters is that the maximum pass ratio stays below 1.0 for all problems, which the paper has verified.
COFFEEEVAL: Unit-Test-Driven Feedback Evaluation and the Critical Editor Training Step
COFFEEEVAL is the reward function that enables RL training. Its design reflects a key insight: the quality of a piece of feedback should be measured not by how it looks, but by whether the code it guides the editor to produce actually works.
The Core Idea: Simulate Editing, Then Test
The COFFEEEVAL score is defined formally in Equation 1 (Section 3.2):
where:
$q$is the problem description,$\tilde{y}$is the incorrect (wrong) code to be fixed,$\hat{c}$is the feedback generated by the feedback model being evaluated,$\phi$is the code editor model (which takes$q$,$\tilde{y}$, and$\hat{c}$as input and produces edited code$y' = \phi(q, \tilde{y}, \hat{c})$),$T = \{(x_1, z_1), (x_2, z_2), \ldots, (x_k, z_k)\}$is the set of$k$test cases, each consisting of an input$x_i$and expected output$z_i$,$\mathbf{1}(\cdot)$is the indicator function returning 1 when the edited code's output on$x_i$matches$z_i$, and 0 otherwise,- and the sum is normalized by
$k$, the total number of test cases, to produce a scalar in$[0, 1]$.
What it computes: For a given wrong code and generated feedback, COFFEEEVAL feeds the feedback to the editor model, which produces an edited version of the code. It then runs the edited code on every test case in the suite. The score is simply the fraction of test cases the edited code passes — 1.0 means the edited code is fully correct (passes all tests), 0.34 means it passes about a third, and so on.
Why this form over alternatives: The obvious alternative is to have a language model (like GPT-4) directly rate the feedback quality, as G-Eval does (Liu et al., 2023c). But as Table 2 demonstrates, this approach has very low correlation with actual feedback helpfulness — GPT-4-Turbo G-Eval achieves a Pearson correlation of only 0.135 with ground-truth binary helpfulness labels, and GPT-3.5-Turbo G-Eval actually shows a negative correlation of -0.172. The problem is that LLM-based evaluation captures surface-level properties (fluency, coherence, plausible-sounding technical content) rather than whether the feedback actually helps fix the bug. COFFEEEVAL bypasses this by evaluating the causal effect of the feedback — did the code become correct after the editor read this feedback? — which is definitionally what we care about.
A second alternative would be to have humans evaluate feedback, but this is far too slow and expensive for RL training, where the policy may need thousands or millions of reward queries during training. COFFEEEVAL is fully automated and fast (it only requires running Python code against test cases), making it practical for online RL.
The Editor Problem: Why Standard Code LLMs Fail as Reward Components
The natural implementation of COFFEEEVAL would be to use a standard, off-the-shelf code LLM (like GPT-3.5-Turbo, GPT-4-Turbo, or DeepSeekCoder-7B) as the editor $\phi$. The paper tested exactly this, and the results in Table 2 reveal why it doesn't work.
The "Editing" baselines in Table 2 use general code LLMs as $\phi$ and evaluate their ability to distinguish correct from incorrect feedback on the COFFEE test set. The key metric is precision: among cases where the edited code passes all tests (positive prediction), what fraction actually had correct feedback? The results are revealing:
-
GPT-4-Turbo Editing: Pass@1 of 53.0% on correct feedback, but also 51.8% on wrong feedback — meaning it produces correct edits roughly half the time regardless of whether the feedback was helpful or not. Precision is only 50.6%. This is essentially random — GPT-4-Turbo is so capable at code editing that it largely ignores the feedback and fixes the code through its own reasoning.
-
GPT-3.5-Turbo Editing: Similarly poor discrimination — 43.4% Pass@1 on correct feedback, 33.6% on wrong feedback, precision 56.4%. Slightly better than random but still far from a reliable reward signal.
-
DeepSeek-Coder-7B Editing: 36.0% on correct, 28.8% on wrong, precision 55.6%. Again, very weak separation between helpful and unhelpful feedback.
The fundamental issue is that general code LLMs are trained to produce correct code. When given a problem, wrong code, and any feedback (even unhelpful or misleading feedback), they default to trying to produce the correct answer. The feedback influences their output only weakly, because their training objective — maximize the probability of correct code — overrides the specific guidance in the feedback. This makes the resulting pass rates an unreliable proxy for feedback quality.
Quantitatively: The Pearson correlation between editing-based scores and ground-truth feedback helpfulness is 0.012 for GPT-4-Turbo, 0.101 for GPT-3.5-Turbo, and 0.077 for DeepSeekCoder-7B. All of these are essentially zero — a reward model with near-zero correlation cannot provide a useful training signal for RL.
The Solution: Training a Faithful Editor with Explicit Positive and Negative Examples
The key innovation in COFFEEEVAL is a two-phase training procedure for the editor $\phi$ that forces it to produce outputs that faithfully reflect the feedback quality rather than defaulting to correctness. The training uses both correct edits (where good feedback is paired with the correct target code) and incorrect edits (where bad feedback is paired with an incorrect target code), with explicit keywords signaling which behavior is expected.
Training data for the editor. The editor is trained on two types of examples from COFFEE:
-
Correct edit examples:
$D_{\text{correct}} = \{(q, \tilde{y}, c^*, y^*)\}$— the problem, wrong code, correct feedback (describing the path to the correct solution), and the correct code. For these examples, the editor should learn: "when the feedback is correct, produce the correct code." -
Incorrect edit examples:
$D_{\text{wrong}} = \{(q, \tilde{y}, \tilde{c}, \tilde{y}')\}$— the problem, wrong code, incorrect feedback (describing a transition between two wrong states), and the next wrong code in the submission history. For these examples, the editor should learn: "when the feedback is incorrect, produce code that is also incorrect (specifically, the wrong state the feedback describes)."
The incorrect edit examples are the crucial addition. Without them, the editor only sees (feedback → correct code) pairs during training, which reinforces the very bias we're trying to eliminate — the editor learns that regardless of feedback, the target output is always correct code. By intermixing (incorrect feedback → incorrect code) examples, the editor learns that the content of the feedback determines the appropriate output, not a universal bias toward correctness.
Why use the next wrong code $\tilde{y}_{k+1}$ as the target for incorrect edits? This is a subtle but important design choice. The incorrect feedback $\tilde{c}$ describes the difference between two consecutive wrong submissions $\tilde{y}_k$ and $\tilde{y}_{k+1}$. Pairing this feedback with $\tilde{y}_{k+1}$ as the target teaches the editor a specific, grounded behavior: "when you receive feedback describing edit X, produce exactly the code that results from applying edit X." This is more precise than simply teaching the editor to "produce wrong code" in general — it teaches fidelity to the specific guidance in the feedback.
Phase I: Training with Keyword Conditioning
The first phase of editor training is formalized in Equation 3 (Appendix A.2.2):
where $\phi$ is the editor model (DeepSeekCoder-7B), $t^* = \texttt{[Correct]}$ is a keyword token prepended to correct code sequences, $\tilde{t} = \texttt{[Wrong]}$ is a keyword token prepended to incorrect code sequences, and $p_\phi(\cdot \mid \cdot)$ is the model's autoregressive probability of the target sequence given the context.
What it computes: The standard negative log-likelihood (cross-entropy) loss for autoregressive language modeling, applied separately to the correct and incorrect edit examples. For correct edit examples, the model maximizes the probability of generating the keyword token [Correct] followed by the correct code $y^*$, given the problem, wrong code, and correct feedback. For incorrect edit examples, it maximizes the probability of generating [Wrong] followed by the target wrong code $\tilde{y}'$, given the problem, wrong code, and incorrect feedback. The total loss is the sum over both sets of examples.
Why the keyword tokens? The [Correct] and [Wrong] tokens serve as explicit conditioning signals that tell the model which mode it should be in. During inference (when COFFEEEVAL is computing rewards), these tokens are not provided — the model must infer from the feedback itself whether to produce a correct or incorrect edit. But during training, they provide a clean separation between the two types of examples, preventing the model from confusing contradictory supervision signals (the same (q, \tilde{y}) context sometimes maps to $y^*$ and sometimes to $\tilde{y}'$ depending on feedback quality). The approach follows Wang et al. (2023a), who used similar keyword conditioning for self-consistent chain-of-thought distillation.
Phase II: Training Without Keywords
After Phase I establishes the basic distinction between correct and incorrect editing behavior, Phase II removes the keyword tokens from the target sequence. The objective simplifies to Equation 4 (Appendix A.2.2):
What it computes: The same negative log-likelihood loss, but now the model generates the target code directly without a preceding keyword. The model must learn to infer, from the context $(q, \tilde{y}, c)$ alone, whether the feedback is helpful (and thus the target is the correct code) or unhelpful (and thus the target is the wrong code).
Why two phases? The paper does not explicitly justify the two-phase design, but the structure is standard in conditional generation tasks where the conditioning signal needs to be internalized. Phase I provides strong, explicit supervision (the keyword directly tells the model what to do), which helps the model learn the association between feedback characteristics and output correctness without ambiguity. Phase II removes this scaffold, forcing the model to rely on the feedback content alone — which is exactly the setting it faces at inference time when COFFEEEVAL is used. This is analogous to teacher forcing in sequence-to-sequence models: first provide the target, then gradually remove it.
Implementation hyperparameters (Appendix A.2.1). The editor is based on DeepSeekCoder-7B (specifically the instruct variant) trained with QLoRA (Dettmers et al., 2023) for parameter efficiency. The configuration uses 4-bit quantization, LoRA rank (dimension of low-rank matrices) of 64, LoRA alpha of 16, learning rate of $5 \times 10^{-5}$, batch size of 4, and training for 2 epochs. Training runs on 8 NVIDIA GeForce RTX 3090 GPUs. Both Phase I and Phase II use the same hyperparameters.
The untrained editor ablation. Table 2 includes a row for "DeepSeek-COFFEEEVAL (w/o WF)" — the COFFEEEVAL editor trained without the wrong-feedback (WF) examples, i.e., only on correct edits. This ablation achieves performance nearly identical to the base DeepSeekCoder-7B Editing baseline: precision 56.2% versus 55.6%, Pearson correlation 0.085 versus 0.077. This confirms that the wrong-feedback training examples are the essential ingredient — without them, the editor behaves essentially like an untrained code LLM.
The full COFFEEEVAL editor performance. With both-phase training including wrong-feedback examples, DeepSeek-COFFEEEVAL achieves precision of 64.7% (up from 55.6%), recall of 52.0% (up from 36.0%), F1 of 57.7%, and Pearson correlation of 0.149 with ground-truth labels — still modest in absolute terms, but substantially better than any alternative. The MSE (mean squared error) of 0.408 is also the lowest among all methods (G-Eval achieves 0.415, GPT-4-Turbo Editing achieves 0.450). Critically, this is the only method that achieves a Pearson correlation meaningfully above zero (next best is GPT-3.5-Turbo Editing at 0.101), making it the only reward signal with any reliable relationship to actual feedback helpfulness.
Why is the correlation still only 0.149? The paper does not discuss this directly, but several factors likely contribute. First, the editor model is only 7B parameters — it may not perfectly capture all feedback nuances. Second, the test case suites, while validated to catch all wrong solutions, may have varying discrimination power across problems, introducing noise into the pass-rate signal. Third, some feedback may be partially helpful (pointing toward a fix but with incomplete or partially incorrect reasoning), creating ambiguous cases that don't map cleanly to binary helpfulness labels. The key point is not that 0.149 is high in absolute terms, but that it is the best available signal and is sufficient to drive meaningful improvements through RL, as demonstrated by the downstream results in Section 5.
Ablation on number of test cases (Figure 6). Figure 6 shows how COFFEEEVAL's evaluation performance varies with the number of test cases used. The Pearson correlation increases and MSE decreases as the number of test cases grows, plateauing around the 30–35 range. This validates the design decision to generate approximately 36 test cases per problem — it is near the point of diminishing returns, where additional test cases would add data collection cost without substantially improving reward reliability.
SFT Initialization: Providing a Starting Policy for RL
Before RL training begins, the feedback model $\theta$ is initialized via supervised fine-tuning on COFFEE's correct feedback data. This is described in Section 2.2 and implemented with DeepSeekCoder-7B as the backbone.
Training data. The SFT dataset consists of $(q_i, \tilde{y}_i, c^*_i)$ triplets, where $c^*_i$ is the correct feedback annotated by GPT-3.5-Turbo (describing the edit from the wrong code to the correct code). Note that the correct code $y^*_i$ is present in the training triplets but is not used as a target for the feedback model — the model only learns to generate $c^*_i$, not the code itself. The code $y^*_i$ is used later for editor training (as described above).
Training objective. The model is trained with the standard autoregressive language modeling loss — minimizing the negative log-likelihood of the target feedback sequence $c^*$ given the problem description $q$ and wrong code $\tilde{y}$ as context:
where $\theta$ is the feedback model parameters and $N$ is the number of training examples.
What this learns. The SFT model learns to produce feedback that (a) identifies errors in the given wrong code, (b) explains why those errors cause incorrect behavior, and (c) suggests specific corrections. However, as the paper emphasizes in Section 2.2, the SFT objective does not directly optimize for the downstream effect of this feedback — a model can minimize $\mathcal{L}_{\text{SFT}}$ perfectly while generating feedback that is unhelpful for actual code editing, as long as the feedback sequences resemble the training distribution. This is the misalignment that RL training aims to correct.
Implementation details (Section 5.1.1, Appendix A.3). The paper uses DeepSeekCoder-7B (instruct variant) as the backbone, fine-tuned with QLoRA using 4-bit quantization. The specific hyperparameters for SFT are not reported in detail beyond the general framework description, but the training follows standard practices for instruction tuning on code data.
The SFT baseline in context. Figure 7 shows that SFT-COFFEE (trained on COFFEE's annotated feedback) outperforms SFT-CODE-FEEDBACK (trained on Zheng et al., 2024's Code-Feedback dataset) when both are evaluated on COFFEE-TEST. This validates the paper's claim that COFFEE provides higher-quality training data than existing alternatives, likely due to the diversity and difficulty coverage of human-authored errors versus model-generated errors.
PPO Training: Aligning the Feedback Model with Editing Outcomes
The core RL training procedure applies Proximal Policy Optimization (PPO; Schulman et al., 2017) to the SFT-initialized feedback model, using COFFEEEVAL as the reward function. This is described in Section 5.1.1 and benchmarked in Section 5.2.
The PPO objective. The policy $\pi_\theta$ (the feedback model) generates feedback $\hat{c}$ given context $(q, \tilde{y})$. The reward $R = \text{COFFEEEVAL}(q, \tilde{y}, \hat{c}, \phi, T)$ is a scalar in $[0, 1]$ measuring what fraction of test cases the edited code passes. PPO optimizes the standard clipped surrogate objective (Section 2.2, referencing Equation 5):
where:
$r_t(\theta) = \frac{\pi_\theta(\hat{c}_t \mid q, \tilde{y})}{\pi_{\theta_{\text{old}}}(\hat{c}_t \mid q, \tilde{y})}$is the probability ratio between the current policy and the old policy (before the update) for the feedback generated at step$t$,$\hat{A}_t$is the advantage estimate — how much better or worse this feedback's reward is compared to a baseline (typically the value function's prediction),$\epsilon$is the clipping hyperparameter (typically 0.1 or 0.2 in standard PPO implementations, though the paper does not specify the exact value used),$\hat{\mathbb{E}}_t$denotes the empirical average over a batch of timesteps,- and the
$\min$and$\text{clip}$operations prevent the policy from changing too dramatically in a single update.
What it computes, in operational terms. During PPO training, the current feedback model $\pi_\theta$ samples feedback $\hat{c}$ for a batch of $(q, \tilde{y})$ instances from the training data. Each piece of feedback is fed to the COFFEEEVAL editor $\phi$, which produces edited code, which is tested against the unit test suite, yielding a scalar reward $R$. The advantage $\hat{A}_t$ is computed (typically using Generalized Advantage Estimation, though the paper does not specify the exact estimator). If the feedback led to higher reward than expected (positive advantage), the policy is updated to increase the probability of generating similar feedback in similar contexts. If the feedback led to lower reward than expected (negative advantage), the policy is updated to decrease that probability. The clipping $\min(\ldots)$ prevents the policy ratio $r_t(\theta)$ from moving outside $[1-\epsilon, 1+\epsilon]$, ensuring each update is conservative and training is stable.
Why PPO over alternatives? The paper benchmarks DPO and Rejection Sampling as alternative RL approaches in Section 5.2. PPO's advantage (discussed in Section 5.2.2) is that it is an online method: the policy generates new feedback during training, which is scored, and the policy is updated. This allows the policy to explore the space of possible feedback and continuously adapt. DPO, by contrast, is offline: it learns from a fixed set of preference pairs and cannot explore beyond the pairs provided. Rejection Sampling is also limited to the best feedback among a fixed set of samples from the initial SFT model. The paper hypothesizes that PPO's online exploration is what drives its superior performance: "online RL methods like PPO allow for continuous updates on the reference model and lead to better alignment compared to offline methods like DPO, which learn from a fixed initial model" (Section 5.2.2).
The reward signal during PPO training. Each PPO update requires computing COFFEEEVAL scores for the feedback generated by the current policy. This involves: (1) running the feedback model $\pi_\theta$ to generate $\hat{c}$, (2) running the editor model $\phi$ to produce $y' = \phi(q, \tilde{y}, \hat{c})$, (3) executing $y'$ on all $k \approx 36$ test cases for the problem, and (4) counting pass/fail to compute the reward. This is computationally intensive (each reward computation requires two forward passes through language models plus running Python code), but fully automated and parallelizable across problems.
Why the reward is task-appropriate. The COFFEEEVAL reward directly measures what we care about — whether the feedback helps fix the bug — rather than a proxy like "does the feedback look like what GPT-4 would say." This means the PPO training signal is aligned with the true objective: a policy update that increases COFFEEEVAL scores is, by definition, improving the feedback's actual helpfulness. The challenge (addressed by the editor training) is ensuring the reward is accurate rather than noisy, but the objective itself is correct.
Implementation details (Section 5.1.1, Appendix A.3). The paper trains the feedback model with PPO using COFFEEEVAL as the reward model. The backbone is DeepSeekCoder-7B with QLoRA (4-bit quantization), following the same infrastructure as the SFT initialization. Training uses the TRL (Transformer Reinforcement Learning) and vLLM libraries for efficient generation. The specific PPO hyperparameters (clipping $\epsilon$, value function coefficient, KL penalty coefficient, learning rate, batch size, number of PPO epochs per batch) are not explicitly reported in the paper, which is a notable omission for reproducibility. The paper references the standard PPO objective and acknowledges using HuggingFace TRL, which implements the canonical Schulman et al. (2017) algorithm.
DPO Training: Direct Preference Optimization as an Alternative
The paper benchmarks DPO (Rafailov et al., 2023) as an alternative RL training method in Section 5.2. DPO works differently from PPO: instead of training a separate reward model and using it to score online samples, DPO directly optimizes the policy from a fixed dataset of preference pairs.
Preference pair construction. The paper explores three variants of DPO, differing in how the preference pairs $(c^+, c^-)$ are constructed (Section 5.2.1):
-
DPO-TS (Teacher-Student): Uses the teacher model's feedback (GPT-3.5-Turbo, which originally annotated COFFEE) as
$c^+$and the student model's feedback (the SFT model) as$c^-$. This follows the distillation approach of Tunstall et al. (2023): the student should prefer the teacher's outputs over its own. However, the paper finds this performs poorly (Figure 7), hypothesizing that "the teacher's feedback may not always be superior to the student's" — GPT-3.5-Turbo's feedback is not guaranteed to be better than what the SFT model produces, making the preference ranking unreliable. -
DPO-CW (Correct-Wrong): Directly uses the labeled feedback pairs
$(c^*, \tilde{c})$from COFFEE as$(c^+, c^-)$. This leverages the naturally occurring preference structure in the dataset: correct feedback (describing the path to a correct solution) is preferred over incorrect feedback (describing a transition between two wrong states). This variant performs better than DPO-TS, demonstrating the value of COFFEE's pairwise annotations. -
DPO-COFFEEEVAL: Samples 10 feedback candidates
$\hat{c}_1, \ldots, \hat{c}_{10}$from the SFT model for each$(q, \tilde{y})$instance, scores each with COFFEEEVAL, and constructs preference pairs using the top-1 and bottom-1 scoring feedback as$(c^+, c^-)$. This uses COFFEEEVAL as the preference signal rather than relying on pre-existing labels. This variant achieves the best performance among DPO variants (Figure 7), suggesting that COFFEEEVAL's reward signal is more reliable than either the teacher-student heuristic or the dataset's correct-wrong labels.
The DPO objective. While the paper does not explicitly state the DPO loss equation, the standard DPO objective (Rafailov et al., 2023) is:
where $\sigma$ is the logistic sigmoid, $\beta$ is a temperature parameter controlling how strongly the policy is pulled toward preferences, $\pi_\theta$ is the policy being trained, and $\pi_{\text{ref}}$ is the reference policy (typically the SFT model, frozen during training). The intuition is that DPO increases the probability of $c^+$ relative to $c^-$, with the reference policy serving as a regularizer preventing the policy from drifting too far from its initialization.
Why DPO is attractive but limited for this task. DPO is simpler than PPO — no separate reward model training, no online sampling, no value function estimation. However, as the results in Figure 7 show, it underperforms PPO in this setting. The paper's hypothesis (Section 5.2.2) is that DPO's offline nature is the bottleneck: it can only learn from the preference pairs provided, and those pairs are limited to what the SFT model can generate. PPO can explore the feedback space during training, discovering feedback strategies that the SFT model never produced, and continuously improving upon them.
Rejection Sampling: A Baseline RL Alternative
Rejection sampling (RS) is the simplest RL-inspired baseline tested (Section 5.2.1). The procedure is:
- For each training instance
$(q, \tilde{y})$, sample 10 feedback candidates$\hat{c}_1, \ldots, \hat{c}_{10}$from the current SFT model. - Score each candidate with COFFEEEVAL.
- Select the feedback with the highest COFFEEEVAL score as the "best" feedback for that instance.
- Create a new dataset of
$(q, \tilde{y}, \hat{c}_{\text{best}})$pairs. - Fine-tune the SFT model on this new dataset (standard SFT).
- Optionally, repeat the process (the paper does not specify the number of iterations, but Figure 7 reports results for a single round of RS).
How this differs from PPO. Rejection sampling is essentially a "best-of-N" approach applied to training data construction. It uses COFFEEEVAL to filter for high-quality feedback, then trains the model to imitate that filtered feedback. Unlike PPO, there is no explicit policy gradient — the model simply learns to produce what the best past samples looked like. Unlike DPO, there are no explicit negative examples — the model only sees the "good" feedback, not contrasting pairs.
Why it underperforms. Figure 7 shows RS-COFFEEEVAL achieving lower performance than PPO-COFFEEEVAL and DPO-COFFEEEVAL. The limitation is that RS does not provide a gradient toward better feedback — it only reinforces the best among a fixed set of candidates from the current model. If none of the 10 samples are particularly good (which is likely early in training), RS has no mechanism to discover better strategies beyond what was already sampled. PPO, by contrast, provides a gradient signal that can incrementally push the policy toward higher-reward regions even when current samples are mediocre.
Summary of Design Choices and Their Justifications
-
Human-authored edit traces over model-generated errors: Captures a broader difficulty spectrum (including problems GPT-4 cannot solve) and more diverse error patterns (Figure 5b), ensuring the feedback model generalizes to realistic human mistakes.
-
GPT-3.5-Turbo for feedback annotation over GPT-4: Balances annotation quality (validated at 3.88/5 human score) with cost at scale, and matches the feedback style the SFT model can learn to produce.
-
Pairwise correct-wrong feedback from sequential submission histories: Exploits the natural structure of human edit traces to create preference pairs
$(c^* \succ \tilde{c})$without requiring explicit human ranking of feedback quality. -
Synthetic test cases generated by GPT-3.5-Turbo and filtered by execution: Provides objective correctness measurement at scale (35.5 test cases per problem) validated to catch all wrong solutions (maximum pass ratio 0.985, Table 5).
-
COFFEEEVAL editor trained on both correct and incorrect edit examples: The wrong-feedback training examples (paired with incorrect target code) are the essential ingredient that prevents the editor from defaulting to correctness — the ablation without them (Table 2, "w/o WF") performs no better than an untrained code LLM.
-
Two-phase editor training with keyword conditioning then removal: Phase I (
[Correct]/[Wrong]tokens) provides strong initial separation of modes; Phase II removes the scaffold to force internalization of feedback quality judgment. -
QLoRA 4-bit quantization for all models: Enables training 7B-parameter models on consumer GPU hardware (8× RTX 3090) with reasonable memory footprint, making the environment accessible to academic researchers.
-
PPO as the primary RL algorithm: Online exploration allows the policy to discover feedback strategies beyond what the SFT model initially produces, yielding better alignment than offline alternatives (DPO, RS) that are limited to fixed preference datasets or sample sets.
4. Key Insights and Innovations
Innovation 1: Feedback Helpfulness Must Be Measured by Downstream Effect, Not Surface Quality
The paper's most fundamental intellectual contribution is not a new algorithm but a diagnostic reframing of what it means for code feedback to be "good." Prior work on feedback generation — both the SFT approaches like Code-Feedback (Zheng et al., 2024) and the self-refinement literature (Madaan et al., 2023) — implicitly equated feedback quality with its resemblance to human-written or GPT-4-written text. The training objective was the standard language modeling loss: maximize the probability of the reference feedback sequence. The evaluation, when done at all, used LLM-based judges like G-Eval (Liu et al., 2023c) that score feedback on Likert scales based on fluency, coherence, and plausible technical content.
This paper argues that this entire framing is wrong — or at least deeply incomplete — for the specific task of feedback-guided code editing. The central diagnostic move appears in Table 2, which measures the correlation between various evaluation methods and ground-truth feedback helpfulness (binary labels indicating whether feedback actually described the path to a correct solution). GPT-4-Turbo G-Eval achieves a Pearson correlation of only 0.135 — essentially noise. GPT-3.5-Turbo G-Eval is actually negatively correlated at -0.172. Even using actual code execution as the evaluation metric, but with standard code LLMs as the editor, yields near-zero correlations (0.012 for GPT-4-Turbo Editing, 0.101 for GPT-3.5-Turbo Editing, 0.077 for DeepSeekCoder-7B Editing). None of these methods meaningfully distinguish between feedback that helps fix bugs and feedback that doesn't.
The conceptual insight is that feedback helpfulness is a causal property, not a textual property. A piece of feedback is helpful if and only if it causes a downstream editor to produce correct code — and this cannot be determined by examining the feedback text in isolation, because it depends on the interaction between the feedback, the specific wrong code, the problem semantics, and the editor model's capability. The field's default assumption — that better-written feedback is more helpful feedback — is empirically false in the code editing setting. This is a fundamental reframing, not an incremental refinement, because it changes what the optimization target should be: not surface similarity to reference feedback, but measured impact on downstream task success.
The practical consequence of this reframing is that SFT alone can never suffice for training helpful feedback models, no matter how good the training data. The SFT model learns to produce feedback that looks like the training distribution, but the training distribution (GPT-3.5-Turbo annotations at 3.88/5 average human score, Appendix A.1.2) has only moderate correlation with actual helpfulness. RL with a task-aligned reward signal becomes not an optional improvement but a necessity — the only way to optimize for the causal property we actually care about.
Innovation 2: Standard Code LLMs Are Biased Toward Correctness, Making Them Unreliable Reward Proxies Without Explicit Intervention
The paper's second conceptual contribution is the empirical discovery — and explicit characterization — of a correctness bias in code LLMs that makes them unsuitable as naive components in feedback evaluation pipelines. This is not a theoretical construct but a specific, measured phenomenon: when given a problem, wrong code, and any feedback (even feedback known to be incorrect), powerful code LLMs tend to produce correct code regardless. Table 2 quantifies this: GPT-4-Turbo achieves 53.0% Pass@1 on correct feedback but also 51.8% on wrong feedback — it edits correctly roughly half the time irrespective of feedback quality, yielding precision of only 50.6% (barely above chance for a binary classifier). GPT-3.5-Turbo and DeepSeekCoder-7B show similarly poor discrimination.
This finding contradicts an intuitive assumption that likely motivated prior work on execution-based code generation rewards (Le et al., 2022; Liu et al., 2023a; Shen et al., 2023). Those works used unit test pass rates as rewards for code generation RL, assuming that better code leads to higher pass rates. Extending this logic to feedback evaluation, one might assume that better feedback leads an editor to produce better code (higher pass rates), making the editor's pass rate a valid proxy for feedback quality. The paper shows this assumption fails because the editor's own capability overwhelms the feedback signal. The editor's training objective — produce correct code — is so strong that it largely ignores the feedback and solves the problem through its own reasoning. The feedback becomes a weak suggestion that the model can override.
The significance of this finding extends beyond this paper's specific task. It suggests a general principle: when using one learned model as a component in evaluating or training another learned model, the evaluator model's own biases and capabilities must be explicitly accounted for. This is particularly acute when the evaluator is trained to optimize the same objective that the evaluation is supposed to measure — in this case, both the editor and the feedback model exist to produce correct code, but the editor's direct path to correctness (its own reasoning) can short-circuit the indirect path (following feedback). This is a form of evaluation collapse analogous to the reward hacking problem in RLHF, but arising from capability rather than exploitation: the editor is too good at its job to serve as a faithful measurement instrument.
The solution — explicitly training the editor to be sensitive to feedback quality through exposure to positive and negative edit examples — is not just an engineering fix. It represents a conceptual shift: the editor is not merely an off-the-shelf tool but a calibrated measurement instrument whose training is as important to the system's success as the feedback model's training. The ablation in Table 2 ("w/o WF," editor trained only on correct edits) demonstrates that the wrong-feedback training examples are the essential ingredient — without them, the editor's performance regresses to that of an untrained code LLM. This is a finding with implications for any system that uses one model's outputs to evaluate another's: the evaluator must be explicitly trained for discrimination, not just competence.
Innovation 3: COFFEE-GYM Establishes That Open-Source Feedback Models Can Match Closed-Source Performance Through Task-Specific RL
The paper's third contribution is an existence proof: with the right training environment (COFFEE-GYM's dataset + reward function + RL algorithm), an open-source 7B-parameter model can generate feedback for code editing that rivals GPT-4-Turbo's feedback in downstream effectiveness. The headline result in Table 3 shows that the PPO-trained feedback model paired with DeepSeekCoder-7B as editor achieves 73.8% Pass@1 on HumanEvalFix, compared to 74.4% for GPT-4-Turbo feedback with the same editor — a gap of only 0.6 percentage points. On COFFEE-TEST, the open-source model actually outperforms GPT-4-Turbo feedback (47.2% vs. 44.4%).
What makes this more than a "big number" result is the contrast with the SFT baseline. SFT-COFFEE (Figure 7) provides only modest improvements over no feedback, while SFT-CODE-FEEDBACK (Zheng et al., 2024) barely helps at all (62.1% vs. 60.4% direct editing, Table 3). The gap between SFT and PPO — approximately 10+ percentage points on HumanEvalFix — represents the value added by RL alignment over simple imitation. This directly supports the paper's core thesis: that feedback helpfulness cannot be learned through supervised imitation alone, and that RL with a task-aligned reward is necessary to close the gap with closed-source models.
The practical significance is substantial for the field's trajectory. Prior to this work, the dominant assumption (implicit in the reliance on GPT-4 for Self-Refine and similar approaches) was that helpful code feedback required the scale and capability of frontier closed-source models. COFFEE-GYM demonstrates that this capability is teachable at the 7B scale when the right training signals are available. This has direct implications for deployment: organizations can now build in-house feedback models that run on consumer hardware, eliminating API costs, latency, and data privacy concerns associated with closed-source alternatives.
However, this innovation should be understood as an infrastructure-enabled empirical finding rather than a fundamental algorithmic advance. PPO and DPO are well-established algorithms; the contribution is showing that they work for this specific task when paired with the right data and reward function. The novelty lies in the demonstration that the environment (COFFEE-GYM) is sufficient to enable this result, not in the RL algorithm itself. This is characteristic of systems-level contributions: the insight is in the integration and the empirical validation, not in a new mathematical technique.
Innovation 4: The Correct-to-Incorrect Reversion Problem Is a Deep Structural Limitation of Sequence-Level Feedback Training, Not Just an Implementation Detail
While the paper does not elevate this to a headline finding, Section 6 identifies a phenomenon with significant conceptual implications for feedback model training: approximately 38% of correct answers produced during a revision chain get "revised" back to incorrect answers in subsequent steps. The paper treats this as a practical issue and mitigates it with majority voting across the revision chain. But this observation points to something deeper about the limits of current feedback training paradigms.
The root cause is a fundamental asymmetry in how feedback models are trained. The model is trained on sequences where all in-context previous answers are incorrect, followed by a correct target. During inference, the model may encounter a correct answer in its context (produced during an earlier revision step) and must decide what to do. The training data provides no signal about the appropriate behavior: the model has never seen an example where the previous answer is already correct, so it has no learned policy for recognizing and preserving correctness. The model defaults to its training behavior — produce a revision — and since it was never taught to recognize when no revision is needed, it alters the answer anyway, with a 38% chance of breaking what was already working.
This is not merely an engineering limitation of the specific revision model in this paper. It reflects a structural challenge for any feedback or self-refinement system trained on static datasets: the training distribution is always "need revision → better answer," but the inference distribution includes "answer is already good → should not revise." This distribution shift is inherent to the sequential nature of revision and cannot be fixed by better data collection alone — it requires either explicit training on "no revision needed" examples (which are hard to construct naturally, since training data is collected from situations where revisions were actually made) or architectural interventions like verifier-based stopping criteria.
The paper's handling of this — using verifier-based selection across the chain rather than always taking the final revision — is pragmatic but incomplete. The more fundamental implication is that feedback model training needs to explicitly represent the possibility of no-change, either through a special [NO CHANGE] token in the training data, a learned stopping criterion, or a training objective that includes both "revise when wrong" and "preserve when correct" examples. This is a research direction the paper opens but does not resolve, and it connects to broader questions in iterative refinement systems about when and how to terminate the refinement process.
5. Experimental Analysis
Evaluation Methodology
-
Dataset. The primary evaluation benchmarks are HumanEvalFix (Muennighoff et al., 2023) — 164 hand-crafted buggy code instances across six programming languages, drawn from HumanEval solutions, each with annotated test cases — and COFFEE-TEST, a held-out set of 180
(q, ~y, y*, T)instances collected through the same pipeline as the COFFEE training data (Section 3.1) but with no overlapping problems. All code editing evaluations use Pass@1 computed as the fraction of problems for which the edited code passes all annotated test cases. -
Base model(s). The paper uses DeepSeekCoder-7B (instruct variant, Guo et al., 2024a) as the backbone for all trained models — the SFT feedback model, the PPO/DPO/RS feedback models, and the COFFEEEVAL editor model. The editor evaluations in Table 2 additionally test GPT-3.5-Turbo, GPT-4-Turbo, and an untrained DeepSeekCoder-7B as alternative editor backbones. For downstream code editing experiments (Table 3), the paper tests three open-source code LLMs as editors: DeepSeekCoder-7B (Guo et al., 2024a), CodeGemma-7B (CodeGemma Team et al., 2024), and OpenCodeInterpreter-DS-Coder-7B (Zheng et al., 2024). GPT-3.5-Turbo and GPT-4-Turbo (OpenAI 2023a,b) are used as closed-source feedback baselines. The choice of 7B-scale models reflects a deliberate focus on accessible, open-source deployment — models that can run on consumer hardware.
-
Metrics. The primary metric throughout is Pass@1 — the fraction of evaluation instances for which the final edited code passes all unit tests for that problem. For COFFEEEVAL validation (Table 2), the paper additionally reports precision, recall, and F1 as binary classification metrics (treating "edited code passes all tests" as a positive prediction of feedback helpfulness), Pearson correlation between predicted scores and ground-truth binary helpfulness labels, and MSE for continuous score prediction error. For human evaluation (Figure 8b), Likert-scale scores (1–5) are collected from MTurk workers, separately for error detection quality and error correction quality.
-
Baselines. The paper compares against the following feedback sources, each paired with the same code editor for fairness:
- Execution Feedback (Chen et al., 2023): Raw runtime output (error messages, stack traces) from executing the wrong code, without any LLM generation.
- Self-Feedback (Madaan et al., 2023): Natural language feedback generated by the code editor model itself — the same model that will perform the edit critiques its own code.
- OpenCodeInterpreter-DS-Coder Feedback (Zheng et al., 2024): A DeepSeekCoder-7B variant fine-tuned on the Code-Feedback dataset (GPT-4-generated feedback on model-generated code edits), provided as a dedicated feedback model.
- GPT-3.5-Turbo Feedback and GPT-4-Turbo Feedback (OpenAI, 2023a,b): Closed-source upper-bound baselines where GPT-3.5/4 generate the feedback.
- Direct Editing: The code editor attempts to fix the code with no feedback at all (only the problem description and wrong code).
- SFT-CODE-FEEDBACK (Figure 7): DeepSeekCoder-7B fine-tuned on Zheng et al.'s Code-Feedback dataset rather than COFFEE.
-
Generation budget / compute accounting. The paper does not use a uniform "generation budget" or "FLOPs-matched" comparison framework in the style of scaling-law analyses. All feedback methods generate exactly one piece of feedback per problem instance. For the RL training comparisons in Section 5.2, the relevant efficiency metric is training algorithm type (SFT, RS, DPO, PPO) rather than inference-time compute, since all feedback models are the same size (7B parameters) and produce one output per input during evaluation. Rejection Sampling and DPO-COFFEEEVAL each involve sampling 10 candidate feedback strings from the model and scoring them with COFFEEEVAL; this cost is part of training, not evaluation.
-
Cross-validation / statistical protocol. The paper does not employ k-fold cross-validation for the main results. The COFFEE-TEST evaluation set (180 instances) is held out from COFFEE training data, with explicit verification of no problem overlap (Appendix A.1.6). For human evaluation (Figure 8b), each of 100 sampled feedback instances is rated by three different MTurk workers to ensure inter-annotator reliability. For the COFFEEEVAL validation experiments (Table 2), the test set is a fixed split of COFFEE with binary helpfulness labels derived from the dataset's correct-wrong feedback annotations. Statistical significance testing (confidence intervals, p-values) is not reported for any experimental comparisons, which is a notable methodological gap.
Main Quantitative Results
COFFEEEVAL Reliability: Can We Measure Feedback Helpfulness Accurately?
The foundational experiment (Table 2) asks whether COFFEEEVAL's reward signal actually correlates with feedback helpfulness. The headline finding is that COFFEEEVAL with a specially trained editor achieves a Pearson correlation of 0.149 with ground-truth feedback helpfulness — modest in absolute terms but substantially better than all alternatives. GPT-4-Turbo G-Eval manages only 0.135, and GPT-3.5-Turbo G-Eval is slightly negatively correlated at -0.172. Direct editing with general-purpose code LLMs performs even worse: GPT-4-Turbo Editing achieves 0.012, GPT-3.5-Turbo Editing 0.101, and DeepSeekCoder-7B Editing 0.077 — all essentially zero.
The practical consequence is visible in the binary discrimination metrics. COFFEEEVAL achieves precision of 64.7% and recall of 52.0% (F1: 57.7%). By contrast, GPT-4-Turbo Editing achieves 53.0% Pass@1 on correct feedback but also 51.8% on wrong feedback — precision of only 50.6%, meaning the editor is basically guessing whether feedback is helpful. This is the central empirical justification for training a specialized editor: without the explicit wrong-feedback training described in Section 3.2.1, the editor cannot distinguish helpful from unhelpful feedback because its own code-editing capability overwhelms the feedback signal.
The ablation in Table 2 (row labeled "DeepSeek-COFFEEEVAL (w/o WF)") tests the editor trained only on correct edit examples, without the wrong-feedback instances. This model achieves precision of 56.2%, recall of 36.4%, F1 of 44.2%, and Pearson correlation of 0.085 — all nearly identical to the untrained DeepSeekCoder-7B Editing baseline. This confirms that the wrong-feedback training examples are the essential ingredient, not the QLoRA fine-tuning itself or the DeepSeekCoder backbone.
Number of test cases matters (Figure 6). The paper ablates the number of test cases used in COFFEEEVAL and finds that evaluation performance (Pearson correlation and MSE) improves monotonically with more test cases, plateauing around 30–35. With only 5 test cases, the Pearson correlation is roughly 0.05; with 35 test cases, it reaches approximately 0.15. This validates the design choice of generating approximately 36 test cases per problem — it sits near the point of diminishing returns.
Downstream Code Editing: Does COFFEE-GYM-Trained Feedback Actually Help?
Table 3 presents the paper's primary result: feedback models trained with COFFEE-GYM substantially improve code editing across multiple open-source editor models, achieving performance comparable to GPT-4-Turbo feedback.
With DeepSeekCoder-7B as editor (top block of Table 3):
- Direct editing (no feedback): 60.4% Pass@1 on HumanEvalFix, 33.8% on COFFEE-TEST.
-
- Self-Feedback: 67.7% (+7.3) on HumanEvalFix, but 28.3% (-5.5) on COFFEE-TEST — a mixed result showing self-feedback can hurt on some distributions.
-
- OpenCodeInterpreter-DS-Coder Feedback: 64.6% (+4.2) on HumanEvalFix, 30.5% (-3.3) on COFFEE-TEST — again mixed.
-
- Execution Feedback: 68.3% (+7.9) on HumanEvalFix, 38.3% (+4.5) on COFFEE-TEST — consistently helpful but modest.
- + OURS (PPO-COFFEEEVAL): 73.8% (+13.4) on HumanEvalFix, 47.2% (+13.4) on COFFEE-TEST — the largest improvement among all open-source feedback methods, and the only one that improves on both benchmarks simultaneously by a substantial margin.
-
- GPT-4-Turbo Feedback: 74.4% (+14.0) on HumanEvalFix, 44.4% (+10.6) on COFFEE-TEST — the open-source model is within 0.6 points on HumanEvalFix and actually outperforms GPT-4-Turbo by 2.8 points on COFFEE-TEST.
With CodeGemma-7B as editor (middle block):
- Direct editing: 53.7% on HumanEvalFix, 14.4% on COFFEE-TEST.
-
- OURS: 59.7% (+6.0) on HumanEvalFix, 31.1% (+16.7) on COFFEE-TEST.
-
- GPT-4-Turbo Feedback: 65.8% (+12.1) on HumanEvalFix, 22.7% (+8.3) on COFFEE-TEST.
- Our model outperforms GPT-4-Turbo feedback on COFFEE-TEST (31.1% vs. 22.7%) but trails on HumanEvalFix (59.7% vs. 65.8%), suggesting some benchmark-dependent variance in the relative advantage.
With OpenCodeInterpreter-DS-Coder-7B as editor (bottom block):
- Direct editing: 65.8% on HumanEvalFix, 30.5% on COFFEE-TEST.
-
- OURS: 70.1% (+4.3) on HumanEvalFix, 42.7% (+12.2) on COFFEE-TEST.
-
- GPT-4-Turbo Feedback: 72.5% (+6.7) on HumanEvalFix, 43.3% (+12.8) on COFFEE-TEST.
- The gap narrows to 2.4 points on HumanEvalFix and 0.6 points on COFFEE-TEST.
Three patterns stand out across these results:
-
Consistency across editors. The PPO-COFFEEEVAL feedback model improves performance over direct editing for all three editor models on both benchmarks. This is not true for Self-Feedback (which hurts COFFEE-TEST performance on DeepSeekCoder-7B and OpenCodeInterpreter) or OpenCodeInterpreter Feedback (which hurts COFFEE-TEST on all three editors).
-
The gap between open-source and closed-source narrows dramatically compared to SFT baselines. The SFT baseline trained on Code-Feedback achieves only 62.1% on HumanEvalFix with DeepSeekCoder-7B (bottom of Figure 1) — just 1.7 points above direct editing. The PPO-COFFEEEVAL model achieves 73.8% — 11.7 points higher than the SFT baseline, representing nearly the entire gap between SFT and GPT-4-Turbo feedback.
-
Self-feedback is unreliable for code editing. Across all three editor models, Self-Feedback produces improvements on HumanEvalFix (+7.3, -0.7, -3.7) but either marginal or negative effects on COFFEE-TEST (-5.5, +2.2, -9.4). This confirms the paper's claim that open-source code LLMs, despite their code generation capabilities, struggle to produce helpful natural language feedback about their own errors. The task of critiquing code appears to be distinct from the task of generating or editing it.
Comparing RL Training Strategies: What Works Best?
Figure 7 compares four training strategies applied to the same DeepSeekCoder-7B backbone, evaluated on COFFEE-TEST with DeepSeekCoder-7B as the editor:
- SFT-COFFEE (supervised fine-tuning on COFFEE's correct feedback): ~31% Pass@1.
- SFT-CODE-FEEDBACK (Zheng et al., 2024): ~28% — worse than SFT-COFFEE, validating that COFFEE's human-authored data produces a better initialization than model-generated data.
- RS-COFFEEEVAL (rejection sampling with COFFEEEVAL): ~33% — modest improvement over SFT.
- DPO-TS (DPO with teacher-student pairs): ~30% — essentially no improvement, and arguably worse than SFT-COFFEE alone. The paper hypothesizes that GPT-3.5-Turbo's feedback is not always better than the student model's, making the preference signal unreliable.
- DPO-CW (DPO with correct-wrong pairs from COFFEE): ~34% — clear improvement, demonstrating value in the pairwise annotations.
- DPO-COFFEEEVAL (DPO with COFFEEEVAL-scored preference pairs): ~36% — the best DPO variant.
- PPO-COFFEEEVAL: ~39% — the overall best, roughly 8 points above SFT-COFFEE and 3 points above the best DPO variant.
The paper attributes PPO's advantage to its online nature: "online RL methods like PPO allow for continuous updates on the reference model and lead to better alignment compared to offline methods like DPO, which learn from a fixed initial model" (Section 5.2.2). DPO-COFFEEEVAL can only learn from preference pairs constructed from the SFT model's initial samples — if those samples are mediocre, DPO has limited room for improvement. PPO, by exploring during training, can discover feedback strategies that the SFT model never initially produced.
The strong performance of DPO-COFFEEEVAL over DPO-CW suggests that COFFEEEVAL's scoring is a more reliable preference signal than the dataset's correct-wrong annotations, even though both come from COFFEE. This is consistent with Table 2's finding that COFFEEEVAL has non-zero correlation with helpfulness while dataset labels alone (the annotations from GPT-3.5-Turbo) are imperfect.
Fine-Grained Analysis by Error Type
Figure 8a breaks down HumanEvalFix editing performance by error type, comparing Direct Editing, Self-Feedback, Execution Feedback, SFT, and PPO-COFFEEEVAL (all using DeepSeekCoder-7B as editor). The PPO model is particularly effective at correcting Missing logic errors and Function misuse errors — cases where the code structure is partially correct but a conceptual misunderstanding leads to incorrect behavior. Natural language feedback is well-suited to these errors because it can explain why the logic is wrong rather than just pointing to a syntax issue. On Value misuse errors (incorrect constants, wrong variable references), the PPO model shows slightly lower performance, which the paper attributes to distribution mismatch between human-authored errors in COFFEE and the synthetic errors in HumanEvalFix.
Human Evaluation of Feedback Quality
Figure 8b reports Likert-scale ratings (1–5) from MTurk workers evaluating feedback generated by different methods on HumanEvalFix instances. The PPO-COFFEEEVAL feedback receives the highest scores for both error detection (~4.4) and error correction (~4.3), narrowly outperforming GPT-4-Turbo (~4.3 and ~4.1 respectively) and substantially outperforming Self-Feedback (~3.6 and ~3.5) and Execution Feedback (~3.7 and ~3.6). The paper emphasizes that these human judgments corroborate the automated Pass@1 results — the feedback that humans rate as more helpful is also the feedback that leads to higher downstream editing success, providing convergent validity for the evaluation methodology.
Ablation Studies and Robustness Checks
Editor training without wrong-feedback examples (Table 2, "w/o WF"): Removing the incorrect edit examples from the COFFEEEVAL editor's training data collapses its discrimination ability — precision drops from 64.7% to 56.2%, recall from 52.0% to 36.4%, and Pearson correlation from 0.149 to 0.085, making it statistically indistinguishable from the untrained DeepSeekCoder-7B Editing baseline. This is the cleanest ablation in the paper: the wrong-feedback data is not an incremental improvement but a categorical requirement for the editor to function as a reward component.
Number of test cases used by COFFEEEVAL (Figure 6): Pearson correlation between COFFEEEVAL scores and ground-truth feedback helpfulness increases from roughly 0.05 at 5 test cases to approximately 0.15 at 35 test cases, with MSE decreasing correspondingly. The curve flattens around 30–35 cases, suggesting the paper's average of 35.5 test cases per problem is near-optimal — additional test cases would yield diminishing returns.
Choice of SFT training data (Figure 7): SFT-COFFEE (trained on COFFEE's GPT-3.5-Turbo feedback annotations) achieves roughly 31% Pass@1 on COFFEE-TEST, outperforming SFT-CODE-FEEDBACK (trained on Zheng et al.'s Code-Feedback dataset, ~28%). This validates the claim that human-authored error traces provide a better initialization than model-generated errors, though the 3-point gap is modest relative to the 8-point gain from subsequent PPO training.
G-Eval with different backbone LLMs (Table 2): GPT-4-Turbo G-Eval achieves Pearson correlation of 0.135; GPT-3.5-Turbo G-Eval achieves -0.172. The negative correlation for GPT-3.5-Turbo is striking — it means the model's Likert-scale ratings are actually inversely related to feedback helpfulness. This demonstrates that LLM-based evaluation of feedback (the G-Eval approach) is not merely imprecise but can be systematically misleading, depending on the evaluator model's calibration.
DPO preference pair construction (Figure 7): The three DPO variants show a clear ordering: DPO-TS (teacher-student pairs) < DPO-CW (dataset correct-wrong pairs) < DPO-COFFEEEVAL (COFFEEEVAL-scored pairs). The gap between the worst and best DPO variant is approximately 6 points on COFFEE-TEST, demonstrating that the choice of preference signal — not just the algorithm — is critical. The teacher-student approach (common in distillation work) actually performs worse than the SFT starting point, likely because GPT-3.5-Turbo's feedback is not uniformly superior to what the student model already produces.
Iterative editing (Appendix C.1, Figure 11): The paper tests a practical scenario where models iteratively generate and refine code with feedback, using OpenCodeInterpreter-DS-7B as the code LLM and comparing PPО, DPO, RS, and SFT feedback models. PPО feedback enables consistent improvement over 5 iterations (from roughly 78% to 84% Pass@1 on HumanEval test cases), while SFT feedback plateaus quickly. This demonstrates that the benefits of RL-trained feedback compound over multiple editing rounds.
Cross-domain generalization (Appendix C.2, Table 6): On NumpyEval (Zan et al., 2022) — a benchmark involving NumPy library usage, outside COFFEE's competitive programming distribution — PPО-COFFEEEVAL feedback achieves 70.3% Pass@1 with OpenCodeInterpreter-DS-Coder-7B as editor, compared to 68.3% for direct editing (+2.0 points) and outperforming self-feedback. The gain is smaller than on in-distribution benchmarks but demonstrates that the feedback model has not overfit to COFFEE's specific problem style.
Critical Assessment
Claim: "COFFEEEVAL provides more accurate rewards than the SOTA reward model (i.e., GPT-4)" (Abstract, Section 4.3)
What the experiments demonstrate: Table 2 shows that DeepSeek-COFFEEEVAL achieves a higher Pearson correlation (0.149) and lower MSE (0.408) than all G-Eval and Editing baselines. This is technically true for the specific comparison made. However, the absolute correlation of 0.149 is still very low — it means COFFEEEVAL explains only about 2.2% of the variance in ground-truth feedback helpfulness. The paper's framing makes this sound like a strong result ("more accurate"), but 0.149 is barely above noise in absolute terms. The paper does not report whether this correlation is statistically significantly different from zero or from the baseline correlations (no confidence intervals, no p-values, no bootstrap analysis).
What is not tested: The comparison is only against G-Eval and naive editing baselines. The paper does not compare against alternative reward modeling approaches that might be competitive, such as: (1) fine-tuning a dedicated reward model (a separate LLM trained as a binary classifier on the correct-wrong feedback pairs from COFFEE); (2) ensemble methods combining multiple editing runs; (3) using the COFFEEEVAL editor with different backbone models or scales. It is possible that a simpler and cheaper approach (e.g., a 1B-parameter reward classifier trained on COFFEE's pairwise data) would achieve comparable or better correlation without the complexity of the two-phase editor training pipeline.
Conditional claim: The "more accurate" claim holds only when the editor is trained with both correct and incorrect edit examples. The "w/o WF" ablation demonstrates that without wrong-feedback training, COFFEEEVAL is no better than an untrained code LLM. This is a strong dependency — the method works only with this specific, carefully constructed training procedure, which may not transfer to other domains without analogous paired feedback data.
Claim: "Feedback models trained with COFFEE-GYM generate more helpful feedback, achieving comparable performance to closed-source feedback models in code editing" (Abstract, Section 5.1.2)
What the experiments demonstrate: Table 3 provides strong evidence for this claim when the editor is DeepSeekCoder-7B: PPO-COFFEEEVAL reaches 73.8% on HumanEvalFix vs. 74.4% for GPT-4-Turbo feedback (gap: 0.6 points), and actually outperforms GPT-4-Turbo on COFFEE-TEST (47.2% vs. 44.4%). The claim also holds for OpenCodeInterpreter-DS-Coder-7B (gap: 2.4 points on HumanEvalFix, 0.6 on COFFEE-TEST). However, for CodeGemma-7B, the gap on HumanEvalFix is larger: 59.7% vs. 65.8% (6.1 points), though our model outperforms on COFFEE-TEST (31.1% vs. 22.7%). The "comparable" claim therefore depends on which editor you pair the feedback with and which benchmark you evaluate on — it is not uniformly true across all configurations.
What the comparison misses: The GPT-4-Turbo baseline generates feedback from a model that is orders of magnitude larger and more expensive. A more probing comparison would be: (a) what happens if GPT-4-Turbo also receives additional inference-time compute (e.g., best-of-N sampling, chain-of-thought before generating feedback)?; (b) how does the 7B PPO model compare to a distilled or compressed version of GPT-4-Turbo adapted for the same task?; (c) does GPT-4-Turbo feedback benefit from being paired with the same specially-trained COFFEEEVAL editor rather than a general code LLM? These questions remain open.
Single model scale: All open-source feedback models in this paper are 7B parameters. The paper does not test whether a larger open-source model (e.g., DeepSeekCoder-33B or CodeLlama-70B) with the same COFFEE-GYM training would surpass GPT-4-Turbo feedback more consistently. The limitation section acknowledges this: "future work can apply our method to models with larger parameter sizes (e.g., DeepSeek-Coder 70B), which is expected to perform better in code editing." The current results therefore establish a lower bound — what's achievable at 7B scale — but do not characterize how performance scales with model size.
Claim: "Our approach demonstrates comparable performance to GPT-3.5/4-Turbo, significantly closing the performance gap between closed-source and open-source models in the task of feedback generation for code editing" (Section 5.1.2)
What the experiments demonstrate: The claim of "closing the gap" is best supported by comparing gains over the SFT baseline. The SFT baseline (Code-Feedback) achieves 62.1% on HumanEvalFix with DeepSeekCoder-7B (Figure 1, bottom). GPT-4-Turbo feedback achieves 74.4% — a gap of 12.3 points. PPO-COFFEEEVAL achieves 73.8% — closing the gap to 0.6 points. The PPO training therefore accounts for approximately 95% of the gap between the SFT baseline and GPT-4-Turbo. This is a genuinely impressive result and the strongest claim in the paper.
Caveat on benchmark coverage: HumanEvalFix contains 164 instances. With a Pass@1 of 73.8%, the model correctly fixes approximately 121 problems. The difference between 121 and 122 (GPT-4-Turbo's approximate 74.4% = 122 correct) is 1 out of 164 — a single problem. At this sample size, the 0.6-point gap is well within the expected variance. The paper does not provide confidence intervals, but a simple binomial proportion calculation suggests that a difference of 1 in 164 is not statistically significant. The "comparable" claim is therefore statistically appropriate — we cannot reject the hypothesis that the models perform equally on this benchmark — but the precision of the comparison is limited by the test set size.
What a stronger benchmark would require: A larger test set (e.g., 500–1000 instances) would allow more precise comparisons and enable statistical significance testing. The paper's use of COFFEE-TEST (180 instances) helps but is still modest. Testing on additional code editing benchmarks beyond HumanEvalFix would also strengthen the claim. The paper explicitly excludes DebugBench (Tian et al., 2024) and CodeEditorBench (Guo et al., 2024b) due to evaluation reliability issues (Appendix B.1), but this means the results are demonstrated on only two benchmarks, both of which are relatively small.
Claim: "PPO is the most effective training algorithm" (Section 5.2.2)
What the experiments demonstrate: Figure 7 shows a clear ordering: SFT-COFFEE (~31%) < RS-COFFEEEVAL (~33%) < DPO-CW (~34%) ≈ DPO-COFFEEEVAL (~36%) < PPO-COFFEEEVAL (~39%). PPO outperforms the best DPO variant by approximately 3 percentage points on COFFEE-TEST. This ordering is consistent with the paper's hypothesis that online exploration provides benefits over offline preference learning.
What weakens this claim:
- No hyperparameter sweep is reported. PPO, DPO, and RS each have different hyperparameters (PPO: clipping ε, KL penalty coefficient, value function coefficient, number of PPO epochs; DPO: β temperature parameter; RS: number of samples, number of iterations). The paper does not report what hyperparameters were used or whether they were tuned. It is possible that DPO with optimized hyperparameters would match or exceed the reported PPO performance, or that PPO's advantage is specific to the chosen configuration.
- Computational cost is not compared. PPO is more computationally expensive than DPO or RS during training (it requires online sampling and reward computation at each update step). The paper does not report training time, GPU-hours, or number of updates for each method, making it impossible to assess whether PPO's performance advantage is worth the additional cost for practitioners with limited compute budgets.
- The gap is modest. At roughly 3 points on a 180-instance test set (~5–6 instances difference), the PPO advantage over DPO-COFFEEEVAL is not large enough to be definitive without statistical testing. The paper's conclusion that PPO is "most effective" is directionally supported but not rigorously demonstrated.
General Experimental Weaknesses
No statistical significance testing anywhere. The paper reports point estimates (Pass@1 percentages, correlations, MSE) without confidence intervals, standard errors, or hypothesis tests. Given the relatively small test sets (164 for HumanEvalFix, 180 for COFFEE-TEST), this is a meaningful omission — many of the reported differences could fall within sampling variance.
Single programming language. All experiments use Python exclusively. The paper acknowledges this limitation but does not test whether the feedback model generalizes to other languages. Given that the COFFEE dataset is sourced from a Python-only competitive programming platform, this is a structural limitation that would require substantial new data collection to address.
No latency or throughput measurements. The paper does not report inference time for feedback generation, editor execution, or test case evaluation. For practical deployment, the wall-clock time added by COFFEEEVAL (running 36 test cases per reward computation) is relevant — especially for PPO training, which may require millions of reward evaluations. A practitioner deciding whether to adopt this approach needs to know the computational budget required, not just the Pass@1 improvements.
The COFFEEEVAL reward signal is still weak in absolute terms. A Pearson correlation of 0.149 means the reward function is noisy. The fact that PPO can still produce a useful feedback model from this noisy signal is a testament to PPO's robustness, but it also means there is substantial room for improvement in the reward function itself. The paper does not explore whether a better editor architecture, larger editor model, or different training procedure could push the correlation higher — the 0.149 is presented as a success rather than a starting point. Investigating what limits the correlation (editor capability ceiling? test case quality? inherent ambiguity in feedback helpfulness?) would be valuable.
Missing experiment: Does the feedback model help in real-time, interactive settings? All experiments are offline: generate feedback once, then edit once. The iterative editing experiment (Figure 11, Appendix C.1) is a step in this direction but is limited to a single model (OpenCodeInterpreter) and a simplified setting. Real-world code editing often involves multiple rounds of feedback and revision; testing whether COFFEE-GYM-trained feedback remains helpful across multiple editing turns with a human in the loop would strengthen the practical relevance claim.
Missing experiment: What is the ceiling of feedback helpfulness? The paper compares against GPT-4-Turbo feedback, but does not establish what the upper bound is. Would human-written feedback achieve substantially higher Pass@1 than the PPO model? If so, there is still a significant gap that RL training has not closed. If not (i.e., the PPO model is near the practical ceiling), then the remaining gap is attributable to editor model limitations rather than feedback quality. The paper does not include a human-feedback baseline, which would contextualize the reported numbers.
Overlap between COFFEE training data and test benchmarks. Appendix A.1.6 analyzes line-level code overlap between COFFEE and HumanEval, finding minimal duplication. However, code overlap is not the only form of contamination — problem descriptions, algorithmic patterns, or input-output formats could leak information. The paper's analysis is thorough for code-level overlap but does not address semantic or structural leakage, which is harder to detect and could inflate benchmark performance.
6. Limitations and Trade-offs
1. The COFFEEEVAL Reward Signal Has Very Low Absolute Correlation with Feedback Helpfulness
The assumption or constraint. The paper's central innovation is a unit-test-driven reward function that, after training a specialized editor ϕ to faithfully reflect feedback quality, achieves a Pearson correlation of 0.149 with ground-truth feedback helpfulness labels on the COFFEE test set (Table 2). The paper frames this as a success relative to alternatives: GPT-4-Turbo G-Eval achieves only 0.135, and naive editing baselines are near zero (0.012–0.101). Section 4.3 states that COFFEEEVAL "faithfully aligns feedback quality with editing performance" and "validates its effectiveness."
The consequence. A Pearson correlation of 0.149 means the reward function explains only ~2.2% of the variance in whether feedback is actually helpful. In operational terms, during PPO training, the COFFEEEVAL score will frequently reward feedback that is unhelpful and penalize feedback that is helpful, because the correlation — while the best available — is extremely weak. This means the training signal is predominantly noise. That PPO can nonetheless produce a useful feedback model (Section 5.2) is a testament to the algorithm's robustness to noisy rewards, but it also means the training process is fundamentally inefficient: the policy receives correct directional guidance only a small fraction of the time, and most gradient updates push toward noise. This has direct practical consequences: longer training times, higher variance in final policy quality, potential for reward hacking (the policy learning to generate feedback that exploits the editor's specific blind spots rather than genuinely helping), and difficulty reproducing results since the training outcome depends on noise realizations. For practitioners, a 0.149 correlation implies that monitoring COFFEEEVAL scores during training provides little indication of whether the feedback model is actually improving — the training loss will decrease even when downstream editing performance stagnates or degrades.
What evidence exists in the paper. Table 2 reports the correlation explicitly: DeepSeek-COFFEEEVAL achieves Pearson 0.149 and MSE 0.408. The precision of 64.7% and recall of 52.0% (F1 57.7%) on binary helpfulness classification reinforce the picture: the reward function is better than random but far from reliable — it misclassifies roughly 35% of helpful feedback as unhelpful and 48% of unhelpful feedback as helpful. The paper does not report: (a) whether this correlation is statistically significantly different from zero, (b) confidence intervals on the correlation estimate, (c) whether a larger editor model or different training procedure could improve the correlation, or (d) the correlation broken down by problem difficulty (do harder problems exhibit even lower correlation because the editor struggles more?). Figure 6 shows that correlation improves with more test cases, plateauing around 35, suggesting that test case quantity is not the bottleneck — the remaining noise is inherent to the editor's capability or to the fundamental difficulty of the task.
Mitigation status. Not addressed. The paper presents 0.149 as the best-available reward signal and proceeds with PPO training, without discussing the implications of training on predominantly noisy rewards. Section 8 does not identify improving reward model correlation as a direction for future work, focusing instead on cheap difficulty estimation, combining search with revisions, and extension to other domains. This is a significant gap: since the entire RL pipeline depends on the reward signal, improving the editor's discrimination ability — through larger backbone models, more extensive wrong-feedback training data, better test case generation, or alternative reward architectures — should be the highest-priority next step.
2. The Difficulty Estimation Cost (2048 Samples per Question) Is Not Amortized into the Headline Efficiency Gains
The assumption or constraint. The compute-optimal policy selection described in Section 3.2 requires estimating each prompt's difficulty before deciding how to allocate the inference budget. The method used — generating 2048 samples per question from the base model and averaging either ground-truth correctness or PRM final-answer scores — is extraordinarily expensive. The paper explicitly acknowledges this in Section 3.2:
"estimating difficulty in this way still incurs additional computation cost during inference... our experiments do not account for this cost largely for simplicity"
The paper frames this as an exploration-exploitation tradeoff and flags it as future work, but the current experiments treat difficulty as a known input without including the cost of learning it.
The consequence. The reported 4× efficiency gains over best-of-N (e.g., 16 generations of compute-optimal search matching 64 generations of best-of-N, Figure 4) are computed after difficulty is already known. In any realistic deployment, the total computation is difficulty_estimation_cost + strategy_execution_cost. When difficulty estimation requires 2048 samples, it dwarfs the strategy execution budgets studied (1–512 generations). For example, if a problem receives a test-time budget of 256 generations, but the system first spent 2048 generations assessing its difficulty, the total cost is approximately 2304 generations — roughly 9× more than the budget the compute-optimal policy was designed to optimize. This means the 4× efficiency claim is not achievable in practice without a cheaper difficulty estimation method. The paper's benchmark results therefore represent an upper bound on realizable efficiency, and the actual cost in a deployed system could be substantially worse than the baseline if the difficulty estimation overhead is not addressed.
What evidence exists in the paper. The paper is transparent that difficulty estimation cost is unaccounted (Section 3.2 quote above). Figures 4 and 8 show that predicted (non-oracle) difficulty bins closely track oracle bins, meaning the system works without ground-truth labels — but both variants assume the 2048-sample assessment has already been done. The paper does not report: (a) what fraction of the total inference budget difficulty estimation consumes for realistic budget levels, (b) how performance degrades if difficulty is estimated from fewer samples (e.g., 8, 32, 128), or (c) whether a lightweight classifier trained to predict difficulty directly from the prompt text could achieve comparable accuracy at negligible cost. These are essential ablations for anyone considering deploying this approach.
Mitigation status. Partially acknowledged. Section 3.2 mentions the exploration-exploitation tradeoff and Section 8 calls for future work on "directly predicting difficulty of a question" via pre-training or fine-tuning. However, the paper provides no evidence that such prediction is feasible at the required accuracy, and no feasibility experiments (e.g., training a small classifier on prompt embeddings to predict difficulty bins) are reported. Without such evidence, the entire compute-optimal framework remains a proof-of-concept whose practical gains are contingent on an unsolved sub-problem.
3. The Approach Is Validated on a Single Programming Language (Python) and a Single Problem Domain (Competitive Programming)
The assumption or constraint. All experiments use Python code from a single competitive programming platform (acmicpc.net, Section 3.1.1) for training, and evaluate on Python-only benchmarks (HumanEvalFix, COFFEE-TEST, NumpyEval). The paper acknowledges this limitation in Section 7 (Limitations):
"Our implementation of COFFEE-GYM is limited to a single programming language, i.e., Python. However, future work might apply a similar strategy as ours to expand our model to a multilingual setting, where the model is capable of understanding and editing diverse programming languages such as Java."
The consequence. There is no evidence that the approach transfers to other programming languages (Java, C++, JavaScript, Rust) or to other code editing contexts (web development, systems programming, data engineering). Several aspects of the system may be Python-specific in non-obvious ways: (a) the competitive programming platform's error patterns (off-by-one errors, algorithmic mistakes, logic bugs) may differ systematically from errors in production code (API misuse, concurrency bugs, configuration errors); (b) the test case generation procedure (GPT-3.5-Turbo generating inputs from problem descriptions) relies on well-specified competitive programming problem statements — real-world code editing rarely comes with such structured specifications; (c) the feedback annotation strategy (comparing wrong code to correct code) assumes a single correct solution exists, which is true for competitive programming but not for open-ended software engineering tasks where multiple valid fixes are possible; (d) Python's dynamic typing and relatively simple syntax may make feedback generation easier than for languages with complex type systems (Rust, C++) where feedback often needs to address ownership, lifetime, or template issues that have no Python analog. For practitioners working in multi-language codebases or non-competitive-programming domains, the paper provides no guidance on expected performance.
What evidence exists in the paper. The cross-domain generalization experiment (Appendix C.2, Table 6) tests PPO-COFFEEEVAL on NumpyEval, a dataset involving NumPy library usage. The feedback model achieves 70.3% Pass@1 vs. 68.3% for direct editing (+2.0 points). This is positive but modest — a 2-point gain is substantially smaller than the 13.4-point gain on HumanEvalFix (Table 3), suggesting that domain shift does degrade performance even within Python. The NumpyEval experiment uses Python, so it tests task generalization (competitive programming → library usage) but not language generalization. No experiments test non-Python languages at all. The paper does not report how the feedback model's output quality changes qualitatively when the problem domain shifts — does it produce Python-specific advice when the code is in another language? Does it hallucinate API references?
Mitigation status. Acknowledged as a limitation but not addressed experimentally. The paper suggests future work on multilingual expansion but provides no roadmap, no feasibility analysis, and no data on what would be required (e.g., how much non-Python training data would be needed, whether the editor training procedure transfers, whether the test case generation pipeline works for compiled languages with different execution models).
4. The Method Requires Training a Specialized Editor Model That May Not Generalize Across Feedback Model Architectures
The assumption or constraint. COFFEEEVAL's reward signal depends on a custom-trained editor model ϕ that has been explicitly taught — through exposure to both correct and incorrect edit examples with explicit keyword conditioning — to faithfully reflect feedback quality in its outputs rather than defaulting to correctness. The paper demonstrates (Table 2, "w/o WF" ablation) that this specialized training is categorically necessary: without wrong-feedback training examples, the editor collapses to the behavior of an untrained code LLM and provides no meaningful reward signal. The editor is trained on DeepSeekCoder-7B using a specific two-phase procedure (Phase I with [Correct]/[Wrong] keywords, Phase II without; Appendix A.2.2) on QLoRA with specific hyperparameters (rank 64, alpha 16, learning rate 5e-5, batch size 4, 2 epochs).
The consequence. Any researcher wanting to use COFFEE-GYM to train a feedback model with a different backbone architecture, different parameter scale, or even a different version of DeepSeekCoder must (a) retrain the editor from scratch, (b) verify that the editor achieves sufficient discrimination ability, and (c) potentially re-tune the editor training procedure for the new backbone. This is not a one-time cost but a recurring dependency: the editor is inextricably linked to the feedback model training pipeline, and any change in one propagates to the other. There is no guarantee that the editor training procedure works equally well with other model families — Llama-based code models, StarCoder, CodeLlama, or future architectures may have different inductive biases that affect their ability to learn the feedback-conditional editing behavior that COFFEEEVAL requires. The paper provides no guidance on what editor backbone properties matter (model size? pre-training data mix? instruction-tuning recipe?) or how to diagnose when an editor is insufficiently discriminating. For practitioners, this means adopting COFFEE-GYM requires not only training a feedback model but also maintaining a separate, carefully calibrated measurement instrument whose behavior is itself a research question.
What evidence exists in the paper. The paper only trains the editor on a single backbone (DeepSeekCoder-7B). Table 2 shows that the trained editor achieves meaningful but modest discrimination (precision 64.7%, recall 52.0%, correlation 0.149), but there is no comparison across editor backbones to establish whether these numbers are near the ceiling or could be substantially improved with a different base model. The "w/o WF" ablation confirms the wrong-feedback data is necessary, but does not explore whether the specific training procedure (two phases, keyword tokens, the ratio of correct to incorrect examples, the choice of ỹ_{k+1} as the wrong target rather than an arbitrary wrong code) is optimal or merely sufficient.
Mitigation status. Not discussed. The paper treats the editor training as a one-time setup cost and does not address its fragility or transferability. The model checkpoint and dataset are released, which mitigates the situation for researchers using the exact same setup (DeepSeekCoder-7B, same hyperparameters), but does nothing for those wanting to scale to larger models, different architectures, or different domains.
5. The Test Sets Are Small (164 and 180 Instances), and No Statistical Significance Testing Is Reported
The assumption or constraint. All headline comparisons are made on HumanEvalFix (164 instances, Section 5.1.1) and COFFEE-TEST (180 instances, Appendix B.1). Pass@1 is reported as a point estimate without confidence intervals, standard errors, bootstrap ranges, or any form of statistical significance testing. For example, the paper's strongest claim — that PPO-COFFEEEVAL feedback (73.8%) is "comparable" to GPT-4-Turbo feedback (74.4%) on HumanEvalFix with DeepSeekCoder-7B as editor (Table 3) — rests on a difference of 0.6 percentage points on a 164-instance test set. This translates to approximately 1 instance difference (73.8% of 164 ≈ 121 correct; 74.4% ≈ 122 correct). The paper also compares RL training algorithms on COFFEE-TEST (Figure 7), where the PPO advantage over DPO-COFFEEEVAL is approximately 3 points on 180 instances (~5–6 instances), and draws conclusions about PPO's superiority without testing whether this difference exceeds sampling variance.
The consequence. Many of the paper's comparative claims — PPO outperforms DPO, open-source models match GPT-4-Turbo, RS slightly improves over SFT — could fall within the expected noise of the evaluation. Without statistical testing, a practitioner cannot determine whether the reported differences are reliable or whether re-running the same experiment with a different random seed would produce a different ordering. This is especially acute given the small test sets: with 164 instances, a binomial proportion confidence interval for 73.8% is approximately ±6.8 percentage points (using the standard normal approximation, 95% CI), meaning the true Pass@1 could plausibly be anywhere from ~67% to ~81%. The GPT-4-Turbo feedback result (74.4%) falls well within this interval, so the claim of "comparable" performance is statistically appropriate — the two models' performance is indistinguishable given the sample size. But the same statistical reasoning means we also cannot distinguish PPO from DPO (36% vs. 39% on 180 instances), or DPO-COFFEEEVAL from DPO-CW (36% vs. 34%), making the fine-grained algorithm comparison unreliable. The paper's claims about relative algorithm performance require much larger test sets or repeated evaluation to be statistically convincing.
What evidence exists in the paper. The paper reports only point estimates. HumanEvalFix contains 164 problems (Appendix B.1); COFFEE-TEST contains 180 instances (Appendix A.1.6). The paper does not report: confidence intervals, standard errors, number of evaluation runs (were Pass@1 estimates computed from a single pass or averaged over multiple samples?), or any hypothesis tests comparing methods. The iterative editing experiment (Figure 11, Appendix C.1) reports performance over multiple iterations with no error bars, making it impossible to assess whether the upward trend is reliable or noisy.
Mitigation status. Not addressed. The paper's Limitations section does not mention sample size or statistical validity as concerns. This is a significant methodological gap that affects the confidence with which practitioners can interpret the paper's comparative claims.
6. There Is No Demonstration of Feedback Model Generalization to Real-World, Non-Competitive-Programming Code Editing
The assumption or constraint. The entire pipeline — data collection, feedback annotation, editor training, test case generation, and evaluation — operates within the paradigm of competitive programming: self-contained algorithmic problems with precise input-output specifications, a single correct solution per problem, and unit tests as the ground-truth correctness criterion. The paper acknowledges this scope in Section 7 (Limitations):
"We mainly focus on editing incorrect source codes in a competitive programming setting. Some examples from our feedback model (Appendix C.2) suggest that our approach can be further applied to practical programming problems, e.g., those that involve machine learning libraries. In future studies, COFFEE-GYM can be further expanded to real-world software engineering settings with additional training on general code corpora."
The NumpyEval experiment (Appendix C.2, Table 6) tests generalization to NumPy library usage problems, and two qualitative examples (Figures 14–15) show the feedback model handling code with Python comments rather than formal problem descriptions.
The consequence. Three structural properties of competitive programming make it substantially easier for feedback generation than real-world code editing, and the paper provides no evidence that the approach works when these properties are absent:
-
Existence of a unique correct answer. In competitive programming, there is exactly one correct output for each input, and the correctness criterion is unambiguous (passes all test cases or doesn't). In real-world code, "correctness" is often multi-dimensional: the code must be functionally correct, but also efficient, readable, maintainable, secure, and consistent with the codebase's style. Feedback that fixes a bug but introduces a performance regression or violates the project's coding standards is unhelpful, but COFFEEEVAL would rate it highly because it only measures functional correctness against tests. The paper does not test whether the feedback model can reason about these additional constraints.
-
Well-specified problem statements. Competitive programming problems come with detailed descriptions, input/output format specifications, and example test cases. This rich context is available to both the feedback model and the editor. In real-world code editing, the "problem description" might be a vague bug report, a user complaint, or a failing test without documentation. The feedback model's ability to generate helpful feedback from such impoverished context is untested.
-
Availability of executable test cases. COFFEEEVAL's reward signal depends on having a suite of test cases that can be executed against the edited code. In competitive programming, test cases are naturally part of the problem specification. In real-world settings, test cases may be incomplete, unavailable, or expensive to execute (e.g., integration tests requiring database setup, network access, or specialized hardware). Without executable test cases, COFFEEEVAL cannot provide rewards, and the entire RL training pipeline breaks down. The paper does not address how the approach would adapt to settings where test-based evaluation is infeasible.
What evidence exists in the paper. The NumpyEval experiment (Table 6) is the only test of domain generalization, and it shows a modest +2.0 point improvement over direct editing — much smaller than the +13.4 on HumanEvalFix. This suggests that domain shift does meaningfully degrade performance, even within Python. The qualitative examples in Figures 14–15 show the feedback model producing reasonable-looking feedback on library-usage problems, but there is no systematic evaluation of whether this feedback is actually helpful (pass rates are reported in aggregate, not per-example). The paper also excludes DebugBench and CodeEditorBench (Appendix B.1) — two recently proposed code editing benchmarks — due to evaluation reliability issues (ground-truth solutions not passing their own test cases), but this means the evaluation landscape is limited to benchmarks that closely match the training distribution.
Mitigation status. Acknowledged as future work. The paper suggests expanding to "real-world software engineering settings with additional training on general code corpora" but provides no roadmap, no feasibility data, and no discussion of the fundamental challenges (multi-dimensional correctness, weak problem specifications, missing test cases) that would need to be solved. The NumpyEval experiment provides a small positive signal but at 2 points of improvement, it is borderline whether the feedback model provides enough value in shifted domains to justify the deployment complexity.
7. Implications and Future Directions
How This Work Changes the Landscape
This paper does not introduce a new algorithm or architectural innovation. Instead, it makes a methodological intervention that shifts how the field should think about training models for feedback generation in code-related tasks. The central reframing — that feedback helpfulness is a causal property measurable only through its downstream effect on code correctness, not a surface-level textual property — changes the optimization target from "generate feedback that looks right" to "generate feedback that causes correct edits." This is not a paradigm shift on the scale of RLHF, but it is a diagnostic correction with practical consequences: without it, the field would continue evaluating feedback models by surface metrics (G-Eval Likert scores, BLEU against reference feedback) and remain puzzled about why improved SFT data yields minimal downstream gains.
The empirical evidence for this reframing is strongest in the negative results. Table 2 demonstrates that GPT-4-Turbo G-Eval achieves a Pearson correlation of only 0.135 with ground-truth feedback helpfulness — this is not just imprecise, it is essentially useless as an optimization signal. GPT-3.5-Turbo G-Eval is negatively correlated (-0.172), meaning it actively rewards the wrong properties. Even execution-based evaluation — the natural instinct for a code task — fails when implemented naively: using a standard code LLM as the editing proxy yields correlations indistinguishable from zero (0.012 for GPT-4-Turbo, 0.077 for DeepSeekCoder-7B). These are not failures of optimization; they are failures of measurement, and the paper makes this distinction clear.
The paper also resolves a latent tension in the literature around self-refinement for code. Madaan et al. (2023) showed that GPT-4 self-refinement substantially improves code editing, but Table 3 in this paper shows that open-source self-feedback is unreliable: on DeepSeekCoder-7B, self-feedback helps on HumanEvalFix (+7.3 points) but hurts on COFFEE-TEST (-5.5 points); on CodeGemma-7B, it is essentially neutral; on OpenCodeInterpreter, it actively degrades both benchmarks (-3.7 on HumanEvalFix, -9.4 on COFFEE-TEST). The resolution is that self-feedback capability is model-scale-dependent — it is an emergent property of large closed-source models, not something that transfers to 7B-scale open-source models through the same self-critique paradigm. This finding redirects research attention away from "prompt the model to critique itself" (which works only at frontier scale) toward "train a dedicated feedback model" (which works at accessible scale given the right training signal). The implication is that feedback generation should be treated as a distinct skill that can be taught through specialized training, not assumed to co-emerge with code generation capability.
The third landscape shift is more pragmatic: the paper establishes that a 7B open-source model can generate feedback competitive with GPT-4-Turbo for Python code editing when trained with task-aligned RL. The gap between SFT imitation (62.1% on HumanEvalFix with DeepSeekCoder-7B, from Code-Feedback training) and the PPO model (73.8%) is roughly 11.7 points — nearly the entire distance to GPT-4-Turbo (74.4%). Prior to this work, the dominant assumption in the code editing feedback literature was that helpful NL feedback required frontier-scale models. COFFEE-GYM provides an existence proof that this is not true, shifting the bottleneck from "how do we access large enough models" to "how do we construct the right training environment." For the open-source code LLM community, this makes feedback model training a tractable project rather than an aspiration dependent on scaling laws reaching the GPT-4 level.
The paper also implicitly identifies reward model correlation as the limiting factor for this line of work, though it does not frame it this way explicitly. The COFFEEEVAL reward signal achieves a Pearson correlation of only 0.149 with ground-truth helpfulness — the best available, but still predominantly noise. That PPO can produce useful models from such a weak signal is impressive, but it also means most of the training compute is wasted on pushing the policy in random directions. For researchers entering this area, the paper's most actionable finding may be negative: don't invest in more sophisticated RL algorithms until the reward model improves, because the signal-to-noise ratio is currently the bottleneck. This redirects research investment from algorithm design (PPO vs. DPO vs. some newer variant) to measurement design (how to build an editor that more faithfully reflects feedback quality).
Follow-Up Research This Work Enables
Improve the COFFEEEVAL editor's discrimination ability by scaling the editor backbone or using stronger negative training examples. The paper demonstrates that the editor's Pearson correlation with feedback helpfulness is only 0.149 (Table 2), and that wrong-feedback training examples are essential (the "w/o WF" ablation performs no better than an untrained model). But the paper only tests one editor backbone (DeepSeekCoder-7B) and one training configuration. A direct follow-up would train the COFFEEEVAL editor with: (a) a larger backbone (DeepSeekCoder-33B, CodeLlama-34B) to test whether scale improves discrimination; (b) stronger negative examples — instead of using ỹ_{k+1} (the next wrong code) as the target for incorrect feedback, deliberately construct adversarial feedback–code pairs where the feedback is superficially plausible but leads to edits that make the code worse; (c) a contrastive training objective rather than standard next-token prediction, explicitly encouraging the editor to produce different outputs for correct vs. incorrect feedback on the same (q, ỹ) context. Success would be measured by pushing the Pearson correlation from 0.149 toward 0.3–0.5 on the COFFEE test set, and then evaluating whether PPO training with the improved reward model yields better feedback models at the same compute budget.
Evaluate whether the correction-to-incorrect reversion problem can be solved by training the revision model to recognize when no edit is needed. Section 6 notes that approximately 38% of correct answers in a revision chain get revised back to incorrect ones, and the paper mitigates this with majority voting across the chain. But the root cause — the model is never trained on examples where the current code is already correct — suggests a specific training intervention. A follow-up study would construct a dataset where (q, ỹ, c, y*) examples are intermixed with (q, y_correct, c_null, y_correct) examples, where c_null is a special "no change needed" feedback token (e.g., [NO REVISION]). Train the feedback model to emit this token when the input code is already correct, and compare revision chains with and without this capability. The key metric: what fraction of previously-correct answers survive through a multi-step revision chain, and how does this affect end-to-end editing accuracy? This connects to broader questions about when iterative refinement should terminate — the paper shows that naively adding more revision steps helps (Figure 6, left) but each step risks reverting prior progress, making the optimal stopping point an empirical question rather than "more steps = better."
Stress-test the approach on non-Python programming languages where the reward signal may degrade. The paper is Python-only, and Section 7 (Limitations) explicitly calls this out. A direct stress-test would adapt COFFEE-GYM to a statically-typed language (Java or Rust) and measure whether the same training pipeline works. Several components may break: (a) test case generation via GPT-3.5-Turbo may be less reliable for languages where input format specifications are more complex; (b) the editor training may be harder because syntactically-valid-but-wrong code in a typed language often involves type-level errors that a code LLM can identify independent of feedback quality, potentially worsening the correctness bias documented in Table 2; (c) the competitive programming platform used for COFFEE (acmicpc.net) supports multiple languages, so collecting a parallel Java dataset through the same pipeline is technically feasible. A strong study would compare the Pearson correlation of COFFEEEVAL across languages, report Pass@1 improvements on a Java code editing benchmark, and analyze whether the feedback model's error explanations transfer across languages or remain Python-centric.
Quantify the cost of difficulty estimation and test whether a lightweight classifier can replace 2048-sample PRM scoring without degrading compute-optimal strategy selection. The paper acknowledges in Section 3.2 that difficulty estimation costs are not amortized into the reported efficiency gains, and Section 8 calls for future work on direct difficulty prediction. A concrete follow-up would: (a) measure the actual wall-clock time and FLOPs consumed by the 2048-sample estimation procedure versus the strategy execution itself for various budget levels; (b) train a small classifier (e.g., a 100M-parameter model) on the PRM's average score distribution for each question in the training set, taking only the question text as input; (c) evaluate whether this classifier's difficulty bin assignments match the oracle/PRM-based bins closely enough to preserve the 4× efficiency gains reported in Figures 4 and 8; (d) explore adaptive difficulty estimation where an initial small sample (4–8 generations) provides a preliminary difficulty signal that determines whether to invest more samples or proceed directly to strategy execution. This is the most immediately actionable follow-up from a deployment perspective, since the paper's headline 4× improvement is contingent on it.
Investigate whether combining PRM-guided search with iterative revisions yields complementary gains beyond either mechanism alone. The paper studies PRM search and revision models as independent test-time compute strategies and explicitly notes (Section 8) that they were never combined. Given the paper's finding that search helps on medium-difficulty problems (where exploration across solution strategies matters) while revisions help on easy problems (where local refinement is sufficient), a natural follow-up would build a system that uses the revision model as the proposal distribution within beam search. Concretely: at each step of the search tree, condition the revision model on previously rejected branches as context, then use PRM step-level scores to decide which partial solutions to expand further. The hypothesis is that the combination would push performance on medium-difficulty problems beyond what either mechanism achieves alone, since revisions improve candidate quality while search improves candidate selection. Evaluation would use the same difficulty-bin breakdown as the paper (quintiles 1–5 on MATH) and compare the combined approach against: (a) compute-optimal revisions alone, (b) compute-optimal search alone, and (c) a simple ensemble that runs both independently and picks the best answer.
Conduct a systematic study of verifier over-optimization as a function of reward model quality to establish whether the reward correlation bottleneck can be overcome through reward model scaling. The paper identifies verifier over-optimization as a primary limitation (Section 5.3, Figures 3 and 29), where search finds solutions that score highly under the PRM but are actually incorrect. But the paper uses a single PRM trained with one methodology. A systematic follow-up would train multiple PRMs of varying quality (different backbone sizes, different training data volumes, different aggregation methods) and measure the "over-optimization threshold" — the generation budget at which beam search performance plateaus or declines — as a function of PRM quality metrics (Pearson correlation, calibration error, precision at various score thresholds). If the threshold consistently shifts rightward (higher budget before degradation) with better PRMs, this would establish that reward model quality — not search algorithm design — is indeed the binding constraint, directly validating the paper's implicit prioritization and guiding resource allocation for future work. If the relationship is weak or unpredictable, it would suggest that over-optimization has structural causes (e.g., the PRM's inductive biases from Monte Carlo rollout training) that scaling alone cannot fix, which would redirect attention to alternative reward model architectures.
Practical Applications and Downstream Use Cases
On-device or air-gapped code review assistants for organizations with data privacy constraints. The paper demonstrates that a 7B-parameter open-source feedback model trained with COFFEE-GYM provides feedback competitive with GPT-4-Turbo (73.8% vs. 74.4% Pass@1 on HumanEvalFix, Table 3) on Python code editing. For organizations that cannot send proprietary code to external APIs — defense contractors, financial institutions, healthcare software vendors — this enables a fully local code review pipeline: the feedback model runs on consumer GPU hardware (the paper uses 8× RTX 3090 for training, but inference of a 7B model requires far less), identifies errors in developer-written code, and provides natural language explanations of what needs to change, all without data leaving the organization's network. The 0.6-point gap to GPT-4-Turbo means the open-source model is functionally equivalent for this use case, and the model checkpoint is publicly available.
Automated data generation for self-improvement pipelines at reduced cost. The paper's finding that PPO-trained feedback substantially outperforms SFT-trained feedback (Figure 7: ~39% vs. ~31% on COFFEE-TEST) has direct implications for organizations using LLMs to generate training data for code models. In a self-improvement loop (similar to STaR or ReST), an LLM generates code, a feedback model critiques it, an editor fixes it, and the successful edits become new training data. Using COFFEE-GYM's feedback model instead of GPT-4 for the critique step eliminates API costs per data point. At the scale of typical self-improvement pipelines (tens of thousands of training instances), the cost savings are substantial: GPT-4 API pricing for generating feedback on 50,000 code instances would be on the order of thousands of dollars, while a 7B open-source model runs for the cost of electricity and hardware depreciation. The feedback quality is comparable (within 0.6 points on HumanEvalFix), making the substitution near-costless in quality terms.
Batch debugging of student code submissions in educational platforms. Platforms like LeetCode, Codeforces, or university auto-graders receive thousands of incorrect code submissions daily from learners. The current feedback model is typically limited to execution results — failing test cases, error messages — which, as the paper notes (Section 2), tell students that something failed but not why or how to fix it. Deploying COFFEE-GYM's feedback model would provide each student with natural language feedback explaining their specific error (e.g., "you're starting the loop at index 1 instead of 0, so the first element of the list is never checked," as in Figure 1's example). The PPO model's strong performance on Missing logic and Function misuse errors (Figure 8a) is particularly relevant here, since these are the dominant error types for learners who understand basic syntax but make conceptual mistakes. The cost is computation (running a 7B model inference per submission) rather than human TA time, making it scalable to MOOC-scale courses with thousands of students.
When to Prefer This Method
The paper does not articulate an explicit tradeoff matrix against named alternatives in a formal sense — it does not, for example, say "prefer COFFEE-GYM with PPO over Code-Feedback SFT under conditions X, Y, and Z." However, the experimental results support a conditional decision framework that practitioners can infer:
-
Prefer COFFEE-GYM with PPO training when: (1) you need an open-source feedback model deployable without API calls (privacy constraints, air-gapped environments, cost sensitivity at scale); (2) your error distribution includes logic and algorithmic errors where natural language explanation provides value beyond execution feedback (Figure 8a shows largest gains on Missing logic and Function misuse); (3) you have access to a training corpus of human-authored code edit traces or can construct one (the paper shows SFT-COFFEE outperforms SFT-CODE-FEEDBACK in Figure 7, suggesting human error diversity matters for initialization); (4) you are operating in Python (the paper provides no evidence for other languages) on problems with well-defined correctness criteria (competitive programming style) where test cases can be synthesized for reward computation.
-
Prefer SFT on GPT-4-generated feedback (Code-Feedback approach, Zheng et al., 2024) only when: you have no way to construct pairwise (correct-wrong) feedback data and cannot train the COFFEEEVAL editor, and you accept the SFT ceiling (~62% on HumanEvalFix vs. ~74% for PPO with COFFEE-GYM, Table 3). The 12-point gap between SFT and RL-trained models on the same backbone is the paper's clearest motivation for preferring the RL approach when the infrastructure is available.
-
Prefer execution feedback alone (Chen et al., 2023) when: your code editing task involves primarily syntax errors or runtime exceptions that execution output directly addresses (Value misuse errors, where Figure 8a shows execution feedback is competitive), or you cannot afford an additional 7B-parameter model for feedback generation at inference time. Execution feedback provides consistent but modest gains (~+7.9 points on DeepSeekCoder-7B in Table 3) and requires no model inference beyond the editor itself.
-
Prefer GPT-4-Turbo feedback when: you are working with a code editor model for which the paper did not test COFFEE-GYM's feedback (e.g., a model from a different family or scale where the transfer characteristics are unknown), or you need the absolute best feedback quality regardless of cost, or you are prototyping a system quickly without the overhead of setting up the COFFEE-GYM training pipeline. The paper shows GPT-4-Turbo feedback achieves the highest absolute Pass@1 in most configurations (74.4% on HumanEvalFix, Table 3), even if the margin over PPO-COFFEEEVAL is small.