mlsanityData to 13 Oct 2026

Learning to Generate Secure Code via Token-Level Rewards

arXiv 2602.23407 ↗First posted 26 Feb 2026cs.CR cs.AI cs.SEcited by 2

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have demonstrated strong capabilities in code generation, yet they remain prone to producing security vulnerabilities. Existing approaches commonly suffer from two key limitations: the scarcity of high-quality security data and coarse-grained reinforcement learning reward signals. To address these challenges, we propose Vul2Safe, a new secure code generation framework that leverages LLM self-reflection to construct high-confidence repair pairs from real-world vulnerabilities, and further generates diverse implicit prompts to build the PrimeVul+ dataset. Meanwhile, we introduce SRCode, a novel training framework that pioneers the use of token-level rewards in reinforcement learning for code security, which enables the model to continuously attend to and reinforce critical fine-grained security patterns during training. Compared with traditional instance-level reward schemes, our approach allows for more precise optimization of local security implementations. Extensive experiments show that PrimeVul+ and SRCode substantially reduce security vulnerabilities in generated code while improving overall code quality across multiple benchmarks.

Key facts. Cited by 2 papers in the map (data through 13 Oct 2026). Builds on 25 of its 68 references that are in the map. First posted on arXiv 26 Feb 2026.

Builds on

25 of 68 references.

References · 25

  1. 2022Training language models to follow instructions with human feedbackcited by 15,856
  2. 2017Proximal Policy Optimization Algorithmscited by 14,592
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,205
  4. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,831
  5. 2021Program Synthesis with Large Language Modelscited by 3,573
  6. 2024LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Modelscited by 1,450
  7. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 743
  8. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 731
  9. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 153
  10. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 136
  11. 2023RLTF: Reinforcement Learning from Unit Test Feedbackcited by 112
  12. 2024Instruction Tuning for Secure Code Generationcited by 65
13 more
  1. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 56
  2. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 53
  3. 2024HumanEval Pro and MBPP Pro: Evaluating Large Language Models on Self-invoking Code Generationcited by 39
  4. 2025ReCode: Reinforcing Code Generation with Reasoning-Process Rewardscited by 25
  5. 2024ProSec: Fortifying Code LLMs with Proactive Security Alignmentcited by 24
  6. 2024Large Language Model Supply Chain: A Research Agendacited by 23
  7. 2025PurpCode: Reasoning for Safer Code Generationcited by 17
  8. 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 15
  9. 2023Enhancing Large Language Models for Secure Code Generation: A Dataset-driven Study on Vulnerability Mitigationcited by 14
  10. 2025Training Language Models to Generate Quality Code with Program Analysis Feedbackcited by 11
  11. 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
  12. 2025LLMs' Reshaping of People, Processes, Products, and Society in Software Development: A Comprehensive Exploration with Early Adopterscited by 8
  13. 2024Unseen Horizons: Unveiling the Real Capability of LLM Code Generation Beyond the Familiarcited by 7

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2026: 2.

2 papers.