Fine adjustment large model driven domain model automatic construction system

The domain model automatic construction system addresses inefficiencies in traditional methods by using a fine-tuned large model to convert text into UML diagrams, ensuring rapid and accurate domain model generation across diverse fields.

CN119166508APending Publication Date: 2024-12-20UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411201923.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Existing domain model construction methods are time-consuming, labor-intensive, prone to errors, and lack accuracy and adaptability due to manual analysis and limited natural language processing capabilities.

Method used

A domain model automatic construction system driven by fine-tuning large models, comprising a code generation module, UML diagram generation module, and interactive page, utilizing a fine-tuned large language model to convert natural language into class diagram codes and UML diagrams, with a training and testing process to enhance accuracy.

Benefits of technology

Facilitates rapid and accurate construction of UML diagrams from text requirements, improving efficiency and reducing communication barriers between developers and users, with enhanced adaptability across various fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166508A_ABST
    Figure CN119166508A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic domain model construction system driven by a fine-tuning large model, relates to the technical field of software development, and solves the technical problem that in the prior art, a domain model cannot be simply and quickly generated according to the needs of developers. The system comprises a code generation module, a UML graph generation module and an interaction page, the code generation module is used for generating class graph codes according to natural language description, and the UML graph generation module is used for generating UML class graphs according to the class graph codes. The connection module is used for transmitting information between the code generation module and the interaction page and between the UML graph generation module and the interaction page, and the interaction page is used for obtaining natural language description, class graph codes and UML class graphs generated by the UML graph generation module; according to the method, the rapid construction from the demand text to the UML graph is realized, the technical barriers among different fields are broken, the communication cost between software developers and users is reduced, and the UML technology and the large language model are organically combined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to an automatic construction system for a domain model driven by a fine-tuned large model. Background Art

[0002] Domain models, as a visual representation of conceptual classes in a domain or objects in the real world, are an indispensable part of software development. However, traditional domain model construction methods mainly rely on manual analysis and design, which is not only time-consuming and labor-intensive, but also prone to omissions or errors due to human factors. In order to improve this situation, people began to explore the use of natural language processing technology (NLP) to assist in the construction of domain models. In addition, in order to further improve the efficiency and quality of software development, people began to try to directly convert simple text into UML diagrams, such as using the PlantUML plug-in. This technology generates UML diagrams by writing the code required by the UML diagram generation plug-in. Although this method simplifies the UML diagram generation process to a certain extent, it still has many inconveniences due to the need to learn the plug-in code language instead of directly generating UML diagrams through human text language.

[0003] Existing technologies have shortcomings in converting natural language into domain models, conveniently generating UML diagrams, and applying open source large models, including inaccurate understanding, low generation efficiency, limited generalization ability, and poor adaptability to specific fields. Summary of the invention

[0004] In order to solve the problems existing in the above-mentioned prior art, the present invention provides a domain model automatic construction system driven by fine-tuning a large model, which solves the technical problem that the prior art cannot generate domain models simply and quickly to meet the needs of developers.

[0005] A domain model automatic construction system driven by fine-tuning large models, including code generation module, UML diagram generation module and interactive page,

[0006] The code generation module is used to generate class diagram code according to natural language description,

[0007] The UML diagram generation module is used to generate a UML class diagram according to the class diagram code.

[0008] The connection module is used to transmit information between the code generation module and the interactive page, and between the UML diagram generation module and the interactive page.

[0009] The interactive page is used to obtain natural language descriptions, class diagram codes, and UML class diagrams generated by a UML diagram generation module.

[0010] Furthermore, the code generation module includes a code generation model and a training module. The code generation model is used to convert text requirements into class diagram codes. The training module is used to construct a code data set and a code test set. The target large language model is trained using the code data set and the code test set is used to test and finally obtain the code generation model. Each data in the code data set includes input instructions and output content. The input instructions are detailed text requirements in a certain field, and the output content is the class diagram code corresponding to the detailed text requirements.

[0011] Furthermore, the process of constructing the code dataset includes:

[0012] Obtain requirement specifications of software systems in multiple fields and extract text requirements of software systems in various fields, wherein the multiple fields include medical, catering, e-commerce, education, finance, tourism, project management, and social media; convert the text requirements into preliminary class diagram code, adjust the preliminary class diagram code according to the code specification and produce a preliminary UML diagram, adjust the preliminary UML diagram according to the specified standard to obtain a rigorous UML diagram, reverse the rigorous UML diagram into an accurate class diagram code, and finally correspond the accurate class diagram code with the text requirements to form a code data set.

