Mastermind: 基於策略的學習以進行程式碼庫規模的漏洞復現
Mastermind: Strategy-grounded Learning for Repository-Scale Vulnerability Reproduction
July 2, 2026
作者: Mingzhe Du, Luu Anh Tuan, Tianyi Wu, Renyang Liu, Zhijiang Guo, Dong Huang, See-Kiong Ng
cs.AI
摘要
仓库级漏洞复现是一项具有挑战性的软件工程(SE)任务:智能体必须检查代码库,推断到达漏洞路径的输入语法,构建概念验证(PoC),并验证崩溃在修补版本上不再出现。近期的大语言模型智能体在策略正确时通常能执行这些步骤,但仍会因选择错误的策略而失败。本文认为,对于此类SE智能体而言,策略——而非完整的动作轨迹——才是正确的学习单元:它足够简洁以进行优化,足够具体以指导执行,并且足够稳定以在多次尝试中储存和复用。我们提出了Mastermind,一种将可迁移策略学习与任务特定经验分离的双循环框架。可训练规划器通过监督微调(SFT)和基于里程碑的GRPO学习可复用的漏洞复现策略,而经验循环则维护任务局部的策略记录以指导后续尝试。规划器独立于执行器进行训练,使得策略学习能够在无需修改动作生成能力的情况下改进多个冻结的执行器。我们在CyberGym上使用260个训练任务和200个保留评估任务评估了Mastermind。以GPT-5.5作为冻结执行器,Mastermind实现了84.5%的通过率,优于开卷式PoC上下文(60.0%)、最佳8次采样(63.0%)和迭代改进(77.0%)。相同的规划器还将GPT-5.4 mini和GLM~5.1从45.0%和58.5%分别提升至60.0%和71.0%。这些结果表明,学习高层策略是改进仓库级SE智能体的有效且可迁移的机制。
English
Repository-level vulnerability reproduction is a demanding software engineering (SE) task: an agent must inspect a codebase, infer the input grammar that reaches a vulnerable path, construct a proof-of-conceptv(PoC), and verify that the crash disappears on the patched build. Recent LLM agents can often execute these steps when the approach is correct, yet they still fail by choosing the wrong strategy. This paper argues that strategy, rather than the full action trajectory, is the right learning unit for such SE agents: it is compact enough to optimize, concrete enough to guide execution, and stable enough to store and reuse across attempts. We present Mastermind, a dual-loop framework that separates transferable strategy learning from task-specific experience. A trainable planner learns reusable vulnerability-reproduction strategies through SFT and milestone-based GRPO, while an experience loop maintains task-local strategy records that guide subsequent attempts. The planner is trained independently of the executor, allowing strategy learning to improve multiple frozen executors without modifying their action-generation capability. We evaluate Mastermind on CyberGym using 260 training tasks and 200 held-out evaluation tasks. With GPT-5.5 as the frozen executor, Mastermind achieves an 84.5% pass rate, outperforming open-book PoC context (60.0%), Best-of-8 sampling (63.0%), and iterative improvement (77.0%). The same planner also improves GPT-5.4 mini and GLM~5.1 from 45.0% and 58.5% to 60.0% and 71.0%. These results demonstrate that learning high-level strategies is an effective and transferable mechanism for improving repository-scale SE agents.