SysML modeling method based on large language model

By using the SysML modeling method based on a large language model, the ambiguity and vagueness of natural language requirements are resolved, enabling efficient and accurate automated development of safety-critical software and improving the reliability and productivity of SysML modeling.

CN120909560APending Publication Date: 2025-11-07NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510813231.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing technologies, natural language requirements are ambiguous and vague in the development of safety-critical software, leading to inconsistent understanding of requirements by designers and affecting software security and quality.

Method used

We employ a SysML modeling approach based on a large language model. By designing a limited sentence requirement template and a SysML knowledge base, combined with RAG technology and a multi-turn dialogue error correction mechanism, we can automatically generate SysML text models, reducing human error and improving consistency.

Benefits of technology

It improves the development efficiency and quality of safety-critical software, reduces human resource costs, ensures the accuracy and reliability of SysML modeling, and lowers the barrier to entry for use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909560A_ABST
    Figure CN120909560A_ABST
Patent Text Reader

Abstract

The invention discloses a SysML modeling method based on a large language model, which comprises the following steps of: designing a demand template of a limited sentence pattern from a natural demand long text as an intermediate transition link, realizing predefined standard expression of a demand, preprocessing a free demand text through the large language model based on the template and a rule, and efficiently generating the demand template; secondly, proposing a Chinese thinking chain cue word based on a standardized demand template in a large model cue project, and guiding the large model to generate an accurate SysML V2 text model; through the method, the performance of the large language model in the SysML model automatic generation task is remarkably improved; the measures not only optimize the understanding of the model for SysML specifications and safety requirements, but also enhance the automatic generation capability of the model in complex system architecture description, thereby improving the generation accuracy and practicability of the model while ensuring the safety and reliability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of safety-critical systems, and particularly relates to a SysML modeling method based on a large language model. BACKGROUND

[0002] Safety-critical systems generally refer to a kind of system that may cause disastrous consequences if the key functions fail or are lost, and are widely used in key fields such as aviation, aerospace and nuclear energy. Safety-critical software refers to a kind of software applied to safety-critical systems, and the running state of the software may cause the system to be in a dangerous state, thereby causing property loss, environmental damage or personnel injury. That is, safety-critical software is generally a part of safety-critical systems, and it may cause or aggravate unsafe conditions. Such software is considered to be safety-critical. In recent years, accidents caused by software system problems have been common. For example, in the past decade, the Toyota recall incident caused billions of dollars in losses due to various control software problems, such as the 2012 car electric window lifting control system failure, the 2013 speed control failure, and the 2015-2018 Takata airbag failure problem; in 2016, the Japanese Aerospace Agency JAXA announced that the X-ray astronomical exploration satellite Hitomi, which cost 31 billion Japanese yen, was completely out of control due to the failure of the attitude control software. It can be seen that the influence of software systems on the safety of embedded systems has gradually dominated, and the failure and safety problems of software control systems have become an important reason for accidents. Therefore, ensuring the safety of embedded software has become an important topic in the field of software engineering research.

[0003] Software safety analysis is a widely accepted method to ensure software safety. Currently, safety analysis of software mainly focuses on software requirement specification and software design phase. The lack of foresight in software design and specification errors are the main reasons affecting safety. Currently, software requirements are mainly described in natural language, which has ambiguity and fuzziness and incompleteness, and is difficult to be automatically analyzed and processed, so that software design mainly depends on the understanding of natural language requirements by designers. This is also the fundamental reason why model-driven development methods (MDD) generally start from software analysis models or design models rather than requirement models. It is because natural language requirements inevitably have ambiguity and fuzziness that makes software design models deviate due to the inconsistent understanding of requirements by designers, and further leads to software safety problems. SUMMARY

[0004] Inventive purpose: In order to solve the problem of affecting the safety of software due to the ambiguity and fuzziness of natural language requirements, the present application proposes a SysML modeling method based on large language model, aiming to explore the use of large language model to assist SysML modeling of safety-critical software, so as to improve the development efficiency and quality of safety-critical software.

[0005] Technical scheme: A SysML modeling method based on large language model, comprising the following steps:

[0006] Step 1: Determine the basic requirement template;

[0007] Step 2: On the basis of the basic requirement template, according to the definition of different SysML modeling graphs, design corresponding biased requirement templates for each SysML modeling graph;

[0008] Step 3: Design corresponding filling sentence pattern rules for the biased requirement template of each SysML modeling graph;

[0009] Step 4: Merge and describe the biased requirement template, filling sentence pattern rule and user-provided requirement long text to form a prompt word;

[0010] Step 5: Input the prompt word into the large language model, and output the limited sentence requirement template, which is obtained by filling the requirement long text in the biased requirement template according to the filling sentence pattern rule

[0011] Step 6: Use retrieval enhancement generation technology to attach the SysML knowledge base to the large language model;

[0012] Step 7: Split the limited sentence requirement template according to different blocks to obtain multiple individual blocks, and determine the thinking chain prompt word of each individual block according to the pre-set mapping rule between each individual block and SysML model element;

[0013] Step 8: The large language model generates SysML text according to the thinking chain prompt word of each individual block;

[0014] Step 9: Perform syntax checking on the SysML text generated by the large language model, and only the SysML text with syntax errors is used again to use the thinking chain prompt word of the corresponding individual block, so that the large model is modified in the next round of output, and through multiple rounds of dialogue, the SysML modeling is finally completed.

[0015] Further, the filling sentence pattern rule designed for the biased requirement template of each SysML modeling graph comprises: single module sentence pattern rule, module relationship sentence pattern rule and non-functional module common sentence pattern rule.

[0016] Further, the basic requirement template includes basic information, data / events, functional requirements and non-functional requirements.

[0017] Further, in step 9, in the multi-round dialogue, the multi-round dialogue content is stored by using the storage data structure.

[0018] Further, the storage data structure adopts a json string format.

[0019] Further, the json string format is expressed as:

[0020] {"role": "system", "content": "xxxxxx"}

[0021] {"role": "assistant", "content": "xxxxxx"}

[0022] {"role": "user", "content": "xxxxxxxx"}

[0023] Wherein, role represents the role played by the global setting, user or large language model, content represents the text input or output corresponding to the role, system represents the global setting of the entire dialogue, for system, xxxxxxxx represents the specific content of the global definition of the identity, style, capability range or limitation of the large model assistant in the subsequent dialogue; user represents the user, for user, xxxx represents the actual input content of the user; assistant represents the large language model, for assistant, xxxxxxxx represents the generated reply of the large language model to the user input.

[0024] Advantages: compared with the prior art, the present application has the following advantages:

[0025] (1) Automation: the large language model of the method of the present application can quickly generate SysML code according to user description, reducing the time of manual writing, and being able to handle a large number of modeling tasks, thereby improving production efficiency;

[0026] (2) Accuracy: the large language model of the method of the present application can generate code according to standard grammar and specifications, reducing human error and omissions, maintaining the consistency of code output, and ensuring compliance with SysML best practices, thereby improving the reliability and maintainability of system modeling;

[0027] (3) Intelligent assistance: based on the large language model of the method of the present application, users can use natural language to describe requirements, and the large language model understands and converts them into SysML text models, significantly reducing the use threshold;

[0028] (4) The method can greatly improve the development efficiency and quality of safety-critical software to reduce labor costs by assisting the SysML modeling of safety-critical software.

[0029] (5) In view of the gap between embedded software requirements and design, the application proposes a prompt framework based on a limited natural language requirement template, which eliminates the ambiguity and ambiguity of natural language requirements. BRIEF DESCRIPTION OF DRAWINGS

[0030] Figure 1 The overall flowchart of the SysML modeling method based on the large language model proposed by the application is shown in the figure.

[0031] Figure 2 The SysML model requirement specification process is shown in the figure.

[0032] Figure 3 The RAG technique is shown in the figure.

[0033] Figure 4 The relationship chain design based on the limited natural language requirement template is shown in the figure. DETAILED DESCRIPTION

