In the field of software security, detecting potential vulnerabilities in code has always been a core challenge for developers and security engineers. Traditional supervised learning methods perform well on known vulnerability patterns, but they often struggle with novel out-of-distribution (OOD) vulnerabilities—these models cannot generalize to vulnerability patterns not seen in the training data.
At the same time, large language models (LLMs) have shown strong capabilities in code understanding and generation, but they still face issues of logical inconsistency and low recall in zero-shot reasoning scenarios. The root cause is that these methods simplify the complex vulnerability analysis process into a single-step prediction, ignoring the fact that vulnerability detection is essentially a task requiring iterative exploration and deep reasoning.