Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detection
Not on the map. Why?
Abstract (arXiv)
Researchers and practitioners increasingly apply Large Language Models (LLMs) for automated vulnerability detection. Recent work has shown that LLMs are susceptible to the same cognitive heuristics that bias human judgment. Yet, no work has investigated whether these heuristics affect a model's assessment of code vulnerabilities. In this paper, we present the first systematic exploration of cognitive heuristics in LLM-driven code vulnerability detection. We introduce a controlled framework that holds the code fixed and only varies the surrounding context to trigger three cognitive heuristics: the halo effect through author attribution, the framing effect through task objectives and consequences, and the anchoring effect through prior analysis results. Within this framework, we evaluate eight LLMs across three programming languages and perform both quantitative and code-level analyses. Our findings demonstrate that all evaluated models are susceptible to these heuristics. Cross-model average susceptibility is highest for framing at 33.2%, followed by anchoring at 23.5% and halo at 18.4%. Code-level analysis reveals that vulnerabilities that require semantic reasoning for detection are more susceptible to cognitive heuristics than those identifiable through pattern matching. Furthermore, models often change their verdict from safe to vulnerable based on the cognitive condition, without accurately identifying the actual vulnerability. To highlight the practical impact, we demonstrate a proof-of-concept black-box cognitive attack that can suppress up to 97% of previously detected vulnerabilities. These findings indicate that cognitive susceptibility is a consistent and exploitable property of LLM-based vulnerability detection.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 54 of its 83 references that are in the map. First posted on arXiv 29 Jun 2026.
Builds on
54 of 83 references.
References · 54
- 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,655
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,339
- 2023Towards Understanding Sycophancy in Language Modelscited by 988
- 2023Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formattingcited by 778
- 2024Justice or Prejudice? Quantifying Biases in LLM-as-a-Judgecited by 354
- 2023State of What Art? A Call for Multi-Prompt LLM Evaluationcited by 299
- 2023Benchmarking Cognitive Biases in Large Language Models as Evaluatorscited by 147
- 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
- 2024Cognitive Bias in Decision-Making with LLMscited by 104
- 2025SycEval: Evaluating LLM Sycophancycited by 101
- 2025PromptArmor: Simple yet Effective Prompt Injection Defensescited by 98
- 2022Capturing Failures of Large Language Models via Human Cognitive Biasescited by 97
38 more
- 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 94
- 2024Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGcited by 67
- 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
- 2024Large Language Models for Cyber Security: A Systematic Literature Reviewcited by 65
- 2022Taxonomy of Attacks on Open-Source Software Supply Chainscited by 57
- 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 57
- 2023Instructed to Bias: Instruction-Tuned Language Models Exhibit Emergent Cognitive Biascited by 51
- 2023Prompt-Enhanced Software Vulnerability Detection Using ChatGPTcited by 51
- 2023TrojanPuzzle: Covertly Poisoning Code-Suggestion Modelscited by 47
- 2025LLMs in Software Security: A Survey of Vulnerability Detection Techniques and Insightscited by 44
- 2023Do Large Language Models Show Decision Heuristics Similar to Humans? A Case Study Using GPT-3.5cited by 41
- 2024Large Language Model for Vulnerability Detection and Repair: Literature Review and the Road Aheadcited by 41
- 2024Finetuning Large Language Models for Vulnerability Detectioncited by 39
- 2024Addressing cognitive bias in medical language modelscited by 34
- 2023Stealthy Backdoor Attack for Code Modelscited by 32
- 2024An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detectioncited by 32
- 2024A Comprehensive Evaluation of Cognitive Biases in LLMscited by 32
- 2025Benchmarking LLMs and LLM-based Agents in Practical Vulnerability Detection for Code Repositoriescited by 29
- 2023How Far Have We Gone in Vulnerability Detection Using Large Language Modelscited by 27
- 2024(Ir)rationality and Cognitive Biases in Large Language Modelscited by 23
- 2025Attractive Metadata Attack: Inducing LLM Agents to Invoke Malicious Toolscited by 23
- 2024LLMDFA: Analyzing Dataflow in Code with Large Language Modelscited by 22
- 2024AI Can Be Cognitively Biased: An Exploratory Study on Threshold Priming in LLM-Based Batch Relevance Assessmentcited by 20
- 2024Comparison of Static Application Security Testing Tools and Large Language Models for Repo-level Vulnerability Detectioncited by 18
- 2023Influence of External Information on Large Language Models Mirrors Social Cognitive Patternscited by 16
- 2024Outside the Comfort Zone: Analysing LLM Capabilities in Software Vulnerability Detectioncited by 16
- 2025To Protect the LLM Agent Against the Prompt Injection Attack with Polymorphic Promptcited by 14
- 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 13
- 2024VulDetectBench: Evaluating the Deep Capability of Vulnerability Detection with Large Language Modelscited by 11
- 2025Justice in Judgment: Unveiling (Hidden) Bias in LLM-assisted Peer Reviewscited by 10
- 2025The Bias is in the Details: An Assessment of Cognitive Bias in LLMscited by 10
- 2017Cognitive Biases in Software Engineering: A Systematic Mapping Studycited by 9
- 2026When Wording Steers the Evaluation: Framing Bias in LLM judgescited by 8
- 2025Beauty and the Bias: Exploring the Impact of Attractiveness on Multimodal Large Language Modelscited by 7
- 2025How Does Cognitive Bias Affect Large Language Models? A Case Study on the Anchoring Effect in Price Negotiation Simulationscited by 7
- 2025More or Less Wrong: A Benchmark for Directional Bias in LLM Comparative Reasoningcited by 6
- 2025Adversarial Suffix Filtering: a Defense Pipeline for LLMscited by 5
- 2025Adversarial Bug Reports as a Security Risk in Language Model-Based Automated Program Repaircited by 4
50 most cited of 54 All 54 (JSON)
Built on by
Not cited yet.