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

Aozhe Wang, Yuchen Yan, Nan Zhou, Zhengxi Lu, Hong Zhao, Yao Fu, Weihao Jiang, Weiming Lu, Jun Xiao, Yueting Zhuang, Yongliang Shen


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 an 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.
Anthology ID:
2026.findings-emnlp.480
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
10068–10089
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.480/
DOI:
Bibkey:
Cite (ACL):
Aozhe Wang, Yuchen Yan, Nan Zhou, Zhengxi Lu, Hong Zhao, Yao Fu, Weihao Jiang, Weiming Lu, Jun Xiao, Yueting Zhuang, and Yongliang Shen. 2026. Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 10068–10089, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning (Wang et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.480.pdf