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

Source: [Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning](<https://www.sota2.com/research/paper/69b8e04e0636e5bf4afbef1f>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-03-20T06:00:01.872Z

Authors: Aozhe Wang, Yuchen Yan, Nan Zhou, Zhengxi Lu, Weiming Lu, Jun Xiao, Yueting Zhuang, Yongliang Shen

Published: 2026-03-16T17:58:13.000Z

## 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.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Code Generation on HumanEval+ (avg@32)](<https://www.sota2.com/research/sota/code-generation-on-humaneval-plus-avg-at-32.md>): Code Generation; HumanEval+; Average Pass Rate @32: 85.21.

- [Code Generation on MBPP+ (avg@32)](<https://www.sota2.com/research/sota/code-generation-on-mbpp-plus-avg-at-32.md>): Code Generation; MBPP+; Average Success Rate (@32): 74.5.

- [Code Generation on BigCodeBench (avg@32)](<https://www.sota2.com/research/sota/code-generation-on-bigcodebench-avg-at-32.md>): Code Generation; BigCodeBench; avg@32: 52.46.

- [Code Generation on HumanEval+, MBPP+, and BigCodeBench Aggregate](<https://www.sota2.com/research/sota/code-generation-on-humaneval-plus-mbpp-plus-and-bigcodebench-aggregate.md>): Code Generation; HumanEval+, MBPP+, and BigCodeBench Aggregate; Average Score: 70.72.

- [Test generation on UnLeakedTestBench](<https://www.sota2.com/research/sota/test-generation-on-unleakedtestbench.md>): Test Generation; UnLeakedTestBench; Pass@1: 36.79.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2603.15611>)

[PDF](<https://arxiv.org/pdf/2603.15611.pdf>)

[Implementation](<https://github.com/ZJU-REAL/Code-A1>)
