mlsanityData to 7 Oct 2026

Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Model

arXiv 2602.07422 ↗First posted 7 Feb 2026cs.CR cs.AI cs.CLcited by 4

On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks

Abstract (arXiv)

Large language models (LLMs) are increasingly used in software development, yet their tendency to generate insecure code remains a major barrier to real-world deployment. Existing secure code alignment methods often suffer from a functionality--security paradox, improving security at the cost of substantial utility degradation. We propose SecCoderX, an online reinforcement learning framework for functionality-preserving secure code generation. SecCoderX first bridges vulnerability detection and secure code generation by repurposing mature detection resources in two ways: (i) synthesizing diverse, reality-grounded vulnerability-inducing coding tasks for online RL rollouts, and (ii) training a reasoning-based vulnerability reward model that provides scalable and reliable security supervision. Together, these components are unified in an online RL loop to align code LLMs to generate secure and functional code. Extensive experiments demonstrate that SecCoderX achieves state-of-the-art performance, improving Effective Safety Rate (ESR) by approximately 10% over unaligned models, whereas prior methods often degrade ESR by 14-54%. We release our code, dataset and model checkpoints at https://github.com/AndrewWTY/SecCoderX.

Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 40 of its 57 references that are in the map. First posted on arXiv 7 Feb 2026.

Builds on

40 of 57 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024ProSec: Fortifying Code LLMs with Proactive Security Alignment19 Nov

Other references · 39

  1. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
  4. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
  5. 2021Program Synthesis with Large Language Modelscited by 3,509
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  7. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  9. 2024SimPO: Simple Preference Optimization with a Reference-Free Rewardcited by 951
  10. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  11. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  12. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
27 more
  1. 2022Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distributioncited by 722
  2. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
  3. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
  4. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  5. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
  6. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
  7. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  8. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
  9. 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 130
  10. 2024OpenCoder: The Open Cookbook for Top-Tier Code Large Language Modelscited by 127
  11. 2023Learning Performance-Improving Code Editscited by 103
  12. 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Futurecited by 85
  13. 2024Instruction Tuning for Secure Code Generationcited by 63
  14. 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 61
  15. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 58
  16. 2024CodeUltraFeedback: An LLM-as-a-Judge Dataset for Aligning Large Language Models to Coding Preferencescited by 56
  17. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 55
  18. 2025Infinity Instruct: Scaling Instruction Selection and Synthesis to Enhance Language Modelscited by 49
  19. 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 33
  20. 2025CodeJudgeBench: Benchmarking LLM-as-a-Judge for Coding Taskscited by 32
  21. 2024Generalization-Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuningcited by 30
  22. 2025PurpCode: Reasoning for Safer Code Generationcited by 17
  23. 2024EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuningcited by 15
  24. 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 14
  25. 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimizationcited by 14
  26. 2024Your Instructions Are Not Always Helpful: Assessing the Efficacy of Instruction Fine-tuning for Software Vulnerability Detectioncited by 6
  27. 2025A Mixture of Linear Corrections Generates Secure Codecited by 4

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 4.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
  2. 2026SecCodePRM: A Process Reward Model for Code Security ↗
  3. 2025R2Vul: Learning to Reason about Software Vulnerabilities with Reinforcement Learning and Structured Reasoning Distillation
  4. 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization
  5. 2025CodeRL+: Improving Code Generation via Reinforcement with Execution Semantics Alignment
  6. 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferences
  7. 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios
  8. 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalization