Making Small Code LLMs More Efficient for Secure Code Review with Neuro-Symbolic Fine-Tuning
Mostafijur Rahman Akhond, Mahmuda Khatun, Gias Uddin
Key points
From the paper's conclusion- The results suggest that fine-tuning helps small models produce more structured, evidence-linked security reasoning.
Abstract
As AI coding assistants generate more code, the need to review it for security flaws grows. Existing approaches leave a gap: static analyzers identify program sites but offer little explanation, while language-model explanations can be difficult to verify. Small open-weight code models could make security review available without sending proprietary code to a hosted service. We study whether fine-tuning helps these models turn security evidence into explanations that developers and tools can check. We present secSemScan, which pairs a static analyzer with a locally deployable model that writes a schema-constrained security monologue naming program sites, assigning a CWE, and giving a machine-parseable verdict. We also introduce OGSM (Oracle-Grounded Security Monologue), a dataset of 1,993 C/C\texttt{++} functions covering 22 CWEs in the taint and lifetime families. Each record pairs a function with analyzer-derived or fix-diff-derived evidence and a monologue. We fine-tune three open-weight code models in two stages, first on the output format and then on the monologue content. Because evaluation prompts supply the verdict and evidence, our results measure how well models use that information, not whether they detect vulnerabilities independently. On 355 test records, fine-tuning raised Qwen2.5-Coder-7B's verdict accuracy from 4.8\% to 96.6\%; DeepSeek-Coder-6.7B reached 78.9\%, and StarCoder2-7B reached 43.7\%. Qwen2.5-Coder-7B cited 87.5\% of Tier~1 oracle sites, and every line it cited belonged to the oracle evidence. The results suggest that fine-tuning helps small models produce more structured, evidence-linked security reasoning.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Secure and Functional Code Generation with Self-EvaluationarXiv · 2026
- Decalage: Uncovering the Gap Between Model-Generated Reasoning and Actual Code Implementation in Small Language ModelsarXiv · 2026
- Static Analysis Guidance for Secure LLM Code GenerationarXiv · 2026
- Empowering Lightweight Language Models for Security Code Review via Context-Aware DistillationProceedings of the ACM on Software Engineering · 2026
- Toward Secure Code Generation: Bridging Correctness and Security via Task-Adaptive Vulnerability Modeling and Execution-Based BenchmarkingProceedings of the ACM on software engineering. · 2026
- Security Tests as Executable Specifications for LLM Code Generation: Benefits, Trade-offs, and Coverage LimitsarXiv · 2026