← Back to feed
2026-06-29agentsreasoningcommunity code

Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detection

Asif Shahriar, Hongyu Cai, Hadjer Benkraouda, Gang Wang, Z. Berkay Celik

PDF preview for Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detection
Read on arXiv →

Key claim

LLMs are biased in vulnerability detection due to cognitive heuristics.

In plain English

Imagine you're building a system to automatically detect vulnerabilities in code. You'd want it to be reliable, but what if the model's judgment is swayed by how the code is presented? That's a real concern because recent studies show that even advanced models can fall prey to the same cognitive biases that affect human decision-making. For instance, if a model sees a piece of code attributed to a well-known author, it might rate it as safer than it actually is — this is called the halo effect. Similarly, how a task is framed can change the model's assessment, leading to what's known as the framing effect. And if the model has seen previous analyses, it might anchor its judgment to those results, even if they were incorrect. These biases can lead to serious misclassifications, where a model might declare a piece of code safe when it’s actually vulnerable, especially if the vulnerability requires deeper understanding rather than just pattern recognition. This paper introduces a framework to investigate these biases systematically, testing eight different large language models across various programming languages. The findings are concerning: the models showed significant susceptibility to these cognitive biases, with the framing effect being the most impactful. This means that if you're relying on LLMs for security assessments, you need to be aware that their judgments can be easily influenced by context, potentially leading to overlooked vulnerabilities.

Novelty
8.0/10

This work systematically explores cognitive heuristics in LLM-driven vulnerability detection, a previously unexamined area.

Reliability
8.0/10

The study evaluates multiple models across different programming languages and provides quantitative analyses, supporting its claims.

Deep reliability assessment

The methodology supports the claim that LLMs are influenced by cognitive heuristics in vulnerability detection, but the practical impact of these biases in real-world settings may be overclaimed due to the controlled nature of the experiments and the lack of live production testing.

Reproducibility

No open source code or dataset is mentioned in the paper.

Key figure

Figure 1 illustrates the halo effect, showing how a model's vulnerability assessment changes based on the perceived prestige of the code author.

GitHub1 repo
ProlificTeddy/words-speak-louder-than-code-investigating-cognitive-heuristics-in-llm-based-code-vulnerabCommunity
Words Speak Louder Than Code: Investigating Cognitive Heuristics in LLM-Based Code Vulnerability Detection — Frontier Papers