[0034] The technical solutions of the application will be further described in combination with the drawings and embodiments.

[0035] The application proposes a SysML modeling method based on a large language model. In this embodiment, the large language model mainly used is Deepseek-v3 large language model. As shown in the figure, the method of this embodiment mainly includes the following steps: Figure 1

[0036] Step 1: A SysML model requirement specification method for large model preprocessing is proposed. First, according to the basic requirement templates sorted out in the current common natural text and related research. On the basis of the basic requirement template, design a biased requirement template according to the definition of different SysML modeling graphs, and design a corresponding sentence specification, which allows the demander to fill in according to the demand and the type of SysML modeling graph required. Finally, use the large model for semantic decomposition to guide the large model to assist in generating the requirement template filled with limited sentence patterns. The specific operation includes:

[0037] Substep 1: According to the current common natural text and related research, design a basic requirement template containing basic information, data / events, functional requirements, and non-functional requirements, as shown in Table 1.

[0038] Table 1 Basic requirement template

[0039] ​

[0040]

[0041] Sub-step 2: Designing different graph model bias multi-graph requirement template: SysML model in the same project is a multi-graph structure. Due to the difference of the graph, the description of different graphs of the final generated SysML model is different. Therefore, in the process of building a system, especially when analyzing and designing a system through different perspectives of SysML model (such as structure diagram and behavior diagram), it is necessary to clarify and refine the system requirements. Taking the module definition diagram as an example, it mainly focuses on describing different types of model elements and relationships to illustrate the structural information of the system, mainly for data structure input. Based on the basic requirement template, the requirement template of the module definition diagram is shown in Table 2.

[0042] Table 2 Requirement template of module definition diagram

[0043]

[0044] In a similar way, according to the characteristics of different graphs, the requirement templates of internal module diagram, package diagram, activity diagram, and state machine diagram are designed respectively.

[0045] Sub-step 3: Designing the limited sentence pattern of the filling template: Due to the ambiguity of natural language expression, ambiguity will be caused when filling in the requirement template. Based on the requirement templates of multiple graph types that have been designed, the expression method should be standardized, so the classified requirement description can be constrained by limited sentence.

[0046] Taking the module definition diagram as an example, the sentence pattern of the requirement template in Table 2 is designed as shown in Table 3.

[0047] Table 3 Sentence pattern of module definition diagram

[0048]

[0049] For data input, multiple sets are used to limit the filling, and for different relationship descriptions of functional requirements, different sentence patterns with changeable keywords are used. In this step, according to the requirement templates of different graph types, different sentence behavior rules are designed, including single module sentence design, module relationship sentence design, and non-functional module common sentence regulation, to complete the sentence pattern rule making.

[0050] Sub-step 4: In order to generate comprehensive prompts, the requirement model, sentence pattern, and requirement text need to be combined into the task description, so the designed prompt words are shown in Table 4:

[0051] Table 4 Example of prompt words

[0052]

[0053]

[0054] The large model generates a corresponding plate output, a segmentation function and a filling function are designed to automatically fill in the corresponding demand template, and a demand template after processing by the large model is obtained without manual filling by the user.

[0055] The embodiment designs a limited sentence demand template as an intermediate transition link, so that it can become a relatively standardized and itemized demand template, and designs a prompt framework to preprocess free text by the large model to assist in generating a demand template.

[0056] Step 2: Use the RAG (Retrieval Augmented Generation) technology to externally connect the SysML knowledge base to the large language model to enhance the SysML modeling document generation capability based on the large language model. As shown in Figure 3 , specifically comprising:

[0057] The SysML knowledge base is constructed, and the SysML knowledge base includes: a demand document sample, a model rule document and a model text document.

[0058] The demand document sample is selected from the existing sample set and the part of the training set of the SysML V2 repository provided by the OMG official, and is filtered and extracted for different model texts, and the.sysml file is converted into a.txt file.

[0059] The model rule document is composed of the SysML V2 text language rules published by the OMG official.

