Model training method, code engineering management method and device
The language model is used to translate natural language into code that can be recognized by the code engineering management model, and the code engineering management model is used to automatically manage the code engineering, which solves the problems of low code engineering management efficiency and high labor cost in the existing technology, and achieves high efficiency and high labor cost. Accurate code engineering management.
Patent Information
- Application Number
- CN202411378387.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-21
AI Technical Summary
It is difficult to efficiently manage a large number of code engineering in the prior art, and technicians need to master a variety of programming languages and code engineering management knowledge, resulting in high labor costs and low management efficiency.
The language model translates natural language into code that can be recognized by the code engineering management model, allowing users to manage code engineering through natural language instructions, automate management operations through the code engineering management model, and adjust model parameters to improve management efficiency.
It improves the efficiency of code engineering management, reduces labor costs, avoids subjective human errors, enhances the accuracy of management, and expands the applicability of the code engineering management model.
Smart Images

Figure CN119336383A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a model training method, a code engineering management method and a device. Background Art
[0002] Usually, each company has a huge number of code projects, and there are many types of programming languages, such as Java, C, C++, etc. The workload of managing code projects by technical personnel is large, and technical personnel need to be proficient in multiple programming languages and code project management knowledge, which has high requirements for technical personnel and high labor costs. Moreover, it is difficult for technical personnel to achieve batch management of code projects. Summary of the invention
[0003] The present application provides a model training method, a code engineering management method and a device for improving the efficiency of code engineering management and reducing labor costs.
[0004] In a first aspect, an embodiment of the present application provides a model training method, comprising:
[0005] Inputting a training sample into a language model, the training sample including a natural language and a standard code project for indicating a management operation on a code project at a first storage address; obtaining a first code generated by translating the natural language by the language model; the first code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0006] Inputting the first code into the code engineering management model, obtaining the code engineering management model to run the first code, and outputting an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0007] The first loss values of the code engineering and the standard code engineering after the management operation are calculated, and the parameters of the language model and the code engineering management model are adjusted with the first loss value being less than the preset first loss value to obtain the adjusted language model and the code engineering management model.
[0008] In this solution, the natural language is translated into the first code that can be recognized by the code engineering management model through the language model, so that the user only needs to input the natural language that expresses his needs, and does not need to be proficient in the code writing method for code engineering management, which can improve the user experience; the code engineering is managed and operated by the code engineering management model, and there is no need for manual management of the code engineering that needs to be managed and operated one by one, which can improve the efficiency of code engineering management, reduce labor costs, avoid human subjective errors, and improve the accuracy of code engineering management;
[0009] In addition, the source of training samples for the code engineering management model can be not only the existing training set, but also the first code output by the language model. The training samples are richer, making the final code engineering management model more widely applicable, which can further improve the efficiency of code engineering management.
[0010] Optionally, each training sample also includes the programming language of the code engineering at the first storage address; obtaining the first code generated after the language model translates the natural language, including: parsing the natural language based on the language model, identifying the intention of the natural language to perform management operations on the code engineering at the first storage address, and generating the first code according to the intention using the programming language in the training sample.
[0011] In this method, the language model recognizes the intention expressed in the natural language, generates a first code according to the intention, and the first code is in the same coding language as the code engineering at the first storage address, so that the subsequent code engineering management model can directly run the first code to manage the code engineering at the first storage address. Avoiding errors due to the different coding languages of the generated first code and the code engineering to be managed can improve the reliability of the present application.
[0012] Optionally, the management operation also includes testing the code engineering of the first storage address; the training sample also includes standard test results, and the operation result also includes test results obtained after testing the code engineering of the first storage address; the method also includes: calculating a second loss value of the test result and the standard test result, and adjusting the parameters of the language model and the code engineering management model with the second loss value being less than a preset second loss value.
[0013] In this method, the management operation may also include testing the code project. If the management operation is testing the code project, the parameters of the language model and the code project management model may be adjusted according to the test results and the standard test results to improve the accuracy of the two models, making the functions of the two models more comprehensive, thereby improving the efficiency of code project management.
[0014] Optionally, the training sample also includes a standard first code, and the method also includes: calculating a third loss value of the standard first code and the first code, and adjusting the parameters of the language model with the third loss value being less than a preset third loss value.
[0015] In this method, the language model is adjusted according to the loss value of the standard first code and the first code to improve the accuracy of the language model, so that the code generated by the language model is more accurate, and the code generated by the language model is used as a training sample of the code engineering management model, thereby improving the accuracy of the code engineering management model.
[0016] Optionally, the training sample also includes a data display form and standard display data; after adjusting the parameters of the language model and the code engineering management model with the first loss value being less than a preset first loss value, the method also includes: inputting the operation result into the language model; parsing the code engineering after the management operation in the operation result based on the language model, identifying the function of the code engineering after the management operation, generating display data for expressing the function in the data display form, and acquiring the display data; calculating a fourth loss value between the display data and the standard display data, and adjusting the parameters of the language model with the fourth loss value being less than a preset fourth loss value.
[0017] In this method, since the code engineering of the management operation output by the code engineering management model is not convenient for users to intuitively understand its function and the management operation of the code engineering by the code engineering management model, the function of the code engineering can be generated into intuitive display data in the data display form desired by the user through a language model, so that users can directly view the function of the code engineering after the management operation, thereby improving the user's usage experience.
[0018] In a second aspect, an embodiment of the present application provides a code engineering management method, including:
[0019] Inputting the user's requirements into the language model, obtaining a second code generated by the language model after translating the requirements; the requirements include natural language for indicating a management operation on the code project at the first storage address; the second code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0020] Inputting the second code into the code engineering management model, obtaining the code engineering management model to run the second code, and outputting an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0021] The operation results are fed back to the user through the language model.
[0022] In this solution, the natural language input by the user is converted into a second code that can be recognized by the code engineering management model through a language model, so that the user only needs to input the natural language that expresses his or her needs, and does not need to be proficient in the code writing method for code engineering management, which can improve the user experience; the code engineering is managed by the code engineering management model, and there is no need for manual management of the code projects that need to be managed one by one, which can improve the efficiency of code engineering management, reduce labor costs, avoid human subjective errors, and improve the accuracy of code engineering management.
[0023] Optionally, before obtaining the code engineering management model to run the second code and outputting the operation result after performing a management operation on the code engineering at the first storage address, the method also includes: obtaining the code engineering at the first storage address based on the code engineering management model, and feeding back the code engineering at the first storage address to the user through a language model; and receiving a confirmation instruction from the user through the language model, and feeding back the confirmation instruction to the code engineering management model; the determination instruction is used to indicate determination to perform a management operation on the code engineering at the first storage address.
[0024] In the present method, before the code engineering management model performs a management operation on the code engineering at the first storage address, it first feeds back the acquired code engineering at the first storage address to the user, and then executes the management operation after receiving the user's confirmation instruction. This can avoid acquiring an erroneous code engineering for management operation, or mistakenly performing a management operation on a code engineering that does not need to be managed due to an erroneous first storage address input by the user, and can improve the accuracy of code engineering management.
[0025] Optionally, obtaining a second code generated after a language model is used to translate the requirement includes: determining a programming language of a code engineering project at the first storage address based on the language model, and generating the second code based on the programming language.
[0026] In this method, the generated second code has the same programming language as the code engineering at the first storage address, so that the code engineering management model can directly run the second code to perform management operations on the code engineering at the first storage address, thereby avoiding errors due to different coding languages and improving the reliability of this application.
[0027] Optionally, the requirement also includes a data display format; feeding back the operation result to the user through a language model, including: inputting the operation result into the language model; parsing the code engineering after the management operation in the operation result based on the language model, identifying the function of the code engineering after the management operation, and generating display data for describing the function in the data display format; and feeding back the display data to the user.
[0028] In this method, since the code engineering after the management operation cannot intuitively display the results of the management operation and the functions of the code engineering to the user, the code engineering after the management operation is generated into display data describing its functions in the data display form desired by the user through a language model, so that the user can more intuitively understand the results of the management operation and the functions of the code engineering, thereby improving the user's usage experience.
[0029] In a third aspect, an embodiment of the present application provides a model training device, comprising:
[0030] The translation module is used to: input a training sample into a language model, the training sample including a natural language and a standard code project for indicating a management operation to be performed on a code project at a first storage address; obtain a first code generated after the language model translates the natural language; the first code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0031] A management module is used to: input the first code into the code engineering management model, obtain the code engineering management model to run the first code, and output an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0032] The optimization module is used to calculate the first loss value of the code engineering and the standard code engineering after the management operation, adjust the parameters of the language model and the code engineering management model with the first loss value being less than the preset first loss value, and obtain the adjusted language model and code engineering management model.
[0033] Optionally, each training sample also includes the programming language of the code engineering at the first storage address; when the translation module obtains the first code generated after the language model translates the natural language, it is specifically used to: parse the natural language based on the language model, identify the intention of the natural language to perform management operations on the code engineering at the first storage address, and generate the first code according to the intention using the programming language in the training sample.
[0034] Optionally, the management operation also includes testing the code engineering of the first storage address; the training sample also includes standard test results, and the operation result also includes test results obtained after testing the code engineering of the first storage address; the optimization module is also used to: calculate a second loss value of the test results and the standard test results, and adjust the parameters of the language model and the code engineering management model with the second loss value being less than a preset second loss value.
[0035] Optionally, the training sample also includes a standard first code, and the optimization module is further used to: calculate a third loss value of the standard first code and the first code, and adjust the parameters of the language model with the third loss value being less than a preset third loss value.
[0036] Optionally, the device also includes a display module; the training sample also includes a data display form and standard display data; after the optimization module adjusts the parameters of the language model and the code engineering management model with the first loss value being less than a preset first loss value, the display module is used to: input the operation result into the language model; parse the code engineering after the management operation in the operation result based on the language model, identify the function of the code engineering after the management operation, generate display data for expressing the function in the data display form, and obtain the display data; calculate the fourth loss value between the display data and the standard display data, and adjust the parameters of the language model with the fourth loss value being less than a preset fourth loss value.
[0037] In a fourth aspect, an embodiment of the present application provides a code engineering management device, including:
[0038] The translation module is used to: input the user's requirements into the language model, and obtain a second code generated by the language model after translating the requirements; the requirements include natural language for indicating a management operation to be performed on the code project at the first storage address; the second code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0039] A management module is used to: input the second code into the code engineering management model, obtain the code engineering management model to run the second code, and output an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0040] The display module is used to: provide feedback of operation results to users through the language model.
[0041] Optionally, before the management module obtains the code engineering management model to run the second code and outputs the operation result after performing the management operation on the code engineering at the first storage address, it is also used to: obtain the code engineering at the first storage address based on the code engineering management model, and feed back the code engineering at the first storage address to the user through the language model; and receive the user's confirmation instruction through the language model, and feed back the confirmation instruction to the code engineering management model; the determination instruction is used to indicate whether to perform the management operation on the code engineering at the first storage address.
[0042] Optionally, when obtaining the second code generated after the language model translates the requirement, the translation module is specifically used to: determine the programming language of the code engineering of the first storage address based on the language model, and generate the second code based on the programming language.
[0043] Optionally, the requirement also includes a data display format; when the display module feeds back the operation result to the user through the language model, it is specifically used to: input the operation result into the language model; based on the language model, parse the code engineering after the management operation in the operation result, identify the function of the code engineering after the management operation, and generate display data for describing the function in the data display format; and feed back the display data to the user.
[0044] In a fifth aspect, an embodiment of the present application provides an electronic device comprising at least one processor, which is used to implement a method in the first aspect or any optional implementation of the first aspect or a method in the second aspect or any optional implementation of the second aspect when executing a computer program stored in a memory.
[0045] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the method in the first aspect or any optional implementation of the first aspect or the method in the second aspect or any optional implementation of the second aspect is implemented.
[0046] In the seventh aspect, an embodiment of the present application provides a computer program product, including a computer program code, which, when executed on a computer, enables the method in the first aspect or any optional implementation of the first aspect or the method in the second aspect or any optional implementation of the second aspect to be implemented.
[0047] The technical effects or advantages of one or more technical solutions provided in the third, fourth, fifth, sixth and seventh aspects of the embodiments of the present application can be correspondingly explained by the technical effects or advantages of one or more corresponding technical solutions provided in the first or second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flow chart of a model training method provided in an embodiment of the present application;
[0049] Figure 2 A flowchart of a code engineering management method provided in an embodiment of the present application;
[0050] Figure 3 An example diagram of a code engineering management framework provided in an embodiment of the present application;
[0051] Figure 4 A structural diagram of a model training device provided in an embodiment of the present application;
[0052] Figure 5 A structural diagram of a code engineering management device provided in an embodiment of the present application;
[0053] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In the technical solution of this application, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0055] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0056] The technical solution of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
[0057] It should be understood that "multiple" in the description of the embodiment of the present application refers to two or more. "First", "second" etc. in the embodiment of the present application are used to distinguish different objects, rather than to describe a specific order. The term "and / or" in the embodiment of the present application is merely a kind of association relationship describing associated objects, indicating that three relationships may exist, for example, A and / or B, which may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "includes" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. The module in the embodiment of the present application refers to a part with independent functions in a software system.
[0058] With the gradual development of various deep learning network frameworks, various language interaction models and code generation auxiliary tools have emerged. Current plug-in tools, whether they are large language models or code auxiliary tools, often use existing training sets to train models, and then further train models based on user behaviors obtained during the interaction process. In addition, simple language models are often trained using training sets of existing programming software, and actual cases are rarely used to verify the operability and accuracy of the code. In this way, the resulting model is very dependent on the existing training set. In the process of interacting with users, such plug-in tools read the code in the class and provide prompts and assistance according to the pre-trained information in the model. They often do not have a good control over the overall context information of the code project, and require a lot of manpower for testing under the demand for batch transformation of code projects.
[0059] Under the current code engineering framework, the quality of the training set largely determines the accuracy of the model. In practice, the configurations and version frameworks of different projects are usually completely different, and their dependencies, warehouses and other configurations are also not completely different. A model trained with a fixed training set cannot cover all situations. Therefore, there may be situations where the results of the model output are difficult to meet user needs or even completely do not meet user needs. In the later stage, in order to make the model adapt to user needs, users need to continuously feed new data to the model to update the model, which requires a lot of energy. In addition, a lot of manpower is needed to sort out and manage the code engineering, which is inefficient and has high labor costs.
[0060] In view of this, the embodiment of the present application provides a model training method, which translates the natural language used to indicate the management operation of the code project at the first storage address in the training sample into a first code that can be recognized by the code project management model through the language model, runs the first code through the code project management model to manage the code project at the first storage address, obtains the code project after the operation, calculates the loss value of the code project after the operation and the standard code project in the training sample, and adjusts the two models with the loss value less than the preset loss value as the goal. The trained model can manage the code project only according to the natural language input by the user, so that the user does not need to be proficient in the code writing method for code project management, and can manage the code project only by inputting the natural language expressing the management operation, thereby improving the user experience; and the user does not need to manually operate the code projects that need to be managed one by one, thereby reducing the labor cost; in addition, the code project management model can be trained not only according to the existing training samples, but also based on the language model, so that the training of the code project management model is more sufficient, the accuracy and applicability of the code project management model are improved, and the efficiency of code project management is improved.
[0061] The language model and the code engineering management model provided in the embodiment of the present application can be deployed on the same device or on different devices. When the language model and the code engineering management model are deployed on different devices, there is a communication connection between the different devices.
[0062] The method provided in the embodiments of the present application can be used with any electronic device with processing capabilities, including but not limited to computers, virtual machines, mobile phones, tablets, etc.
[0063] The method provided in the embodiment of the present application can be applied to any code engineering management or code management scenario, including but not limited to the above-mentioned management operation of the code engineering of the first storage address.
[0064] See also Figure 1 , is a model training method provided in an embodiment of the present application, the method comprising steps S101 to S103:
[0065] S101: Input a training sample into a language model, and obtain a first code generated by the language model after translating the natural language in the training sample.
[0066] The training samples include natural language and standard code engineering for indicating management operations on the code engineering at the first storage address; the first code is used to perform management operations on the code engineering at the first storage address; and the management operations include at least one of adding, deleting, and modifying.
[0067] It can be understood that the first storage address is the storage address of multiple code projects that need to be managed and configured by the user, and is usually set to the local code project storage address of the user device by default, and can also be set according to actual conditions.
[0068] Management operations include adding, such as generating a new code project based on an existing code project or directly adding new functional code to an existing code project; deleting, such as deleting an existing code project or deleting part of the code in an existing code project; modifying, such as modifying part of the functional code in an existing code project, etc. In addition, management operations may also include merging and splitting code projects, etc., which can be selected according to actual needs, and the embodiments of the present application do not limit this.
[0069] It can be understood that the language model stores the output information of the code engineering management model, including but not limited to code engineering information (coding language, storage address, function description, etc.), basic software knowledge base information, etc.
[0070] Optionally, taking the management operation of adding as an example, the natural language in the training sample can be used to add a new functional module to the code project of a project stored locally, or directly describe the information of the code project of the functional module to be added. For example, if a new function needs to be added to a certain interface, but the specific storage address of the code project corresponding to the interface is uncertain, the information of the interface can be directly described. The language model matches the code project corresponding to the interface in the stored code project information based on the description information of the interface, and obtains the storage address of the code project.
[0071] In a possible embodiment, the training sample also includes the programming language of the code engineering at the first storage address, and obtaining the first code generated by translating the natural language in the training sample by the language model specifically includes:
[0072] The natural language is parsed based on the language model to identify the intention of the natural language to perform a management operation on the code engineering of the first storage address, and the first code is generated according to the intention using the programming language in the training sample.
[0073] Exemplarily, the language model first extracts word vectors or sentence vectors in the natural language, parses and recognizes the natural language, obtains the intent expressed by the natural language, and then generates a first code that can be recognized by the code engineering management model based on the intent. It can be understood that the programming language of the first code is the same as the programming language of the code engineering at the first storage address, so that the code engineering management model can directly run the first code to manage the code engineering at the first storage address.
[0074] Optionally, the first code is only used to instruct the code engineering management model to perform management operations on the code engineering at the first storage address. After identifying the first code, the code engineering management model generates a management code in the same programming language as the code engineering at the first storage address, and runs the management code to perform management operations on the code engineering at the first storage address.
[0075] Optionally, if the programming language of the code projects for which users in the actual application scenario have management operation permissions are all the same, the user can be bound to the programming language. For example, the corresponding programming language can be determined based on the user ID of the user, without the need to obtain the specific code project to determine the programming language, thereby improving the efficiency of code project management.
[0076] In a possible embodiment, the training sample also includes a standard first code, and the method further includes: calculating a third loss value of the standard first code and the first code, and adjusting the parameters of the language model with the third loss value being less than a preset third loss value.
[0077] It can be understood that the standard first code is a standard code provided by the user for expressing the natural language, and the third loss value can be calculated according to the standard first code and the first code output by the language model, and the parameters of the language model are adjusted according to the third loss value until the loss value is less than the preset third loss value. In this way, the accuracy of the language model translation can be improved, thereby improving the efficiency and accuracy of the subsequent code engineering model training.
[0078] The method for calculating the third loss value may be to use a cross entropy loss function, a soft loss function, etc. The preset third loss value may also be set according to the actual accuracy requirements for the language model, and the embodiment of the present application does not impose any restrictions on this.
[0079] S102: Input the first code into the code engineering management model, obtain the operation result outputted after the code engineering management model runs the first code and performs a management operation on the code engineering at the first storage address.
[0080] The operation result includes the code engineering after the management operation.
[0081] Exemplarily, the operation result may also include the time used to execute the management operation, whether the management operation is successful, problems encountered when executing the management operation, etc. The output of the code engineering management model may be set according to actual conditions.
[0082] The code engineering management model includes a resource warehouse or has the authority to access the resource warehouse. The resource warehouse stores information about the code engineering at the first storage address. The code engineering management model can parse all code engineering, store the dependencies and access relationships between different code engineering, and parse and store the logical relationships between each code module in the code engineering for each code engineering, such as whether different Java modules have dependencies and can call each other, whether the methods in a class can be called and rewritten by the subclasses of the class, etc. These parsed information is stored in the resource warehouse. This facilitates the subsequent generation of new code engineering or code based on existing code engineering or code, or provides suggestions to users based on existing code engineering.
[0083] S103, calculating the first loss values of the code engineering after the management operation and the standard code engineering, adjusting the parameters of the language model and the code engineering management model with the first loss value being less than the preset first loss value, and obtaining the adjusted language model and code engineering management model.
[0084] It can be understood that the method for calculating the first loss value and the setting of the preset first loss value can be set according to the actual accuracy requirements of the two models, and the embodiments of the present application do not limit this.
[0085] In addition, the output operation results may also include other parameters, such as the running results of the code project after the management operation, the time of executing the management operation, the error message that occurs when executing the management operation, etc. The parameters of the language model and the code project management model may also be adjusted according to other parameters; and depending on the management operation, the output operation results may also be different.
[0086] In a possible example, the management operation may also include testing the code engineering of the first storage address; the training sample also includes a standard test result, and the operation result also includes a test result obtained after testing the code engineering of the first storage address; the method also includes: calculating a second loss value of the test result and the standard test result, and adjusting the parameters of the language model and the code engineering management model with the second loss value being less than a preset second loss value.
[0087] It can be understood that the calculation method of the second loss value and the setting of the preset second loss value can also be set according to actual conditions, and the embodiments of the present application do not limit this.
[0088] Optionally, before using the model training method of the embodiment of the present application to train the language model and the code engineering management model, the language model and the code engineering management model can be trained separately using an existing training set, that is, the language model and the code engineering management model used in the embodiment of the present application can be models that have been pre-trained with an existing training set.
[0089] In this way, the sources of training samples for the language model and the code engineering management model are richer. Not only can the two models be trained based on the existing training sets, but they can also be trained based on training samples related to local code engineering provided by users. In addition, the two models can also learn adversarially, so that the final language model and code engineering management model have higher accuracy and wider applicability.
[0090] In this solution, natural language is translated into the first code that can be recognized by the code engineering management model through the language model, so that users only need to input the natural language that expresses their needs, and do not need to be proficient in the code writing method for code engineering management, which can improve the user experience; the code engineering is managed by the code engineering management model, and there is no need to manually manage the code projects that need to be managed one by one, which can improve the efficiency of code engineering management, reduce labor costs, avoid human subjective errors, and improve the accuracy of code engineering management; in addition, the source of training samples for the code engineering management model can not only be the existing training set, but also include the first code output by the language model. The training samples are richer, so that the final code engineering management model has a wider applicability, which can further improve the efficiency of code engineering management.
[0091] In one possible design, since the code engineering of the management operation output by the code engineering management model cannot intuitively reflect the situation of the management operation of the code engineering and the function of the code engineering, if the code engineering of the management operation is directly fed back to the user, the user still needs to analyze the code engineering by himself, which requires high professional knowledge of the user and increases the difficulty of understanding for the user. In view of this, the above training samples also include data display form and standard display data; after step S103, the method also includes:
[0092] Input the operation results into the language model;
[0093] Parsing the code engineering after the management operation in the operation result based on the language model, identifying the function of the code engineering after the management operation, generating display data for expressing the function in a data display form, and obtaining the display data;
[0094] A fourth loss value between the display data and the standard display data is calculated, and parameters of the language model are adjusted with the fourth loss value being less than a preset fourth loss value.
[0095] Exemplarily, if the data display form is text, the standard display data is a text description of the function of the code engineering after the management operation provided by the user. After the code engineering management model outputs the operation result, the operation result is input into the language model, and the language model parses the code engineering after the management operation in the operation result according to the stored code engineering information and basic software knowledge, etc., identifies the function of the code engineering, and generates text describing the function of the code engineering. The loss value between the text generated by the language model and the text provided by the user is calculated.
[0096] In this way, the trained language model can generate display data on the functions of the code project after the management operation according to the data display format required by the user, which helps the user to intuitively view the functions of the code project after the management operation and understand the management operation status of the code project.
[0097] Optionally, the language model can also compare the code project after the management operation with the original code project, and only output the changed content, or translate the functions of the code project after the management operation and the original code project in the form of data display, and generate display data that expresses the functions of the two code projects. The specific functions of the language model are set and trained according to actual user needs.
[0098] Optionally, the code engineering information stored in the language model also includes the user described in the code engineering information. When generating display data for expressing the function in a data display form, display data that is easy for the user to understand can also be generated according to the user's programming habits. For example, if the user mainly uses Java for development, the generated display data uses professional terms related to Java programming to describe the functions of the code engineering after the management operation.
[0099] It can be understood that the text data display exemplified above is only an optional data display form. Other data display forms can be selected according to actual needs, such as pictures, tables, statistical charts, code blocks containing comments, etc., and the embodiments of the present application do not limit this.
[0100] See also Figure 2 The embodiment of the present application further provides a code engineering management method, which is applied to an electronic device including the above-mentioned trained language model and the code engineering management model, and the method includes steps S201 to S203:
[0101] S201: Input the user's requirements into a language model, and obtain a second code generated by the language model after translating the requirements.
[0102] The requirement includes a natural language for indicating a management operation on the code project at the first storage address; the second code is used to perform a management operation on the code project at the first storage address; and the management operation includes at least one of adding, deleting, and modifying.
[0103] It can be understood that the management operation may also include other operations mentioned in the above training method, which can be determined according to the functions of the actual code engineering management model.
[0104] The user's needs can be to directly express the management operations of the code project at a specific storage address, or to describe the information of a certain code project. The language model matches the code project that matches the description based on the stored code project information and obtains the storage address of the code project.
[0105] Similarly, obtaining the second code generated after the language model translates the requirement specifically includes: determining the programming language of the code engineering of the first storage address based on the language model, and generating the second code based on the programming language.
[0106] Optionally, the second code is only an instruction for instructing to perform management operations on the code engineering at the first storage address, and the code engineering management model generates a management code based on the second code, and the management code is used to perform management operations on the code engineering at the first storage address.
[0107] S202: Input the second code into the code engineering management model, obtain the code engineering management model to run the second code, and output an operation result after performing a management operation on the code engineering at the first storage address.
[0108] The operation result includes the code engineering after the management operation.
[0109] It can be understood that the operation result may also include other parameters, which can be determined based on the actual needs of the user and the specific management operation, and the embodiments of the present application will not be elaborated here.
[0110] In a possible embodiment, users usually perform batch management operations on locally stored code projects. In order to avoid obtaining erroneous code projects, management operations are performed on code projects that do not need to be managed, resulting in a large number of erroneous operations. Before the code project management model is obtained to run the second code and the code project at the first storage address is managed and the output operation result is output, the method further includes:
[0111] Acquire the code project at the first storage address based on the code project management model, and feed back the code project at the first storage address to the user through the language model;
[0112] The user's confirmation instruction is received through the language model, and the confirmation instruction is fed back to the code engineering management model; the determination instruction is used to indicate whether to perform a management operation on the code engineering at the first storage address.
[0113] Before performing management operations on the code project at the first storage address, the code project management model first determines with the user whether the correct code project has been obtained, and then performs the management operation after receiving the user's confirmation instruction. In this way, it can be avoided that the wrong code project is obtained for management operations, or the management operation is mistakenly performed on the code project that does not need to be managed due to the wrong first storage address input by the user, which can improve the accuracy of code project management.
[0114] Optionally, after the code engineering management model obtains the code engineering at the first storage address, it may only feed back the identifier (eg, name, number, etc.) of the code engineering to the user through the language model, so that the user can quickly confirm whether the obtained code engineering is correct.
[0115] S203: Feedback the operation result to the user through the language model.
[0116] In a possible example, the user's requirements also include the form of data display; the operation results are fed back to the user through the language model, specifically including:
[0117] Input the operation results into the language model;
[0118] Parse the code engineering after the management operation in the operation result based on the language model, identify the function of the code engineering after the management operation, and generate display data for describing the function in a data display form;
[0119] The display data is fed back to the user.
[0120] In this way, since the code engineering after the management operation cannot intuitively show the results of the management operation and the functions of the code engineering to the user, the user needs to analyze the code engineering after the management operation, which increases the difficulty of understanding for the user. Therefore, the code engineering after the management operation is generated into display data describing its functions in the data display form desired by the user through the language model, so that the user can more intuitively understand the results of the management operation and the functions of the code engineering, and improve the user's experience.
[0121] The above embodiments may be implemented individually or in combination.
[0122] The following is an example of a combined implementation method provided in an embodiment of the present application, taking the user's requirement of batch modifying the configuration of a certain interface as an example, which can be applied to Figure 3 The following is an example diagram of the code engineering management framework.
[0123] like Figure 3 As shown, the code engineering management model includes resource warehouse, code engineering and test engineering, and the language model includes translation layer, optimization layer and service layer.
[0124] Specifically, the resource warehouse in the code project management model is used to store information of the code project at the first storage address, including dependency relationships and access relationships between various code projects and between various modules within each code project.
[0125] The code projects in the code project management model include all code projects at the first storage address, and can support users to modify the code projects, including modifying code, dependency, configuration and other information, but cannot directly provide information feedback to users.
[0126] The test project in the code project management model provides a test environment for testing the code project.
[0127] The translation layer in the language model is used to translate the natural language input by the user into code that can be recognized by the code engineering management model, and to translate the code engineering output by the code engineering management model into display data that is easy for users to understand.
[0128] The optimization layer in the language model is used to optimize the two models to improve the accuracy and adaptability of the models. Usually, when the user modifies the dependency, call relationship or other configuration between the code projects at the first storage address, it is necessary to call the function of the optimization layer to train and optimize the two models. Users can also manually adjust the parameters of the two models based on the optimization layer.
[0129] The service layer in the language model is used to provide an interface for the language model to interact with users.
[0130] based on Figure 3 The framework example of code engineering management is as follows:
[0131] 1. The user inputs the requirements through the interface provided by the service layer of the language model. The language model receives the user input requirements through the interface of the service layer and transmits them to the translation layer.
[0132] Exemplarily, the requirement is to modify the first parameter configuration of all first interfaces from a to b, as well as a detailed description of the first interface, and to display data in a table.
[0133] 2. The translation layer of the language model translates the requirement into a second code recognizable by the code engineering management model, and sends the second code to the code engineering module of the code engineering management model, which receives the second code.
[0134] Exemplarily, the language model parses the requirement, determines the storage address of all code projects corresponding to the first interface based on the description of the first interface in the requirement, generates a second code, instructs the code project management model to modify all code projects corresponding to the first interface, and changes the first parameter configuration in the code project from a to b.
[0135] 3. The code engineering module in the code engineering management model obtains all code engineering corresponding to the first interface according to the second code, and feeds back the code engineering to the user through the language model, and the user receives feedback information from the language model.
[0136] Exemplarily, the code engineering management model may only feed back the identifiers of these code engineering projects to the user, or generate a first interface to be processed based on these code engineering projects, and feed back information of the generated first interface to the user.
[0137] 4. The user feeds back confirmation instructions to the code engineering management model through the language model, and the code engineering management model receives the confirmation instructions.
[0138] 5. The code engineering module of the code engineering management model runs the second code to modify the first parameter configurations of all first interfaces, and feeds back the modified code engineering to the language model, and the language model receives the modified code engineering.
[0139] 6. The translation layer of the language model parses the modified code project, identifies various parameter configurations of the first interface in the code project, generates a table according to the various parameter configurations of the first interface according to user requirements, and feeds the table back to the user through the interface.
[0140] It can be understood that the above is only an example of possible code engineering management and is not limited thereto.
[0141] The method provided by the embodiment of the present application is introduced above, and the device provided by the embodiment of the present application is introduced below.
[0142] Based on the same technical concept, the embodiment of the present application provides a model training device, which includes a module / unit / means for executing the method executed by the electronic device with processing capability in the above method embodiment. The module / unit / means can be implemented by software, or by hardware, or the corresponding software can be implemented by hardware.
[0143] For example, see Figure 4 , the device 400 comprises:
[0144] The translation module 401 is used to: input a training sample into a language model, the training sample including a natural language and a standard code project for indicating a management operation on a code project at a first storage address; obtain a first code generated by the language model after translating the natural language; the first code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0145] Management module 402, used to: input the first code into the code engineering management model, obtain the code engineering management model to run the first code, and output an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0146] The optimization module 403 is used to: calculate the first loss value of the code project and the standard code project after the management operation, adjust the parameters of the language model and the code project management model with the first loss value being less than the preset first loss value, and obtain the adjusted language model and code project. Optionally, each training sample also includes the programming language of the code project at the first storage address; when the translation module obtains the first code generated after the language model translates the natural language, it is specifically used to: parse the natural language based on the language model, identify the intention of the natural language to perform management operations on the code project at the first storage address, and generate the first code using the programming language in the training sample according to the intention.
[0147] Optionally, the management operation also includes testing the code engineering of the first storage address; the training sample also includes standard test results, and the operation result also includes test results obtained after testing the code engineering of the first storage address; the optimization module 403 is also used to: calculate the second loss value of the test results and the standard test results, and adjust the parameters of the language model and the code engineering management model with the second loss value being less than a preset second loss value.
[0148] Optionally, the training sample also includes a standard first code, and the optimization module 403 is further used to: calculate a third loss value of the standard first code and the first code, and adjust the parameters of the language model with the third loss value being less than a preset third loss value. Process management model.
[0149] Optionally, the device also includes a display module 404; the training sample also includes a data display form and standard display data; after the optimization module 403 adjusts the parameters of the language model and the code engineering management model with the first loss value being less than a preset first loss value, the display module 404 is used to: input the operation result into the language model; parse the code engineering after the management operation in the operation result based on the language model, identify the function of the code engineering after the management operation, generate display data for expressing the function in the data display form, and obtain the display data; calculate the fourth loss value between the display data and the standard display data, and adjust the parameters of the language model with the fourth loss value being less than a preset fourth loss value.
[0150] Based on the same technical concept, the embodiment of the present application provides a code engineering management device, which includes a module / unit / means for executing the method executed by the electronic device with processing capability in the above method embodiment. The module / unit / means can be implemented by software, or by hardware, or the corresponding software can be implemented by hardware.
[0151] For example, see Figure 5 , the device 500 comprises:
[0152] The translation module 501 is used to: input the user's requirements into the language model, and obtain the second code generated by the language model after translating the requirements; the requirements include natural language for indicating a management operation to be performed on the code project at the first storage address; the second code is used to perform a management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying;
[0153] Management module 502, used to: input the second code into the code engineering management model, obtain the code engineering management model to run the second code, and output an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation;
[0154] The display module 503 is used to: feed back the operation result to the user through the language model.
[0155] Optionally, before the management module 502 obtains the code engineering management model to run the second code and outputs the operation result after performing the management operation on the code engineering at the first storage address, it is also used to: obtain the code engineering at the first storage address based on the code engineering management model, and feed back the code engineering at the first storage address to the user through the language model; and receive the user's confirmation instruction through the language model, and feed back the confirmation instruction to the code engineering management model; the determination instruction is used to indicate whether to perform the management operation on the code engineering at the first storage address.
[0156] Optionally, when obtaining the second code generated after the language model translates the requirement, the translation module 501 is specifically used to: determine the programming language of the code engineering of the first storage address based on the language model, and generate the second code based on the programming language.
[0157] Optionally, the requirement also includes a data display format; when the display module 503 feeds back the operation result to the user through the language model, it is specifically used to: input the operation result into the language model; based on the language model, parse the code engineering after the management operation in the operation result, identify the function of the code engineering after the management operation, and generate display data for describing the function in the data display format; and feed back the display data to the user.
[0158] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0159] Based on the same technical concept, see Figure 6 The embodiment of the present application further provides an electronic device 600, including:
[0160] At least one processor 601; and a communication interface 603 that is communicatively connected to the at least one processor 601; the at least one processor 601 executes instructions stored in the memory 602, so that the electronic device 600 executes the method steps performed by the billboard in the above method embodiment through the communication interface 603.
[0161] Optionally, the memory 602 is located outside the electronic device 600 .
[0162] Optionally, the electronic device 600 includes the memory 602, the memory 602 is connected to the at least one processor 601, and the memory 602 has instructions that can be executed by the at least one processor 601. Figure 6 The dashed lines indicate that the memory 602 is optional for the electronic device 600 .
[0163] The at least one processor 601 and the memory 602 may be coupled via an interface circuit or may be integrated together, which is not limited here.
[0164] The specific connection medium between the at least one processor 601, the memory 602 and the communication interface 603 is not limited in the embodiment of the present application. Figure 6 In the embodiment, at least one processor 601, a memory 602 and a communication interface 603 are connected via a bus 604. Figure 6 The connection between other components is only for schematic illustration and is not intended to be limiting. The bus part may be an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
[0165] It should be understood that the processor mentioned in the embodiments of the present application can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor implemented by reading software code stored in a memory.
[0166] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0167] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DirectRambus RAM, DR RAM).
[0168] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.
[0169] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0170] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the computer executes the method steps executed by any device in the above method embodiments.
[0171] Based on the same technical concept, an embodiment of the present application also provides a computer program product, including computer program code. When the computer program code is executed on a computer, the method steps executed by any device in the above method embodiment are implemented.
[0172] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0173] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0174] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0175] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0176] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A model training method, characterized in that: include: Inputting a training sample into a language model, the training sample comprising a natural language and a standard code engineering for indicating a management operation to be performed on the code engineering of the first storage address; Obtaining a first code generated by translating the natural language by the language model; The first code is used to perform the management operation on the code project of the first storage address; the management operation includes at least one of adding, deleting, and modifying; Inputting the first code into the code engineering management model, obtaining the operation result outputted after the code engineering management model runs the first code and performs a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation; Calculate the first loss value of the code engineering and the standard code engineering after the management operation, adjust the parameters of the language model and the code engineering management model with the first loss value being less than a preset first loss value, and obtain the adjusted language model and code engineering management model.
2. The method according to claim 1, characterized in that Each of the training samples also includes the programming language of the code engineering of the first storage address; The obtaining of the first code generated by translating the natural language by the language model includes: The natural language is parsed based on the language model to identify the intention indicated by the natural language to perform management operations on the code engineering of the first storage address, and the first code is generated according to the intention using the programming language in the training sample.
3. The method according to claim 1, characterized in that The management operation further includes testing the code engineering of the first storage address; the training sample further includes a standard test result, and the operation result further includes a test result obtained after testing the code engineering of the first storage address; The method further includes: calculating a second loss value of the test result and the standard test result, and adjusting parameters of the language model and the code engineering management model with the second loss value being smaller than a preset second loss value.
4. The method according to claim 1, characterized in that The training sample also includes a standard first code, and the method further includes: calculating a third loss value of the standard first code and the first code, and adjusting the parameters of the language model with the third loss value being less than a preset third loss value.
5. The method according to claim 1, characterized in that The training sample also includes a data display form and standard display data; after adjusting the parameters of the language model and the code engineering management model with the first loss value being less than a preset first loss value, the method further includes: inputting the operation result into the language model; parsing the code engineering after the management operation in the operation result based on the language model, identifying the function of the code engineering after the management operation, generating display data for describing the function in the data display form, and acquiring the display data; A fourth loss value between the display data and the standard display data is calculated, and parameters of the language model are adjusted with the fourth loss value being smaller than a preset fourth loss value.
6. A code engineering management method, characterized in that: include: Inputting the user's requirements into a language model, and obtaining a second code generated by translating the requirements by the language model; The requirement includes a natural language for indicating a management operation to be performed on a code project at a first storage address; the second code is used to perform the management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying; Inputting the second code into a code engineering management model, obtaining an operation result outputted after the code engineering management model runs the second code and performs a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation; The operation result is fed back to the user through the language model.
7. The method according to claim 6, characterized in that Before obtaining the code engineering management model to run the second code and outputting an operation result after performing a management operation on the code engineering at the first storage address, the method further includes: Acquire the code project of the first storage address based on the code project management model, and feed back the code project of the first storage address to the user through the language model; The user's confirmation instruction is received through the language model, and the confirmation instruction is fed back to the code engineering management model; the confirmation instruction is used to indicate whether to perform the management operation on the code engineering at the first storage address.
8. The method according to claim 6, characterized in that The obtaining of the second code generated by translating the requirement by the language model includes: A programming language of the code engineering of the first storage address is determined based on the language model, and the second code is generated based on the programming language.
9. The method according to claim 6, characterized in that The requirement also includes a data display form; the feeding back the operation result to the user through the language model includes: inputting the operation result into the language model; parsing the code engineering after the management operation in the operation result based on the language model, identifying the function of the code engineering after the management operation, and generating display data for describing the function in the data display form; The display data is fed back to the user.
10. A model training device, characterized in that: include: A translation module, used to: input a training sample into a language model, wherein the training sample includes a natural language and a standard code project for indicating a management operation on the code project of the first storage address; Obtaining a first code generated by translating the natural language by the language model; The first code is used to perform the management operation on the code project of the first storage address; the management operation includes at least one of adding, deleting, and modifying; A management module is used to: input the first code into the code engineering management model, obtain the operation result outputted after the code engineering management model runs the first code and performs a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation; The optimization module is used to calculate the first loss value of the code engineering and the standard code engineering after the management operation, adjust the parameters of the language model and the code engineering management model with the first loss value being less than the preset first loss value, and obtain the adjusted language model and code engineering management model.
11. A code engineering management device, characterized in that: include: A translation module, used to: input the user's requirements into a language model, and obtain a second code generated after the language model translates the requirements; The requirement includes a natural language for indicating a management operation to be performed on a code project at a first storage address; the second code is used to perform the management operation on the code project at the first storage address; the management operation includes at least one of adding, deleting, and modifying; A management module is used to: input the second code into a code engineering management model, obtain the code engineering management model to run the second code, and output an operation result after performing a management operation on the code engineering at the first storage address; the operation result includes the code engineering after the management operation; The transceiver module is used to: feed back the operation result to the user through the language model.
12. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in the method according to any one of claims 1 to 5 or any one of claims 6 to 9 according to the obtained program instructions.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to have a computer program, which includes program instructions. When the program instructions are executed by a computer, the method according to any one of claims 1 to 5 or the method according to any one of claims 6 to 9 is implemented.
14. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 5 or the method according to any one of claims 6 to 9.