[0013] Furthermore, the training process of the code generation model includes:

[0014] Select the target large language model, use the Colab and Unsloth framework to fine-tune the target large language model, and then use OpenAI's Triton to rewrite the model's calculation process to obtain a preliminary code generation model.

[0015] Furthermore, the testing process of the code generation model includes:

[0016] A code test set is prepared, which only includes text requirements. The text requirements are different from the input instructions in the code data set. The test set is respectively input into the target large language model before training and the preliminary code generation model after training to simultaneously perform the operation of converting the requirement text into UML diagram code. The output results of the two are compared based on the model fine-tuning result comparison table, and then the data in the model fine-tuning result comparison table are analyzed to judge the code generation effect of the preliminary code generation model. If the effect is not good, the preliminary code generation model is retrained by supplementing the code data set through the training module until the preliminary code model obtains the expected code generation effect, and it is used as the code generation model.

[0017] Furthermore, the indicators of the model fine-tuning result comparison table include: code direct availability rate, precision rate, recall rate, F1 score, model size and inference time.

[0018] Furthermore, the interactive page includes a model switching box, a text requirement input box, a class diagram code output box, a class diagram code input box, and a UML diagram output box. The text requirement input box and the class diagram code output box transmit information with the code generation module, and the class diagram code input box and the UML diagram output box transmit information with the UML diagram generation module.

[0019] Furthermore, it also includes a connection module, which is used to transmit information between the code generation module and the interactive page.

[0020] Furthermore, the connection module includes Ol l ama, and the Ol l ama is used to deploy the code generation module locally.

[0021] Further, the usage is as follows:

[0022] Step 1: Select the required model from multiple models deployed locally;

[0023] Step 2: Input the domain text requirements into the code generation module through the interactive interface. The code generation module generates the corresponding class diagram code and feeds it back to the interactive page.

[0024] Step 3: Make appropriate adjustments to the corresponding class diagram code and input it into the UML diagram generation module through the interactive page. The UML diagram generation module generates the UML class diagram and feeds it back to the interactive page.

[0025] The beneficial effects of the present invention include:

[0026] a. Realizes the rapid construction from requirement text to UML diagram: This invention breaks the technical barriers between different fields, reduces the communication cost between software developers and users, and organically combines the generation of UML technology and large language model

[0027] b. The accuracy of domain model construction has been greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 This is a diagram of the data format in the code data set.

[0029] Figure 2 Schematic diagram of the switching model.

[0030] Figure 3 Schematic diagram of the process of generating class diagram code for a fine-tuned large model-driven domain model automated construction system.

[0031] Figure 4 Schematic diagram of the class diagram generation process for a fine-tuned large model-driven domain model automation construction system.

[0032] Figure 5 A diagram of the user interface. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0034] A domain model automatic construction system driven by fine-tuning large models, including code generation module, UML diagram generation module and interactive page,

[0035] The code generation module is used to generate class diagram code according to natural language description,

[0036] The UML diagram generation module is used to generate a UML class diagram according to the class diagram code.

[0037] The interactive page is used to obtain natural language descriptions, class diagram codes, and UML class diagrams generated by a UML diagram generation module.

[0038] Specifically, the usage is as follows:

[0039] Step 1: Select the required model from multiple models deployed locally; Figure 2 Shown

[0040] Here, relevant technicians can train different large models according to their needs and choose more suitable large models in different scenarios;

[0041] Step 2: Enter the domain text requirements into the code generation module through the interactive interface. The code generation module generates the corresponding class diagram code and feeds it back to the interactive page, such as Figure 3 As shown;

[0042] Step 3: Make appropriate adjustments to the corresponding class diagram code and input it into the UML diagram generation module through the interactive page. The UML diagram generation module generates the UML class diagram and feeds it back to the interactive page, such as Figure 4 shown.

[0043] In another embodiment, the code generation module includes a code generation model and a training module. The code generation model is used to convert text requirements into class diagram codes. The training module is used to construct a code data set and a code test set. The target large language model is trained using the code data set and the code test set is used to test and finally obtain the code generation model. Each data in the code data set includes input instructions and output content. The input instructions are detailed text requirements in a certain field, and the output content is the class diagram code corresponding to the detailed text requirements.

[0044] In another embodiment, the process of constructing the code data set includes:

[0045] Obtain the requirements specifications of software systems in multiple fields and extract the text requirements of software systems in various fields, including medical, catering, e-commerce, education, finance, tourism, project management, and social media; convert the text requirements into preliminary class diagram code, adjust the preliminary class diagram code according to the code specification and produce a preliminary UML diagram, adjust the preliminary UML diagram according to the specified standards to obtain a rigorous UML diagram, reverse the rigorous UML diagram into an accurate class diagram code, and correspond the accurate class diagram code with the text requirements to form a code data set. Specifically:

