Automatically repairing tensor shape faults in deep learning programs

被引:4
作者
Wu, Dangwei [1 ]
Shen, Beijun [1 ]
Chen, Yuting [1 ]
Jiang, He [2 ]
Qiao, Lei [3 ]
机构
[1] Shanghai Jiao Tong Univ, Sch Elect Informat & Elect Engn, Shanghai, Peoples R China
[2] Dalian Univ Technol, Sch Software, Dalian, Peoples R China
[3] Beijing Inst Control Engn, Ctr Board Comp & Elect, Beijing, Peoples R China
基金
中国国家自然科学基金;
关键词
Tensor shape faults; Crashing faults; Automated program repair; Deep learning programs;
D O I
10.1016/j.infsof.2022.107027
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Context: Software developers frequently invoke deep learning (DL) APIs to incorporate artificial intelligence solutions into software systems. However, misuses of these APIs can cause various DL faults, such as tensor shape faults. Tensor shape faults occur when restriction conditions of operations are not met; they are prevalent in practice, leading to many system crashes. Meanwhile, researchers and engineers still face a strong challenge in detecting tensor shape faults - static techniques incur heavy overheads in defining detection rules, and the only dynamic technique requires human engineers to rewrite APIs for tracking shape changes. Objective: This paper introduces a novel technique that leverages machine learning to detect tensor shape faults, and as well uses patterns to repair faults detected. Methods: We first construct SFData, a set of 146 buggy programs with crashing tensor shape faults (i.e., those causing programs to crash). We also conduct an empirical study on crashing tensor shape faults, categorizing them into four types and revealing twelve repair patterns. Then we propose Tensfa2, an automated approach to detecting and repairing crashing tensor shape faults. Tensfa2 employs a machine learning method to learn from crash messages and decision trees to detect tensor shape faults. Next, Tensfa2 tracks shape properties by a customized Python debugger, analyzes their data dependences, and uses the twelve patterns to generate patches. Tensfa2 is an extended version of Tensfa-our previous approach presented at ISSRE'21. Its performance is enhanced by two techniques: a search-based method for repairing shape value faults, and a bundle of three ranking strategies for prioritizing the repair patterns. Results: Tensfa2 is evaluated on SFData and IslamData (another dataset of tensor shape faults). The results show the effectiveness of Tensfa2. In particular, Tensfa2 achieves an F1-score of 96.88% in detecting the faults and repairs 82 out of 146 buggy programs in SFData. Conclusion: We believe that repair patches generated by our approach will help engineers fix their deep learning programs much more efficiently, saving their time and efforts.
引用
收藏
页数:13
相关论文
共 44 条
[21]  
Keras, US
[22]  
Kim D, 2013, PROCEEDINGS OF THE 35TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2013), P802, DOI 10.1109/ICSE.2013.6606626
[23]   FixMiner: Mining relevant fix patterns for automated program repair [J].
Koyuncu, Anil ;
Liu, Kui ;
Bissyande, Tegawende F. ;
Kim, Dongsun ;
Klein, Jacques ;
Monperrus, Martin ;
Le Traon, Yves .
EMPIRICAL SOFTWARE ENGINEERING, 2020, 25 (03) :1980-2024
[24]  
Lagouvardos S., 2020, ECOOP
[25]   GenProg: A Generic Method for Automatic Software Repair [J].
Le Goues, Claire ;
ThanhVu Nguyen ;
Forrest, Stephanie ;
Weimer, Westley .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2012, 38 (01) :54-72
[26]   TBar: Revisiting Template-Based Automated Program Repair [J].
Liu, Kui ;
Koyuncu, Anil ;
Kim, Dongsun ;
Bissyande, Tegawende F. .
PROCEEDINGS OF THE 28TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS (ISSTA '19), 2019, :31-42
[27]   Staged Program Repair with Condition Synthesis [J].
Long, Fan ;
Rinard, Martin .
2015 10TH JOINT MEETING OF THE EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND THE ACM SIGSOFT SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (ESEC/FSE 2015) PROCEEDINGS, 2015, :166-178
[28]  
Lutellier T, 2020, PROCEEDINGS OF THE 29TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS, ISSTA 2020, P101, DOI 10.1145/3395363.3397369
[29]   Mining software repair models for reasoning on the search space of automated program fixing [J].
Martinez, Matias ;
Monperrus, Martin .
EMPIRICAL SOFTWARE ENGINEERING, 2015, 20 (01) :176-205
[30]   DirectFix: Looking for Simple Program Repairs [J].
Mechtaev, Sergey ;
Yi, Jooyong ;
Roychoudhury, Abhik .
2015 IEEE/ACM 37TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, VOL 1, 2015, :448-458