Skip to content

Defeating Secure Code Review GPT Hallucinations

Wang ZhilongXinzhi Luo

Analysis of when and why large language models hallucinate during automated code review, and how misleading identifier names induce errors.

Summary

LLMs in Automated Code Analysis

Large language models are increasingly used for code security analysis tasks including semantic code search, vulnerability detection, and code clone analysis. However, their probabilistic nature introduces significant risks of false positives and hallucinated conclusions.

Mechanisms of Review Hallucinations

Empirical testing shows that popular LLMs rely heavily on semantic variable and function naming conventions rather than true control-flow and data-flow semantics. Misleading or obfuscated identifier names consistently induce incorrect security assessments.

Mitigating AI Code Review Pitfalls

Understanding failure modes in LLM-assisted code review enables security engineers to design hybrid validation pipelines combining AI heuristics with deterministic static analysis tools.

Related talks