[0060] In order to enhance the actual scene fitting degree of data, the demand text sample is combined with the Chinese model text document to constitute a demand document, as shown in Table 5.

[0061] Table 5 Demand document example

[0062]

[0063]

[0064] After the SysML knowledge base is constructed, the RAG is gradually realized under the RAGFlow framework according to the following setting method.

[0065] In the system, the SysML knowledge base that has been constructed is selected, and the local demand document is loaded. The local demand document is segmented into blocks and vectorized by using the template segmentation technology and the Embedding model, and embedding and full-text (keyword) indexes are constructed on these blocks to realize text analysis and test generation.

[0066] Among them, the template block technology is used to block different layout files and ensure semantic integrity, i.e., to split the requirement document. Adjust the parameter settings: chunk_size = 512 (number of characters) and add a new segment identifier ## in the segment identifier of the text segmentation to ensure that each requirement block is semantically complete.

[0067] In addition, the Embedding model converts the segmented text into a numerical vector and stores it in a vector database. In this step, the Embedding model is bge-large-zh.

[0068] Prompt construction generation: build communication prompts, emphasize that the model uses knowledge in the SysML knowledge base, add the matched text to the prompts together with the questions raised by the requirementer, and submit them to the large language model (LLM). The prompts are used to emphasize that the large language model uses the requirement document in the SysML knowledge base to generate answers using the comprehensive reasoning ability of the large language model. In this step, the large language model uses DeepSeek-v3.

[0069] Step 3: Use the few-shot prompt method to guide the large language model (LLM) to generate output that meets specific requirements. Specifically: based on the various blocks in the requirement template, integrate task-related examples with complex and multiple event syntax after learning the SysML V2 grammar structure, and consider them as the context of the large model to provide learning conditions for the large model.

[0070] Step 4: Design Chinese thought chain prompts: as shown in Figure 4 , split the different blocks in the requirement template and understand them as separate blocks. List the mapping rules from the requirement template text to the SysML model element V2 grammar, i.e., Chinese thought chain prompts, for the large model to understand and remember. Similarly, take the module definition diagram as an example, and design the thought chain as shown in Table 6.

[0071] Table 6 Module Definition Diagram Thought Chain

[0072]

[0073]

[0074] Among them, the various blocks in the requirement template correspond to different grammars, and the right thought chain prompts are used to construct the grammar. When the large model is constructed, the corresponding part of the thought chain is used to make it accurately map to the corresponding block. The large model will generate SysML text step by step according to the logical prompts given by the thought chain.

[0075] The embodiment injects relevant SysML knowledge by prompting engineering technology, selecting few-sample prompts and Chinese thinking chain prompt words, and guides the large model to generate accurate SysML V2 text models. Through the above method, the performance of the large language model in the task of automatic generation of SysML models is significantly improved. These measures not only optimize the model's understanding of SysML specifications and safety requirements, but also enhance its ability to automatically generate in complex system architecture descriptions, thereby ensuring system safety and reliability while improving the accuracy and practicality of model generation.

[0076] Step 5: Design code, perform simple basic syntax checking on the generated content of the first round of large language model output, and use the corresponding thinking chain as a prompt for the error part again. Introduce multiple rounds of dialogue to let the large model modify in the next round of output. Specific operations include:

[0077] The generated content of the large language model output may have basic syntax problems, such as using part as block, defining type twice after the block has been defined, different syntax for the starting package, and different usage of semicolons in different diagram text model statements.

[0078] In the process of multiple rounds of dialogue, a storage data structure is designed to store the content of multiple rounds of dialogue.

[0079] The json string format is a data format suitable for recording multiple rounds of dialogue of the large language model, represented as:

[0080] {"role":"system","content":"xxxxxx"}

[0081] {"role":"assistant","content":"xxxxxx"}

[0082] {"role":"user","content":"xxxxxxxx"}

