mlsanityData to 7 Oct 2026

To Err is Machine: Vulnerability Detection Challenges LLM Reasoning

arXiv 2403.17218 ↗First posted 25 Mar 2024cs.SE cs.CR cs.LGcited by 17

On the map: LLM reasoning → Reasoning for agents, planning and code

Abstract (arXiv)

In this paper, we present a challenging code reasoning task: vulnerability detection. Large Language Models (LLMs) have shown promising results in natural-language and math reasoning, but state-of-the-art (SOTA) models reported only 54.5% Balanced Accuracy in our vulnerability detection evaluation, even those models pre-trained on large amounts of source code. Our error analysis on LLM responses shows that the models struggle to reason about the code semantics relevant to identifying vulnerabilities, especially subtle semantic differences caused by small textual changes. We explored prominent models and training settings to understand their effects on vulnerability detection performance -- including better prompts, larger models, more pre-training data, and fine-tuning -- but none led to significant improvements. This raises the question of whether simply scaling training data and model size will allow us to "solve" complex code reasoning tasks like vulnerability detection, or if a fundamental shift in modeling and training techniques is required. We also explored adding domain knowledge to prompts; although it helped certain models understand some code semantics, vulnerability detection requires multi-step reasoning, and these models still failed in steps, such as reasoning about variable relations. Our results suggest that new models, new training methods, or more execution-specific pretraining data may be needed to conquer vulnerability detection. We speculate that auto-regressive pre-training on source code may not effectively extract code semantics, especially on the current pretraining mixtures, in which execution data is scarce. Success on vulnerability detection as a code reasoning task can benefit many areas of software engineering such as debugging, test input generation, and program repair. Our code and data are available at https://doi.org/10.6084/m9.figshare.27368025.

Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 26 of its 70 references that are in the map. First posted on arXiv 25 Mar 2024.

Builds on

26 of 70 references.

References · 26

  1. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  2. 2021Training Verifiers to Solve Math Word Problemscited by 9,743
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2023Mistral 7Bcited by 3,065
  5. 2023A Survey of Large Language Modelscited by 2,537
  6. 2022Emergent Abilities of Large Language Modelscited by 2,483
  7. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  8. 2024Mixtral of Expertscited by 1,785
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  10. 2023AgentBench: Evaluating LLMs as Agentscited by 1,211
  11. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  12. 2023Gemini: A Family of Highly Capable Multimodal Modelscited by 810
14 more
  1. 2023StarCoder: may the source be with you!cited by 790
  2. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  3. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
  4. 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
  5. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
  6. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 94
  7. 2023Understanding the Effectiveness of Large Language Models in Detecting Security Vulnerabilitiescited by 58
  8. 2023Prompt-Enhanced Software Vulnerability Detection Using ChatGPTcited by 51
  9. 2023ChatGPT for Vulnerability Detection, Classification, and Repair: How Far Are We?cited by 44
  10. 2024Finetuning Large Language Models for Vulnerability Detectioncited by 39
  11. 2024Chain-of-Thought Prompting of Large Language Models for Discovering and Fixing Software Vulnerabilitiescited by 31
  12. 2023The Hitchhiker's Guide to Program Analysis: A Journey with Large Language Modelscited by 18
  13. 2023Transformer-based Vulnerability Detection in Code at EditTime: Zero-shot, Few-shot, or Fine-tuning?cited by 13
  14. 2024Your Instructions Are Not Always Helpful: Assessing the Efficacy of Instruction Fine-tuning for Software Vulnerability Detectioncited by 6

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 1; 2025: 9; 2026: 7.

17 papers.

Sort:

By area:

  1. 2025SEC-bench: Automated Benchmarking of LLM Agents on Real-World Software Security Taskscited by 69
  2. 2025Are Smarter LLMs Safer? Exploring Safety-Reasoning Trade-offs in Prompting and Fine-Tuningcited by 19
  3. 2025Failure-Driven Workflow Refinementcited by 19
  4. 2025CodeSense: a Real-World Benchmark and Dataset for Code Semantic Reasoningcited by 12
  5. 2025VulnLLM-R: Specialized Reasoning LLM with Agent Scaffold for Vulnerability Detectioncited by 11
  6. 2026SEC-bench Pro: Can Language Models Solve Long-Horizon Software Security Tasks?cited by 8
  7. 2025Vulnerability Detection: From Formal Verification to Large Language Models and Hybrid Approaches: A Comprehensive Overviewcited by 7
  8. 2025R2Vul: Learning to Reason about Software Vulnerabilities with Reinforcement Learning and Structured Reasoning Distillationcited by 7
  9. 2026Co-RedTeam: Orchestrated Security Discovery and Exploitation with LLM Agentscited by 6
  10. 2026CVE-Factory: Scaling Expert-Level Agentic Tasks for Code Security Vulnerabilitycited by 5
  11. 2024RealVul: Can We Detect Vulnerabilities in Web Applications with LLM?cited by 3
  12. 2025Revisiting Pre-trained Language Models for Vulnerability Detectioncited by 3
5 more
  1. 2026DREA: Decoupled Reasoning and Exploration Agents for Repository-Level Vulnerability Detectioncited by 3
  2. 2025Llama-based source code vulnerability detection: Prompt engineering vs Fine tuningcited by 2
  3. 2026Veritas: Grounding LLM Agents for Reliable Vulnerability Reasoning over Stripped Binariescited by 1
  4. 2026Three Heads Are Better Than One: A Multi-perspective Reasoning Framework for Enhanced Vulnerability Detectioncited by 1
  5. 2026VulReaD: Knowledge-Graph-guided Software Vulnerability Reasoning and Detectioncited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoning
  2. 2026Do Fine-Tuned LLMs Understand Vulnerabilities? An Investigation into the Semantic Trap
  3. 2025Boosting Vulnerability Detection of LLMs via Curriculum Preference Optimization with Synthetic Reasoning Data
  4. 2024Can LLM Prompting Serve as a Proxy for Static Analysis in Vulnerability Detection
  5. 2026ConceptCoder: Improve Code Reasoning via Concept Learning
  6. 2024Towards Explainable Vulnerability Detection with Large Language Models
  7. 2025VulInstruct: Teaching LLMs Root-Cause Reasoning for Vulnerability Detection via Security Specifications
  8. 2025SV-TrustEval-C: Evaluating Structure and Semantic Reasoning in Large Language Models for Source Code Vulnerability Analysis