跳到正文
EasyXiv 检索
投稿 关于 登录

按回车检索 · 直接输入编号(如 1706.03762)可跳转到论文

计算机科学 > 密码学与安全

arXiv:2606.03489 (cs)
[提交于 2026年6月2日 (v1),最后修订于 2026年6月13日 (此版本, v2)]

标题:Learn from Your Mistakes: Tree-like Self-Play for Secure Code LLMs

作者:Wenqi Chen, Ziyan Zhang, Bin Wang, Lin Liu, Hengheng Zhang, Zhengsu Chen
查看论文《Learn from Your Mistakes: Tree-like Self-Play for Secure Code LLMs》的 PDF
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读
摘要:While Large Language Models (LLMs) excel in code generation, they remain prone to replicating subtle yet critical vulnerabilities endemic to their training data. Current alignment techniques, such as Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL), typically apply coarse-grained optimization at the sequence level. This approach often fails to address the localized nature of security flaws, where a single incorrect token choice can compromise an entire program. To bridge this gap, we introduce Tree-like Self-Play (TSP), a framework that reframes secure code generation as a fine-grained sequential decision process. Unlike standard methods that blindly maximize likelihood, TSP constructs a decision tree where the model explores branching trajectories--generating both secure "golden paths" and vulnerable variants. By treating code generation as a self-play game, the model learns to strictly discriminate against its own localized errors. This provides a dense, on-policy learning signal that forces self-correction precisely at the critical decision nodes where vulnerabilities typically emerge. Our experiments demonstrate that TSP fundamentally enhances model reliability. In Python security benchmarks, TSP boosts CodeLlama-7B's pass rate (SPR@1) to 75.8%, significantly outperforming SFT (57.0%) and unstructured self-play baselines. Crucially, TSP induces robust out-of-distribution generalization: the model not only reduces vulnerabilities in unseen categories (CWEs) by 24.5% but also successfully transfers security principles learned from C/C++ to diverse languages, including Python, Go, and JavaScript. This suggests that TSP does not merely memorize patches, but internalizes abstract, language-agnostic security logic.
评论: 18 pages, 3 figures, Accepted by ICML 2026
主题: 密码学与安全 (cs.CR); 人工智能 (cs.AI)
引用方式: arXiv:2606.03489 [cs.CR]
  (或者 arXiv:2606.03489v2 [cs.CR] 对于此版本)
  https://doi.org/10.48550/arXiv.2606.03489

提交历史

来自:Wenqi Chen
[v1] 2026年6月2日 星期二 11:07:20 UTC (468 KB)
[v2] 2026年6月13日 星期六 20:00:19 UTC (468 KB)
全文链接:

访问论文:

  • 查看原文 PDF
  • 中文 PDF (下批处理)
  • EasyResearch 阅读
  • TeX 源文件
  • arXiv 原文页面
查看许可

当前浏览上下文:

cs
< 上一篇   |   下一篇 >
最新 | 近期 | 2026-06
切换浏览方式为:
cs.CR
cs.AI

参考文献与引用

  • Google Scholar
  • Semantic Scholar

BibTeX 格式的引用

EasyXiv 是独立运营的中文预印本站点,与 arXiv 及康奈尔大学无隶属关系。 论文元数据与原文来自 arXiv.org,感谢 arXiv 提供开放获取服务。
关于 · 帮助 · 投稿指南 · 版权 · arXiv 原站