[0083] Wherein, role represents the role played by the global setting, user or large language model, and content represents the text input or output of the corresponding role. system represents the global setting of the entire dialogue, xxxxxxx represents the specific content of the global definition of the identity, style, ability range or limitation of the large model assistant in the next dialogue; user represents the user, xxxxx represents the actual input content of the user, i.e. the prompt to be adjusted. assistant represents the large language model, and xxxxxxx represents the large language model's generated reply to the user input.

[0084] In the initial dialogue, the system is automatically used to set the entire dialogue globally, and the data record records ten rounds of dialogue content. By calling the record large model according to the prompt, the output of the last round is modified to give a new generation result.

[0085] In the safety-critical field, this embodiment designs different Chinese requirement templates with focus through the standardized requirement construction of different model diagrams of SysML, aiming at the natural language ambiguity and long text problems of requirement text. And the process of generating requirements specification suitable for SysML after inputting requirement text into large model is completed by designing context prompt words. Using RAG technology and prompt engineering to enhance the large model generation model, a kind of prompt word assisted large model generation based on standardized requirement template is proposed, and the model text generated by large model multi-round conversation is checked for errors. The performance of large language model in SysML model automatic generation task is significantly improved. These measures not only optimize the understanding of SysML specification and safety requirements of the model, but also enhance its automatic generation ability in complex system architecture description, so as to ensure the safety and reliability of the system while improving the generation accuracy and practicality of the model.

Claims

1. A SysML modeling method based on a large language model, characterized by: The method comprises the following steps: Step 1: determining a basic requirement template; Step 2: designing a corresponding biased requirement template for each SysML modeling graph according to the definition of different SysML modeling graphs on the basis of the basic requirement template; Step 3: designing a corresponding filling sentence pattern rule for the biased requirement template of each SysML modeling graph; Step 4: merging and describing the biased requirement template, the filling sentence pattern rule and the requirement long text provided by the user to form a prompt word; Step 5: inputting the prompt word into the large language model to output a limited sentence requirement template, which is obtained by filling the biased requirement template according to the filling sentence pattern rule of the requirement long text; Step 6: using a retrieval enhancement generation technology to externally connect a SysML knowledge base to the large language model; Step 7: splitting the limited sentence requirement template according to different blocks to obtain a plurality of individual blocks, and determining a thinking chain prompt word of each individual block according to a pre-set mapping rule between each individual block and a SysML model element; Step 8: the large language model generates SysML text according to the thinking chain prompt word of each individual block; Step 9: performing syntax checking on the SysML text generated by the large language model, and using the thinking chain prompt word of the corresponding individual block again only for the SysML text with syntax errors to modify the output of the large model in the next round, and finally completing SysML modeling through multiple rounds of dialogue.

2. The SysML modeling method based on a large language model according to claim 1, characterized in that: The filling sentence pattern rule designed for the biased requirement template of each SysML modeling graph comprises a single-module sentence pattern rule, a module relationship sentence pattern rule and a non-functional module common sentence pattern rule.

3. The SysML modeling method based on a large language model according to claim 1, characterized in that: The basic requirement template comprises basic information, data / events, functional requirements and non-functional requirements.

4. The SysML modeling method based on a large language model according to claim 1, characterized in that: In step 9, in the multiple rounds of dialogue, a storage data structure is used to store the contents of the multiple rounds of dialogue.

5. The SysML modeling method based on a large language model according to claim 4, characterized in that: The storage data structure adopts a json string format.

6. The SysML modeling method based on a large language model according to claim 5, characterized in that: The json string format is represented as: {"role":"system","content":"xxxxxx"} {"role":"assistant","content":"xxxxxx"} {"role":"user","content":"xxxxxxxx"} Wherein, role represents the role played by the global setting, the user or the large language model, content represents the text input or output of the corresponding role, system represents the global setting of the entire dialogue, for system, xxxxxxxx represents the specific content of the global definition of the identity, style, capability range or limitation of the large model assistant in the next dialogue; user represents the user, for user, xxxx represents the actual input content of the user; assistant represents the large language model, for assistant, xxxxxxxx represents the generated reply of the large language model to the user input.