Skip to main content
QUICK REVIEW

[논문 리뷰] Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning

Aozhe Wang, Yuchen Yan|arXiv (Cornell University)|2026. 03. 16.
Software Testing and Debugging TechniquesComputer Science인용 수 0
한 줄 요약

Code-A1은 Code LLM과 Test LLM의 적대적 공진화를 도입하여 Mistake Book을 통한 안정적인 RL 학습을 가능하게 하는 화이트박스 적대적 테스트 생성을 가능케 하고, 인간이 주석한 테스트 없이도 코드 생성 및 테스트 생성을 강력하게 수행합니다.

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.

연구 동기 및 목표

  • 희소한 정적 테스트 스위트 너머의 코드 생성에 대한 검증 가능한 보상의 개선 동기를 부여한다.
  • Code LLM과 Test LLM의 상반된 목표를 가진 분리된 적대 프레임워크를 제안하여 자기-결합(self-collusion)을 회피한다.
  • 경험 재생을 안정시키고 과거의 실패를 추적하기 위한 Mistake Book를 도입한다.
  • 테스트의 타당성과 적대적 난이도의 균형을 맞추는 복합 보상을 설계한다.
  • 적대적 공진화가 인간이 주석한 테스트를 사용하는 RL과 견주거나 능가하면서 더 나은 테스트를 생성하는 것을 입증한다.

제안 방법

  • Code LLM이 후보 해를 생성하고 Test LLM이 코드에 조건화된 도전적 테스트를 생성하는 분리된 이중 모델 아키텍처를 적용한다.
  • 적대적 롤아웃: 다수의 코드 후보를 생성하고 각 후보에 대해 다수의 테스트 스위트를 생성하며, 테스트를 실제 해답과 대조해 검증하고 검증된 테스트를 이용해 코드를 실행해 통과율을 얻는다.
  • Mistake Book: 문제별 경험 재생으로 과거에 실패한 테스트를 저장해 보상을 안정시키고 역량의 변화를 추적한다.
  • 복합 보상: Code LLM 보상은 과거 및 새로운 테스트 통과율을 결합하여 강건함을 촉진하고, Test LLM 보상은 테스트 타당성과 적대적 난이도를 가중합으로 균형 있게 조절한다.
  • 그룹 상대 정책 최적화(GRPO)를 이용한 정책 최적화: 비대칭 샘플링과 최상 분산 선택으로 학습 Compute의 균형을 맞춘다.
  • 학습 역학은 강한 코드가 더 어려운 테스트를 요구하고, 더 어려운 테스트가 더 강한 코드를 이끌어내는 커리큘럼 유사한 공진화를 촉진한다.
Figure 1 : Comparison of three training paradigms for code generation. Vanilla GRPO relies on static golden tests with rigid rewards. GRPO with Self-Play unifies code and test generation but must operate in black-box mode to prevent self-collusion. Code-A1 decouples the two tasks into models with op
Figure 1 : Comparison of three training paradigms for code generation. Vanilla GRPO relies on static golden tests with rigid rewards. GRPO with Self-Play unifies code and test generation but must operate in black-box mode to prevent self-collusion. Code-A1 decouples the two tasks into models with op

실험 결과

연구 질문

  • RQ1자기-결합(self-collusion) 없이 화이트박스 적대적 테스트 생성을 안전하게 가능하게 하려면 어떻게 해야 하는가?
  • RQ2Code LLM과 Test LLM의 적대적 공진화가 인간이 주석한 테스트에 의해 학습된 여러 코드 벤치마크에서 RL보다 우수하게 작동하는가?
  • RQ3Mistake Book이 적대적 공진화 중 학습을 안정시키고 재앙적 망각을 방지하는가?
  • RQ4테스트의 타당성과 적대적 난이도의 균형이 학습 동학 및 최종 성능에 어떤 영향을 미치는가?
  • RQ5Code-A1의 테스트 생성 품질이 전통적인 골든 테스트 RL 접근법과 일치하거나 그 이상인가?

주요 결과

  • Code-A1은 HumanEval+, MBPP+, BigCodeBench에서 인간이 주석한 테스트로 학습된 모델과 비교하여 또는 그 이상으로 코드 생성을 달성한다.
  • Code-A1의 Test LLM은 감독된 미세조정이나 자기놀이 기반의 기초보다 더 높은 판별적 테스트 생성 능력을 달성한다.
  • 3B 모델의 테스트 생성에 대한 Mul 점수 15.29가 7B 기본 모델의 14.72를 상회하여 적대적 공진화의 효율성을 시사한다.
  • Mistake Book은 학습을 안정시키고 버그의 점진적 발견을 가능하게 하며 과거의 실패가 보상 계산을 안내하고 망각을 방지한다.
  • 화이트박스 접근을 제거하거나 Mistake Book, 예측 정답 요건을 제거하면 성능이 저하되며 각 구성 요소의 기여가 확인된다.
Figure 2 : Overview of the Code-A1 training framework. The Code LLM generates solutions accessible to the Test LLM for white-box testing. Generated tests are validated and merged with historical tests from the Mistake Book. The Code LLM is rewarded for passing more tests; the Test LLM is rewarded fo
Figure 2 : Overview of the Code-A1 training framework. The Code LLM generates solutions accessible to the Test LLM for white-box testing. Generated tests are validated and merged with historical tests from the Mistake Book. The Code LLM is rewarded for passing more tests; the Test LLM is rewarded fo

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.