mlsanityData to 14 Oct 2026

Diagnosing Generalization Boundaries in AI-Based Vulnerability Detection via Calibrated Embedding Distances

arXiv 2610.14296 ↗First posted 9 Oct 2026cs.SE cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

High benchmark scores in learning-based vulnerability detection mask severe degradation under distribution shifts. This paper demonstrates that calibrated embedding geometry exposes these hidden generalization boundaries on syntactically similar vulnerable and patched code pairs. An evaluation of CodeBERT and Qwen2.5-Coder across pattern, project, and temporal shifts on a strictly paired dataset reveals three main findings. First, whitened intermediate-layer embeddings with local nearest-neighbour scoring separate unfamiliar samples with a mean out-of-distribution AUROC of 0.739 (RQ1). Second, distance scores reveal a shift-specific reliability gradient where accuracy drops by over 35 percentage points and cross-project shifts cause the sharpest degradation, even though temporal shifts drift geometrically farthest (RQ2). Third, false positives on patched code systematically correlate with geometric proximity to vulnerable training neighbourhoods, increasing from 9.4% in the lowest-risk decile to 58.8% in the highest (RQ3). These calibrated distances establish a diagnostic signal that maps representation geometry directly to model degradation without requiring auxiliary models.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 34 of its 51 references that are in the map. First posted on arXiv 9 Oct 2026.

Builds on

34 of 51 references.

References · 34

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
  3. 2017On Calibration of Modern Neural Networkscited by 4,960
  4. 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,418
  5. 2020Supervised Contrastive Learningcited by 2,829
  6. 2016A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networkscited by 2,385
  7. 2020Shortcut Learning in Deep Neural Networkscited by 1,969
  8. 2018A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attackscited by 1,485
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  10. 2019Can You Trust Your Model's Uncertainty? Evaluating Predictive Uncertainty Under Dataset Shiftcited by 1,287
  11. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  12. 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,059
22 more
  1. 2019How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddingscited by 784
  2. 2022Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distributioncited by 739
  3. 2020Contrastive Learning with Hard Negative Samplescited by 628
  4. 2022Out-of-Distribution Detection with Deep Nearest Neighborscited by 600
  5. 2020Supervised Contrastive Learning for Pre-trained Language Model Fine-tuningcited by 276
  6. 2018Deep k-Nearest Neighbors: Towards Confident, Interpretable and Robust Deep Learningcited by 207
  7. 2021Whitening Sentence Representations for Better Semantics and Faster Retrievalcited by 202
  8. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 139
  9. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
  10. 2019What Would Elsa Do? Freezing Layers During Transformer Fine-Tuningcited by 89
  11. 2023Data Quality for Software Vulnerability Datasetscited by 51
  12. 2025LLMs in Software Security: A Survey of Vulnerability Detection Techniques and Insightscited by 47
  13. 2022An Empirical Study of Deep Learning Models for Vulnerability Detectioncited by 46
  14. 2024Finetuning Large Language Models for Vulnerability Detectioncited by 40
  15. 2024Investigating Large Language Models for Code Vulnerability Detection: An Experimental Studycited by 12
  16. 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 9
  17. 2025Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challengescited by 7
  18. 2025Out of Distribution, Out of Luck: How Well Can LLMs Trained on Vulnerability Datasets Detect Top 25 CWE Weaknesses?cited by 6
  19. 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 5
  20. 2025Data and Context Matter: Towards Generalizing AI-based Software Vulnerability Detectioncited by 3
  21. 2026Toward Scalable Automated Repository-Level Datasets for Software Vulnerability Detectioncited by 1
  22. 2026Mitigating Implicit Inconsistencies in Patch Portingcited by 1

Built on by

Not cited yet.