Mahdieh Abazar, Lorenzo De Carli, Benjamin Tan · 2026 · arXiv (Cornell University)
DOI: 10.48550/arxiv.2610.24907 · cited by 0 works (OpenAlex) · open-access PDF
Trotz des raschen Fortschritts bei der LLM-basierten Code-Generation bleiben Sicherheitsanfälligkeiten weit verbreitet, und die RACG-Generation (Recovery-Augmented Code Generation) kann das Risiko weiter verstärken, wenn das abgerufene Wissen verbose oder anfällig für Vergiftungen ist. Bestehende sichere RACG-Ansätze injizieren Sicherheitswissen auf einer fein gesäuerten Vulnerabilitätsebene und verursachen sofortige Überlagerungen und verdünnte Modellaufmerksamkeit, wenn eine Abfrage mehrere verwandte Schwächen beinhaltet. Wir schlagen CAT-RAG, ein Agentenschutzkategorie-bewußtes RACG-Code-Augmented Code-Generation-Framework, vor. CAT-RAG
Machine translation (Meta M2M100); the English original follows.
Despite rapid progress in LLM-based code generation, security vulnerabilities remain widespread, and retrieval-augmented code generation (RACG) can further amplify risk when retrieved knowledge is verbose or vulnerable to poisoning. Existing secure RACG approaches inject security knowledge at a fine-grained vulnerability level, causing prompt overhead and diluted model attention when a query implicates multiple related weaknesses. We propose CAT-RAG, an agentic security category-aware retrieval-augmented code generation framework. CAT-RAG performs adaptive category selection via an LLM as a categorizer agent and operates either as a standalone security layer or as a drop-in add-on to RACG pipelines, requiring no modification to the underlying model. We replace CWE-level retrieval with compact, language-specific security categories. These categories provide a higher-level abstraction over individual CWE weaknesses, organizing them by the security concern they share, such as Input Validation and Injection Attacks, rather than merely grouping related entries. Each category consolidates best practices and secure code examples into a single, prompt-efficient representation. We perform a comprehensive evaluation across CyberSecEval, CodeGuard+, and HumanEval. On CyberSecEval, CAT-RAG nearly doubles the secure code generation improvement over the state of the art (23.57% vs. 12.11%) while reducing token overhead by 41.71%.
Read in: English · Spanish · Chinese · Hindi · Arabic · Portuguese · French · German · Japanese · Russian · Korean · Indonesian · Vietnamese
Topics: Computer science, Code (set theory), Vulnerability (computing), Abstraction, Overhead (engineering), Computer security
GET https://store.agentexchange.work/gw/papers/verify?title=...&year=... (0.003 USD), fetch this record as JSON with /gw/papers/paper?id=2610.24907, or list what it cites with /gw/papers/references?id=.... Pay per call in USDC (x402) or with a 19 USD card key for 1,000 calls. Catalogue · llms.txtSources: OpenAlex (CC0), arXiv, Crossref. Agent Exchange