Rethinking the Evaluation of Secure Code Generation
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) are widely used in software development. However, the code generated by LLMs often contains vulnerabilities. Several secure code generation methods have been proposed to address this issue, but their current evaluation schemes leave several concerns unaddressed. Specifically, most existing studies evaluate security and functional correctness separately, using different datasets. That is, they assess vulnerabilities using security-related code datasets while validating functionality with general code datasets. In addition, prior research primarily relies on a single static analyzer, CodeQL, to detect vulnerabilities in generated code, which limits the scope of security evaluation. In this work, we conduct a comprehensive study to systematically assess the improvements introduced by four state-of-the-art secure code generation techniques. Specifically, we apply both security inspection and functionality validation to the same generated code and evaluate these two aspects together. We also employ three popular static analyzers and two LLMs to identify potential vulnerabilities in the generated code. Our study reveals that existing techniques often compromise the functionality of generated code to enhance security. Their overall performance remains limited when evaluating security and functionality together. In fact, many techniques even degrade the performance of the base LLM by more than 50%. Our further inspection reveals that these techniques often either remove vulnerable lines of code entirely or generate ``garbage code'' that is unrelated to the intended task. Moreover, the commonly used static analyzer CodeQL fails to detect several vulnerabilities, further obscuring the actual security improvements achieved by existing techniques.
Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Builds on 35 of its 59 references that are in the map. First posted on arXiv 18 Mar 2025.
Builds on
35 of 59 references.
References · 35
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2024Qwen2.5 Technical Reportcited by 4,942
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2022CodeT: Code Generation with Generated Testscited by 384
23 more
- 2023Using an LLM to Help With Code Understandingcited by 228
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 138
- 2023Self-planning Code Generation with Large Language Modelscited by 124
- 2024IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilitiescited by 103
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 96
- 2025ACECODER: Acing Coder RL via Automated Test-Case Synthesiscited by 93
- 2024Automated Unit Test Improvement using Large Language Models at Metacited by 75
- 2024Instruction Tuning for Secure Code Generationcited by 68
- 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
- 2023Understanding the Effectiveness of Large Language Models in Detecting Security Vulnerabilitiescited by 59
- 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 59
- 2023Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program Repaircited by 55
- 2023Large Language Models for Code Analysis: Do LLMs Really Do Their Job?cited by 45
- 2024CodeJudge: Evaluating Code Generation with Large Language Modelscited by 44
- 2023SALLM: Security Assessment of Generated Codecited by 39
- 2024Constrained Decoding for Secure Code Generationcited by 37
- 2024PromSec: Prompt Optimization for Secure Generation of Functional Source Code with Large Language Models (LLMs)cited by 19
- 2024RePair: Automated Program Repair with Process-based Feedbackcited by 16
- 2023Enhancing Large Language Models for Secure Code Generation: A Dataset-driven Study on Vulnerability Mitigationcited by 15
- 2024SecCoder: Towards Generalizable and Robust Secure Code Generationcited by 14
- 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
Built on by
Citing papers per year: 2025: 1; 2026: 9.
10 papers.
- 2025One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discoverycited by 6
- 2026Enhancing Reliability in LLM-Based Secure Code Generationcited by 2
- 2026Correct Code, Vulnerable Dependencies: A Large Scale Measurement Study of LLM-Specified Library Versionscited by 1
- 2026LLMs + Security = Troublecited by 0
- 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanismscited by 0
- 2026Rewriting the Response Path: Silent Tampering and Provider-Signed Defense in BYOK LLM Agentscited by 0
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forwardcited by 0
- 2026The Illusion of Secure LLM Code: Closing the Security Gap via Iterative Repromptingcited by 0
- 2026When Who You Are Can Change the Code You Get: A Study of Persona-Induced Bias in LLM Code Generationcited by 0
- 2026Metrics Failure in LLM-Based Code Vulnerability Repair: An Empirical Study and a Change-Aware Screencited by 0
- 2026Metrics Failure in LLM-Based Code Vulnerability Repair: An Empirical Study and a Change-Aware Screen22 Sep 2026
- 2026When Who You Are Can Change the Code You Get: A Study of Persona-Induced Bias in LLM Code Generation12 Aug 2026
- 2026The Illusion of Secure LLM Code: Closing the Security Gap via Iterative Reprompting26 Jul 2026
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026Enhancing Reliability in LLM-Based Secure Code Generation22 May 2026
- 2026Correct Code, Vulnerable Dependencies: A Large Scale Measurement Study of LLM-Specified Library Versions7 May 2026
- 2026Rewriting the Response Path: Silent Tampering and Provider-Signed Defense in BYOK LLM Agents4 May 2026
- 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanisms11 Mar 2026
- 2026LLMs + Security = Trouble9 Feb 2026
- 2025One Bug, Hundreds Behind: LLMs for Large-Scale Bug Discovery15 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Poster: Rethinking Security in LLM Code Generation through Real-World Risk Scenarios
- 2024Software Vulnerability and Functionality Assessment using LLMs
- 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
- 2026Persistent Human Feedback, LLMs, and Static Analyzers for Secure Code Generation and Vulnerability Detection
- 2026RealSec-bench: A Benchmark for Evaluating Secure Code Generation in Real-World Repositories
- 2024From Vulnerabilities to Remediation: A Systematic Literature Review of LLMs in Code Security
- 2026Improving LLM-Assisted Secure Code Generation through Retrieval-Augmented-Generation and Multi-Tool Feedback
- 2025SOSecure: Safer Code Generation with RAG and StackOverflow Discussions