通过校准嵌入距离诊断基于AI的漏洞检测中的泛化边界
Diagnosing Generalization Boundaries in AI-Based Vulnerability Detection via Calibrated Embedding Distances
AI总结:
该研究针对CodeBERT与Qwen2.5-Coder,利用校准嵌入距离揭示AI漏洞检测在分布偏移下的泛化边界,发现跨项目偏移退化最剧烈,误报与几何 proximity 相关,无需辅助模型即可诊断模型退化。
摘要:
基于学习的漏洞检测的高基准分数掩盖了分布偏移下的严重性能退化。本文表明,校准后的嵌入几何结构可揭示语法相似的易受攻击代码与补丁代码对中隐藏的泛化边界。在严格配对的数据集上,针对模式、项目和时间偏移对CodeBERT与Qwen2.5-Coder进行评估,得出三个主要发现:第一,带局部近邻评分的白化中间层嵌入,在分布外样本上的平均AUROC为0.739(RQ1);第二,距离分数显示出特定于偏移的可靠性梯度,准确率下降超过35个百分点,且跨项目偏移导致的退化最剧烈,尽管时间偏移在几何上漂移最远(RQ2);第三,补丁代码上的误报与易受攻击训练邻域的几何 proximity 系统相关,从最低风险十分位的9.4%升至最高的58.8%(RQ3)。这些校准后的距离建立了一种诊断信号,可直接将表示几何结构映射到模型退化,无需辅助模型。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。