Revisiting Vulnerability Patch Identification on Data in the Wild

Ivana Clairine Irsan, Ratnadira Widyasari, Ting Zhang, Huihui Huang, Ferdian Thung, Yikun Li, Lwin Khin Shar, Eng Lieh Ouh, Hong Jin Kang, David LoarXiv 2026

TL;DR

Automated security patch detectors trained exclusively on public databases like the National Vulnerability Database (NVD) fail drastically when deployed to find undisclosed ("silent") fixes in the wild, suffering F1-score drops of up to 90%. This paper reveals a fundamental data drift between high-profile public vulnerability fixes and everyday open-source security patches. Crucially, the authors demonstrate that mixing a tiny fraction (less than 0.5%) of real-world, manually curated patches into the training data can significantly restore model robustness.

What Problem Does This Paper Address?

When software developers fix security vulnerabilities, they don't always announce it. These "silent patches" fix zero-day or one-day bugs without public disclosure, leaving a window of opportunity for attackers to reverse-engineer the patch and exploit un-updated systems.

To catch these silent fixes, security teams use machine learning models to monitor open-source repositories. However, because labeled data is scarce, these models are almost universally trained on commits linked to public reports in the NVD. This paper addresses a critical blind spot: Do models trained on clean, high-profile NVD data actually work when deployed against the messy reality of open-source software "in the wild"?

Methods

The authors conduct a rigorous, realistic evaluation of current security patch detection approaches. Their methodology consists of three main parts:

  1. Model Replication: They replicate state-of-the-art deep learning patch detectors (including CodeBERT, CommitBART, CodeT5, UniXcoder, and the graph-based GRAPE). They also evaluate modern Large Language Models (LLMs) like DeepSeek-R1, Qwen3, Llama-3.1, and GPT-4 in both zero-shot (using Chain-of-Thought prompting) and fine-tuned configurations.
  2. Data Drift Analysis: To understand why models fail, they analyze the differences between NVD data and real-world data using XGBoost classifiers, perplexity analysis (measuring how "surprising" the text is to a code language model), and manual vulnerability type (CWE) classification.
  3. Mitigation Testing: They evaluate a hybrid training approach, incrementally adding small amounts of manually verified, in-the-wild patches to the NVD training sets to see if it improves real-world generalization.
Fig. 1. Overview of the realistic evaluation of the models trained on NVD-linked security patches. We assess their performance by applying them to in-the-wild patches derived from open-source repositories

Datasets

The study leverages two distinct categories of data:

  • NVD-Linked Data (Training/Benchmarks): ColeFunda (Java), GRAPE (Java), and MoreFixes (a massive multilingual dataset covering 81 programming languages).
  • In-the-Wild Data (Evaluation): JavaVFC (manually verified Java security patches collected over 3 years), PatchDB (C/C++ patches), and a partial Devign dataset (C/C++ commits from Qemu and FFmpeg).

Key Insights and Ideas

  • NVD Patches Are Loud, Not Silent: XGBoost easily distinguished NVD commits from real-world commits with 84% accuracy. NVD commit messages frequently contain explicit metadata, such as "signed-off-by" phrases or direct CVE IDs (found in 15% of MoreFixes commits), which models lean on as shortcuts.
  • Vulnerability Type Bias: NVD data is heavily skewed toward easily exploitable, web-facing vulnerabilities like Cross-Site Scripting (XSS/CWE-79) and Input Validation (CWE-20). In contrast, silent in-the-wild patches are dominated by internal implementation flaws, such as resource management (CWE-664) and exception handling (CWE-703).
  • Code-Only Modalities Fail Harder: Prior literature suggested training models only on code changes (ignoring commit messages) to bypass obscured text. However, this study proves that code-only models degrade even worse in the wild, showing that commit messages still provide vital context despite potential developer obfuscation.
  • NVD Data is Noisy: NVD links often point to massive "meta-changes" like merge commits (accounting for 12% of MoreFixes) or non-code documentation updates, which act as noise during training.

Key Results

  • Performance Collapse: When a CodeBERT model trained on NVD data (ColeFunda) was tested on real-world data (JavaVFC), its F1-score plummeted by 90% (from 91.26% to 8.68%). The graph-based GRAPE model saw a 45% drop.
  • LLMs Struggle Zero-Shot: In zero-shot Chain-of-Thought testing, even advanced models like DeepSeek-R1 and GPT-4 performed no better than random guessing, hovering around a ~50% F1-score.
  • The Power of a Few Examples: Adding just 100 manually curated in-the-wild patches (less than 0.5% of the total training set) to the NVD training data boosted the model's real-world F1-score by 15%. Combining all available JavaVFC training data raised the F1-score from 55.81% to 77.99% without sacrificing performance on NVD benchmarks.

Limitations and Future Work

The primary limitation acknowledged by the authors is the lack of fine-grained vulnerability labels (like CWE classifications) for large-scale in-the-wild datasets, which restricts granular category-specific analysis. Additionally, manually curating "in-the-wild" datasets is incredibly labor-intensive.

For future work, the authors plan to explore better commit representation techniques to handle data drift and develop methods to pinpoint the exact lines of a commit that address a vulnerability, moving toward a more granular approach to patch detection.

Summary updated

BibTeX
@misc{irsan2026revisiting,
  author = {Ivana Clairine Irsan and Ratnadira Widyasari and Ting Zhang and Huihui Huang and Ferdian Thung and Yikun Li and Lwin Khin Shar and Eng Lieh Ouh and Hong Jin Kang and David Lo},
  title = {{Revisiting Vulnerability Patch Identification on Data in the Wild}},
  year = {2026},
  eprint = {2603.17266},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.17266},
}
Figure