一句话:提出 P2IM,用保持预测的输入最小化揭示代码模型是否依赖正确漏洞信号,并定义 SAR 度量。
该工作研究 AI 模型在源代码理解中的信号感知能力,以软件漏洞检测为用例,评估模型是否捕获了正确漏洞信号。作者提出保持预测的输入最小化(P2IM),将原源代码系统地缩减为仍能维持模型预测的最小片段;若原漏洞在最小片段中已缺失而模型仍预测为漏洞,则暴露其依赖错误信号。为量化该现象,提出 Signal-aware Recall (SAR)。实验在三种神经网络架构和多个数据集上应用 P2IM,模型 Recall 从 90 多骤降至 60 以下,表明模型学习漏洞检测逻辑时可能大量吸收噪声或数据集偏差。作者强调 P2IM 不是对抗攻击,SAR 用于度量任务无关训练的影响,理想情况下应与 Recall 一致。
This work explores the signal awareness of AI models for source code understanding. Using a software vulnerability detection use case, we evaluate the models' ability to capture the correct vulnerability signals to produce their predictions. Our prediction-preserving input minimization (P2IM) approach systematically reduces the original source code to a minimal snippet which a model needs to maintain its prediction. The model's reliance on incorrect signals is then uncovered when the vulnerability in the original code is missing in the minimal snippet, both of which the model however predicts as being vulnerable. We measure the signal awareness of models using a new metric we propose -- Signal-aware Recall (SAR). We apply P2IM on three different neural network architectures across multiple datasets. The results show a sharp drop in the model's Recall from the high 90s to sub-60s with the new metric, highlighting that the models are presumably picking up a lot of noise or dataset nuances while learning their vulnerability detection logic. Although the drop in model performance may be perceived as an adversarial attack, but this isn't P2IM's objective. The idea is rather to uncover the signal-awareness of a black-box model in a data-driven manner via controlled queries. SAR's purpose is to measure the impact of task-agnostic model training, and not to suggest a shortcoming in the Recall metric. The expectation, in fact, is for SAR to match Recall in the ideal scenario where the model truly captures task-specific signals.
@inproceedings{paperbot6412,
title = {Probing model signal-awareness via prediction-preserving input minimization},
author = {Sahil Suneja and Yunhui Zheng and Yufan Zhuang and Jim A. Laredo and Alessandro Morari},
booktitle = {FSE},
year = {2021},
doi = {10.1145/3468264.3468545}
}