Decalage: Uncovering the Gap Between Model-Generated Reasoning and Actual Code Implementation in Small Language Models
Saif Uddin Mahmud, Afsana Tasnim, Ahmed Ryan, Md Rayhanur Rahman
Key points
From the paper's conclusion- We test what that instruction does in small language models, which are attractive because they run locally and cheaply.
Abstract
Agentic code generation often asks a model to explain its reasoning before it writes code, and a common way to make such a workflow safer is to add a security instruction to the prompt. We test what that instruction does in small language models, which are attractive because they run locally and cheaply. Four open code models of 1.5B to 3B parameters generate C++ from 166 sections of eleven public requirements documents, once with a general prompt and once with a secure prompt. The secure prompt more than doubles the share of reasoning about validation, resource handling and threats, and we find no evidence that the rise is larger for requirements with security content. The code changes only in part. Among functions with a body and reasoning, the share with a check that our lexical test recognises rises from 23% to 39%, but more than a quarter of the functions remain stubs, compile rates stay low, and half or more of the functions whose reasoning mentions a check contain no such check. Two rounds of compiler-feedback repair leave more than 80% of sections unusable, and neither cppcheck nor an exploratory ESBMC run separates the prompts on the usable code. A hand check by two annotators supports the stub measure and the direction of the reasoning result. For small models, a security instruction changes the reasoning broadly but the code only in part, so the reasoning should be checked against the code rather than trusted.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Security Tests as Executable Specifications for LLM Code Generation: Benefits, Trade-offs, and Coverage LimitsarXiv · 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
- Making Small Code LLMs More Efficient for Secure Code Review with Neuro-Symbolic Fine-TuningarXiv · 2026
- Static Analysis Guidance for Secure LLM Code GenerationarXiv · 2026
- Security and Quality in LLM-Generated Code: A Multi-Language, Multi-Model AnalysisIEEE Transactions on Dependable and Secure Computing · 2026
- Secure and Functional Code Generation with Self-EvaluationarXiv · 2026