Affiliation:
1. College of Computer Science, Sichuan University, Chengdu 610065, China
2. Science and Technology on Reactor System Design Technology Laboratory, Nuclear Power Institute of China, Chengdu 610041, China
Abstract
In the digital era of increasing software complexity, improving the development efficiency of safety-critical software is a challenging task faced by academia and industry in domains such as nuclear energy, aviation, the automotive industry, and rail transportation. Recently, people have been excited about using pre-trained large language models (LLMs) such as ChatGPT and GPT-4 to generate code. Professionals in the safety-critical software field are intrigued by the code generation capabilities of LLMs. However, there is currently a lack of systematic case studies in this area. Aiming at the need for automated code generation in safety-critical domains such as nuclear energy and the automotive industry, this paper conducts a case study on generating safety-critical software code using GPT-4 as the tool. Practical engineering cases from the industrial domain are employed. We explore different approaches, including code generation based on overall requirements, specific requirements, and augmented prompts. We propose a novel prompt engineering method called Prompt-FDC that integrates basic functional requirements, domain feature generalization, and domain constraints. This method improves code completeness from achieving 30% functions to 100% functions, increases the code comment rate to 26.3%, and yields better results in terms of code compliance, readability, and maintainability. The code generation approach based on LLMs also introduces a new software development process and V-model lifecycle for safety-critical software. Through systematic case studies, we demonstrate that, with appropriate prompt methods, LLMs can auto-generate safety-critical software code that meets practical engineering application requirements. It is foreseeable that LLMs can be applied to various engineering domains to improve software safety and development efficiency.
Funder
National Key Research and Development Program
Major Science and Technology Special Project of Sichuan Province
Subject
Fluid Flow and Transfer Processes,Computer Science Applications,Process Chemistry and Technology,General Engineering,Instrumentation,General Materials Science
Reference41 articles.
1. Leveson, N.G. (2016). Engineering a Safer World: Systems Thinking Applied to Safety, The MIT Press.
2. Jolak, R., Ho-Quang, T., Chaudron, M.R.V., and Schiffelers, R.R.H. (2018, January 14–19). Model-Based Software Engineering: A Multiple-Case Study on Challenges and Development Efforts. Proceedings of the 21th ACM/IEEE International Conference on Model Driven Engineering Languages and Systems, New York, NY, USA. Association for Computing Machinery.
3. Colaco, J.-L., Pagano, B., and Pouzet, M. (2017, January 13–15). SCADE 6: A Formal Language for Embedded Critical Software Development (Invited Paper). Proceedings of the 2017 International Symposium on Theoretical Aspects of Software Engineering (TASE), Sophia Antipolis, France.
4. SCADE: A Comprehensive Framework for Critical System and Software Engineering;Ober;SDL 2011: Integrating System and Software Modeling,2011
5. Experiences with Incorporating Formal Techniques into Industrial Practice;Osaiweran;Empir. Softw. Eng.,2014