Despite recent progress in Large Language Model (LLM) Agents for Software Engineering (SWE) tasks, end-to-end fine-tuning typically relies on verifiable terminal rewards such as whether all unit tests pass. While these binary signals reflect whether the final solution is correct, they provide little guidance for shaping intermediate behaviors during multi-step interactions, thereby limiting improvements in the overall quality of the resolution process. To address this, we introduce a rubric-based Generative Reward Model (GRM) that provides richer learning signals. The GRM is equipped with human-designed rubrics that indicate criteria for encouraging or discouraging specific behavioral patterns, and we leverage this feedback for high-quality training data collection via trajectory filtration. When used for Reinforced Fine-Tuning (RFT) on SWE Tasks, our approach outperforms terminal-score-only rejection sampling: it more effectively suppresses undesirable patterns while promoting beneficial ones, as confirmed by case analyses, and it ultimately improves final test accuracy.
Figures & tables
Figure 1: Illustration of Rubrics-based GRM Filtering Process. From the same trajectory prefix (conversation history), we sample multiple candidates continuations (black arrows, three candidates per-step in figure). Here each candidate can be a one-step action or a multistep trajectory segments, which are sampled independently. A Generative Reward Model (GRM) then evaluates candidates based on the rubrics and additional information when available (e.g., a ground-truth git patch), selects out the best continuation, and discards the others. This process repeats until the termination of the trajectory, after which a verifiable reward based on unit tests is assigned.
Before RFT
Baseline (VR only)
T-GRM N=3
T-GRM N=5
S-GRM L=7,N=3
S-GRM L=5,N=3
Test Accuracy
28.0%
36.6%
39.3%
42.6%
40.2%
40.5%
Table 1: Test Accuracy of Models after RFT. Collecting RFT dataset with our rubric-based GRM approach leads to higher test accuracy.
Table 2: Pattern Analysis of 36B on Test Set after RFT. Up : the proportion of resolution trajectories create or run test/reproduction scripts. Down : the averaged consumed turns to resolve the issue and the error rate. Here “Task-Level” measures the proportion of tasks (or trajectories) containing error, while “Turn-Level” computes the proportion of overall turns with error. Overall, incorporating GRM into the RFT data collection stage helps to promote desired patterns while suppressing undesired ones in LLM agents’ behaviors.
Before RFT
Baseline (VR only)
T-GRM N=3
Test Accuracy
48.0%
46.8%
50.6%
Table 3: Test Accuracy of the Stronger 36B after RFT. Our approach still yields a better performance. The baseline method results in a performance drop, which we interpret as a normal fluctuation when the performance is close to its upper limit.
Table 4: Pattern Analysis of the “stronger” 36B on Test Set after RFT. We observe clear improvements in reproduction-related behaviors and the averaged number of consumed turns. Although there is no significant change in the test-related behaviors or error rates, this is expected—the base model already exhibits near-optimal performance for those patterns.
Table 5: Pattern Analysis of 36B Model on Train Set
Rejection Fine-Tuning (RFT) is a standard method for training LLM agents, where unsuccessful trajectories are discarded from the training set. In the context of SWE-bench tasks, this corresponds to filtering out runs where the submitted patch does not pass the tests. However, this approach discards unresolved trajectories, even though they form a large portion of all trajectories for hard tasks and even then may be partially correct. In this work, we propose Step Rejection Fine-Tuning (SRFT) - a practical way to leverage these unresolved trajectories. For this, we employ a critic LLM to assess the correctness of each step in a trajectory. Consequently, during training, we mask the loss for erroneous steps while retaining them in the context window. This way we ensure the model learns to recover from errors without reproducing them. Evaluation on SWE-bench Verified shows that while RFT improves the resolution rate by 2.4% by excluding unresolved trajectories, SRFT improves it by 3.7% by filtering them instead of discarding completely, reaching the total resolution rate of 32.2%.
Reinforcement learning with verifiable rewards (RLVR) provides reliable supervision for software engineering agents through executable tests, but binary rewards fail to distinguish trajectories with substantially different debugging quality. We investigate whether the current policy can judge its own trajectories and use these judgments to improve task performance without a separately trained reward model. To this end, we introduce Behavioral Self-Rewarding (BSR), a reward-refinement method that reuses the policy to compare observable debugging behavior among trajectories from the same task with the same verifier outcome. BSR aggregates pairwise preferences into task-local scores and converts them into bounded auxiliary rewards, introducing reward contrast while preserving the verifier-defined pass/fail ordering. This provides additional supervision from already-collected trajectories without requiring new environment interactions. Experiments on SWE-bench Verified and SWE-bench-Live show consistent improvements across the evaluated Qwen3-14B and Qwen3-32B configurations, supporting using the policy's own comparative judgments as a complementary learning signal for training software engineering agents.
Yiran Wu, Andrew Zhao, Yurui Chang +2
Pennsylvania State University · Microsoft Research · AG2AI
LLM-driven software engineering agents have become a central testbed for real-world language-model capability, yet their training remains limited by the availability of high-quality SWE tasks. Existing synthetic data methods typically create tasks through fixed mutation or bug-injection procedures, making the resulting distributions largely independent of the agent's own weaknesses and training progress. We introduce Socratic-SWE, a closed-loop self-evolution framework that reuses the agent's historical solving traces as a source of training signal. Rather than treating traces only as evidence for reward computation, Socratic-SWE distills them into structured agent skills that summarize recurring failures and effective repair patterns. These skills then guide the generation of targeted repair tasks in real repositories. Candidate tasks are checked through execution-based validation and scored with a solver-gradient alignment reward, so that the retained tasks are both verifiable and useful for improving the Solver. The updated Solver produces new traces, enabling the task curriculum to adapt over successive rounds. Across SWE-bench Verified, SWE-bench Lite, SWE-bench Pro, and Terminal-Bench 2.0, Socratic-SWE consistently improves over self-evolving baselines under the same compute budget, reaching 50.40% on SWE-bench Verified after three iterations. These results suggest that solving traces can serve as a scalable substrate for self-evolving SWE agents.
Chuan Xiao, Zhengbo Jiao, Shaobo Wang +5
2Shanghai Jiao Tong University · 1AI Data, Alibaba Group