ABSTRACT Program slicing is widely used in downstream software engineering tasks, such as bug localization and code feature extraction in deep learning. For program slicing, existing research focuses on dependency analysis during slicing while lacking the selection of slicing criteria before slicing. As the starting point of dependency analysis, the slicing criterion directly determines the results of the program slicing application. However, existing criterion selection is only based on empirical judgment and lacks an effective slicing criterion selection method. In this paper, we propose PSCSelector, an appropriate Program Slicing Criterion Selection framework based on a popular lightweight LLM CodeBERT. PSCSelector first constructs the detailed substatement level system dependency graph to obtain the context of the slicing criterion. CodeBERT is then fine‐tuned in a parameter‐efficient way to jointly embed the slicing criterion context and the application texts to capture the appropriate criterion pattern. To validate the effectiveness of PSCSelector in downstream tasks, we choose bug localization as the example application and build the corresponding PSCSelector. In the experiment, we evaluate the effectiveness of PSCSelector in bug dataset Defects4J by calculating the number of searched bugs and the size of the search scope. The experimental results show that the PSCSelector‐selected slicing criterion can effectively search 74% of bugs and reduce 69% of the original slice, which uses the bug‐triggering statement as the slicing criterion.
Chang et al. (Sun,) studied this question.