Summary
Adversarial Code Evolution (ACE) is a self-evolving framework for code generation that replaces the conventional solver-verifier architecture with a solver–adversary architecture. A single LLM alternates between two roles: generating candidate programs (solver) and producing adversarial unit test inputs (adversary). The adversary is optimized to actively induce execution-level failures—runtime errors, exceptions, or non-termination—rather than merely confirming semantic correctness. Supervision comes solely from execution outcomes: robust programs are selected for supervised fine-tuning (SFT), and the adversary is refined via Kahneman–Tversky Optimization (KTO) using execution-derived preferences. ACE requires no ground-truth code or external reward models. Experiments on CodeContests, MBPP, and LiveCodeBench show ACE consistently outperforms solver-verifier baselines with 3–7% absolute gains in pass@1, larger improvements on out-of-distribution benchmarks, and competitive or improved inference efficiency.
Key Points
- ACE introduces an adversary that generates unit test inputs optimized to expose execution failures (runtime errors, exceptions, non-termination), inspired by fuzzing.
- The architecture uses a single LLM that alternates between solver and adversary roles; no separate verifier or reward model is needed.
- Execution outcomes alone construct preference signals for both solver and adversary: adversarial tests filter robust programs for SFT and induce preference pairs for KTO on the adversary.
- On CodeContests, ACE achieves pass@1 of 46.7 (4B backbone) vs. 41.7 from instruction tuning; pass@10 improves from 56.5 to 60.1.
- On out-of-distribution benchmarks (MBPP, LiveCodeBench), ACE shows larger gains, e.g., 2–4 points in pass@1 over solver-verifier baselines.
- ACE improves inference efficiency: average token usage on MBPP (4B) decreases from 785.9 to 688.8 while accuracy rises.
- Ablation studies confirm that each component (adversarial optimization, KTO, SFT) is essential; removing any degrades performance.
- The adversary generates diverse failure types: boundary/extreme-value (30.2%), format-sensitive (24.1%), combinatorial corners (22.7%), large-scale/stress (12.3%), and others.
- The framework uses LoRA adapters (rank 64) on a shared backbone to separate solver and adversary roles without interference.