mlsanityData to 7 Oct 2026

Secure-Instruct: An Automated Pipeline for Synthesizing Instruction-Tuning Datasets Using LLMs for Secure Code Generation

arXiv 2510.07189 ↗First posted 8 Oct 2025cs.SEcited by 2

On the map: Synthetic data and self-improvement for LLMs → Code and instruction data synthesis

Abstract (arXiv)

Although Large Language Models (LLMs) show promising solutions to automated code generation, they often produce insecure code that threatens software security. Current approaches (e.g., SafeCoder) to improve secure code generation are limited by small, imbalanced instruction-tuning datasets. In this work, we present Secure-Instruct, a novel pipeline that automatically synthesizes high-quality vulnerable and secure code examples and instruction-tunes LLMs to align task description and secure code generation abilities. We evaluate Secure-Instruct on four representative LLMs using two security-related benchmarks: our own CWEBench and the existing CWEval. CWEBench comprises 93 scenarios on 44 CWEs, all without overlap with Secure-Instruct's synthetic instruction-tuning dataset, while CWEval covers 31 CWEs with 119 manually verified security-critical tasks. We find that Secure-Instruct improves both security and functional correctness in code generation. On CWEBench, Secure-Instruct substantially improves secure code generation, giving a 28.5% increase on average in secure ratio over the pre-trained models and outperforms SafeCoder by 12.6%. On CWEval, Secure-Instruct achieves an increase of 157.3% for CodeLlama-7B and 46.4% for Mistral-7B in Func-Sec@1 over pretrained models, and significantly outperforms SafeCoder.

Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Placed in Code and instruction data synthesis, one of 13 directions in Synthetic data and self-improvement for LLMs. Builds on 22 of its 35 references that are in the map. First posted on arXiv 8 Oct 2025.

Builds on

22 of 35 references.

References · 22

  1. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  2. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  3. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  4. 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,116
  5. 2023StarCoder: may the source be with you!cited by 790
  6. 2023The Flan Collection: Designing Data and Methods for Effective Instruction Tuningcited by 734
  7. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  8. 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
  9. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  10. 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 124
  11. 2023InferFix: End-to-End Program Repair with LLMscited by 113
  12. 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
10 more
  1. 2023How Secure is Code Generated by ChatGPT?cited by 77
  2. 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
  3. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 55
  4. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 52
  5. 2023No Need to Lift a Finger Anymore? Assessing the Quality of Code Generation by ChatGPTcited by 45
  6. 2024SOEN-101: Code Generation by Emulating Software Process Models Using Large Language Model Agentscited by 34
  7. 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarkscited by 34
  8. 2023Enhancing Large Language Models for Secure Code Generation: A Dataset-driven Study on Vulnerability Mitigationcited by 14
  9. 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 14
  10. 2024An Exploratory Study on Fine-Tuning Large Language Models for Secure Code Generationcited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 2.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents
  2. 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
  3. 2024Semi-Instruct: Bridging Natural-Instruct and Self-Instruct for Code Large Language Models
  4. 2025Rethinking the Evaluation of Secure Code Generation
  5. 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
  6. 2026RealSec-bench: A Benchmark for Evaluating Secure Code Generation in Real-World Repositories
  7. 2024ProSec: Fortifying Code LLMs with Proactive Security Alignment
  8. 2026Improving LLM-Assisted Secure Code Generation through Retrieval-Augmented-Generation and Multi-Tool Feedback