aiqbench analysis
This research demonstrates how integrating static analysis tools like CodeQL and symbolic execution into retrieval-augmented workflows significantly reduces security vulnerabilities in LLM-generated C code for embedded systems. By leveraging prior repair patterns alongside compilation diagnostics, the approach cuts defect rates by over 60% compared to baseline models alone. This work highlights a critical pathway toward making generative AI safer for resource-constrained environments where traditional debugging is difficult.
Tool-Guided Retrieval-Augmented Repair for Securing LLM-Generated C Code
arXiv:2607.21641v1 Announce Type: cross Abstract: Large language models can generate C code from natural-language descriptions, but resulting programs often contain security vulnerabilities and compilation errors, posing risks for embedded and resource-constrained systems. This work investigates how feedback and retrieval improve reliability of LLM-generated C code. We present an analysis-and-repair workflow that combines compilation diagnostics, CodeQL static analysis, and KLEE symbolic execution with retrieval of prior repair patterns for iterative refinement. Evaluated on 5,000 C programming tasks exercising embedded relevant vulnerabilities, baseline models show substantial reliability gaps, with compilation failure rates up to 46% and security defect rates up to 49%. Our approach improves both metrics. For CodeLlama 7B, security defect rates decrease from 49% to 19% and total CodeQL errors drop from 15,088 to 2,463 (83.7%). For DeepSeek Coder 1.3B, compilation failures are reduced from 42% to 22% and security defects from 35% to 15%. These results show that integrating lightweight analysis tools can improve the safety of LLM-generated code for embedded development.
Abstract:Large language models can generate C code from natural-language descriptions, but resulting programs often contain security vulnerabilities and compilation errors, posing risks for embedded and resource-constrained systems. This work investigates how feedback and retrieval improve reliability of LLM-generated C code. We present an analysis-and-repair workflow that combines compilation diagnostics, CodeQL static analysis, and KLEE symbolic execution with retrieval of prior repair patterns for iterative refinement. Evaluated on 5,000 C programming tasks exercising embedded relevant vulnerabilities, baseline models show substantial reliability gaps, with compilation failure rates up to 46% and security defect rates up to 49%. Our approach improves both metrics. For CodeLlama 7B, security defect rates decrease from 49% to 19% and total CodeQL errors drop from 15,088 to 2,463 (83.7%). For DeepSeek Coder 1.3B, compilation failures are reduced from 42% to 22% and security defects from 35% to 15%. These results show that integrating lightweight analysis tools can improve the safety of LLM-generated code for embedded development.
Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
arXiv:2607.21641 [cs.SE]
(or arXiv:2607.21641v1 [cs.SE] for this version)
https://doi.org/10.48550/arXiv.2607.21641 Focus to learn more arXiv-issued DOI via DataCite
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.
Full text under the publisher's open licence · 253 words
Related coverage

Beyond LLMs: Why Scalable Enterprise AI Adoption Depends on Agent Logic
Hugging Face · Jun 1, 2026

Build an AI-Powered Equipment Repair Assistant Using Amazon Bedrock AgentCore
AWS · Jun 10, 2026
Beyond "What to Retrieve": Uncertainty in Retrieval-Augmented Code Generation
arXiv · Jul 29, 2026
SPARK: Security Knowledge Priming and Representation-Guided Knowledge Activation for LLM-based Secure Code Generation
arXiv · Jun 16, 2026