FailForge: Distilling Procedural Competence from Persistent Failures into Code Agents

Dongyi Lv, Fushun E, Aichen Cai, Liang Huang, Ya Zhang +6 more
8/9/2026
cs.AI

No confident code implementation found for this paper.

Abstract

Rejection sampling fine-tuning (RFT) is widely used to train code agents by generating trajectories on verifiable software engineering tasks, retaining those that pass the tests, and fine-tuning on the successful rollouts. However, even strong code agents repeatedly fail on a substantial fraction of such tasks, and standard RFT simply discards these failures.

Show full abstract

The discarded samples are precisely the hardest and most informative ones, drawn from verifiable instances that are costly to curate. Stronger base models may reduce the number of failures, but the remaining hard cases still define the frontier for further improvement. We propose FailForge, an agentic framework that converts failed rollouts into training signal. For each failed instance, an agent diagnoses the failure from error feedback and execution traces, distills the diagnosis into a concise and actionable skill, and injects the skill into the agent context for a guided second attempt. Trajectories that succeed under skill guidance are folded back into the RFT corpus. Crucially, the skill is removed at training time, so the model internalizes the recovered behavior rather than relying on external hints at inference. FailForge recovers over 26% of previously failed instances at marginal additional cost, and training Qwen3.5-4B on the augmented corpus improves the SWE-bench Verified resolve rate by 6.6 points over a strong RFT baseline, with gains concentrated on the hardest problems.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{lv2026failforge,
  title  = {FailForge: Distilling Procedural Competence from Persistent Failures into Code Agents},
  author = {Dongyi Lv and Fushun E and Aichen Cai and Liang Huang and Ya Zhang and Qiuyu Ding and Canhui Wu and Zhi Wang and Yuesong Zhang and Jiaqi Wang and Nan Duan},
  year   = {2026},
  eprint = {2608.08570},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.08570v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.08570.svg)](https://codeofpaper.com/paper/2608.08570)

Discussion