Risk-Aware Self-Play Reinforcement Learning for Secure and Capable Code-Generating Agents
Abstract We study risk-aware self-play in finite-action code repair, separating functional success from test-integrity and forbidden-call violations. From 591 MBPP/HumanEval programs, 395 mutation tasks yield 4,527 candidates. On 133 external HumanEval tasks, the full policy reduces expected violations from 68.55% to 0.64% versus public-test-only RL, but fixed multiobjective rewards achieve slightly higher joint success, 72.78% versus 72.37%. Additional experiments execute 5,296 alias/data-flow probes and matched controls, investigate selected-action sparse verification, and test 30 functions from Python, JavaScript and TypeScript repositories. Detector blind spots, identical safe/unsafe feature representations and weak repository transfer limit the safety interpretation. Zero greedy violations on 133 tasks yields only an illustrative 2.23% upper risk bound under iid assumptions. These results support verifier-aware rewards without establishing a consistent self-play advantage or a formal deployment guarantee.
Authors
- Duo Xu (ORCID: https://orcid.org/0009-0005-8082-154X)
- Yan-Cheng Hsu
- Ziwei Wang (ORCID: https://orcid.org/0009-0002-4759-6158)
Institutions
- Northeastern University (US)
- University of California San Diego Medical Center (US)
Publication Details
- Journal
- Research Square
- Published
- 2026-11-10
- DOI
- https://doi.org/10.21203/rs.3.rs-11671045/v1
- Primary Topic
- Software Engineering Research
- Type
- preprint