SEEK: Agentic Knowledge Graph Retrieval for Secure Code Generation
On the map: LLM agents and tool use → Agent threats, guardrails and governance also fits: Software engineering coding agents
Abstract (arXiv)
Large Language Models (LLMs) can generate functionally correct code while introducing exploitable security weaknesses, particularly when developers specify functionality without explicit security requirements. Recent state-of-the-art approaches mitigate this problem using external security knowledge, but largely rely on flat similarity-based retrieval over independent artifacts, making it difficult to infer the relevant vulnerability space and retrieve targeted knowledge when direct matches are unavailable. We propose SEEK, an agentic Graph RAG framework for secure code generation that constructs a security knowledge graph using the Common Weakness Enumeration (CWE) taxonomy as its structural backbone and injects it with curated real-world CVE vulnerability-fix instances. At inference time, a Planner Agent predicts potential CWE weaknesses associated with the developer query, which guide Graph Scoping to restrict retrieval to relevant regions of the CWE taxonomy before deterministic multi-faceted candidate ranking. A Selection Agent subsequently validates the predicted weaknesses and retrieved candidates prior to code generation. Across five open-source LLMs, we evaluate SEEK in an out-of-distribution setting on CodeGuard+ and CyberSecEval, spanning C, C++, and Python. SEEK achieves the highest SecurePass@1 of 77.45% on CodeGuard+ and the highest aggregate ICD pass rate of 79.45% on CyberSecEval, surpassing prior approaches. Moreover, SEEK achieves 85.2% SecurePass@1 across 13 unseen CWE types with no directly linked vulnerability-fix instances, demonstrating strong generalizability, while maintaining acceptable inference latency costs.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 17 of its 50 references that are in the map. First posted on arXiv 10 Oct 2026.
Builds on
17 of 50 references.
References · 17
- 2023GPT-4 Technical Reportcited by 18,396
- 2020Knowledge Graphscited by 621
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2024Graph Retrieval-Augmented Generation: A Surveycited by 324
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
- 2021Retrieval Augmented Code Generation and Summarizationcited by 149
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2024Instruction Tuning for Secure Code Generationcited by 68
- 2024Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGcited by 68
- 2024We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMscited by 65
- 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 34
5 more
- 2024How secure is AI-generated Code: A Large-Scale Comparison of Large Language Modelscited by 24
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunitiescited by 18
- 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 16
- 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
- 2025SOSecure: Safer Code Generation with RAG and StackOverflow Discussionscited by 5
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Fortifying LLM-Based Code Generation with Graph-Based Reasoning on Secure Coding Practices
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
- 2026MACGen: Toward Functionally Correct and Secure Code Generation via Multi-Agent Collaboration
- 2025RESCUE: Retrieval Augmented Secure Code Generation
- 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarios
- 2026CVE-Factory: Scaling Expert-Level Agentic Tasks for Code Security Vulnerability
- 2025Automated Vulnerability Validation and Verification: A Large Language Model Approach
- 2026AgenticSCR: An Autonomous Agentic Secure Code Review for Immature Vulnerabilities Detection