同侪压力:面向代码安全的攻击者与防御者种群执行验证协同进化 Peer Pressure: Execution-Verified Co-Evolution of Attacker and Defender Populations for Code Security 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-10-17
⬇️ 1 次下载
👁️ 预览文献
💡 AI 中文简介
针对LLM代码智能体生成代码缺乏监督、静态漏洞数据集训练的防御方难以跟上攻击者变化的问题,研究让攻击方(红队)和防御方协同进化,并以真实执行结果决定奖励:攻击方必须让补丁成功应用、构建、通过测试并复现真实漏洞才能得分。作者提出同侪相对策略优化(PRPO),把双方建模为共享冻结基座的LoRA适配器种群,按相同条件下的同角色同侪进行信用分配。7B审查模型在三个未训练语言、四个未见应用上达到64.8%平衡准确率,超过监督微调和前沿模型;9B仓库智能体在172条留出公告中复现23条。
领域人工智能安全 / 代码安全与大模型智能体
适合谁读需要一定专业背景(了解强化学习、LLM微调与软件安全)
核心贡献1. 提出执行验证的攻击者-防御者协同进化框架,攻击方必须在隔离容器中真实复现漏洞才能获得奖励,避免静态数据集的过时问题;2. 提出PRPO算法,将同角色同侪放入策略梯度基线而非对手池,在相同覆盖率下比基于其他条件的基线高2.3个平衡准确率点,并以一半验证开销达到策略内控制的效果。
关键数据7B diff审查器在三个未训练语言、四个未见应用上达64.8%平衡准确率,比监督安全微调高5.5点,比冻结前沿审查器(Claude Opus 4.8)高4.4点,在训练应用上领先15.8点;9B仓库智能体在172条留出VulnGym公告中复现23条(监督微调为10条,同骨架未训练为7条),定位43个可达入口点中的17个(mini-swe-agent+GLM-5.2为13个);越狱防御中攻击成功率从36.0%降至4.6%(WildGuard为8.9%)。
推荐理由如果你关心大模型写代码的安全底线,这篇用真实执行结果当裁判、让攻防双方共同进化的工作,数据扎实且思路新颖,值得一读。
关键词["代码安全", "大语言模型智能体", "协同进化", "策略优化", "漏洞检测", "红队对抗"]

原文摘要

查看英文原文摘要

LLM code agents increasingly ship code with little oversight, yet defenders trained on static vulnerability datasets fall behind adapting adversaries. We co-train attacker and defender instead, and let execution decide every reward: an attacker (Red) edits a real repository and earns nothing unless its patch applies, builds, passes the tests, completes its development task and reproduces a real exploit in an isolated container, whose path also labels the entry point, the critical operation and the trace between them. Peer-Relative Policy Optimization (PRPO) makes both sides populations of LoRA adapters over one frozen base and credits each against same-role peers that faced an identical condition, placing the population inside the policy-gradient baseline rather than the opponent pool, with a tournament preserving diversity. Matching cancels the condition's difficulty: at equal coverage it is worth 2.3 points of balanced accuracy over a baseline computed on other conditions, and it matches a within-policy control at half the verifier spend. PRPO's 7B diff reviewer reaches 64.8% balanced accuracy on four unseen applications in three untrained languages, 5.5 points above supervised security fine-tuning and 4.4 above a frozen frontier reviewer (Claude Opus 4.8), which it leads by 15.8 on the application it trains on. Its 9B repository agent recovers 23 of 172 held-out VulnGym advisories, against 10 after supervised fine-tuning and 7 for the same backbone untrained under the same scaffold, and locates 17 of 43 reachable entry points against 13 for mini-swe-agent with GLM-5.2. Run unchanged on jailbreak defense, the same algorithm matches or exceeds WildGuard's static F1 at equal corpus and model size. Under a judge distinct from its training oracle it cuts attack success from 36.0% to 4.6%, against WildGuard's 8.9%.