Method, apparatus, medium and electronic device for generating software based on large model technology
Through big model technology, software is generated, user demand information is obtained, configuration definition files are generated, business flow logic is determined, front and back-end pages are automatically generated, solving the problem of inefficiency of existing tools and achieving efficient software development.
Patent Information
- Application Number
- CN202510155543.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-02-12
AI Technical Summary
Existing software development tools can only generate partial code snippets for specific programming languages or frameworks, resulting in low software development efficiency.
Through big model technology generation software, user demand information is obtained, configuration definition files are generated, format checks and reformats are performed, business flow logic is determined, and front-end pages are automatically generated.
It realizes the accuracy and consistency of demand information, improves the efficiency of software development, and users can quickly generate software without manual encoding.
Smart Images

Figure CN120085843B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software generation technology, and in particular to a method, device, medium and electronic device for generating software based on large model technology. Background Art
[0002] Software development is the process of building a software system or the software components of a system according to user requirements. Software development is a systematic project encompassing requirements capture, analysis, design, implementation, and testing. Software is typically implemented using a programming language and is typically developed using software development tools. Software is categorized as system software and application software. Software encompasses more than just the programs that run on a computer; the files associated with these programs are also generally considered part of the software. Software development has demonstrated its irreplaceable importance in meeting user needs, driving business development, and promoting economic growth. It is not only a crucial component of modern scientific and technological development but also a key force driving overall social progress.
[0003] At present, the common method used for software development is to rely on programmers to manually write code, while using some existing code generation tools to assist in coding. However, these tools can usually only generate partial code snippets for specific programming languages or frameworks, and the improvement in development efficiency of software development with manually written code is limited, resulting in low software development efficiency. Summary of the Invention
[0004] In order to improve the efficiency of software development, the present application provides a method, device, medium and electronic device for generating software based on large model technology.
[0005] In a first aspect of the present application, a method for generating software based on large model technology is provided, specifically comprising:
[0006] Obtain user-generated demand information for software;
[0007] Generate a configuration definition file corresponding to the requirement information through a preset code generation model, wherein the configuration definition file is a configuration file of a domain-specific language definer, and the code generation model is a model capable of generating corresponding software code according to the user's requirement information;
[0008] Reformatting the configuration definition file into a regular format to obtain a processed file;
[0009] Based on the processed file, determining the business flow logic corresponding to the business functions in the software to be generated, and based on the business flow logic, generating target software code corresponding to the software to be generated through the code generation macro model, wherein the format of the target software code is a configuration file format of a domain-specific language definer;
[0010] Based on the target software code, a front-end page and a back-end page of the software to be generated are generated through a preset rendering engine.
[0011] By adopting the above technical solution, the user's requirement information for software generation is obtained, and this requirement information is converted into a configuration definition file, thereby realizing the conversion of the requirement information into a unified and standardized JSON DSL format, thereby ensuring the accuracy and consistency of the requirement information in software generation and improving the accuracy of code generation. The configuration definition file is then reformatted to verify the format. Furthermore, based on the processed file representing the user's requirements, the business flow logic of each business function in the software to be generated is determined, providing an important basis for the subsequent generation of software code, and then the target software code is generated through the code generation model. Finally, the rendering engine is used to render and generate the front-end and back-end pages of the software to be generated based on the code, completing the automatic generation of the software. The user only needs to input the requirement information and does not need to manually participate in coding. Based on the code generation model, the corresponding software is automatically generated quickly and efficiently, thereby improving the efficiency of software development.
[0012] Optionally, before obtaining the user's requirement information for the software, the method further includes:
[0013] Introducing a latent key-value cache into the multi-head self-attention mechanism of the Transformer model and storing expert gates in the latent key-value cache to obtain an initial large model;
[0014] Input the preset code data sample into the initial large model and perform attention QKV calculation to obtain the KV intermediate result;
[0015] Storing the KV intermediate result in the Latent key-value cache, and establishing a mapping relationship between the KV intermediate result and a preset expert module through the expert gating;
[0016] Inputting a preset Token sample into the initial large model for pre-training, adding an expert dimension to the hidden layer output corresponding to the Token sample based on the mapping relationship, and repeatedly performing the step of inputting the preset Token sample into the initial large model for pre-training until the model converges, thereby obtaining a pre-trained large model;
[0017] The pre-trained large model is fine-tuned to obtain a code generation large model.
[0018] By adopting the above technical solution, a latent key-value cache is introduced to store KV intermediate results. This facilitates the establishment of a mapping relationship between KV intermediate results and preset expert modules through expert gating. Token samples are then input into the initial large model for pre-training. Through token sample attention Q, the most suitable KV intermediate results are found from each KV intermediate result. Based on this mapping relationship, the most suitable expert module is quickly and accurately assigned to the token sample after input. Furthermore, the pre-trained large model is fine-tuned to continuously optimize its ability to generate software code, ultimately resulting in a large code generation model.
[0019] Optionally, generating a configuration definition file corresponding to the requirement information through a preset code generation model specifically includes:
[0020] Determining whether the demand information is a text demand;
[0021] If not, the requirement information is converted into the target token corresponding to the text requirement through the Qformer multimodal compatible network structure introduced in the preset code generation model;
[0022] Through the preset prompt project and the target token, the configuration definition file corresponding to the requirement information is determined through the code generation model.
[0023] By adopting the above technical solution, if the requirements are not textual, the Qformer multimodal compatible network structure introduced in the code generation model can serve as the input preprocessing component of the code generation model, processing and fusing multimodal data, converting it into information suitable for the code generation model. Finally, the target token is converted into a configuration definition file, converting the requirements information into a unified and standardized JSON DSL format, thereby ensuring the accuracy and consistency of the requirements information during software generation.
[0024] Optionally, reformatting the configuration definition file into a regular format to obtain a processed file specifically includes:
[0025] Performing format verification on the configuration definition file and determining whether the configuration format of the database field in the configuration definition file is correct;
[0026] When the configuration definition file format verification fails or the configuration format is incorrect, regular expression matching is performed on the configuration definition file, key fields and corresponding value values in the configuration definition file are extracted and verified to obtain a verification result;
[0027] Based on the configuration definition file, the missing key fields in the verified result are determined, and default values are filled in for the missing key fields to obtain a processed file.
[0028] By adopting the above technical solution, when the configuration definition file format verification fails or the configuration format is incorrect, regular matching is performed on the configuration definition file, thereby better verifying the format and integrity of the configuration definition file representing the user's needs, thereby facilitating the subsequent code generation large model to better understand the user's needs for software generation based on the processed file.
[0029] Optionally, determining the business flow logic corresponding to the business functions in the software to be generated based on the processed file specifically includes:
[0030] Create a target Base table in the database. The fields in the target Base table are logically consistent across the front-end and back-end in any business scenario.
[0031] Based on the processed file, selecting the first field corresponding to the single business function in the software to be generated from the target Base table, and aggregating the first fields to obtain a user behavior object table, where the first field is a field related to the user behavior object;
[0032] Based on the processed file, selecting a second field corresponding to a single business function in the software to be generated from the target Base table, and aggregating each second field to obtain a user table, where the second field is a user-related field;
[0033] Based on the processed file, select the third field corresponding to the single business function in the software to be generated from the target Base table, and aggregate the third fields to obtain a user behavior table, where the third field is a field related to user behavior;
[0034] Based on the user behavior object table, user table and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic.
[0035] By employing this technical solution, based on user demand information and the three dimensions of user, user behavior, and user behavior object, we select potentially dependent fields from the target Base table to generate the user table, user behavior table, and user behavior object table. Furthermore, based on the fields that the business function depends on, these three tables accurately describe the business flow logic of the business function in the software to be generated.
[0036] Optionally, based on the user behavior object table, user table, and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic, specifically including:
[0037] For a single business function, based on the user behavior object table and the user table, determine the business logic behavior node corresponding to the single user behavior in the user behavior table. The business logic behavior node includes the upstream node, current node, and downstream node of the single user behavior. The upstream node represents the state of the single user behavior at the previous moment, the current node represents the current state of the single user behavior, and the downstream node represents the state of the single user behavior at the next moment.
[0038] Assemble the business logic behavior nodes to obtain the business flow logic of the corresponding business function in the software to be generated.
[0039] By adopting the above technical solution, the various business logic behavior nodes corresponding to the same business function are assembled to obtain the business flow logic of the corresponding business function in the software to be generated, thereby forming the correct dependence of this business function on the fields in the target Base table, so that the business flow logic can be described more accurately through the target Base table, thereby making the business flow logic of the business function more reasonable.
[0040] Optionally, fine-tuning the pre-trained large model to obtain a code generation large model specifically includes:
[0041] Determine a preset third-party large model as a teacher model, and train the teacher model with a preset open source code snippet to obtain a converged teacher model, wherein the converged teacher model has the ability to identify code correctness and modify code;
[0042] Determine the pre-trained large model as the student model, and use the converged teacher model to guide the student model to perform fine-tuning training to obtain a fine-tuned large model;
[0043] If the performance index data of the large model after fine-tuning training on the verification set is better than the performance index data of the converged teacher model on the verification set, the large model after fine-tuning training is switched to the self-learning stage for training to obtain a code generation large model.
[0044] By adopting the above technical solution, if the performance index data of the large model after fine-tuning training on the validation set is better than the performance index data of the teacher model after convergence on the validation set, it means that the performance of the large model after fine-tuning training in code optimization is better than the teacher model after convergence. Then the large model after fine-tuning training is switched from the teaching stage to the self-learning stage for training, and finally a code generation large model is obtained, thereby continuously optimizing the effect of model generation software code.
[0045] In a second aspect of the present application, a device for generating software based on large model technology is provided, specifically comprising:
[0046] An information acquisition module is used to obtain the user's demand information for the software;
[0047] A file configuration module is configured to generate a configuration definition file corresponding to the requirement information through a preset code generation model, wherein the configuration definition file is a configuration file of a domain-specific language definer, and the code generation model is a model capable of generating corresponding software code according to the user's requirement information;
[0048] A format processing module, configured to reformat the configuration definition file into a regular format to obtain a processed file;
[0049] a logic determination module, configured to determine, based on the processed file, the business flow logic corresponding to the business functions in the software to be generated, and, based on the business flow logic, generate target software code corresponding to the software to be generated using the code generation macro model, wherein the format of the target software code is a configuration file format of a domain-specific language definer;
[0050] The code rendering module is used to generate the front-end page and the back-end page of the software to be generated based on the target software code through a preset rendering engine.
[0051] By adopting the above technical solution, after the information acquisition module obtains the user's demand information generated for the software, the file configuration module generates a configuration definition file corresponding to the demand information, and then the format processing module reformats the configuration definition file in a regular format to obtain the processed file. Then the logic determination module determines the business flow logic corresponding to the business functions in the software to be generated, and based on the business flow logic, generates the target software code corresponding to the software to be generated through the code generation model. Finally, the code rendering module generates the front-end page and back-end page of the software to be generated based on the target software code through a preset rendering engine.
[0052] In a third aspect of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is loaded and executed by a processor, the method steps as described in any one of the first aspects are performed.
[0053] In a fourth aspect of the present application, an electronic device is provided, specifically comprising:
[0054] A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the processor is used to load and execute the computer program stored in the memory so that the electronic device performs the method as described in any one of the first aspects.
[0055] In summary, this application includes at least one of the following beneficial technical effects:
[0056] Obtain the user's requirement information for software generation, convert this requirement information into a configuration definition file, and thus realize the conversion of the requirement information into a unified and standardized JSON DSL format, thereby ensuring the accuracy and consistency of the requirement information in the software generation and improving the accuracy of the code generation. Then reformat the configuration definition file to verify the format. Furthermore, based on the processed file representing the user's requirements, determine the business flow logic of each business function in the software to be generated, and provide an important basis for the subsequent generation of software code. Then, generate the target software code through the code generation model, and finally use the rendering engine to render and generate the front-end and back-end pages of the software to be generated based on the code to complete the automatic generation of the software. The user only needs to enter the requirement information and does not need to manually participate in the coding. Based on the code generation model, the corresponding software is automatically generated quickly and efficiently, thereby improving the efficiency of software development. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is a flow chart of a method for generating software based on large model technology provided in an embodiment of the present application;
[0058] Figure 2 This is a schematic diagram of the structure of a device for generating software based on large model technology provided in an embodiment of the present application;
[0059] Figure 3 This is a structural diagram of another device for generating software based on large model technology provided in an embodiment of the present application.
[0060] Explanation of the accompanying drawings: 11. Information acquisition module; 12. File configuration module; 13. Format processing module; 14. Logic determination module; 15. Code rendering module; 16. Model determination module. DETAILED DESCRIPTION
[0061] In order to enable people skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0062] In the description of the embodiments of this application, words such as "exemplary," "for example," or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.
[0063] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0064] See also Figure 1 The present application discloses a flowchart of a method for generating software based on large-scale modeling technology. The method can be implemented as a computer program or run on a device based on the von Neumann architecture that generates software based on large-scale modeling technology. The computer program can be integrated into an application or run as a standalone tool application, specifically including:
[0065] S101: Obtaining user demand information for software.
[0066] Specifically, in an embodiment of the present application, the user is a user who wants to generate a certain type of software product. The demand information is the user's functional requirement information, performance requirement information, or security requirement information for the software to be generated, that is, the software product to be generated. Exemplarily, the demand information may be: generating e-commerce shopping software with multi-channel payment, shopping cart and other functions. In other embodiments, the demand information may also be: adding shopping cart and other functions to existing e-commerce shopping software. Furthermore, the demand information may be text demand information. In other embodiments, the demand information may also be non-text demand information, specifically in the form of video, picture or voice, or a combination of multiple forms such as video, picture or voice.
[0067] In addition, the embodiment of the present application discloses a method for generating software based on large model technology, the execution subject of which is a server. The server is wirelessly connected to the user's terminal. The user's terminal can be a personal computer or a tablet computer. The terminal is installed with a client that automatically generates software. The server can be a background server corresponding to the client. Specifically, it can be an independent physical server or a server cluster composed of multiple physical servers. Furthermore, a feasible way to obtain demand information is: the user enters the demand information for the software to be generated in the client in the terminal, and the client sends the demand information to the server through the software development kit (SDK). Finally, the server obtains the demand information generated by the user for the software.
[0068] In other embodiments, before obtaining the user's requirement information for the software, the method further includes: introducing a latent key-value cache into the multi-head self-attention mechanism of the Transformer model, and storing the expert gate in the latent key-value cache to obtain an initial large model;
[0069] Input the preset code data sample into the initial large model and perform attention QKV calculation to obtain the KV intermediate result;
[0070] The KV intermediate results are stored in the Latent key-value cache, and a mapping relationship between the KV intermediate results and the preset expert modules is established through expert gating;
[0071] Input the preset token samples into the initial large model for pre-training. Based on the mapping relationship, add the expert dimension to the hidden layer output corresponding to the token samples. Repeat the step of inputting the preset token samples into the initial large model for pre-training until the model converges to obtain the pre-trained large model.
[0072] Fine-tune the pre-trained large model to obtain the code generation large model.
[0073] Specifically, the Multi-Head Self-Attention (MSA) mechanism is a core component of the Transformer model. It operates multiple independent attention mechanisms in parallel to obtain attention distributions across different subspaces of the input sequence, thereby more comprehensively capturing the diverse potential semantic connections within the sequence. A latent key-value cache is a data structure that stores key-value pairs for fast information storage and retrieval. Expert gating is a mechanism used in deep learning models, particularly in architectures with multiple expert modules, to efficiently distribute input data to different expert modules. Its core goal is to dynamically route data to the most appropriate expert module for processing based on input features, thereby improving overall model performance and efficiency. The attention QKV calculation is the core component of the attention mechanism. By generating three matrices: query (Q), key (K), and value (V), attention analysis is performed, ultimately enabling efficient processing of the model's input and information extraction. The key and value matrices are referred to as KV intermediate results. Furthermore, the latent key-value cache is introduced into the multi-head self-attention mechanism of the Transformer model, and the expert gating is stored in the latent key-value cache to obtain the initial large model.
[0074] Furthermore, a preset code data sample is input into the initial large model. During the process, the input data sample is processed into a token, and then the attention QKV is calculated to obtain a KV intermediate result. The multiple KV intermediate results are then stored in the Latent key-value cache. Then, the association relationship between the KV intermediate result and the preset expert module is calculated through expert gating, and the mapping relationship between the KV intermediate result and the preset expert module is determined. The preset Token sample is then input into the initial large model for pre-training. During the process, the attention Q is calculated on the Token sample, and the degree of matching between the attention Q of this Token sample and the KV intermediate result is determined. Finally, based on the mapping relationship between the KV intermediate result and the expert module, a more suitable expert module is assigned to the KV intermediate result with the highest matching degree, and the expert dimension of the expert module is added to the hidden layer output corresponding to the Token sample, so that the model continuously learns to assign an adapted expert module according to the input Token, and at the same time, the model continuously learns the ability to understand user needs and accurately generate software code using adapted expert modules. Furthermore, the step of inputting the preset Token samples into the initial large model for pre-training is repeated until the model converges to obtain the pre-trained large model.
[0075] For example, under normal circumstances, the hidden layer output of the model is u(t), and after adding the expert dimension, the hidden layer output is u(t, e), which means that at time step t, the model output is not only related to time, but also to the corresponding expert module. Among them, the Token sample is a token that simulates the user's needs for software generation. In addition, the process of determining the matching degree between the attention Q of the Token sample and the KV intermediate result is: the KV intermediate result includes {(K1, V1), (K2, V2)......(K n , V n )}, and then calculate the attention Q of the Token sample and K1, K2...K n The cosine similarity of the KV is used to determine the matching degree with the KV intermediate result.
[0076] In another embodiment, in order to continuously optimize the effect of model generation software code, after the pre-training is completed, the pre-trained large model is fine-tuned to finally obtain a code generation large model. A feasible implementation method is: a preset third-party large model is used as a teacher model, and the third-party large model adopts GPT4. In this teacher model, roles such as questioner and programmer are initialized, and their respective multiple rounds of interaction and the corresponding docker environment for isolated operation are initialized. Then, this teacher model is trained by a preset open source code snippet. The specific process is: importing the preset open source code snippet, and asking questions according to the corresponding prompt words input, and then adding the open source code snippet to the interpreter for execution. If the execution fails, the feedback result is described in natural language to inform the questioner role and displayed in the dialogue context of the teacher model. Then, based on the feedback result, a new question is formed to inform the programmer role, so that it can modify and optimize the input open source code snippet, and attach the modified code to the context dialogue. This process is continuously iterated until the teacher model reaches a convergence state, and a converged teacher model is obtained, which has the ability to identify code correctness and modify code. Furthermore, the pre-trained large model is used as the student model, and the converged teacher model is used to guide the student model to perform fine-tuning training, that is, enter the teaching stage to obtain the fine-tuned large model. At the same time, the preset validation set is used to evaluate and test the fine-tuned large model and the converged teacher model. If the performance indicator data of the fine-tuned large model on the validation set is better than the performance indicator data of the converged teacher model on the validation set, it means that the performance of the fine-tuned large model in code optimization is better than the converged teacher model. Then the fine-tuned large model is switched from the teaching stage to the self-learning stage for training, and finally a code generation large model is obtained. If the performance indicator data of the fine-tuned large model on the validation set is not better than the performance indicator data of the converged teacher model on the validation set, then the teaching stage is continued, and the converged teacher model is used to guide the student model for training. It should be noted that the performance indicator data can be the accuracy of the model on the validation set, or it can be the recall rate or F1 value, etc.
[0077] S102: Generate a configuration definition file corresponding to the requirement information through a preset code generation model, where the configuration definition file is a configuration file of a domain-specific language definer.
[0078] Specifically, the code generation model is a large model capable of generating corresponding software code based on user requirement information. The Domain Specific Language (DSL) definer is a tool or component used to create, define, and manage DSLs. It can design language syntax and semantics tailored to the domain's needs. The configuration definition file is the DSL definer's configuration file, formatted in JSON DSL format. JSON DSL offers the advantages of structured data storage and ease of parsing, making it suitable for storing simple DSL definitions and configuration information. Furthermore, after obtaining the requirement information, it is determined whether the requirement information is textual, i.e., a requirement described in text. If not, the Qformer multimodal compatible network structure introduced in the code generation model serves as the input preprocessor for the code generation model, processing and fusing multimodal data to convert it into information suitable for processing by the code generation model. Specifically, the Qformer multimodal compatible network structure converts this requirement information into target tokens corresponding to the textual requirement. A token is the basic unit used by large language models to process input text and can be a word, subword, character, or other text fragment.
[0079] Furthermore, by simultaneously inputting the preset prompt engineering and target tokens into the large code generation model, a configuration definition file corresponding to the requirements information is generated. This allows the requirements information to be converted into a unified and standardized JSON DSL format, thereby ensuring the accuracy and consistency of the requirements information during software generation. It should be noted that prompt engineering involves designing and optimizing input prompts to guide AI models (especially large-scale language models such as the GPT series and BERT) to produce more accurate, useful, and high-quality output. By carefully constructing input prompts, the powerful capabilities of AI models are leveraged to achieve better performance in various tasks, such as text generation, machine translation, question-answering systems, code generation, and text summarization.
[0080] S103: Reformatting the configuration definition file into a regular format to obtain a processed file.
[0081] Specifically, after determining the configuration definition file corresponding to the requirement information, it is reformatted in a regular format to obtain a processed file, thereby improving the readability of the configuration definition file, checking syntax errors, cleaning data, and achieving format standardization, thereby facilitating the subsequent better generation of software code. A feasible processing method is to perform format verification on the configuration definition file and determine whether the configuration format of the database field in the configuration definition file is correct. Among them, since the JSON DSL format is a special JSON format, the format verification is mainly to perform JSON format verification. If the format is correct, then the format verification is confirmed to pass; in addition, the database field refers to the column in the database table, which is the basic component unit of the database and is used to store specific types of data. Furthermore, when the configuration definition file format verification fails or the configuration format is incorrect, the configuration definition file is subjected to regular matching, and the key field and the corresponding value value in the configuration definition file are verified one by one to obtain the verified result. Among them, regular matching is a process of using regular expressions to perform text operations. Finally, a new JOSN DSL format file is created with the correct verification result, and then it is determined that there is a missing key field compared to the configuration definition file, that is, the missing key field. The missing key field and the corresponding value value are filled in the new JOSN DSL format file, specifically filled with the default value, and finally the processed file is obtained.
[0082] S104: Based on the processed file, determine the business flow logic corresponding to the business functions in the software to be generated, and based on the business flow logic, generate the target software code corresponding to the software to be generated through the code generation model.
[0083] Specifically, the format of the target software code is the configuration file format of the domain-specific language definer. Business flow logic refers to a series of operation sequences, conditional judgments and interactive relationships that describe the business function from startup to completion. It is an important basis for ensuring the normal operation of software functions, handling exceptions and ensuring data consistency. Business function refers to a specific service or operation provided in the software to be generated to meet user or business needs. It is a functional unit with a clear business purpose in the software system, which completes a specific task through a series of operations and processes. Furthermore, in an embodiment of the present application, a feasible way to determine the business flow logic corresponding to a single business function in the software to be generated is: establish a target Base table in the database of the server, specifically crawl GitHub through crawler technology to obtain the target Base table, the target Base table includes multiple different fields, and the front-end and back-end logic are consistent in any business scenario, that is, in different business scenarios, the logical meaning and processing method carried by the fields in the target Base table remain the same or compatible at the front-end and back-end. It should be noted that the target Base table can be used to clearly organize and describe the business flow logic, because it clarifies the storage and operation sources of the data. When designing business logic, the structure of the target Base table can be used to ensure data integrity and consistency.
[0084] Furthermore, based on the processed file (representing the user's demand information), the first field corresponding to a single business function in the software to be generated is selected from the target Base table. The first field is a field related to the user behavior object. For example, the software to be generated is e-commerce shopping software, and the business function is the "shopping cart" function in the e-commerce shopping software. Then the user behavior object is the quantity, price, name, etc. of the product. Then, the first field finally selected from the target Base table is the quantity, price, name and other fields. The selected first fields are summarized to obtain a user behavior object table. Among them, the user behavior object refers to an entity or data structure used to describe the user's performance of a certain behavior in a software system or network environment. It contains the operations performed by the user when using the system, the objects of the operations, and related information of the operations.
[0085] Furthermore, based on the processed file, the second field corresponding to the individual business functions in the software to be generated is selected from the target Base table. This second field is a user-related field. For example, if the business function is a "shopping cart" function, the user-related fields in this function may be the user's username and user ID used to log in to the e-commerce shopping software. This is because the user must be logged in before adding items to their shopping cart. Therefore, the second field is the field corresponding to the username and user ID. Finally, the second fields are aggregated to form the user table.
[0086] Furthermore, based on the processed file, the third field corresponding to a single business function in the software to be generated is selected from the target Base table, and the third field is a field related to user behavior. For example, the business function is the "shopping cart" function, which involves the user adding an item to the shopping cart or deleting it from the shopping cart, etc., then the third field involves adding, deleting, and other user behavior-related fields, and finally the third fields are summarized to obtain a user behavior table. It should be noted that for each different business function in the software to be generated, the first field, second field, and third field selected from the target Base table are also different.
[0087] Finally, based on the user behavior object table, user table, and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic. One achievable implementation method is: for a single business function, based on its user behavior object table and user table, determine the business logic behavior node corresponding to a single user behavior in the user behavior table. This node includes the upstream node, current node, and downstream node of the single user behavior. The upstream node represents the state of the single user behavior at the previous moment, the current node represents the current state of the single user behavior, and the downstream node represents the state of the single user behavior at the next moment. The upstream node, current node, and downstream node can all be understood as operation nodes. For example, for the user behavior of "Place an Order" in e-commerce shopping software, the previous state of this user behavior is that the user has logged in. This operation requires information in the user table, such as the username or user ID field. Therefore, the upstream node is configured to rely on the username and other fields. The current state of this user behavior is the interface for placing an order for goods and paying for goods. This operation requires information in the user behavior object table, such as the product name field. Therefore, the current node is configured to rely on the product name and other fields. The next state of this user behavior is to add a new order to the order information. This operation requires information related to the order information in the user behavior object table. Therefore, the downstream node is configured to rely on field information such as order information.
[0088] Furthermore, the business logic behavior nodes corresponding to the same business function are assembled to obtain the business flow logic of the corresponding business function in the software to be generated. This helps establish the correct dependency of this business function on the fields in the target Base table, allowing the target Base table to more accurately describe the business flow logic, thereby making the business flow logic of the business function more reasonable. Finally, based on the business flow logic corresponding to the business function, the code generation model is used to generate the target software code corresponding to the software to be generated.
[0089] S105: Based on the target software code, a front-end page and a back-end page of the software to be generated are generated through a preset rendering engine.
[0090] Specifically, after determining the target software code corresponding to the software to be generated based on the requirements information, the corresponding front-end and back-end pages are rendered based on the target software code. The front-end page is the direct entry point and interface for users to interact with the software system. By rendering the front-end page, the various software functions are visually presented to the user, allowing them to easily operate and obtain information. The back-end page is responsible for handling core functions such as business logic and data storage. Although not directly visible to the user, it also needs to process and respond to front-end requests to ensure the normal operation of the entire software system. Furthermore, the target software code is converted into JavaScript and Python formats respectively. Based on the JavaScript code, the front-end page of the software to be generated is rendered by the front-end rendering engine. Finally, based on the Python code, the back-end page of the software to be generated is rendered by the back-end rendering engine. This ultimately completes the automatic generation of the corresponding software to be generated based on the user's software requirements using large-scale model technology. Blink is used as the front-end rendering engine, and Tornado is used as the back-end rendering engine.
[0091] In one embodiment, at least one target group type of the software to be generated is obtained. After the software to be generated is released and the users download and use it, the target business functions for which historical users have provided optimization feedback are obtained, and the first occurrence number of each target business function is counted. The larger the first occurrence number, the more likely it is that users will provide optimization feedback on the corresponding target business function in the software to be generated, and the more the corresponding target business function needs to be optimized. A first number of target business functions are selected from each target business function in descending order of the first occurrence number to be determined as key business functions, i.e., business functions that are prone to optimization feedback. Then, the group type of historical users who have provided optimization feedback on the single key business function is obtained, the second occurrence number of each group type is counted, and a second number of group types are selected from each group type in descending order of the second occurrence number to be determined as key group types for the corresponding key business function.
[0092] Furthermore, a first weight is determined for each key business function, where the first weight is the ratio of the first occurrence count of each key business function to the sum of the first occurrence counts of all key business functions. A second weight is determined for each key group type corresponding to each key business function, where the second weight is the ratio of the second occurrence count of a single key group type corresponding to the key business function to the sum of the second occurrence counts of all key group types corresponding to the key business function. Key business functions that have a target group type in each corresponding key group type are determined as reference business functions. The first product of the first weight of each reference business function and the second weight of the corresponding target group type is calculated, and each first product is summed to obtain the sum of the first products. The larger the sum of the first products, the greater the likelihood that the business function of the software to be generated needs to be optimized for its target population. If the sum of the first products exceeds a preset threshold, indicating a high likelihood, the software to be generated is determined to be optimized to better meet the needs of the target population. Based on each first product, the order of iterative optimization of the corresponding reference business functions is determined. The larger the first product, the higher the order of iterative optimization. In addition, the second product of the first weight of each key business function and the second weight of the corresponding key group type is calculated, and the second products are summed to obtain the sum of the second products of the corresponding key business functions. The maximum sum of the second products is selected from the sums of the second products, and the key business function corresponding to the maximum sum of the second products is determined as the business function to be changed. That is, when the code generation model generates the code for the business function to be changed, the code generation effect is poor, then it is determined to iteratively optimize the code generation model in its ability to generate the code for the business function to be changed.
[0093] The implementation principle of the method for generating software based on the big model technology in the embodiment of the present application is as follows: obtaining the user's requirement information for software generation, converting the requirement information into a configuration definition file, thereby converting the requirement information into a unified and standardized JSON DSL format, thereby ensuring the accuracy and consistency of the requirement information in the software generation, and improving the accuracy of the code generation. The configuration definition file is then reformatted to verify the format. Furthermore, based on the processed file representing the user's requirements, the business flow logic of each business function in the software to be generated is determined, providing an important basis for the subsequent generation of software code, and then the target software code is generated through the code generation big model. Finally, the rendering engine is used to render and generate the front-end and back-end pages of the software to be generated based on the code to complete the automatic generation of the software. The user only needs to input the requirement information and does not need to manually participate in the coding. Based on the code generation big model, the corresponding software is automatically generated quickly and efficiently, thereby improving the efficiency of software development.
[0094] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0095] See Figure 2 , which is a schematic diagram of the structure of an apparatus for generating software based on large model technology, provided in an embodiment of the present application. The apparatus for generating software based on large model technology can be implemented as all or part of the apparatus through software, hardware, or a combination of both. The apparatus includes an information acquisition module 11, a file configuration module 12, a format processing module 13, a logic determination module 14, and a code rendering module 15.
[0096] The information acquisition module 11 is used to obtain the user's demand information for the software;
[0097] A file configuration module 12 is configured to generate a configuration definition file corresponding to the requirement information through a preset code generation model. The configuration definition file is a configuration file of a domain-specific language definer. The code generation model is a model capable of generating corresponding software code according to the user's requirement information.
[0098] The format processing module 13 is used to reformat the configuration definition file into a regular format to obtain a processed file;
[0099] A logic determination module 14 is configured to determine, based on the processed file, the business flow logic corresponding to the business functions in the software to be generated, and based on the business flow logic, generate target software code corresponding to the software to be generated using a code generation model. The target software code is in the configuration file format of the domain-specific language definer.
[0100] The code rendering module 15 is used to generate the front-end page and the back-end page of the software to be generated based on the target software code through a preset rendering engine.
[0101] Optional, such as Figure 3 As shown, the device further includes a model determination module 16, which is specifically configured to:
[0102] Introducing the latent key-value cache into the multi-head self-attention mechanism of the Transformer model and storing expert gating in the latent key-value cache to obtain the initial large model;
[0103] Input the preset code data sample into the initial large model and perform attention QKV calculation to obtain the KV intermediate result;
[0104] The KV intermediate results are stored in the Latent key-value cache, and a mapping relationship between the KV intermediate results and the preset expert modules is established through expert gating;
[0105] Input the preset token samples into the initial large model for pre-training. Based on the mapping relationship, add the expert dimension to the hidden layer output corresponding to the token samples. Repeat the step of inputting the preset token samples into the initial large model for pre-training until the model converges to obtain the pre-trained large model.
[0106] Fine-tune the pre-trained large model to obtain the code generation large model.
[0107] Optionally, the file configuration module 12 is specifically used to:
[0108] Determine whether the requirement information is a text requirement;
[0109] If not, the Qformer multimodal compatible network structure introduced in the preset code generation model is used to convert the requirement information into the target token corresponding to the text requirement;
[0110] Through the preset prompt project and target token, the configuration definition file corresponding to the requirement information is determined by the code generation large model.
[0111] Optionally, the format processing module 13 is specifically configured to:
[0112] Perform format verification on the configuration definition file and determine whether the configuration format of the database fields in the configuration definition file is correct;
[0113] If the configuration definition file format verification fails or the configuration format is incorrect, regular expression matching is performed on the configuration definition file, and the key field and the corresponding value in the configuration definition file are extracted and verified to obtain the verification result;
[0114] Based on the configuration definition file, determine the missing key fields in the verification result, fill the missing key fields with default values, and obtain the processed file.
[0115] Optionally, the logic determination module 14 is specifically configured to:
[0116] Create a target Base table in the database. The fields in the target Base table are logically consistent across the front-end and back-end in any business scenario.
[0117] Based on the processed file, select the first field corresponding to a single business function in the software to be generated from the target Base table, and aggregate the first fields to obtain a user behavior object table, where the first field is a field related to the user behavior object;
[0118] Based on the processed file, select the second field corresponding to the single business function in the software to be generated from the target Base table, and aggregate the second fields to obtain the user table, where the second field is the user-related field;
[0119] Based on the processed file, select the third field corresponding to the single business function in the software to be generated from the target Base table, and summarize the third fields to obtain a user behavior table. The third field is the field related to user behavior.
[0120] Based on the user behavior object table, user table and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic.
[0121] Optionally, the logic determination module 14 is specifically configured to:
[0122] For a single business function, based on the user behavior object table and the user table, determine the business logic behavior node corresponding to a single user behavior in the user behavior table. The business logic behavior node includes the upstream node, current node, and downstream node of the single user behavior. The upstream node represents the state of the single user behavior at the previous moment, the current node represents the current state of the single user behavior, and the downstream node represents the state of the single user behavior at the next moment.
[0123] Assemble each business logic behavior node to obtain the business flow logic of the corresponding business function in the software to be generated.
[0124] Optionally, the model determination module 16 is specifically configured to:
[0125] The preset third-party large model is determined as the teacher model, and the teacher model is trained with the preset open source code snippets to obtain a converged teacher model. The converged teacher model has the ability to identify code correctness and modify code;
[0126] The pre-trained large model is determined as the student model, and the converged teacher model is used to guide the student model for fine-tuning training to obtain the fine-tuned large model;
[0127] If the performance index data of the large model after fine-tuning training on the validation set is better than the performance index data of the teacher model after convergence on the validation set, the large model after fine-tuning training will be switched to the self-learning stage for training to obtain the code generation large model.
[0128] It should be noted that the above embodiment provides an apparatus for generating software based on large model technology. When executing the method for generating software based on large model technology, the division of the above functional modules is only used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the above embodiment provides an apparatus for generating software based on large model technology and an embodiment of a method for generating software based on large model technology. The embodiment of the embodiment is based on the same concept. The implementation process is detailed in the method embodiment and will not be repeated here.
[0129] An embodiment of the present application further discloses a computer-readable storage medium, and the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, a method for generating software based on large model technology of the above embodiment is adopted.
[0130] Among them, the computer program can be stored in a computer-readable medium, the computer program includes computer program code, the computer program code can be in the form of source code, object code, executable file or certain middleware, etc. The computer-readable medium includes any entity or device that can carry computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that computer-readable medium includes but is not limited to the above-mentioned components.
[0131] Among them, through this computer-readable storage medium, a method of generating software based on large model technology in the above embodiment is stored in a computer-readable storage medium, and is loaded and executed on a processor to facilitate the storage and application of the above method.
[0132] An embodiment of the present application also discloses an electronic device, in which a computer program is stored in a computer-readable storage medium. When the computer program is loaded and executed by a processor, the above-mentioned method for generating software based on large model technology is adopted.
[0133] Among them, the electronic device can be an electronic device such as a desktop computer, a laptop computer or a cloud server, and the electronic device includes but is not limited to a processor and a memory. For example, the electronic device can also include input and output devices, network access devices and buses, etc.
[0134] Among them, the processor can adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be adopted. The general-purpose processor can adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.
[0135] Among them, the memory can be an internal storage unit of the electronic device, such as the hard disk or memory of the electronic device, or it can be an external storage device of the electronic device, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD) or flash memory card (FC) equipped on the electronic device. In addition, the memory can also be a combination of an internal storage unit and an external storage device of the electronic device. The memory is used to store computer programs and other programs and data required by the electronic device. The memory can also be used to temporarily store data that has been output or is to be output. This application does not impose any restrictions on this.
[0136] Among them, through this electronic device, a method of generating software based on large model technology in the above embodiment is stored in the memory of the electronic device, and is loaded and executed on the processor of the electronic device for easy use.
[0137] The above description is merely an exemplary embodiment of the present disclosure and is not intended to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A method for generating software based on large model technology, characterized in that: The method comprises: Obtain user-generated demand information for software; Generating a configuration definition file corresponding to the requirement information through a preset code generation macromodel, including: determining whether the requirement information is a text requirement; if not, converting the requirement information into a target token corresponding to the text requirement through a Qformer multimodal compatible network structure introduced in the preset code generation macromodel; determining a configuration definition file corresponding to the requirement information through the code generation macromodel using a preset prompt project and the target token, wherein the configuration definition file is a configuration file of a domain-specific language definer, and the code generation macromodel is a macromodel capable of generating corresponding software code according to the user's requirement information; Reformatting the configuration definition file into a regular format to obtain a processed file; Based on the processed file, determining the business flow logic corresponding to the business functions in the generated software, including: establishing a target Base table in the database, wherein the fields in the target Base table are consistent in front-end and back-end logic in any business scenario; Based on the processed file, selecting the first field corresponding to the single business function in the software to be generated from the target Base table, and aggregating the first fields to obtain a user behavior object table, where the first field is a field related to the user behavior object; Based on the processed file, selecting a second field corresponding to a single business function in the software to be generated from the target Base table, and aggregating each second field to obtain a user table, where the second field is a user-related field; Based on the processed file, select the third field corresponding to the single business function in the software to be generated from the target Base table, and aggregate the third fields to obtain a user behavior table, where the third field is a field related to user behavior; Based on the user behavior object table, user table, and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic; and based on the business flow logic, the target software code corresponding to the software to be generated is generated through the code generation macro model, and the format of the target software code is the configuration file format of the domain-specific language definer; Based on the target software code, a front-end page and a back-end page of the software to be generated are generated through a preset rendering engine.
2. The method for generating software based on large model technology according to claim 1, characterized in that: Before obtaining the user's requirement information for the software, the method further includes: Introducing a latent key-value cache into the multi-head self-attention mechanism of the Transformer model and storing expert gates in the latent key-value cache to obtain an initial large model; Input the preset code data sample into the initial large model and perform attention QKV calculation to obtain the KV intermediate result; Storing the KV intermediate result in the Latent key-value cache, and establishing a mapping relationship between the KV intermediate result and a preset expert module through the expert gating; Inputting a preset Token sample into the initial large model for pre-training, adding an expert dimension to the hidden layer output corresponding to the Token sample based on the mapping relationship, and repeatedly performing the step of inputting the preset Token sample into the initial large model for pre-training until the model converges, thereby obtaining a pre-trained large model; The pre-trained large model is fine-tuned to obtain a code generation large model.
3. The method for generating software based on large model technology according to claim 1, characterized in that: The step of reformatting the configuration definition file in a regular format to obtain a processed file specifically includes: Performing format verification on the configuration definition file and determining whether the configuration format of the database field in the configuration definition file is correct; When the configuration definition file format verification fails or the configuration format is incorrect, regular expression matching is performed on the configuration definition file, key fields and corresponding value values in the configuration definition file are extracted and verified to obtain a verification result; Based on the configuration definition file, the missing key fields in the verified result are determined, and default values are filled in for the missing key fields to obtain a processed file.
4. The method for generating software based on large model technology according to claim 1, characterized in that: Based on the user behavior object table, user table, and user behavior table corresponding to a single business function, the business logic of the corresponding business function in the software to be generated is described to obtain the corresponding business flow logic, specifically including: For a single business function, based on the user behavior object table and the user table, determine the business logic behavior node corresponding to the single user behavior in the user behavior table. The business logic behavior node includes the upstream node, current node, and downstream node of the single user behavior. The upstream node represents the state of the single user behavior at the previous moment, the current node represents the current state of the single user behavior, and the downstream node represents the state of the single user behavior at the next moment. Assemble the business logic behavior nodes to obtain the business flow logic of the corresponding business function in the software to be generated.
5. The method for generating software based on large model technology according to claim 2, characterized in that: Fine-tuning the pre-trained large model to obtain a code generation large model specifically includes: Determine a preset third-party large model as a teacher model, and train the teacher model with a preset open source code snippet to obtain a converged teacher model, wherein the converged teacher model has the ability to identify code correctness and modify code; Determine the pre-trained large model as the student model, and use the converged teacher model to guide the student model to perform fine-tuning training to obtain a fine-tuned large model; If the performance index data of the large model after fine-tuning training on the verification set is better than the performance index data of the converged teacher model on the verification set, the large model after fine-tuning training is switched to the self-learning stage for training to obtain a code generation large model.
6. A device for generating software based on large model technology, used to implement the method for generating software based on large model technology according to any one of claims 1 to 5, characterized in that: include: An information acquisition module (11) is used to obtain the user's demand information for the software; A file configuration module (12) is used to generate a configuration definition file corresponding to the requirement information through a preset code generation model, wherein the configuration definition file is a configuration file of a domain specific language definer, and the code generation model is a model capable of generating corresponding software code according to the user's requirement information; A format processing module (13) is used to reformat the configuration definition file into a regular format to obtain a processed file; A logic determination module (14) is used to determine the business flow logic corresponding to the business functions in the software to be generated based on the processed file, and based on the business flow logic, generate the target software code corresponding to the software to be generated through the code generation model, wherein the format of the target software code is the configuration file format of the domain specific language definer; The code rendering module (15) is used to generate the front-end page and the back-end page of the software to be generated based on the target software code through a preset rendering engine.
7. A computer-readable storage medium storing a computer program, wherein: When the computer program is loaded and executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: When the processor loads and executes the computer program, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Conversational software function generation method and system based on large language model
CN118276826A
Software product development method and device, electronic equipment and nonvolatile storage medium
CN118916451A