Source Code Assessment and Classification Based on Estimated Error Probability Using Attentive LSTM Language Model and Its Application in Programming Education
Source abstract
Abstract
The rate of software development has increased dramatically. Conventional compilers cannot assess and detect all source code errors. Software may thus contain errors, negatively affecting end-users. It is also difficult to assess and detect source code logic errors using traditional compilers, resulting in software that contains errors. A method that utilizes artificial intelligence for assessing and detecting errors and classifying source code as correct (error-free) or incorrect is thus required. Here, we propose a sequential language model that uses an attention-mechanism-based long short-term memory (LSTM) neural network to assess and classify source code based on the estimated error probability. The attentive mechanism enhances the accuracy of the proposed language model for error assessment and classification. We trained the proposed model using correct source code and then evaluated its performance. The experimental results show that the proposed model has logic and syntax error detection accuracies of 92.2% and 94.8%, respectively, outperforming state-of-the-art models. We also applied the proposed model to the classification of source code with logic and syntax errors. The average precision, recall, and F-measure values for such classification are much better than those of benchmark models. To strengthen the proposed model, we combined the attention mechanism with LSTM to enhance the results of error assessment and detection as well as source code classification. Finally, our proposed model can be effective in programming education and software engineering by improving code writing, debugging, error-correction, and reasoning.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Software Engineering Research · Advanced Malware Detection Techniques · Software Testing and Debugging Techniques
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
School of Computer Science and Engineering, Graduate Department of Computer and Information Systems, The University of Aizu, Aizu-Wakamatsu, Fukushima 965-8580, Japan
Funding
Japan Society for the Promotion of Science
References (43)
Show source-provided references
1. Data mining for software engineering and humans in the loop10.1007/s13748-016-0092-2 ↗
2. Automatic software repair: A bibliography10.1145/3105906 ↗
3. Seo, H., Sadowski, C., Elbaum, S., Aftandilian, E., and Bowdidge, R. (June, January 31). Programmers’ build errors: A case study (at google). Proceedings of the 36th International Conference on Software Engineering (ICSE ‘14), Hyderabad, India.
4. Progress on approaches to software defect prediction10.1049/iet-sen.2017.0148 ↗
5. Early software defect prediction: A systematic map and review10.1016/j.jss.2018.06.025 ↗
6. A systematic review of software fault prediction studies10.1016/j.eswa.2008.10.027 ↗
7. Halstead, M.H. (1977). Elements of Software Science (Operating and Programming Systems Series), Elsevier. [2nd ed.].
8. A complexity measure10.1109/TSE.1976.233837 ↗
9. Jureczko, M., and Spinellis, D.D. (2010). Using object-oriented design metrics to predict software defects. Models and Methods of System Dependability, Oficyna Wydawnicza Politechniki Wrocławskiej.
10. Pu, Y., Narasimhan, K., Solar-Lezama, A., and Barzilay, R. (November, January 30). Sk_p: A neural program corrector for mooc. Proceedings of the 2016 ACM SIGPLAN International Conference on Systems, Programming, Languages and Applications: Software for Humanity, Amsterdam, The Netherlands.10.1145/2984043.2989222 ↗
11. Pennington, J., Socher, R., and Manning, C.D. (2014, January 25–29). Glove: Global vectors for word representation. Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar.10.3115/v1/D14-1162 ↗
12. White, M., Vendome, C., Linares-Vásquez, M., and Poshyvanyk, D. (2015, January 16–17). Toward deep learning software repositories. Proceedings of the 12th Working Conference on Mining Software Repositories (MSR ‘15), Florence, Italy.10.1109/MSR.2015.38 ↗
13. Bengio, Y., Boulanger-Lewandowski, N., and Pascanu, R. (2013, January 26–31). Advances in optimizing recurrent networks. Proceedings of the 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, Vancouver, BC, Canada.10.1109/ICASSP.2013.6639349 ↗
14. Terada, K., and Watanobe, Y. (2019, January 9–10). Code Completion for Programming Education based on Recurrent Neural Network. Proceedings of the 2019 IEEE 11th International Workshop on Computational Intelligence and Applications (IWCIA), Hiroshima, Japan.10.1109/IWCIA47330.2019.8955090 ↗
15. Nagappan, N., and Ball, T. (2007, January 20–21). Using software dependencies and churn metrics to predict field failures: An empirical case study. Proceedings of the First International Symposium on Empirical Software Engineering and Measurement (ESEM 2007), Madrid, Spain.10.1109/ESEM.2007.13 ↗
16. Moser, R., Pedrycz, W., and Succi, G. (2008, January 10–18). A comparative analysis of the efficiency of change metrics and static code attributes for defect prediction. Proceedings of the 30th International Conference on Software Engineering, Leipzig, Germany.10.1145/1368088.1368114 ↗
17. A feature dependent naive Bayes approach and its application to the software defect prediction problem10.1016/j.asoc.2017.05.043 ↗
18. Jing, X.-Y., Ying, S., Zhang, Z.-W., Wu, S.-S., and Liu, J. (June, January 31). Dictionary learning based software defect prediction. Proceedings of the 36th International Conference on Software Engineering, Hyderabad, India.
19. An efficient approach for selecting initial centroid and outlier detection of data clustering
20. Intisar, C.M., and Watanobe, Y. (2018, January 19–21). Classification of Online Judge Programmers based on Rule Extraction from Self Organizing Feature. Proceedings of the 9th International Conference on Awareness Science and Technology (iCAST), Fukuoka, Japan.10.1109/ICAwST.2018.8517222 ↗
21. Intisar, C.M., and Watanobe, Y. (2018, January 1–3). Cluster Analysis to Estimate the Difficulty of Programming Problems. Proceedings of the 3rd International Conference on Applications in Information Technology (ICAIT ‘18), Aizu-Wakamatsu, Japan.10.1145/3274856.3274862 ↗
22. Alreshedy, K., Dharmaretnam, D., Germán, D.M., Srinivasan, V., and Gulliver, T.A. (2018, January 23–24). SCC: Automatic Classification of Code Snippets. Proceedings of the 2018 IEEE 18th International Working Conference on Source Code Analysis and Manipulation (SCAM), Madrid, Spain.10.1109/SCAM.2018.00031 ↗
23. Ram, A., and Nagappan, M. (2018). Supervised Sentiment Classification with CNNs for Diverse SE Datasets. arXiv.
24. Reyes, J., Ramírez, D., and Paciello, J. (2016, January 15–17). Automatic classification of source code archives by programming language: A deep learning approach. Proceedings of the 2016 International Conference on Computational Science and Computational Intelligence (CSCI), Las Vegas, NV, USA.10.1109/CSCI.2016.0103 ↗
25. Terada, K., and Watanobe, Y. (2019, January 1–4). Automatic Generation of Fill-in-the-Blank Programming Problems. Proceedings of the 2019 IEEE 13th International Symposium on Embedded Multicore/Many-core Systems-on-Chip (MCSoC), Singapore.10.1109/MCSoC.2019.00034 ↗
26. Tai, K.S., Socher, R., and Manning, C.D. (2015, January 26–31). Improved semantic representations from tree-structured long short-term memory networks. Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, Beijing, China.10.3115/v1/P15-1150 ↗
27. Pedroni, M., and Meyer, B. (2008, January 12–15). Compiler error messages: What can help novices?. Proceedings of the 39th SIGCSE Technical Symposium on Computer Science Education, Portland, OR, USA.
28. Learning Path Recommendation System for Programming Education based on Neural Networks10.4018/IJDET.2020010103 ↗
29. Teshima, Y., and Watanobe, Y. (2018, January 7–10). Bug detection based on LSTM networks and solution codes. Proceedings of the 2018 IEEE International Conference on Systems, Man, and Cybernetics (SMC), Miyazaki, Japan.10.1109/SMC.2018.00599 ↗
30. Software Defect Prediction via Attention-Based Recurrent Neural Network
31. Ohashi, H., and Watanobe, Y. (2019, January 1–4). Convolutional Neural Network for Classification of Source Codes. Proceedings of the 2019 IEEE 13th International Symposium on Embedded Multicore/Many-core Systems-on-Chip (MCSoC), Singapore, Singapore.10.1109/MCSoC.2019.00035 ↗
32. Graves, A. (2014). Generating Sequences with Recurrent Neural Networks. arXiv.
33. Mnih, V., Heess, N., Graves, A., and Kavukcuoglu, K. (2014, January 8–13). Recurrent models of visual attention. Proceedings of the 27th International Conference on Neural Information Processing Systems (NIPS), Montreal, QC, Canada.
34. Luong, T., Pham, H., and Manning, C.D. (2015, January 17–21). Effective approaches to attention-based neural machine translation. Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP), Lisbon, Portugal.10.18653/v1/D15-1166 ↗
35. Chen, J., Zhang, H., He, X., Nie, L., Liu, W., and Chua, T.-S. (2017, January 7–11). Attentive collaborative filtering: Multimedia recommendation with item- and component-level attention. Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR ‘17), Shinjuku, Tokyo, Japan.10.1145/3077136.3080797 ↗
36. Cheng, J., Dong, L., and Lapata, M. (2016, January 1–5). Long short-term memory-networks for machine reading. Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing (EMNLP), Austin, TX, USA.10.18653/v1/D16-1053 ↗
37. Bahdanau, D., Cho, K., and Bengio, Y. (2015, January 7–9). Neural machine translation by jointly learning to align and translate. Proceedings of the 3rd International Conference on Learning Representations (ICLR), San Diego, CA, USA.
38. Li, J., Wang, Y., Lyu, M.R., and King, I. (2018, January 13–19). Code completion with neural attention and pointer networks. Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI’18), Stockholm, Sweden.10.24963/ijcai.2018/578 ↗
39. Watanobe, Y. (2019, October 10). Aizu Online Judge. Available online: https://onlinejudge.u-aizu.ac.jp/.
40. Aizu Online Judge (2019, October 10). Developers Site (api). Available online: http://developers.u-aizu.ac.jp/index.
41. Dropout: A simple way to prevent neural networks from overfitting
42. Kingma, D.P., and Ba, J. (2015, January 7–9). Adam: A Method for Stochastic Optimization. Proceedings of the 3rd International Conference for Learning Representations (ICLR), San Diego, CA, USA.
43. Deep belief networks10.4249/scholarpedia.5947 ↗