Search papers, labs, and topics across Lattice.
Code-A1 introduces an adversarial co-evolution framework using reinforcement learning to jointly optimize a Code LLM and a Test LLM with opposing objectives: the Code LLM aims to pass tests, while the Test LLM aims to expose defects. By separating the code and test generation roles, Code-A1 mitigates self-collusion risks and enables white-box test generation, allowing the Test LLM to inspect candidate code for targeted adversarial tests. Experiments using Qwen2.5-Coder models show that Code-A1 achieves code generation performance comparable to models trained on human-annotated tests and significantly enhances test generation capabilities.
By adversarially co-evolving code and test LLMs, Code-A1 eliminates self-collusion and unlocks white-box test generation, rivaling human-annotated test performance.
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.