[0046] (a) Retrieve the requirements specifications of software systems in various fields through multiple channels (CSDN, GitHub, search engines, etc.), and use the large language model to extract the text requirements of each system. The currently constructed dataset includes software system requirements in the fields of medical care, catering, e-commerce, education, finance, tourism, project management, social media, etc.

[0047] (b) The text requirements are converted into preliminary Plant UML codes with the help of GPT-4o. The reason for choosing this model is that compared with other large models on the market, this model performs better and generates preliminary Plant UML codes with a higher accuracy rate. When other large models are selected, the generated code will require more manual intervention to draw preliminary UML diagrams, which will increase the difficulty of building the dataset;

[0048] (c) Modify the code according to the code specifications provided by PlantUML and generate preliminary UML diagrams;

[0049] (d) The preliminary UML diagram is further revised according to the UML class diagram notation in the Unified Modeling Language standard developed by the Object Management Group (OMG) and the suggestions of UML modeling experts to obtain a more rigorous UML diagram;

[0050] (e) The obtained UML diagram is reversed into PlantUML code, and together with the corresponding text requirements, a JSON format data set is formed, namely, a code data set. The JSON format of each data in the code data set mainly consists of two parts: input instruction "instruction" and output content "output". The main content of "instruction" is the detailed text requirements of the field, and the main content of "output" is the PlantUML code output by the model. Figure 1 shown.

[0051] In another embodiment, the training process of the code generation model includes:

[0052] Select the target large language model, use the Colab and Unsloth framework to fine-tune the target large language model, and then use OpenAI's Triton to rewrite the model's calculation process to obtain a preliminary code generation model. Specifically:

[0053] (a) Fine-tuning the open source large language model. To better suit the needs of the Chinese context, this technology uses the open source large model Tongyi Qianwen (Qwen2-7.6B) developed by Alibaba Cloud. This method is based on Qwen2 and fine-tuned based on Qwen2. Qwen2 uses byte pair encoding (BPE) as the word segmentation method and expands the vocabulary to include commonly used Chinese characters and words.

[0054] (c) Fine-tune the model with the help of Colab and the open source large model training acceleration project Unsloth framework. Use OpenAI's Triton to rewrite the model's calculation process, greatly improving the model's training speed and reducing the memory usage during training. Unsloth can ensure the consistency of the rewritten model calculation, there is no approximate calculation in the implementation, and the accuracy loss of the model training is zero.

[0055] (d) After downloading the Uns loth framework code locally, create the dataset and model folders, put the organized JSON format dataset and the Qwen2 model that needs to be fine-tuned into the correct path, modify some parameters in the configuration file in the Uns loth framework, and start training.

[0056] (e) Import the trained GGUF model into the local Ol l ama for effect testing

[0057] In another embodiment, the testing process of the code generation model includes:

[0058] A code test set is prepared, which only includes text requirements. The text requirements are different from the input instructions in the code data set. The test set is respectively input into the target large language model before training and the preliminary code generation model after training to simultaneously perform the operation of converting the requirement text into UML diagram code. The output results of the two are compared based on the model fine-tuning result comparison table, and then the data in the model fine-tuning result comparison table are analyzed to judge the code generation effect of the preliminary code generation model. If the effect is not good, the preliminary code generation model is retrained by supplementing the code data set through the training module until the preliminary code model obtains the expected code generation effect, and it is used as the code generation model.

[0059] In another embodiment, the indicators of the model fine-tuning result comparison table include: code direct usability rate, precision rate, recall rate, F1 score, model size and inference time.

[0060] Since this model automatically generates UML models based on software requirements when software designers do not fully understand software requirements, the more accurate the model is, the more helpful it will be to software designers. Therefore, the test uses the classification task evaluation criteria of precision, recall, and F1 score for evaluation.

[0061] The definitions of the above-mentioned specific indicators are shown in the following table:

[0062] Table 1 Performance index table

[0063]

[0064] In the table, TP stands for TruePositive, FP stands for FallPositive, FN stands for FallNegative, and TN stands for TrueNegative.

[0065] The open-source large language model trained with the new data set is better adapted to Chinese needs, and has achieved significant improvements in code direct availability, precision, recall, and F1 score compared to the original open-source large model. The test results on the same test set (five data points) are shown in the following table:

