Repairing DNN Numerical Defects with Semantic-Driven Knowledge Graph Retrieval
Source abstract
Abstract
Ensuring numerical robustness in deep neural networks (DNNs) is critical, as defects like overflow or NaN can cause silent failures. However, automated repair is challenged by fragmented domain knowledge and the semantic gap for general-purpose large language models (LLMs). This work proposes NCKG, a Numerical–Conceptual Knowledge Graph-based method for retrieval-augmented repair of DNN numerical defects. NCKG introduces a unified semantic formalization that explicitly models DNN execution contexts, numerical defects, mitigation methods, and constraint knowledge, transforming dispersed defect knowledge into a consistent, machine-interpretable representation. Based on this formalization, a multi-view semantic graph index is constructed, enabling a hybrid semantic-driven retrieval mechanism that combines structure-aware graph matching with vector similarity. Retrieved, semantically aligned defect–repair knowledge is then used to guide LLMs in generating context-aware repairs. Experimental results demonstrate that NCKG significantly outperforms standard retrieval baselines and consistently improves the quality and correctness of LLM-generated fixes across different model scales. This work demonstrates that explicit semantic structuring and retrieval of domain knowledge are crucial for enabling reliable, automated numerical defect repair in DNNs.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Advanced Graph Neural Networks · Graph Theory and Algorithms · Topic Modeling
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
School of Reliability and Systems Engineering, Beihang University, Beijing 100191, China
China Academy of Electronics and Information Technology, Shijingshan District, Beijing 100041, China
References (41)
Show source-provided references
1. Humbatova, N., Jahangirova, G., Bavota, G., Riccio, V., Stocco, A., and Tonella, P. (2020). Taxonomy of real faults in deep learning systems. Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion 2020), Seoul, Republic of Korea, 5–11 October 2020, Curran Associates, Inc.10.1145/3377811.3380395 ↗
2. Harzevili, N.S., Shin, J., Wang, J., Wang, S., and Nagappan, N. (2023). Characterizing and Understanding Software Security Vulnerabilities in Machine Learning Libraries. Proceedings of the 2023 IEEE/ACM 20th International Conference on Mining Software Repositories (MSR), Melbourne, Australia, 15–16 May 2023, Curran Associates, Inc.10.1109/MSR59073.2023.00018 ↗
3. Zhang, Y., Ren, L., Chen, L., Xiong, Y., Cheung, S.C., and Xie, T. (2020). Detecting numerical bugs in neural network architectures. Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ACM.10.1145/3368089.3409720 ↗
4. Yan, M., Chen, J., Zhang, X., Tan, L., Wang, G., and Wang, Z. (2021). Exposing numerical bugs in deep learning via gradient back-propagation. Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ACM.10.1145/3468264.3468612 ↗
5. Kloberdanz, E., Kloberdanz, K.G., and Le, W. (2022). DeepStability: A study of unstable numerical methods and their solutions in deep learning. Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 25–27 May 2022, ACM.10.1145/3510003.3510095 ↗
6. Wang, G., Wang, Z., Chen, J., Chen, X., and Yan, M. (2022). An Empirical Study on Numerical Bugs in Deep Learning Programs. Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, Rochester, MI, USA, 10–14 October 2022, ACM.10.1145/3551349.3559561 ↗
7. Zhang, X., Zhai, J., Ma, S., and Shen, C. (2021). AUTOTRAINER: An Automatic DNN Training Problem Detection and Repair System. Proceedings of the 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE), Madrid, Spain, 22–30 May 2021, IEEE Press.10.1109/ICSE43902.2021.00043 ↗
8. Wardat, M., Cruz, B.D., Le, W., and Rajan, H. (2022). DeepDiagnosis: Automatically diagnosing faults and recommending actionable fixes in deep learning programs. Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 25–27 May 2022, ACM.10.1145/3510003.3510071 ↗
9. Li, L., Zhang, Y., Ren, L., Xiong, Y., and Xie, T. (2023). Reliability Assurance for Deep Neural Network Architectures Against Numerical Defects. Proceedings of the 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), Melbourne, Australia, 14–20 May 2023, IEEE Press.10.1109/ICSE48619.2023.00156 ↗
10. Shang, Y., and Liu, S. (2024). LRNN: A Formal Logic Rules-Based Neural Network for Software Defect Prediction. Proceedings of the Formal Methods and Software Engineering: 25th International Conference on Formal Engineering Methods, ICFEM 2024, Hiroshima, Japan, 2–6 December 2024, Springer Nature.10.1007/978-981-96-0617-7_7 ↗
11. Cross-project software defect prediction based on the reduction and hybridization of software metrics10.1016/j.aej.2024.10.034 ↗
12. Yamaguchi, F., Golde, N., Arp, D., and Rieck, K. (2014). Modeling and discovering vulnerabilities with code property graphs. Proceedings of the 2014 IEEE Symposium on Security and Privacy, Berkeley, CA, USA, 18–21 May 2014, IEEE Computer Society.10.1109/SP.2014.44 ↗
13. ACGDP: An Augmented Code Graph-Based System for Software Defect Prediction10.1109/TR.2022.3161581 ↗
14. Software fault prediction metrics: A systematic literature review10.1016/j.infsof.2013.02.009 ↗
15. Muthukumaran, K., Choudhary, A., and Murthy, N.B. (2015). Mining GitHub for novel change metrics to predict buggy files in software systems. Proceedings of the 2015 International Conference on Computational Intelligence and Networks, Odisha, India, 12–13 January 2015, IEEE Press.10.1109/CINE.2015.13 ↗
16. A software network model for software structure and faults distribution analysis10.1109/TR.2019.2909786 ↗
17. Phan, A.V., Le Nguyen, M., and Bui, L.T. (2017). Convolutional neural networks over control flow graphs for software defect prediction. Proceedings of the 2017 IEEE 29th International Conference on Tools with Artificial Intelligence (ICTAI), Boston, MA, USA, 6–8 November 2017, IEEE Press.
18. Deep semantic feature learning for software defect prediction10.1109/TSE.2018.2877612 ↗
19. Precise learning of source code contextual semantics via hierarchical dependence structure and graph attention networks10.1016/j.jss.2021.111108 ↗
20. Application of knowledge graph in software engineering field: A systematic literature review10.1016/j.infsof.2023.107327 ↗
21. Schumi, R., and Sun, J. (2022). ExAIS: Executable AI semantics. Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 25–27 May 2022, ACM.10.1145/3510003.3510112 ↗
22. Knowledge-driven innovation in industrial maintenance: A neural-enhanced model-based definition framework for lifecycle maintenance process information propagation10.1016/j.jmsy.2025.08.001 ↗
23. Maintenance planning recommendation of complex industrial equipment based on knowledge graph and graph neural network10.1016/j.ress.2022.109068 ↗
24. Sahoo, P., Singh, A.K., Saha, S., Jain, V., Mondal, S., and Chadha, A. (2024). A systematic survey of prompt engineering in large language models: Techniques and applications. arXiv.10.1007/979-8-8688-0569-1_4 ↗
25. Retrieval-augmented generation for knowledge-intensive nlp tasks
26. Dong, Q., Li, L., Dai, D., Zheng, C., Ma, J., Li, R., Xia, H., Xu, J., Wu, Z., and Chang, B. (2024). A survey on in-context learning. Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, Miami, FL, USA, 12–16 November 2024, Association for Computational Linguistics.10.18653/v1/2024.emnlp-main.64 ↗
27. Yin, X., Ni, C., Wang, S., Li, Z., Zeng, L., and Yang, X. (2024). Thinkrepair: Self-directed automated program repair. ISSTA 2024: Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, Vienna, Austria, 16–20 September 2024, Association for Computing Machinery.10.1145/3650212.3680359 ↗
28. ReAPR: Automatic program repair via retrieval-augmented large language models10.1007/s11219-025-09728-1 ↗
29. Trotman, A., Puurula, A., and Burgess, B. (2014). Improvements to BM25 and language models examined. ADCS ’14: Proceedings of the 19th Australasian Document Computing Symposium, Association for Computing Machinery.10.1145/2682862.2682863 ↗
30. Karpukhin, V., Oguz, B., Min, S., Lewis, P.S., Wu, L., Edunov, S., Chen, D., and Yih, W.t. (2020). Dense Passage Retrieval for Open-Domain Question Answering. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), Online, 16–20 November 2020, Association for Computational Linguistics.10.18653/v1/2020.emnlp-main.550 ↗
31. Zhang, Q., Chen, S., Bei, Y., Yuan, Z., Zhou, H., Hong, Z., Dong, J., Chen, H., Chang, Y., and Huang, X. (2025). A Survey of Graph Retrieval-Augmented Generation for Customized Large Language Models. arXiv.
32. Li, Z., Chen, X., Yu, H., Lin, H., Lu, Y., Tang, Q., Huang, F., Han, X., Sun, L., and Li, Y. (2024). Structrag: Boosting knowledge intensive reasoning of llms via inference-time hybrid information structurization. arXiv.
33. Edge, D., Trinh, H., Cheng, N., Bradley, J., Chao, A., Mody, A., Truitt, S., Metropolitansky, D., Ness, R.O., and Larson, J. (2024). From local to global: A graph rag approach to query-focused summarization. arXiv.
34. Sun, J., Xu, C., Tang, L., Wang, S., Lin, C., Gong, Y., Ni, L.M., Shum, H.Y., and Guo, J. (2023). Think-on-graph: Deep and responsible reasoning of large language model on knowledge graph. arXiv.
35. Ma, S., Xu, C., Jiang, X., Li, M., Qu, H., and Guo, J. (2024). Think-on-graph 2.0: Deep and interpretable large language model reasoning with knowledge graph-guided retrieval. arXiv.
36. Liu, J., Ai, J., Su, H., and Shi, T. (2025). Enhancing Reliability Assurance for DNN against Numerical Defect with Large Language Models. Proceedings of the 2025 IEEE 36th International Symposium on Software Reliability Engineering (ISSRE), São Paulo, Brazil, 21–24 October 2025, IEEE Press.10.1109/ISSRE66568.2025.00039 ↗
37. FIDES: An ontology-based approach for making machine learning systems accountable10.1016/j.websem.2023.100808 ↗
38. Duarte, B.B., Falbo, R.A., Guizzardi, G., Guizzardi, R.S., and Souza, V.E. (2018). Towards an Ontology of Software Defects, Errors and Failures, Springer.10.1007/978-3-030-00847-5_25 ↗
39. Guizzardi, G. (2005). Ontological Foundations for Structural Conceptual Models. [Ph.D. Thesis, University of Twente].
40. EEPSA as a core ontology for energy efficiency and thermal comfort in buildings10.3233/AO-210245 ↗
41. Ren, S., Guo, D., Lu, S., Zhou, L., Liu, S., Tang, D., Sundaresan, N., Zhou, M., Blanco, A., and Ma, S. (2020). CodeBLEU: A Method for Automatic Evaluation of Code Synthesis. arXiv.