ChatPaper.aiChatPaper

코드-A1: 강화 학습을 통한 코드 LLM과 테스트 LLM의 적대적 공진화

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

March 16, 2026
저자: Aozhe Wang, Yuchen Yan, Nan Zhou, Zhengxi Lu, Weiming Lu, Jun Xiao, Yueting Zhuang, Yongliang Shen
cs.AI

초록

코드 생성을 위한 강화 학습은 일반적으로 단위 테스트 통과율이라는 검증 가능한 보상에 의존합니다. 그러나 고품질 테스트 스위트는 부족한 실정이며, 기존 데이터셋은 제한된 커버리지만 제공하고, 정적 보상은 모델이 개선됨에 따라 적응하지 못합니다. 최근 등장한 자기 경험(self-play) 기법은 코드 생성과 테스트 생성을 단일 모델로 통합하지만, 본질적인 딜레마에 직면합니다: 화이트박스 접근은 모델이 쉬운 보상을 위해 사소한 테스트를 생성하는 자기 공모(self-collusion)로 이어지고, 블랙박스 제약은 구현 특화 버그를 놓치는 일반적인 테스트만 생성하게 됩니다. 본 논문에서는 상반된 목표를 가진 코드 LLM과 테스트 LLM을 함께 최적화하는 적대적 공진화(adversarial co-evolution) 프레임워크인 Code-A1을 소개합니다. 코드 LLM은 더 많은 테스트를 통과할 때 보상을 받고, 테스트 LLM은 더 많은 결함을 찾아낼 때 보상을 받습니다. 이러한 아키텍처적 분리는 자기 공모 위험을 제거하고, 테스트 LLM이 후보 코드를 검사하여 표적 적대적 테스트를 생성할 수 있는 화이트박스 테스트 생성을 안전하게 가능하게 합니다. 또한 경험 재생을 위한 오류 기록부(Mistake Book) 메커니즘과 테스트 타당성과 적대적 난이도를 균형 있게 고려한 복합 보상 체계를 도입했습니다. Qwen2.5-Coder 모델을 이용한 실험 결과, Code-A1은 인간이 주석을 단 테스트로 학습한 모델에 필적하거나 그 이상의 코드 생성 성능을 달성하는 동시에 테스트 생성 능력을 크게 향상시킴을 확인했습니다.
English
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.
PDF91March 18, 2026