AI
New Framework Improves AI Code Generation by Testing and Fixing Programs Iteratively
Researchers introduce FixAudit, a method that treats code generation as an iterative debugging process rather than one-shot creation, achieving substantial gains on competitive programming benchmarks.
Large language models have made strides in generating code, yet competitive programming tasks remain difficult. Existing approaches train models to produce candidate solutions and evaluate them against tests, but this strategy has structural gaps: test generators often lack visibility into actual code implementations, and models cannot learn from failures to repair faulty programs.
A New Approach to Code Improvement#
Rather than asking a model to generate a perfect solution on the first try, researchers have proposed FixAudit, a framework that recasts competitive code generation as an iterative test-and-repair process. The system starts with a single initial candidate solution and repeatedly refines it through targeted cycles of testing and debugging. A shared language model takes on two distinct roles—a Fixer that repairs code based on failed tests, and an Auditor that reads the candidate solution to devise new tests designed to uncover remaining bugs.
How It Works#
The framework trains the model through four specialized stages, enabling it to handle both code repair and test generation with awareness of the actual implementation. Rather than creating many candidate solutions in parallel and picking the best one, FixAudit focuses computational effort on progressively improving a single program, similar to how human programmers debug their work.
Performance Gains#
Testing on three competitive programming benchmarks—APPS, CodeContests, and xCodeEval—FixAudit demonstrated significant improvements. On a 7-billion-parameter model, it matched the performance of a much larger 32-billion-parameter baseline in zero-shot settings. Compared to other methods using the same 7B base model, FixAudit achieved average Pass@1 improvements of 35.1% to 36.8% and average AvgPassRatio gains of 7.1% to 24.5%.

