Reproduce “ProSec: Fortifying Code LLMs with Proactive Security Alignment” 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

Xiangzhe Xu, Zian Su, Jinyao Guo, Kaiyuan Zhang, Zhenting Wang, Xiangyu Zhang

PROSEC introduces a proactive security alignment framework for code Large Language Models (LLMs) that systematically synthesizes vulnerability-inducing instructions and employs preference learning. This approach from Purdue University reduces the generation of insecure code by 25.2% to 35.4% across tested models while preserving or slightly improving their general code generation utility.

Key insights

  • Leveraging structured security knowledge (CWEs) allows for proactive and scalable synthesis of diverse vulnerability-inducing instructions, overcoming data scarcity.
  • Generating both vulnerable and fixed code snippets by instructing the LLM to repair its own errors, verified by static analysis, creates high-quality preference data for secure alignment.
  • Selecting utility preservation data based on training dynamics is critical to prevent security alignment from degrading the model's general code generation capabilities.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.