ProSec: Fortifying Code LLMs with Proactive Security Alignment
On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks
Abstract (arXiv)
While recent code-specific large language models (LLMs) have greatly enhanced their code generation capabilities, the safety of these models remains under-explored, posing potential risks as insecure code generated by these models may introduce vulnerabilities into real-world systems. Existing methods collect security-focused datasets from real-world vulnerabilities for instruction tuning in order to mitigate such issues. However, they are largely constrained by the data sparsity of vulnerable code, and have limited applicability in the multi-stage post-training workflows of modern LLMs. In this paper, we propose ProSec, a novel proactive security alignment approach designed to align code LLMs with secure coding practices. ProSec systematically exposes the vulnerabilities in a code LLM by synthesizing vulnerability-inducing coding scenarios from Common Weakness Enumerations (CWEs) and generates fixes to vulnerable code snippets, allowing the model to learn secure practices through preference learning objectives. The scenarios synthesized by ProSec trigger 25x more vulnerable code than a normal instruction-tuning dataset, resulting in a security-focused alignment dataset 7x larger than the previous work. Experiments show that models trained with ProSec are 25.2% to 35.4% more secure compared to previous work without degrading models' utility.
Key facts. Cited by 25 papers in the map (data through 14 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 49 of its 70 references that are in the map. First posted on arXiv 19 Nov 2024.
Builds on
49 of 70 references.
Closest ancestors · 2
Same direction, newest first
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Dataset10 Jul
- 2022Red Teaming Language Models to Reduce Harms: Methods, Scaling Behaviors, and Lessons Learned23 Aug
Other references · 47
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2024GPT-4o System Cardcited by 4,588
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2022Scaling Instruction-Finetuned Language Modelscited by 3,024
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
35 more
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 1,002
- 2024SimPO: Simple Preference Optimization with a Reference-Free Rewardcited by 963
- 2023A General Theoretical Paradigm to Understand Learning from Human Preferencescited by 912
- 2022Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Taskscited by 868
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2024ORPO: Monolithic Preference Optimization without Reference Modelcited by 562
- 2024LESS: Selecting Influential Data for Targeted Instruction Tuningcited by 532
- 2023RRHF: Rank Responses to Align Language Models with Human Feedback without tearscited by 463
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2020Dataset Cartography: Mapping and Diagnosing Datasets with Training Dynamicscited by 425
- 2024Agentless: Demystifying LLM-based Software Engineering Agentscited by 421
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2023Data Selection for Language Models via Importance Resamplingcited by 329
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 247
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2024QuRating: Selecting High-Quality Data for Training Language Modelscited by 157
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
- 2024RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learningcited by 151
- 2024Nemotron-4 340B Technical Reportcited by 144
- 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 138
- 2024OpenCoder: The Open Cookbook for Top-Tier Code Large Language Modelscited by 130
- 2024Understanding the performance gap between online and offline alignment algorithmscited by 110
- 2023Training Socially Aligned Language Models on Simulated Social Interactionscited by 78
- 2024Instruction Tuning for Secure Code Generationcited by 68
- 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
- 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 62
- 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 55
- 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
- 2024UniDebugger: Hierarchical Multi-Agent Framework for Unified Software Debuggingcited by 35
- 2024LLMDFA: Analyzing Dataflow in Code with Large Language Modelscited by 22
- 2024Learning Code Preference via Synthetic Evolutioncited by 19
- 2024Source Code Foundation Models are Transferable Binary Analysis Knowledge Basescited by 8
- 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
- 2024APILOT: Navigating Large Language Models to Generate Secure Code by Sidestepping Outdated API Pitfallscited by 3
- 2022Static Analysis for AWS Best Practices in Python Codecited by 2
Built on by
Citing papers per year: 2025: 14; 2026: 11.
25 papers.
Sort:
By area:
- 2026SWE-chat: Coding Agent Interactions From Real Users in the Wildcited by 43
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
- 2025PurpCode: Reasoning for Safer Code Generationcited by 18
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 13
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Modelscited by 12
- 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
- 2025SOFT: Selective Data Obfuscation for Protecting LLM Fine-tuning against Membership Inference Attackscited by 10
- 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
- 2025ASTRA: Autonomous Spatial-Temporal Red-teaming for AI Software Assistantscited by 6
- 2026Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Modelcited by 6
- 2025μKE: Matryoshka Unstructured Knowledge Editing of Large Language Modelscited by 5
13 more
- 2025A Mixture of Linear Corrections Generates Secure Codecited by 4
- 2026Learning to Generate Secure Code via Token-Level Rewardscited by 2
- 2025Learning to Align Human Code Preferencescited by 1
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 1
- 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generationcited by 1
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalizationcited by 1
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimizationcited by 1
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)cited by 1
- 2025Position: Intelligent Coding Systems Should Write Programs with Justificationscited by 0
- 2026Learn from Your Mistakes: Tree-like Self-Play for Secure Code LLMscited by 0
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
- 2026CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Trainingcited by 0
- 2026Last Secure Code Benchmark: Is the Code You Vibe Secure?cited by 0
- 2026Last Secure Code Benchmark: Is the Code You Vibe Secure?10 Oct 2026
- 2026CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Training6 Aug 2026
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026Learn from Your Mistakes: Tree-like Self-Play for Secure Code LLMs2 Jun 2026
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)19 May 2026
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization8 May 2026
- 2026SWE-chat: Coding Agent Interactions From Real Users in the Wild22 Apr 2026
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalization4 Apr 2026
- 2026Learning to Generate Secure Code via Token-Level Rewards26 Feb 2026
- 2026Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Model7 Feb 2026
- 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generation1 Feb 2026
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents24 Nov 2025
13 more
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025RESCUE: Retrieval Augmented Secure Code Generation21 Oct 2025
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios26 Sep 2025
- 2025Position: Intelligent Coding Systems Should Write Programs with Justifications8 Aug 2025
- 2025ASTRA: Autonomous Spatial-Temporal Red-teaming for AI Software Assistants5 Aug 2025
- 2025Learning to Align Human Code Preferences27 Jul 2025
- 2025PurpCode: Reasoning for Safer Code Generation25 Jul 2025
- 2025A Mixture of Linear Corrections Generates Secure Code13 Jul 2025
- 2025SOFT: Selective Data Obfuscation for Protecting LLM Fine-tuning against Membership Inference Attacks12 Jun 2025
- 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferences31 May 2025
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Models25 May 2025
- 2025μKE: Matryoshka Unstructured Knowledge Editing of Large Language Models1 Apr 2025
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?17 Feb 2025
- 2026SWE-chat: Coding Agent Interactions From Real Users in the Wildcited by 43
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 13
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 1
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimizationcited by 1
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)cited by 1
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
- 2026CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Trainingcited by 0
- 2026Last Secure Code Benchmark: Is the Code You Vibe Secure?cited by 0
- 2026Last Secure Code Benchmark: Is the Code You Vibe Secure?10 Oct 2026
- 2026CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Training6 Aug 2026
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)19 May 2026
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization8 May 2026
- 2026SWE-chat: Coding Agent Interactions From Real Users in the Wild22 Apr 2026
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents24 Nov 2025
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios26 Sep 2025
- 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
- 2025RESCUE: Retrieval Augmented Secure Code Generation21 Oct 2025
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
- 2025μKE: Matryoshka Unstructured Knowledge Editing of Large Language Modelscited by 5
- 2025A Mixture of Linear Corrections Generates Secure Codecited by 4
- 2026Learning to Generate Secure Code via Token-Level Rewardscited by 2
- 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generationcited by 1
- 2025Position: Intelligent Coding Systems Should Write Programs with Justificationscited by 0
- 2026Learning to Generate Secure Code via Token-Level Rewards26 Feb 2026
- 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generation1 Feb 2026
- 2025Position: Intelligent Coding Systems Should Write Programs with Justifications8 Aug 2025
- 2025A Mixture of Linear Corrections Generates Secure Code13 Jul 2025
- 2025μKE: Matryoshka Unstructured Knowledge Editing of Large Language Models1 Apr 2025
- 2025BaxBench: Can LLMs Generate Correct and Secure Backends?17 Feb 2025
Similar, not cited
Close in wording, no citation either way
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Security
- 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
- 2024Code Security Vulnerability Repair Using Reinforcement Learning with Large Language Models
- 2025Secure-Instruct: An Automated Pipeline for Synthesizing Instruction-Tuning Datasets Using LLMs for Secure Code Generation
- 2026Enhancing Reliability in LLM-Based Secure Code Generation
- 2024Enhancing Source Code Security with LLMs: Demystifying The Challenges and Generating Reliable Repairs
- 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanisms
- 2026An Empirical Evaluation of LLM-Based Approaches for Code Vulnerability Detection: RAG, SFT, and Dual-Agent Systems