Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Model
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
Other references · 39
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2024SimPO: Simple Preference Optimization with a Reference-Free Rewardcited by 951
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
27 more
- 2022Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distributioncited by 722
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
- 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 130
- 2024OpenCoder: The Open Cookbook for Top-Tier Code Large Language Modelscited by 127
- 2023Learning Performance-Improving Code Editscited by 103
- 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Futurecited by 85
- 2024Instruction Tuning for Secure Code Generationcited by 63
- 2024SelfCodeAlign: Self-Alignment for Code Generationcited by 61
- 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 58
- 2024CodeUltraFeedback: An LLM-as-a-Judge Dataset for Aligning Large Language Models to Coding Preferencescited by 56
- 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 55
- 2025Infinity Instruct: Scaling Instruction Selection and Synthesis to Enhance Language Modelscited by 49
- 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 33
- 2025CodeJudgeBench: Benchmarking LLM-as-a-Judge for Coding Taskscited by 32
- 2024Generalization-Enhanced Code Vulnerability Detection via Multi-Task Instruction Fine-Tuningcited by 30
- 2025PurpCode: Reasoning for Safer Code Generationcited by 17
- 2024EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuningcited by 15
- 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 14
- 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimizationcited by 14
- 2024Your Instructions Are Not Always Helpful: Assessing the Efficacy of Instruction Fine-tuning for Software Vulnerability Detectioncited by 6
- 2025A Mixture of Linear Corrections Generates Secure Codecited by 4
Built on by
Citing papers per year: 2026: 4.
4 papers.
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoringcited by 0
- 2026Mastermind: Strategy-grounded Learning for Repository-Scale Vulnerability Reproductioncited by 0
- 2026From Evaluation to Optimisation: Hierarchy-Aware Training Signals for CWE Prediction in Pythoncited by 0
- 2026SecureVibe: Making Vibe Coding More Securecited by 0
- 2026SecureVibe: Making Vibe Coding More Secure29 Sep 2026
- 2026From Evaluation to Optimisation: Hierarchy-Aware Training Signals for CWE Prediction in Python23 Jul 2026
- 2026Mastermind: Strategy-grounded Learning for Repository-Scale Vulnerability Reproduction2 Jul 2026
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoring1 May 2026
Similar, not cited
Close in wording, no citation either way
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
- 2026SecCodePRM: A Process Reward Model for Code Security ↗
- 2025R2Vul: Learning to Reason about Software Vulnerabilities with Reinforcement Learning and Structured Reasoning Distillation
- 2026SecureForge: Finding and Preventing Vulnerabilities in LLM-Generated Code via Prompt Optimization
- 2025CodeRL+: Improving Code Generation via Reinforcement with Execution Semantics Alignment
- 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferences
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalization