mlsanityData to 14 Oct 2026

RESCUE: Retrieval Augmented Secure Code Generation

arXiv 2510.18204 ↗First posted 21 Oct 2025cs.CR cs.LG cs.SEcited by 7

On the map: Retrieval-augmented generation → Privacy and security of RAG

Abstract (arXiv)

Despite recent advances, Large Language Models (LLMs) still generate vulnerable code. Retrieval-Augmented Generation (RAG) has the potential to enhance LLMs for secure code generation by incorporating external security knowledge. However, the conventional RAG design struggles with the noise of raw security-related documents, and existing retrieval methods overlook the significant security semantics implicitly embedded in task descriptions. To address these issues, we propose textscRescue, a new RAG framework for secure code generation with two key innovations. First, we propose a hybrid knowledge base construction method that combines LLM-assisted cluster-then-summarize distillation with program slicing, producing both high-level security guidelines and concise, security-focused code examples. Second, we design a hierarchical multi-faceted retrieval that traverses the constructed knowledge base from top to bottom and integrates multiple security-critical facts at each hierarchical level, ensuring comprehensive and accurate retrieval. We evaluated textscRescue on four benchmarks and compared it with five state-of-the-art secure code generation methods on six LLMs. The results demonstrate that textscRescue improves the SecurePass@1 metric by an average of 4.8 points, establishing a new state-of-the-art performance for security. Furthermore, we performed in-depth analysis and ablation studies to rigorously validate the effectiveness of individual components in textscRescue. Our code is available at https://github.com/steven1518/RESCUE.

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Placed in Privacy and security of RAG, one of 15 directions in Retrieval-augmented generation. Builds on 37 of its 61 references that are in the map. First posted on arXiv 21 Oct 2025.

Builds on

37 of 61 references.

Closest ancestors · 1

Same direction, newest first

  1. 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injection23 Apr

Other references · 36

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
  4. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
  5. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  6. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  7. 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
  8. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  9. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 399
  10. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
  11. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  12. 2023The Impact of AI on Developer Productivity: Evidence from GitHub Copilotcited by 274
24 more
  1. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  2. 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
  3. 2021Retrieval Augmented Code Generation and Summarizationcited by 149
  4. 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
  5. 2024Instruction Tuning for Secure Code Generationcited by 68
  6. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 59
  7. 2024Repoformer: Selective Retrieval for Repository-Level Code Completioncited by 55
  8. 2022When Language Model Meets Private Librarycited by 54
  9. 2024Constrained Decoding for Secure Code Generationcited by 37
  10. 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 34
  11. 2023Assessing the Security of GitHub Copilot Generated Code -- A Targeted Replication Studycited by 26
  12. 2024ProSec: Fortifying Code LLMs with Proactive Security Alignmentcited by 25
  13. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyondcited by 22
  14. 2024How much does AI impact development speed? An enterprise-based randomized controlled trialcited by 20
  15. 2024PromSec: Prompt Optimization for Secure Generation of Functional Source Code with Large Language Models (LLMs)cited by 19
  16. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunitiescited by 18
  17. 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generationcited by 16
  18. 2024HexaCoder: Secure Code Generation via Oracle-Guided Synthetic Training Datacited by 16
  19. 2024SecCoder: Towards Generalizable and Robust Secure Code Generationcited by 14
  20. 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generationcited by 10
  21. 2024An Exploratory Study on Fine-Tuning Large Language Models for Secure Code Generationcited by 9
  22. 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
  23. 2025SOSecure: Safer Code Generation with RAG and StackOverflow Discussionscited by 5
  24. 2024Codexity: Secure AI-assisted Code Generationcited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 7.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026Improving LLM-Assisted Secure Code Generation through Retrieval-Augmented-Generation and Multi-Tool Feedback
  2. 2026Securing Retrieval-Augmented Generation: A Taxonomy of Attacks, Defenses, and Future Directions
  3. 2025SafeRAG: Benchmarking Security in Retrieval-Augmented Generation of Large Language Model
  4. 2025Secure Multifaceted-RAG for Enterprise: Hybrid Knowledge Retrieval with Security Filtering
  5. 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
  6. 2025ImportSnare: Directed "Code Manual" Hijacking in Retrieval-Augmented Code Generation
  7. 2025Privacy-Aware RAG: Secure and Isolated Knowledge Retrieval
  8. 2025RefleXGen:The unexamined code is not worth using