paperbot · PL 论文追踪

全部论文 待读 收藏

P1 A Learning-Based Approach to Static Program Slicing

基于学习的静态程序切片方法
OOPSLA 8(OOPSLA1)2024匹配度 7/10 · 该论文用预训练语言模型预测静态程序切片,属于“AI/ML 辅助静态程序分析”方向,与用户关注的 AI→PL 交叉契合;但并非 LLM/Agent 改进形式化验证或浮点/贝叶斯程序分析,且更偏向学习式替代传统切片而非增强现有分析器。引用 13 inbox
Aashish Yadavally, Yi Li, Shaohua Wang, Tien N. Nguyen
crossref: 2026-09-10

AI 速览

一句话:提出 NS-Slicer,用预训练语言模型预测完整与不完整代码的静态切片,并用于漏洞检测。

传统程序切片技术对不完整代码无能为力,难以用于在线代码片段的早期缺陷检测与调试。为此,本文提出 NS-Slicer,一种基于学习的静态程序切片方法。它利用预训练语言模型对源码中细粒度变量-语句依赖关系的理解,给定变量位置和语句,判断该语句属于后向切片还是前向切片。在完整代码上,后向与前向切片的 F1 分别为 97.41% 和 95.82%,总体 F1 为 96.77%,其中 85.20% 的预测切片与 oracle 完全一致。在部分程序上,后向切片 F1 为 96.77%–97.49%,前向切片为 92.14%–95.40%,总体为 94.66%–96.62%。作者还将预测切片集成到自动漏洞检测工具中,在 Java 代码上取得 73.38% 的 F1,并分析了变量别名等代码内在属性对切片的影响。

问题
传统程序切片技术无法处理不完整代码,限制了其在在线代码片段早期缺陷检测与调试中的实际应用。
方法
提出 NS-Slicer,基于预训练语言模型预测静态程序切片:给定变量位置和语句,判断该语句是否属于后向切片或前向切片,从而支持完整与部分代码。
评估
在完整代码上后向/前向切片 F1 分别为 97.41% 和 95.82%,总体 96.77%,85.20% 的预测切片与 oracle 完全一致;在部分程序上总体 F1 为 94.66%–96.62%。将预测切片集成到自动漏洞检测工具后,在 Java 代码上达到 73.38% 的 F1。
原文摘要(Abstract)

Traditional program slicing techniques are crucial for early bug detection and manual/automated debugging of online code snippets. Nevertheless, their inability to handle incomplete code hinders their real-world applicability in such scenarios. To overcome these challenges, we present NS-Slicer, a novel learning-based approach that predicts static program slices for both complete and partial code Our tool leverages a pre-trained language model to exploit its understanding of fine-grained variable-statement dependencies within source code. With this knowledge, given a variable at a specific location and a statement in a code snippet, NS-Slicer determines whether the statement belongs to the backward slice or forward slice, respectively. We conducted a series of experiments to evaluate NS-Slicer's performance. On complete code, it predicts the backward and forward slices with an F1-score of 97.41% and 95.82%, respectively, while achieving an overall F1-score of 96.77%. Notably, in 85.20% of the cases, the static program slices predicted by NS-Slicer exactly match entire slices from the oracle. For partial programs, it achieved an F1-score of 96.77%–97.49% for backward slicing, 92.14%–95.40% for forward slicing, and an overall F1-score of 94.66%–96.62%. Furthermore, we demonstrate NS-Slicer's utility in vulnerability detection (VD), integrating its predicted slices into an automated VD tool. In this setup, the tool detected vulnerabilities in Java code with a high F1-score of 73.38%. We also include the analyses studying NS-Slicer’s promising performance and limitations, providing insights into its understanding of intrinsic code properties such as variable aliasing, leading to better slicing.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2565,
  title = {A Learning-Based Approach to Static Program Slicing},
  author = {Aashish Yadavally and Yi Li and Shaohua Wang and Tien N. Nguyen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA1},
  year = {2024},
  doi = {10.1145/3649814}
}