arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.15611cs.CL
收藏

Code-A1:通过强化学习进行代码LLM和测试LLM的对抗演化

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

Zhejiang University(浙江大学)

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

AI总结:

Code-A1通过对抗性共进化框架联合优化代码LLM和测试LLM,解决传统方法中白盒访问导致的自我 collusion 和黑盒限制下的测试泛化问题,提升测试生成能力。

摘要:

针对代码生成中强化学习依赖可验证奖励但高质量测试套件稀缺的问题,Code-A1引入对抗性共进化框架,联合优化代码LLM和测试LLM。代码LLM被奖励通过更多测试,测试LLM被奖励暴露更多缺陷。通过引入Mistake Book机制和复合奖励平衡测试有效性与对抗难度,实验表明Code-A1在代码生成和测试生成方面均优于传统方法。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