Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning
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.
69b8d6506b3f36c249fbc489
Aozhe Wang
69b8d6506b3f36c249fbc48a
Yuchen Yan
claimed_verified
2026-03-17T08:19:21.182Z
64098738342c26884c792c93
https://cdn-avatars.huggingface.co/v1/production/uploads/64098738342c26884c792c93/SxBUd-wLrl-PjQsrVYJte.jpeg
Yuchen Yan
yanyc
user
yanyc
69b8d6506b3f36c249fbc48b
Nan Zhou
69b8d6506b3f36c249fbc48c
Zhengxi Lu
admin_assigned
2026-03-17T08:48:56.655Z
676127cf11b19ea602bb202a
/avatars/dfd802a24bd63e509728159ebb1769f6.svg
Zhengxi Lu
LZXzju
user
LZXzju
69b8d6506b3f36c249fbc48d
Weiming Lu
admin_assigned
2026-03-17T08:49:03.375Z
69a953b711b00bfd8980e07d
/avatars/b01256a3a50913c7d600e9254d2811d9.svg
Weiming Lu
WeMinL
user
WeMinL
69b8d6506b3f36c249fbc48e
Jun Xiao
69b8d6506b3f36c249fbc48f
Yueting Zhuang
69b8d6506b3f36c249fbc490
Yongliang Shen
claimed_verified
2026-04-07T08:48:11.478Z
5e1058e9fcf41d740b69966d
/avatars/ce74839ba871f2b54313a670a233ba82.svg
Yongliang Shen
tricktreat
user
tricktreat
Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning
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.