TY - GEN
T1 - A Search-Based Testing Framework for Deep Neural Networks of Source Code Embedding
AU - Pour, Maryam Vahdat
AU - Li, Zhuo
AU - Ma, Lei
AU - Hemmati, Hadi
N1 - Funding Information:
ACKNOWLEDGMENTS This work was supported in part by JSPS KAKENHI Grant No.20H04168, 19K24348, 19H04086, and JST-Mirai Program Grant No.JPMJMI18BB, Japan
Publisher Copyright:
© 2021 IEEE.
PY - 2021/4
Y1 - 2021/4
N2 - Over the past few years, deep neural networks (DNNs) have been continuously expanding their real-world applications for source code processing tasks across the software engineering domain, e.g., clone detection, code search, comment generation. Although quite a few recent works have been performed on testing of DNNs in the context of image and speech processing, limited progress has been achieved so far on DNN testing in the context of source code processing, that exhibits rather unique characteristics and challenges.In this paper, we propose a search-based testing framework for DNNs of source code embedding and its downstream processing tasks like Code Search. To generate new test inputs, we adopt popular source code refactoring tools to generate the semantically equivalent variants. For more effective testing, we leverage the DNN mutation testing to guide the testing direction. To demonstrate the usefulness of our technique, we perform a large-scale evaluation on popular DNNs of source code processing based on multiple state-of-the-art code embedding methods (i.e., Code2vec, Code2seq and CodeBERT). The testing results show that our generated adversarial samples can on average reduce the performance of these DNNs from 5.41% to 9.58%. Through retraining the DNNs with our generated adversarial samples, the robustness of DNN can improve by 23.05% on average. The evaluation results also show that our adversarial test generation strategy has the least negative impact (median of 3.56%), on the performance of the DNNs for regular test data, compared to the other methods.
AB - Over the past few years, deep neural networks (DNNs) have been continuously expanding their real-world applications for source code processing tasks across the software engineering domain, e.g., clone detection, code search, comment generation. Although quite a few recent works have been performed on testing of DNNs in the context of image and speech processing, limited progress has been achieved so far on DNN testing in the context of source code processing, that exhibits rather unique characteristics and challenges.In this paper, we propose a search-based testing framework for DNNs of source code embedding and its downstream processing tasks like Code Search. To generate new test inputs, we adopt popular source code refactoring tools to generate the semantically equivalent variants. For more effective testing, we leverage the DNN mutation testing to guide the testing direction. To demonstrate the usefulness of our technique, we perform a large-scale evaluation on popular DNNs of source code processing based on multiple state-of-the-art code embedding methods (i.e., Code2vec, Code2seq and CodeBERT). The testing results show that our generated adversarial samples can on average reduce the performance of these DNNs from 5.41% to 9.58%. Through retraining the DNNs with our generated adversarial samples, the robustness of DNN can improve by 23.05% on average. The evaluation results also show that our adversarial test generation strategy has the least negative impact (median of 3.56%), on the performance of the DNNs for regular test data, compared to the other methods.
UR - http://www.scopus.com/inward/record.url?scp=85107971136&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85107971136&partnerID=8YFLogxK
U2 - 10.1109/ICST49551.2021.00016
DO - 10.1109/ICST49551.2021.00016
M3 - Conference contribution
AN - SCOPUS:85107971136
T3 - Proceedings - 2021 IEEE 14th International Conference on Software Testing, Verification and Validation, ICST 2021
SP - 36
EP - 46
BT - Proceedings - 2021 IEEE 14th International Conference on Software Testing, Verification and Validation, ICST 2021
PB - Institute of Electrical and Electronics Engineers Inc.
T2 - 14th IEEE International Conference on Software Testing, Verification and Validation, ICST 2021
Y2 - 12 April 2021 through 16 April 2021
ER -