[0066] Table 2 Comparison of model fine-tuning results

[0067]

[0068] In another embodiment, the interactive page, such as Figure 5As shown, it includes a model switching box, a text requirement input box, a class diagram code output box, a class diagram code input box, and a UML diagram output box. The text requirement input box and the class diagram code output box transmit information with the code generation module, and the class diagram code input box and the UML diagram output box transmit information with the UML diagram generation module.

[0069] In another embodiment, a connection module is further included, and the connection module is used to transmit information between the code generation module and the interactive page.

[0070] In another embodiment, the connection module includes Ol l ama, and Ol l ama is used to deploy the code generation module locally.

[0071] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.

Claims

1. A domain model automation construction system driven by fine-tuning large models, characterized in that: Including code generation module, UML diagram generation module and interactive page, The code generation module is used to generate class diagram code according to natural language description, The UML diagram generation module is used to generate a UML class diagram according to the class diagram code. The interactive page is used to obtain natural language descriptions, class diagram codes and UML class diagrams.

2. According to claim 1, a fine-tuning large model driven domain model automatic construction system is characterized in that: The code generation module includes a code generation model and a training module. The code generation model is used to convert text requirements into class diagram codes. The training module is used to construct a code data set and a code test set. The target large language model is trained using the code data set and the code test set is used to test and finally obtain the code generation model. Each data in the code data set includes input instructions and output content. The input instructions are detailed text requirements in a certain field, and the output content is the class diagram code corresponding to the detailed text requirements.

3. According to claim 2, a fine-tuning large model driven domain model automatic construction system is characterized in that: The process of constructing the code dataset includes: Obtain requirement specifications of software systems in multiple fields and extract text requirements of software systems in various fields, wherein the multiple fields include medical, catering, e-commerce, education, finance, tourism, project management, and social media; convert the text requirements into preliminary class diagram code, adjust the preliminary class diagram code according to the code specification and produce a preliminary UML diagram, adjust the preliminary UML diagram according to the specified standard to obtain a rigorous UML diagram, reverse the rigorous UML diagram into an accurate class diagram code, and finally correspond the accurate class diagram code with the text requirements to form a code data set.

4. According to claim 2, a fine-tuning large model driven domain model automatic construction system is characterized in that: The training process of the code generation model includes: Select the target large language model, use Colab and Unsloth framework to fine-tune the target large language model, and then use OpenAI's Triton to rewrite the model's calculation process to obtain a preliminary code generation model.

5. According to claim 4, a fine-tuning large model driven domain model automatic construction system is characterized in that: The testing process of the code generation model includes: A code test set is prepared, which only includes text requirements. The text requirements are different from the input instructions in the code data set. The test set is respectively input into the target large language model before training and the preliminary code generation model after training to simultaneously perform the operation of converting the requirement text into UML diagram code. The output results of the two are compared based on the model fine-tuning result comparison table, and then the data in the model fine-tuning result comparison table are analyzed to judge the code generation effect of the preliminary code generation model. If the effect is not good, the preliminary code generation model is retrained by supplementing the code data set through the training module until the preliminary code model obtains the expected code generation effect, and it is used as the code generation model.

6. According to claim 5, a fine-tuning large model driven domain model automatic construction system is characterized in that: The indicators of the model fine-tuning result comparison table include: code direct availability rate, precision rate, recall rate, F1 score, model size and inference time.

7. According to claim 1, a fine-tuning large model driven domain model automatic construction system is characterized in that: The interactive page includes a model switching box, a text requirement input box, a class diagram code output box, a class diagram code input box, and a UML diagram output box. The text requirement input box and the class diagram code output box transmit information with the code generation module, and the class diagram code input box and the UML diagram output box transmit information with the UML diagram generation module.

8. According to claim 1, a fine-tuning large model driven domain model automatic construction system is characterized in that: It also includes a connection module, which is used to transmit information between the code generation module and the interactive page.

9. According to claim 8, a fine-tuning large model driven domain model automatic construction system is characterized in that: The connection module includes Ollama, and Ollama is used to deploy the code generation module locally.

10. A fine-tuning large model driven domain model automatic construction system according to any one of claims 1 to 9, characterized in that: Here’s how to use it: Step 1: Select the required model from multiple models deployed locally; Step 2: Input the domain text requirements into the code generation module through the interactive interface. The code generation module generates the corresponding class diagram code and feeds it back to the interactive page. Step 3: Make appropriate adjustments to the corresponding class diagram code and input it into the UML diagram generation module through the interactive page. The UML diagram generation module generates the UML class diagram and feeds it back to the interactive page.