mlsanityData to 14 Oct 2026

ProSec: Fortifying Code LLMs with Proactive Security Alignment

arXiv 2411.12882 ↗First posted 19 Nov 2024cs.CR cs.CL cs.SEcited by 25

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

  1. 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Dataset10 Jul
  2. 2022Red Teaming Language Models to Reduce Harms: Methods, Scaling Behaviors, and Lessons Learned23 Aug

Other references · 47

  1. 2022Training language models to follow instructions with human feedbackcited by 15,971
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  5. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
  6. 2024GPT-4o System Cardcited by 4,588
  7. 2021Program Synthesis with Large Language Modelscited by 3,637
  8. 2022Scaling Instruction-Finetuned Language Modelscited by 3,024
  9. 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
  10. 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
  11. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  12. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
35 more
  1. 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 1,002
  2. 2024SimPO: Simple Preference Optimization with a Reference-Free Rewardcited by 963
  3. 2023A General Theoretical Paradigm to Understand Learning from Human Preferencescited by 912
  4. 2022Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Taskscited by 868
  5. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
  6. 2024ORPO: Monolithic Preference Optimization without Reference Modelcited by 562
  7. 2024LESS: Selecting Influential Data for Targeted Instruction Tuningcited by 532
  8. 2023RRHF: Rank Responses to Align Language Models with Human Feedback without tearscited by 463
  9. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  10. 2020Dataset Cartography: Mapping and Diagnosing Datasets with Training Dynamicscited by 425
  11. 2024Agentless: Demystifying LLM-based Software Engineering Agentscited by 421
  12. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  13. 2023Data Selection for Language Models via Importance Resamplingcited by 329
  14. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 247
  15. 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
  16. 2024QuRating: Selecting High-Quality Data for Training Language Modelscited by 157
  17. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  18. 2024RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learningcited by 151
  19. 2024Nemotron-4 340B Technical Reportcited by 144
  20. 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 138
  21. 2024OpenCoder: The Open Cookbook for Top-Tier Code Large Language Modelscited by 130
  22. 2024Understanding the performance gap between online and offline alignment algorithmscited by 110
  23. 2023Training Socially Aligned Language Models on Simulated Social Interactionscited by 78
  24. 2024Instruction Tuning for Secure Code Generationcited by 68
  25. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
  26. 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 62
  27. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 55
  28. 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
  29. 2024UniDebugger: Hierarchical Multi-Agent Framework for Unified Software Debuggingcited by 35
  30. 2024LLMDFA: Analyzing Dataflow in Code with Large Language Modelscited by 22
  31. 2024Learning Code Preference via Synthetic Evolutioncited by 19
  32. 2024Source Code Foundation Models are Transferable Binary Analysis Knowledge Basescited by 8
  33. 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
  34. 2024APILOT: Navigating Large Language Models to Generate Secure Code by Sidestepping Outdated API Pitfallscited by 3
  35. 2022Static Analysis for AWS Best Practices in Python Codecited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 14; 2026: 11.

25 papers.

Sort:

By area:

  1. 2026SWE-chat: Coding Agent Interactions From Real Users in the Wildcited by 43
  2. 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
  3. 2025PurpCode: Reasoning for Safer Code Generationcited by 18
  4. 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
  5. 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 13
  6. 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Modelscited by 12
  7. 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
  8. 2025SOFT: Selective Data Obfuscation for Protecting LLM Fine-tuning against Membership Inference Attackscited by 10
  9. 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
  10. 2025ASTRA: Autonomous Spatial-Temporal Red-teaming for AI Software Assistantscited by 6
  11. 2026Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Modelcited by 6
  12. 2025μKE: Matryoshka Unstructured Knowledge Editing of Large Language Modelscited by 5
13 more
  1. 2025A Mixture of Linear Corrections Generates Secure Codecited by 4
  2. 2026Learning to Generate Secure Code via Token-Level Rewardscited by 2
  3. 2025Learning to Align Human Code Preferencescited by 1
  4. 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 1
  5. 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generationcited by 1
  6. 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalizationcited by 1
  7. 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimizationcited by 1
  8. 2026Refusal Evaluation in Coding LLMs and Code Agents: A Systematic Review of Thirteen Malicious-Code Prompt Corpora (2023-2025)cited by 1
  9. 2025Position: Intelligent Coding Systems Should Write Programs with Justificationscited by 0
  10. 2026Learn from Your Mistakes: Tree-like Self-Play for Secure Code LLMscited by 0
  11. 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
  12. 2026CyberForge: Verified Vulnerability Injection at Repository Level for Cybersecurity Agent Trainingcited by 0
  13. 2026Last Secure Code Benchmark: Is the Code You Vibe Secure?cited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Security
  2. 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
  3. 2024Code Security Vulnerability Repair Using Reinforcement Learning with Large Language Models
  4. 2025Secure-Instruct: An Automated Pipeline for Synthesizing Instruction-Tuning Datasets Using LLMs for Secure Code Generation
  5. 2026Enhancing Reliability in LLM-Based Secure Code Generation
  6. 2024Enhancing Source Code Security with LLMs: Demystifying The Challenges and Generating Reliable Repairs
  7. 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanisms
  8. 2026An Empirical Evaluation of LLM-Based Approaches for Code Vulnerability Detection: RAG, SFT, and Dual-Agent Systems