Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning

Aozhe Wang, Yuchen Yan, Nan Zhou, Zhengxi Lu, Weiming Lu +3 more
3/16/2026
cs.CL

No official code found. Best implementation: ZJU-REAL/Code-A1 (38 stars, last commit 2026-03-17).

Abstract

Reinforcement learning for code generation relies on verifiable rewards from unit test pass rates. Yet high-quality test suites are scarce, existing datasets offer limited coverage, and static rewards fail to adapt as models improve. Recent self-play methods unify code and test generation in a single model, but face a inherent dilemma: white-box access leads to self-collusion where the model produces trivial tests for easy rewards, yet black-box restriction yields generic tests that miss implementation-specific bugs. We introduce Code-A1, an adversarial co-evolution framework that jointly optimizes a Code LLM and a Test LLM with opposing objectives. The Code LLM is rewarded for passing more tests, while the Test LLM is rewarded for exposing more defects. This architectural separation eliminates self-collusion risks and safely enables white-box test generation, where the Test LLM can inspect candidate code to craft targeted adversarial tests. We further introduce a Mistake Book mechanism for experience replay and a composite reward balancing test validity with adversarial difficulty. Experiments on Qwen2.5-Coder models demonstrate that Code-A1 achieves code generation performance matching or exceeding models trained on human-annotated tests, while significantly improving test generation capability.

View on arXivView PDF

Code Implementations(1)

ZJU-REAL/Code-A1Community73%

Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning

384Shell, PythonFeb 7, 20267 months ago

Similar Papers

Cite this paper

@article{wang2026codea,
  title  = {Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning},
  author = {Aozhe Wang and Yuchen Yan and Nan Zhou and Zhengxi Lu and Weiming Lu and Jun Xiao and Yueting Zhuang and Yongliang Shen},
  year   = {2026},
  eprint = {2603.15611},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.15611v1}
}

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/2603.15611.svg)](https://codeofpaper.com/paper/2603.15611)

Discussion