mlsanityData to 13 Oct 2026

Improving LLM-Assisted Secure Code Generation through Retrieval-Augmented-Generation and Multi-Tool Feedback

arXiv 2601.00509 ↗First posted 1 Jan 2026cs.CR cs.LGcited by 1

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Large Language Models (LLMs) can generate code but often introduce security vulnerabilities, logical inconsistencies, and compilation errors. Prior work demonstrates that LLMs benefit substantially from structured feedback, static analysis, retrieval augmentation, and execution-based refinement. We propose a retrieval-augmented, multi-tool repair workflow in which a single code-generating LLM iteratively refines its outputs using compiler diagnostics, CodeQL security scanning, and KLEE symbolic execution. A lightweight embedding model is used for semantic retrieval of previously successful repairs, providing security-focused examples that guide generation. Evaluated on a combined dataset of 3,242 programs generated by DeepSeek-Coder-1.3B and CodeLlama-7B, the system demonstrates significant improvements in robustness. For DeepSeek, security vulnerabilities were reduced by 96%. For the larger CodeLlama model, the critical security defect rate was decreased from 58.55% to 22.19%, highlighting the efficacy of tool-assisted self-repair even on "stubborn" models.

Key facts. Cited by 1 paper in the map (data through 13 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 1 of its 3 references that are in the map. First posted on arXiv 1 Jan 2026.

Builds on

1 of 3 references.

References · 1

  1. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 427

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2026Tool-Guided Retrieval-Augmented Repair for Securing LLM-Generated C Code
  2. 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
  3. 2025SOSecure: Safer Code Generation with RAG and StackOverflow Discussions
  4. 2025A Mixture of Linear Corrections Generates Secure Code
  5. 2026Persistent Human Feedback, LLMs, and Static Analyzers for Secure Code Generation and Vulnerability Detection
  6. 2025RESCUE: Retrieval Augmented Secure Code Generation
  7. 2025Rethinking the Evaluation of Secure Code Generation
  8. 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injection