Reproduce “Learning to Generate Secure Code via Token-Level Rewards” on OpenResearch
Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Jiazheng Quan, Xiaodong Li, Bin Wang, Guo An, Like Liu, Degen Huang, Lin Liu, Chengbin Hou
Researchers developed the SRCode framework, which utilizes a novel Vul2Safe data construction and token-level reinforcement learning, to significantly improve large language models' ability to generate secure code. The approach led to consistent gains in security metrics, such as a 9.39% average increase from supervised fine-tuning alone, and enabled 7B models to outperform 14B baselines in security, without compromising general code quality.
Key insights
- High-quality, curriculum-based datasets like PrimeVul+, derived from real-world vulnerabilities and implicit prompts, are effective in building foundational secure coding capabilities in LLMs.
- Fine-grained token-level rewards are critical for enabling LLMs to learn and reinforce subtle, localized security patterns, outperforming traditional instance-level rewards in addressing complex vulnerabilities.
- The SRCode framework can significantly enhance code security without incurring an "alignment tax" on general code generation capabilities, maintaining or even improving overall functional correctness.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.