Code processing model training, code task processing, and code development methods
By simulating the software development process, the code processing model is trained, and the problems of low efficiency and poor code processing quality are solved, and efficient and full-process code processing capabilities are achieved.
Patent Information
- Application Number
- CN202411327211.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-09-19
AI Technical Summary
Traditional software development processes are time-consuming and inefficient, making it difficult to adapt to rapidly changing market demands. Existing code generation tools mainly focus on static code processing, and cannot effectively deal with complex code tasks, resulting in poor code processing quality.
By obtaining sample code documents of sample projects, simulating project development cycles, training code processing models, understanding project architecture, dependencies and dynamic development processes, and generating code processing models that can handle complex code tasks.
It significantly improves software development efficiency, reduces development costs, and can participate in full process work such as requirements analysis, architecture design, testing and maintenance, improving code processing quality and adaptability.
Smart Images

Figure CN118860900B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular to code processing model training, code task processing, and code development methods. Background Art
[0002] With the rapid development of artificial intelligence technology, especially the widespread application of large models in various fields, the field of software engineering has also ushered in opportunities for intelligent transformation. Traditional manual software development processes are often time-consuming and inefficient, and are difficult to adapt to rapidly changing market demands.
[0003] Currently, automated code processing can usually be performed through code generation and auxiliary tools. However, the above tools mainly focus on the generation and completion of static code and cannot cope with complex code tasks, resulting in poor code processing quality. Summary of the invention
[0004] In view of this, an embodiment of this specification provides a code processing model training method. One or more embodiments of this specification also involve a code task processing method, a code development method, an information processing method based on a code processing model, a task platform, a code processing model training device, a code task processing device, a code development device, an information processing device based on a code processing model, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a code processing model training method is provided, including:
[0006] Obtain a sample code document of a sample project, wherein the sample code document includes a sample problem and a sample patch corresponding to the sample problem;
[0007] According to the sample problems and the sample patches, a project development cycle of a sample project is simulated to obtain sample code data, wherein the sample code data includes sample phase data corresponding to a plurality of project development phases in the project development cycle;
[0008] The pre-trained processing model is trained using the sample code data to obtain a code processing model, wherein the pre-trained processing model is trained based on the sample code document.
[0009] According to a second aspect of an embodiment of this specification, a code task processing method is provided, including:
[0010] Get the code data to be processed of the target code task;
[0011] The code data to be processed is input into the code processing model to obtain the code processing result, wherein the code processing model is trained using the code processing model training method.
[0012] According to a third aspect of an embodiment of this specification, a code development method is provided, which is applied to a server, and includes:
[0013] Receiving code requirement information sent by a terminal device;
[0014] Inputting the code requirement information into a code processing model to obtain a target code, wherein the code processing model is trained using a code processing model training method;
[0015] Feedback the target code to the terminal device.
[0016] According to a fourth aspect of the embodiments of this specification, there is provided an information processing method based on a code processing model, which is applied to a task platform and includes:
[0017] Receiving a model request sent by a terminal device;
[0018] Based on the model request, a target code processing model is determined from a plurality of code processing models, wherein the plurality of code processing models are trained based on a code processing model training method.
[0019] According to a fifth aspect of the embodiments of this specification, there is provided a task platform, including a request interface and a response unit;
[0020] A request interface, used to receive a model request sent by a terminal device, wherein the model request includes a scene identifier of a target scene, scene input data of the target scene, and at least one of a model specification parameter;
[0021] The response unit is used to determine a target code processing model from a plurality of code processing models based on a model request, wherein the plurality of code processing models are trained based on a code processing model training method.
[0022] According to a sixth aspect of an embodiment of this specification, a code processing model training device is provided, including:
[0023] A first acquisition module is configured to acquire a sample code document of a sample project, wherein the sample code document includes a sample problem and a sample patch corresponding to the sample problem;
[0024] A simulation module is configured to simulate a project development cycle of a sample project according to the sample problem and the sample patch, and obtain sample code data, wherein the sample code data includes sample phase data corresponding to a plurality of project development phases in the project development cycle;
[0025] The training module is configured to train the pre-trained processing model using the sample code data to obtain the code processing model, wherein the pre-trained processing model is trained based on the sample code document.
[0026] According to a seventh aspect of the embodiments of this specification, there is provided a code task processing device, including:
[0027] A second acquisition module is configured to acquire the to-be-processed code data of the target code task;
[0028] The first input module is configured to input the code data to be processed into the code processing model to obtain the code processing result, wherein the code processing model is trained using the code processing model training method.
[0029] According to an eighth aspect of the embodiments of this specification, a code development device is provided, which is applied to a server, including:
[0030] A first receiving module is configured to receive code requirement information sent by a terminal device;
[0031] A second input module is configured to input the code requirement information into a code processing model to obtain a target code, wherein the code processing model is trained using a code processing model training method;
[0032] The feedback module is configured to feed back the target code to the terminal device.
[0033] According to a ninth aspect of the embodiments of this specification, there is provided an information processing device based on a code processing model, which is applied to a task platform, including:
[0034] A second receiving module is configured to receive a model request sent by a terminal device;
[0035] The determination module is configured to determine a target code processing model from a plurality of code processing models based on a model request, wherein the plurality of code processing models are trained based on a code processing model training method.
[0036] According to a tenth aspect of an embodiment of this specification, a computing device is provided, including:
[0037] Memory and processor;
[0038] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method provided in the first aspect, the second aspect, the third aspect, or the fourth aspect are implemented.
[0039] According to the eleventh aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method provided in the first aspect, the second aspect, the third aspect, or the fourth aspect are implemented.
[0040] According to the twelfth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the method provided in the first aspect, the second aspect, the third aspect, or the fourth aspect.
[0041] A code processing model training method provided by an embodiment of the present specification includes: obtaining a sample code document of a sample project, wherein the sample code document includes sample problems and sample patches corresponding to the sample problems; simulating the project development cycle of the sample project according to the sample problems and sample patches to obtain sample code data, wherein the sample code data includes sample stage data corresponding to multiple project development stages in the project development cycle; using the sample code data, training a pre-trained processing model to obtain a code processing model, wherein the pre-trained processing model is trained based on the sample code document. By simulating the project development cycle to obtain sample code data, the code processing model can understand the architecture of the entire project, the dependencies between project development stages, and the dynamic project development process over time, and learn the full process knowledge of code implementation, so that it can handle complex code tasks, and comprehensively improve the adaptability to project changes and code processing capabilities based on the full process knowledge. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is an architecture diagram of a code task processing system provided by an embodiment of this specification;
[0043] Figure 2 is a flowchart of a code processing model training method provided by an embodiment of this specification;
[0044] Figure 3 is a flow chart of a code task processing method provided by an embodiment of this specification;
[0045] Figure 4 is a flow chart of a code development method provided by an embodiment of this specification;
[0046] Figure 5 is a processing flow chart of a code task processing method provided by an embodiment of this specification;
[0047] Figure 6 is a flowchart of an information processing method based on a code processing model provided by an embodiment of this specification;
[0048] Figure 7 It is a structural diagram of a task platform provided by an embodiment of this specification;
[0049] Figure 8 It is a structural diagram of a code processing model training device provided by an embodiment of this specification;
[0050] Fig. 9 It is a structural diagram of a code task processing device provided by an embodiment of this specification;
[0051] Fig.10 It is a structural schematic diagram of a code development device provided by an embodiment of this specification;
[0052] Fig.11 is a schematic diagram of the structure of an information processing device based on a code processing model provided by an embodiment of this specification;
[0053] Fig.12 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0054] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0055] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0056] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0057] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0058] In one or more embodiments of this specification, a large model refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than 10 trillion model parameters. A large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM, Large Language Model), a multi-modal pre-training model, etc.
[0059] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image description (IC, Image Caption), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0060] First, the terms involved in one or more embodiments of this specification are explained.
[0061] Automated Software Engineering (ASE) refers to the process of using automation technology and tools in the field of software engineering to improve the efficiency of software development, testing, deployment and maintenance. The goal of automated software engineering is to reduce human errors, improve productivity and accelerate the software delivery cycle.
[0062] Git repository: It is a place in the Git version control system for storing all project files and their historical versions. A Git repository contains the complete history of the project, including every commit information, file change records, and metadata such as branches and tags.
[0063] Static code: usually refers to the source code that has been determined and written before the program is run. In computer programming, when writing a program, every line of code written is static code, which is the code that already exists during the compilation stage or before the interpretation and execution. These codes will not be dynamically generated or changed when the program is running.
[0064] Supervised Fine-Tuning (SFT): is a further training method based on a pre-trained model. In this method, the model is trained on a dataset containing input and expected output pairs so that the model can learn how to generate answers closer to human level. Supervised fine-tuning is usually used to adapt the model to data in a specific task or domain, thereby improving the model's performance on these tasks.
[0065] Traditional software development processes are often time-consuming, inefficient, and difficult to adapt to rapidly changing market demands. For example, a large software project may take months or even years from requirements analysis to final release. In this process, requirements changes, code refactoring, and problem (bug) repair often lead to project delays and cost overruns. Current code generation and auxiliary tools mainly focus on static code generation and completion, which causes these models to perform poorly when handling complex software engineering tasks, making it difficult to adapt to real software development environments and unable to comprehensively improve the efficiency and quality of software development.
[0066] In order to solve the above problems, the embodiments of this specification propose an intelligent model training solution for the entire process of software project development. By understanding and simulating the entire software development process, the trained model can not only generate high-quality code, but also understand the architecture of the entire project, the dependencies between modules, and the project evolution process over time, and can further participate in the full process of project development such as demand analysis, architecture design, testing and maintenance. In addition, by integrating the dynamic process data of project development into model training, a code processing model that can understand the entire process of software development is constructed, thereby greatly improving the efficiency of software project development, reducing development costs, and providing strong basic support for the field of automated software engineering.
[0067] In this specification, a code processing model training method is provided. This specification also involves a code task processing method, a code development method, an information processing method based on a code processing model, a task platform, a code processing model training device, a code task processing device, a code development device, an information processing device based on a code processing model, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0068] Considering that the model parameters of the code processing model are relatively large and the computing resources of the client are limited, the code task processing method proposed in the embodiment of this specification can be applied to Figure 1 The code task processing system shown is not limited to this. Figure 1 , Figure 1 The following is an architecture diagram of a code task processing system provided by an embodiment of the present specification. The code task processing system may include a client 100 and a server 200;
[0069] The client 100 is used to send the to-be-processed code data of the target code task to the server 200;
[0070] The server 200 is used to input the code data to be processed into the code processing model to obtain the code processing result, wherein the code processing model is trained using the code processing model training method; and send the code processing result to the client 100;
[0071] The client 100 is also used to receive the code processing result sent by the server 200.
[0072] like Figure 1 As shown, the code processing model is deployed in the server 200, and the server 200 can be connected to one or more clients 100 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks. The client 100 may include, but is not limited to: a smart phone, a tablet computer, a laptop computer, a PDA, a personal computer, a smart home device, a vehicle-mounted device, etc. The client 100 can also interact with the user through a graphical user interface to implement the call of the code processing model, thereby implementing the code task processing method provided in the embodiment of this specification.
[0073] It is worth noting that the code task processing method provided in the embodiments of this specification is generally executed by the server, but in other embodiments of this specification, when the operating resources of the client can meet the deployment and operating conditions of the code processing model, the client can also have similar functions as the server, thereby executing the code task processing method provided in the embodiments of this specification. In other embodiments, the code task processing method provided in the embodiments of this specification can also be jointly executed by the client and the server.
[0074] See also Figure 2 , Figure 2 A flowchart of a code processing model training method provided by an embodiment of this specification is shown, which specifically includes the following steps:
[0075] Step 202: Obtain a sample code document of a sample project, wherein the sample code document includes a sample problem and a sample patch corresponding to the sample problem.
[0076] In one or more embodiments of the present specification, in order to train a model capable of handling code problems, a sample code document of a sample project may be obtained, and model training may be performed based on sample problems in the sample code document and sample patches corresponding to the sample problems.
[0077] It should be noted that the sample project refers to a software development project. The sample code document refers to a document consisting of code information generated during the historical development process of the sample project. The sample code document includes, but is not limited to, the submitted code, merge requests, sample issues, sample patches, sample comment information, and sample description information of the sample patches of the sample project. Optionally, the data in the sample code document is arranged in chronological order to simulate the evolution process of the sample project.
[0078] Sample issues refer to code problems in sample code documents, that is, various code-related problems or errors encountered during the development of sample projects. Sample issues include, but are not limited to, logic errors, compatibility issues, syntax errors, and security vulnerabilities. Sample issues can be code problems in different code processing tasks. Since different code processing tasks correspond to different sample requirement information, the sample requirement information can be used to describe the solution goals of sample issues.
[0079] A boilerplate patch is a code snippet written to fix or improve a boilerplate problem in a boilerplate code document. The goal of a boilerplate patch is to fix the boilerplate problem and restore the code to a normal or better working state. A boilerplate patch can be as small as a one-line change or as complex as a refactored code.
[0080] In actual applications, there are many ways to obtain sample code documents for sample projects, which can be selected based on actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, sample code documents including sample issues and sample patches can be extracted from historical submission information of the sample project. In another possible implementation of this specification, the file understanding capability of the document generation model can be used to generate sample code documents including sample issues and sample patches based on the source code files of the sample project.
[0081] In an optional embodiment of the present specification, the obtaining of the sample code document of the sample project may include the following steps:
[0082] Get the source code files of the sample project;
[0083] Parse source code files to determine multiple code blocks and code relationships between multiple code blocks;
[0084] Construct a code structure graph using multiple code blocks as nodes and code relationships as edges;
[0085] The code structure diagram and the document template are input into the document generation model to obtain the sample code document of the sample project.
[0086] It should be noted that source code files refer to text files used to write the code used in sample projects. Source code files include requirements documents, design documents, application programming interface documents, etc. Source code files can include instructions, logic, and metadata required to create sample projects, such as project descriptions, configuration files for dependency management tools (such as Maven, Gradle), etc. Source code files are usually stored in version control systems (such as Git repositories) to track change history, support team collaboration, and manage various stages of software development. Optionally, the source code files of sample projects can be automatically updated as the code and sample projects are updated, thereby maintaining the consistency of the source code files with the sample projects.
[0087] A code block is an independent, manageable part consisting of a group of related code statements that perform a certain function or logic as a unit. Code relationships between code blocks are used to describe the dependencies and interactions between different code blocks. Code relationships refer to situations where a code block needs to use the services provided by other code blocks in order to complete its function. Code relationships include but are not limited to dependency relationships, call relationships, inheritance relationships, inclusion relationships, direct relationships, indirect relationships, and cyclic relationships.
[0088] A code structure graph is a graphical representation that treats code blocks in a source code file as nodes and depicts the relationships between code blocks as edges. A code structure graph can help understand the logical structure of the code and the interactions between its parts, covering the relationships and call chains between code blocks. A document generation model refers to a deep learning model with code understanding capabilities. The document generation model is used to construct sample code documents including sample questions and sample patches based on the information in the code structure graph. The document generation model can be a pre-trained large model for code tasks, or it can be a neural network model trained based on training code documents (including training questions and training patches corresponding to training questions), training code structure graphs, and document templates.
[0089] The document template is used to guide the document generation model to generate a sample code document including sample problems and sample patches based on the code structure diagram. The document template is such as "You are a professional programmer, please understand the information in the code structure diagram, construct at least one sample problem and a sample patch corresponding to each sample problem, and integrate the constructed sample problems and sample patches into a sample code document". The document template is specifically set according to the actual situation, and this specification embodiment does not make any limitation on this.
[0090] In actual applications, there are many ways to obtain the source code file of the sample project, which can be selected according to actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the source code file of the sample project can be read from the Git repository. In another possible implementation of this specification, the source code file of the sample project sent by the developer through the terminal device can be received. There are many ways to parse the source code file and determine the code relationship between multiple code blocks and multiple code blocks, which can be selected according to actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, a static code analysis tool can be used to parse the source code file to determine the code relationship between multiple code blocks and multiple code blocks. In another possible implementation of this specification, a code compiler or a parser can be used to parse the source code file to determine the code relationship between multiple code blocks and multiple code blocks.
[0091] By applying the solution of the embodiments of this specification and generating sample code documents by using code structure diagrams, the model can fully understand the structure and module dependencies of the entire sample project, thereby improving the model's global understanding ability, and further enabling the model to consider global factors in code tasks such as system design, code refactoring and optimization, and provide higher quality code solutions.
[0092] In another optional embodiment of the present specification, the obtaining of the sample code document of the sample project may include the following steps:
[0093] Get the historical commit information of the sample project;
[0094] Identify sample issues and sample patches corresponding to the sample issues in historical commit information, and obtain sample code documents of sample projects.
[0095] It should be noted that, since the historical commit information of the sample project includes sample issues and sample patches corresponding to the sample issues, the sample code document of the sample project can be generated based on the historical commit information. The historical commit information of the sample project refers to the record of each change made to the project source code or project-related files during the development of the sample project. Therefore, the historical commit information can be understood as dynamic information during the project runtime. Historical commit information is usually stored in a version control system (such as a Git repository), recording the evolution history of the sample project. Historical commit information is a time series data, including but not limited to code submission, submission information, and merge requests. Code submission refers to saving the changes made to the code to the version control system. The commit information is a description of the changes made in this submission, clearly stating the purpose of this submission and the problems solved. A merge request is a collaborative method for merging changes from one branch into another.
[0096] Optionally, after obtaining the historical submission information of the sample project, data cleaning (such as deduplication) can be performed on the historical submission information to ensure that the historical submission information does not include redundant information, thereby obtaining cleaned historical submission information. Next, sample issues and sample patches corresponding to the sample issues in the cleaned historical submission information are identified to obtain sample code documents for the sample project.
[0097] In actual applications, there are many ways to identify sample problems in historical submission information and sample patches corresponding to sample problems, and obtain sample code documents for sample projects. The methods are selected based on actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, an identification template can be obtained, and the historical submission information can be matched with the identification template, so as to extract the sample code document from the historical submission information based on the matching result. Among them, the identification template includes a problem template and a patch template, which are set according to actual conditions, and the embodiments of this specification do not impose any restrictions on this. In another possible implementation of this specification, the historical submission information can be input into an information recognition model to obtain a sample code document output by the information recognition model. Among them, the information recognition model can be a pre-trained large model for code tasks, or it can be a neural network model trained based on training submission information, training problems, and training patches corresponding to training problems.
[0098] By applying the solution of the embodiments of this specification, sample code documents are generated through the historical submission information of sample projects, and dynamic information of project runtime is introduced into the model training samples, thereby overcoming the limitations of static data and improving the model's capabilities in tasks such as debugging and performance optimization. The model can understand the dynamic process of sample project development and improve the model's ability to adapt to project changes. In addition, the model can understand and predict the long-term development trend of the project and provide suggestions and code generation that are more in line with the actual situation of the project.
[0099] In an optional embodiment of the present specification, the sample code document also includes sample comment information. After the sample problem and the sample patch corresponding to the sample problem in the historical submission information are identified and the sample code document of the sample project is obtained, the following steps may be further included:
[0100] Obtain historical review information of a sample project, wherein the historical review information carries a review object identifier;
[0101] Filtering sample comment information of the sample code document from the historical comment information according to the comment object identifier and the submission object identifier of the sample patch;
[0102] Add the sample comment information to the sample code document to obtain an updated sample code document.
[0103] It should be noted that historical comment information refers to the information obtained by the comment subject's comments on the sample project. For example, questions raised by the comment subject on the sample patch, or solutions proposed for the sample problems. The comment subject can be the submission object of the sample patch, or an object other than the submission object. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. The comment object identifier is used to uniquely identify the comment object. The comment object identifier is such as an identity unique code. The submission object identifier of the sample patch is used to uniquely identify the submission object of the sample patch. The submission object refers to the object that submitted the sample patch, such as a code developer. The sample comment information of the sample code document refers to the historical comment information in which the comment object identifier is the same as the submission object identifier.
[0104] In practical applications, when selecting sample comment information of a sample code document from historical comment information based on the comment object identifier and the submission object identifier of the sample patch, it can be determined whether the comment object identifier carried by each historical comment information is the same as the submission object identifier. If so, the historical comment information is determined as the sample comment information. Optionally, after obtaining the historical comment information of the sample project, the historical comment information can be cleaned (e.g., noise information can be removed), and the sample comment information of the sample code document can be selected from the cleaned historical comment information based on the comment object identifier and the submission object identifier of the sample patch.
[0105] Furthermore, after obtaining the sample comment information, the sample issues, sample patches, and sample comment information can be sorted and combined according to the code submission time to build a long-term project evolution document. When combining, the sample code document can be built in the form of a triple of <sample issue, sample comment information, sample patch>.
[0106] It is worth noting that the sample code document may include sample description information, which is used to describe the sample patch in the form of natural language. In this case, the sample code document may be constructed in the form of a triple of <sample problem, sample description information, sample patch>, or in the form of a quadruple of <sample problem, sample description information, sample comment information, sample patch>, which is selected according to the actual situation, and the embodiments of this specification do not impose any limitation on this.
[0107] By applying the solution of the embodiment of this specification, by adding sample comment information to the sample code document, the sample code data can be obtained more completely and accurately when simulating the project development cycle of the sample project.
[0108] Step 204: According to the sample problem and the sample patch, the project development cycle of the sample project is simulated to obtain sample code data, wherein the sample code data includes sample phase data corresponding to multiple project development phases in the project development cycle.
[0109] In one or more embodiments of the present specification, after obtaining the sample code document of the sample project, further, the sample problems and sample patches corresponding to the sample problems included in the sample code document can be used to simulate the project development cycle of the sample project, thereby obtaining model training data, i.e., sample code data.
[0110] It should be noted that the project development cycle refers to the entire process of the sample project from conception to final release and maintenance. This cycle is usually divided into several project development stages, each of which has its specific goals and activities. The project development cycle includes but is not limited to the requirements analysis stage, architecture design stage, search stage, positioning stage, coding stage, testing stage, deployment stage and maintenance stage. The sample code data includes multiple sample stage data, and the sample stage data includes sample sub-problems and sample sub-patches corresponding to the sample sub-problems. For example, the sample code data includes sample sub-problem A and sample sub-patch a in the positioning stage, and sample sub-problem B and sample sub-patch b in the coding stage. The sample problems and sample patches corresponding to the sample problems included in the sample code document can be sample problems and sample patches corresponding to at least one project development stage in the project development cycle. Therefore, based on the sample problems and sample patches, the project development cycle of the sample project can be accurately simulated to obtain sample code data that can cover the entire project development cycle.
[0111] In an optional embodiment of the present specification, the sample code document further includes sample reference information, and the sample reference information includes at least one of sample comment information and sample description information of the sample patch; the above-mentioned simulating the project development cycle of the sample project according to the sample problem and the sample patch to obtain the sample code data may include the following steps:
[0112] According to the sample problems, sample patches and sample reference information, the project development cycle of the sample project is simulated to obtain sample code data.
[0113] It should be noted that the sample reference information includes at least one of sample comment information and sample description information of the sample patch. In order to simulate the project development cycle of the sample project more accurately, on the basis of simulation based on sample problems and sample patches, sample reference information can also be incorporated, so as to deepen the understanding of sample patches and sample problems during the project development cycle simulation process, that is, based on sample problems, sample patches and sample reference information, the project development cycle of the sample project is simulated to obtain sample code data.
[0114] By applying the solution of the embodiments of this specification, by using sample problems, sample patches and sample reference information to simulate the complete project development workflow, the code processing model can learn the knowledge of the entire process from requirement analysis to code implementation, thereby improving the problem-solving ability of the code processing model, and further enabling the code processing model to handle more complex software engineering tasks, such as directly generating an initial code framework based on the requirement document, or providing repair suggestions based on the problem description.
[0115] In actual applications, there are many ways to obtain sample code data based on sample problems and sample patches, simulating the project development cycle of sample projects. The specific method is selected according to the actual situation, and this specification does not impose any restrictions on this. In one possible implementation of this specification, based on sample problems and sample patches, candidate code data with high similarity to sample problems and sample patches can be screened out from a candidate code database, and these candidate code data with high similarity can be determined as sample code data. Among them, the candidate code database includes candidate code data corresponding to multiple project development stages. In another possible implementation of this specification, a data processing model can be used to simulate the project development cycle of a sample project based on sample problems and sample patches to obtain sample code data.
[0116] In an optional embodiment of the present specification, simulating the project development cycle of the sample project based on the sample problem and the sample patch to obtain the sample code data may include the following steps:
[0117] The simulation prompt information, sample problems and sample patches of multiple project development stages are input into the data processing model to obtain sample code data, wherein the multiple project development stages include at least two of the search stage, positioning stage, coding stage, debugging stage, repair stage and development stage.
[0118] It should be noted that the simulation prompt information refers to the prompt information used to guide the data processing model to simulate the sample stage data (including sample sub-problems and sample sub-patches) of the corresponding project development stage based on sample problems and sample patches. Optionally, the model prompt information corresponding to different project development stages is different, that is, the simulation prompt information used when generating different sample stage data can be different. Through the simulation prompt information corresponding to the project development stage one by one, the sample stage data of the corresponding project development stage can be accurately simulated, so that the sample code data can cover the entire project development cycle. For example, the simulation prompt information of the search stage can be "You are a professional code developer, please simulate the sample sub-problems and sample sub-patches of the search stage based on sample problems and sample patches." The data processing model can be a pre-trained large model for code tasks, or it can be a neural network model trained based on simulation prompt information, training problems, training patches and training code data of multiple project development stages.
[0119] The scheme of the embodiment of this specification is applied, by utilizing the code understanding ability of the data processing model and the model guiding role of the simulation prompt information, and using the data processing model to generate sample code data including multiple sample stage data, thereby improving the efficiency and accuracy of obtaining the sample code data.
[0120] In an optional embodiment of the present specification, the above-mentioned use of sample code data to train the pre-trained processing model to obtain the code processing model may also include the following steps:
[0121] Get the sample test code from the sample code document;
[0122] Run the sample test code to obtain the code test log, and run the sample code data to obtain the code running log;
[0123] Determine the test results of the sample code data based on the code test log and code operation log;
[0124] Using the sample code data to train the pre-trained processing model to obtain the code processing model may include the following steps:
[0125] The pre-trained processing model is trained using sample code data whose test results are passed to obtain a code processing model.
[0126] It should be noted that since the sample code data is obtained by simulating the project development cycle of the sample project, the sample code data usually has certain errors. In order to avoid the problem of inaccurate training of the pre-trained processing model due to errors, the sample test code can be used to determine whether the sample code data can be used to train the pre-trained processing model. The sample test code is used to test the accuracy of the sample code data and can be understood as code review data. The sample test code is the real and accurate code corresponding to the sample code document. Therefore, the code test log of the sample test code can be regarded as a real and accurate code judgment standard, which is constructed based on a large amount of high-quality and verified data. The test results include test pass and test fail.
[0127] In actual applications, there are many ways to obtain sample test codes from sample code documents, which are selected according to actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, sample test codes from sample code documents can be read from a Git repository. In another possible implementation of this specification, sample test codes from sample code documents sent by code developers through terminal devices can be received. When running sample test codes or running sample code data, a containerized automated testing environment can be built to simulate actual software operation conditions.
[0128] Furthermore, after obtaining the code test log and the code running log, it can be determined whether the code test log and the code running log are the same, or whether the key information is the same. If they are the same, it means that the sample code data is accurate, and the test result of the sample code data is a test pass, which can be used to train the pre-trained processing model. If they are not the same, it means that the sample code data is inaccurate, and the test result of the sample code data is a test fail, which cannot be used to train the pre-trained processing model. At this time, the sample code data can be deleted, and only the sample code data with a test result of a test pass can be used to train the pre-trained processing model to obtain the code processing model.
[0129] By applying the solution of the embodiments of this specification, the quality and reliability of sample code data are significantly improved by introducing sample test code, the training efficiency of the code processing model is improved, the workload of manual verification and repair is reduced, and the code generated by the code processing model is more in line with practice and project specifications.
[0130] Step 206: Use the sample code data to train the pre-trained processing model to obtain a code processing model, wherein the pre-trained processing model is trained based on the sample code document.
[0131] In one or more embodiments of the present specification, a sample code document of a sample project is obtained, and the project development cycle of the sample project is simulated based on sample problems and sample patches. After the sample code data is obtained, the sample code data can be further used to train a pre-trained processing model to obtain a code processing model.
[0132] It should be noted that the pre-trained processing model refers to a neural network model obtained by pre-training the initial processing model using sample code documents. The initial processing model can be a large pre-trained model for code data, or a neural network model that learns massive amounts of static code data and establishes basic code understanding and generation capabilities. The stage of training to obtain a pre-trained processing model can be regarded as the pre-training stage (PT, Pre-training).
[0133] In practical applications, there are many ways to obtain a code processing model by training the pre-trained processing model using sample code data, and the specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the pre-trained processing model can be directly fine-tuned using multiple sample sub-problems included in the sample code data and sample sub-patches corresponding to the multiple sample sub-problems to obtain a code processing model. In another possible implementation of this specification, the pre-trained processing model can be first trained using multiple sample sub-problems to obtain an initial code processing model; and then the initial code processing model can be trained using multiple sample sub-problems and sample sub-patches corresponding to the multiple sample sub-problems to obtain a code processing model.
[0134] By applying the solution of the embodiments of this specification, sample code data is obtained by simulating the project development cycle, so that the code processing model can understand the dynamic process of project development and learn the full process knowledge of code implementation, so as to handle complex code tasks, thereby comprehensively improving the code processing model's adaptability to project changes and code processing capabilities.
[0135] In an optional embodiment of the present specification, the sample code data includes a plurality of sample stage data, the sample stage data includes a sample sub-problem and a sample sub-patch corresponding to the sample sub-problem; the above-mentioned training of the pre-trained processing model using the sample code data to obtain the code processing model may include the following steps:
[0136] Using multiple sample sub-problems, the pre-trained processing model is trained to obtain an initial code processing model;
[0137] The initial code processing model is trained using the multiple sample sub-problems and the sample sub-patches respectively corresponding to the multiple sample sub-problems to obtain a code processing model.
[0138] It should be noted that the process of training the pre-training processing model using multiple sample sub-problems can be regarded as a continuous pre-training stage (CPT). In the continuous pre-training stage, the pre-training processing model predicts multiple sample sub-problems token by token, and adjusts the model parameters of the pre-training processing model based on the prediction results and multiple sample sub-problems to obtain a trained initial code processing model.
[0139] After the continuous pre-training stage, the initial code processing model has the ability to understand multiple sample sub-problems. Then, the initial code processing model can be trained using multiple sample sub-problems and the sample sub-patches corresponding to the multiple sample sub-problems to obtain the code processing model. This process can be regarded as the supervised fine-tuning stage. In the supervised fine-tuning stage, multiple sample sub-problems are input into the initial code processing model to obtain the predicted sub-patches corresponding to each sample sub-problem. The prediction loss is calculated based on the predicted sub-patches and the sample sub-patches corresponding to each sample sub-problem. The model parameters of the initial code processing model are adjusted based on the prediction loss to obtain a fully trained code processing model.
[0140] By applying the solution of the embodiments of this specification, the pre-training processing model is first continuously pre-trained through multiple sample sub-problems, so that the initial code processing model obtained by training has the ability to understand multiple sample sub-problems, and then the initial code processing model is supervised fine-tuned using the multiple sample sub-problems and the sample sub-patches corresponding to the multiple sample sub-problems, so that the trained code processing model has the ability to solve code problems, thereby improving the accuracy of the code processing model.
[0141] In an optional embodiment of the present specification, after the sample code data is used to train the pre-trained processing model and the code processing model is obtained, the following steps may also be included:
[0142] Obtain multiple sample demand information;
[0143] Inputting multiple sample demand information into the code processing model to obtain prediction processing results corresponding to the multiple sample demand information respectively;
[0144] According to the preference information fed back by the terminal device regarding the prediction processing result, the model parameters of the code processing model are adjusted to obtain an updated code processing model.
[0145] It should be noted that sample requirement information refers to a series of specifications and requirements on which the code processing task is based. The sample requirement information is used to generate code that can meet predetermined functional and non-functional requirements. The sample requirement information is used to describe the processing objectives of the code processing task. Code processing tasks include but are not limited to code generation, code completion, code interpretation, code optimization, and comment generation. There are many ways to obtain multiple sample requirement information, which can be selected based on actual conditions. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, multiple sample requirement information can be read from other data acquisition devices or databases. In another possible implementation of this specification, multiple sample requirement information sent by code developers through terminal devices can be received.
[0146] In practical applications, the process of adjusting the model parameters of the code processing model based on the preference information fed back by the terminal device regarding the prediction processing results can be regarded as direct preference optimization (DPO) of the code processing model. Direct preference optimization improves the behavior of the model by allowing the model to learn user preferences. This method does not directly optimize the output of the code processing model, but optimizes based on the user's comparison of different outputs of the code processing model. During the direct preference optimization process, the code processing model can learn from the user's preference feedback on different outputs, thereby gradually adjusting its generation strategy so that the output is more in line with user expectations.
[0147] By applying the solution of the embodiments of this specification, an updated code processing model is obtained by directly optimizing the preferences of the code processing model, so that the updated code processing model better meets user needs and realizes personalized code processing model training.
[0148] See also Figure 3 , Figure 3 A flowchart of a code task processing method provided by an embodiment of the present specification is shown, which specifically includes the following steps:
[0149] Step 302: Obtain the code data to be processed of the target code task.
[0150] Step 304: input the code data to be processed into the code processing model to obtain the code processing result, wherein the code processing model is trained using the code processing model training method.
[0151] It should be noted that the target code task may be different types of code tasks, such as code completion tasks, code generation tasks, code interpretation tasks, code optimization tasks, code comment generation tasks, etc. The code data to be processed may be code tasks to be completed, code data to be interpreted, code data to be optimized, code data to be annotated, etc. The code processing result corresponds to the target code task. For example, if the target code task is a code comment generation task, the code processing result is code comment information.
[0152] In practical applications, there are many ways to obtain the code data to be processed of the target code task, which can be selected according to the actual situation, and the embodiments of this specification do not limit this. In one possible implementation of this specification, the code data to be processed of the target code task can be read from other data acquisition devices or databases. In another possible implementation of this specification, the code data to be processed of the target code task sent by the user through the terminal device can be received.
[0153] In the scheme of the embodiment of the present specification, since the code processing model is obtained by training the pre-trained processing model based on sample code data, and the sample code data is obtained by simulating the project development cycle of the sample project according to the sample problem and the sample patch corresponding to the sample problem, the code processing model can understand the dynamic process of project development, learn the knowledge of the whole process of code implementation, and have the ability to adapt to complex changes in the project and high-quality code processing capabilities. Therefore, the code processing model is used to process the code data to be processed, taking into account the global factors of the project development cycle, so that the code processing results are more in line with the actual situation of the project, and the quality of the code processing results is improved.
[0154] The following combination Figure 4 , taking the application of the code task processing method provided in this specification in the code development scenario as an example, the code task processing method is further explained. Figure 4 A flowchart of a code development method provided by an embodiment of the present specification is shown. The code development method is applied to a server and specifically includes the following steps:
[0155] Step 402: Receive code requirement information sent by the terminal device.
[0156] Step 404: input the code requirement information into the code processing model to obtain the target code, wherein the code processing model is trained using the code processing model training method.
[0157] Step 406: Feedback the target code to the terminal device.
[0158] It should be noted that since the code processing model can be obtained by adjusting the model parameters based on multiple sample requirement information, the code processing model can process the code requirement information to generate the target code corresponding to the code requirement information. Code requirement information refers to a series of specifications and requirements on which the code processing model performs code processing. These requirement information help ensure that the code generated by the code processing model can meet predetermined functional and non-functional requirements. Code requirement information includes functional requirements, structural requirements, testing requirements, etc., which are selected according to actual conditions, and the embodiments of this specification do not impose any restrictions on this. For example, the code requirement information is "generate code that can verify the security of user accounts."
[0159] By applying the solution of the embodiment of this specification, the code requirement information is processed using a code processing model, and the global factors of the project development cycle are considered, so that the target code is more in line with the actual project situation and the code requirement information, and the quality of the target code is improved.
[0160] See also Figure 5 , Figure 5 A processing flow chart of a code task processing method provided by an embodiment of the present specification is shown. The code task processing method includes a pre-training stage, a continuous pre-training stage, a supervised fine-tuning stage and an application stage. These stages are described in detail below.
[0161] Pre-training stage: The sample code documents of the sample projects are used to train the initial processing model to obtain a pre-trained processing model. The initial processing model is trained based on massive static code data. When training the initial processing model, all-round training can be performed based on tasks such as code completion, code generation, comment generation, code interpretation, and code optimization.
[0162] Continuous pre-training stage: Based on the sample problems and sample patches corresponding to the sample problems included in the sample code document, the project development cycle of the sample project is simulated to obtain sample code data, wherein the sample code data includes multiple sample stage data, and the sample stage data includes sample sub-problems and sample sub-patches corresponding to the sample sub-problems; the pre-training processing model is trained using the multiple sample sub-problems to obtain an initial code processing model;
[0163] Supervised fine-tuning stage: Use multiple sample sub-problems and sample sub-patches corresponding to the multiple sample sub-problems to train the initial code processing model to obtain the code processing model; it should be noted that when simulating the project development cycle of the sample project, multiple software evolution processes such as problem determination, problem location, problem repair, and code application can be simulated, so that the code processing model can support the processing of different software development tasks such as requirements analysis, system design, detailed design, coding / testing, etc. The code processing model can be applied to different products such as software development workbenches and artificial intelligence programmers.
[0164] Application phase: obtain the code data to be processed of the target code task; input the code data to be processed into the code processing model to obtain the code processing result.
[0165] The solution of the embodiment of this specification is applied, by integrating project evolution dynamic modeling, code structure diagram construction, multi-object collaboration simulation and other solutions, to simulate the entire process of project development for intelligent model training, realize more intelligent software engineering full process research and development, and thus build a code processing model covering the entire life cycle of software development tasks. The code processing model can be used to deeply understand the dynamic process of software development, and provide all-round intelligent assistance from demand analysis to code implementation, which not only significantly improves software development efficiency, but also greatly improves code quality and project management level, effectively solving the key problems of static data limitations, lack of global understanding, and insufficient multi-role collaboration capabilities that are common in current artificial intelligence programming assistants. At the same time, it can adapt to different types of code tasks, showing strong adaptability and generalization capabilities.
[0166] See also Figure 6 , Figure 6 A flowchart of an information processing method based on a code processing model provided by an embodiment of this specification is shown, which specifically includes the following steps:
[0167] Step 602: Receive a model request sent by a terminal device.
[0168] Step 604: Based on the model request, determine a target code processing model from a plurality of code processing models, wherein the plurality of code processing models are trained based on a code processing model training method.
[0169] It should be noted that the target code processing model is a code processing model suitable for the target scenario. The model request includes the scene identifier of the target scene, the scene input data of the target scene, and at least one of the model specification parameters. Based on the model request, there are many ways to determine the target code processing model from multiple code processing models, and the specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, based on the model request, the corresponding target code processing model can be searched from at least one code processing model included in the model library; in another possible implementation of this specification, based on the model request, the target code processing model can be trained and obtained; in another optional method of this specification, the target code processing model can be constructed based on the model request.
[0170] For example, based on the scenario identification of the target scenario, at least one pre-trained code processing model can be searched from the model library, and then based on the model specification parameters, an initial code processing model can be obtained by screening at least one code processing model, and then based on the scenario input data of the target scenario, the initial code processing model obtained by screening can be trained to obtain a target code processing model suitable for user needs. Figure 2 The code processing model is obtained by training using the training method shown, and will not be described in detail in the embodiments of this specification.
[0171] The solution of the embodiment of this specification is applied to obtain the target code processing model according to user needs, realize personalized model service, provide users with an efficient, flexible and easy-to-use model service method, and improve user experience.
[0172] In an optional embodiment of the present specification, the model request includes a scene identifier of a target scene; and determining the target code processing model from a plurality of code processing models based on the model request may include the following steps:
[0173] Based on the scenario identifier of the target scenario, a target code processing model suitable for the target scenario is searched from a model library, wherein the model library stores a plurality of code processing models suitable for different code processing scenarios.
[0174] It should be noted that scenario identification refers to a unique or specific label used to distinguish different code task scenarios. The model library is a database for storing and managing various pre-trained deep learning models. Multiple code processing models adapted to different code task scenarios cover different code application scenarios and requirements. The model library allows users to select appropriate models according to their needs, or directly call the model for code task processing through the application programming interface.
[0175] Multiple code processing models suitable for different code task scenarios are stored in the model library. Each model is optimized for a specific application environment. Figure 2 The model obtained by training the code processing model shown in the training method is as follows: For example, based on the scenario identifier "code generation" of the target scenario, a target code processing model suitable for the code generation scenario can be searched from the model library.
[0176] By applying the solution of the embodiments of this specification, based on scenario requirements, the target code processing model suitable for the scenario is accurately found through scenario identification, so that code task processing is more accurate and more in line with the scenario, thereby improving user experience and code task processing quality.
[0177] In an optional embodiment of the present specification, the model request includes scene input data of the target scene; and the above-mentioned determining the target code processing model from multiple code processing models based on the model request may include the following steps:
[0178] Determine an initial code processing model suitable for a target scenario from among multiple code processing models;
[0179] Based on the scenario input data of the target scenario, the initial code processing model is trained to obtain the target code processing model.
[0180] It should be noted that the scenarios adapted by each code processing model are different. For example, code processing model 1 is adapted to scenarios 1 and 2, and code processing model 2 is adapted to scenarios 2 and 3. The initial code processing model refers to the model that is adapted to the target scenario among multiple code processing models. If the target scenario is scenario 1, the initial code processing model is code processing model 1 adapted to scenario 1. The initial code processing model may not only be applicable to the target scenario, but also to other scenarios. It is a general code processing model that can be applied to different scenarios. Code task processing can be performed using the initial code processing model, but the effect may not be very good. At this time, the initial code processing model can be optimized based on the scenario input data of the target scenario. For example, the initial code processing model can be optimized based on the scenario input data of the code generation scenario to obtain a target code processing model that is adapted to the code generation scenario. The scenario input data of the target scenario can be understood as the sample data of the sample code task in the target scenario. The method of training the initial code processing model based on the scenario input data of the target scenario and obtaining the target code processing model can refer to Figure 2 The training method of the code processing model shown in the present specification will not be described in detail in the embodiments.
[0181] By applying the solution of the embodiments of this specification, based on scenario requirements, a general initial code processing model is further trained through scenario input data to obtain a target code processing model adapted to the scenario, so that the target code processing model is more in line with the scenario, thereby improving the user experience and the processing quality of code tasks.
[0182] In an optional embodiment of the present specification, the model request includes model specification parameters; and determining the target code processing model from the plurality of code processing models based on the model request may include the following steps:
[0183] Based on the model specification parameters, a corresponding target code processing model is searched from a model library, wherein the model library stores a plurality of code processing models with different model specification parameters.
[0184] It should be noted that model specification parameters refer to various parameters that define the structure and behavior of the model. These parameters can be roughly divided into two categories: model parameters (learnable parameters) and hyperparameters. Model parameters refer to parameters that are automatically adjusted by the back-propagation algorithm during model training, including but not limited to weight matrices (weights) and biases (biases). For example, in a simple fully connected layer, the weight matrix is a two-dimensional tensor that connects the neurons in the input layer and the output layer; the bias term is a one-dimensional vector that provides an additional offset value for each output neuron. Hyperparameters refer to parameters set before starting model training to control the learning process and architecture of the model. Hyperparameters include but are not limited to learning rate and the number of neurons per layer (Number of Neurons per Layer), which should be selected according to actual conditions.
[0185] By applying the solution of the embodiments of this specification, the corresponding target code processing model can be accurately found based on the model specification parameters, thereby ensuring the efficient and stable operation of the target code processing model and improving the user experience.
[0186] In an optional embodiment of the present specification, after determining the target code processing model from multiple code processing models based on the model request, the following steps may also be included:
[0187] Deploy the target code processing model, and build a code task processing interface based on the target code processing model to enable the terminal device to schedule the target code processing model to execute the target code task.
[0188] It should be noted that the code task processing interface is an interactive programming interface for the terminal device to schedule the target code processing model to perform target code task processing, which is usually provided in the form of an application programming interface. Through the code task processing interface, the user can input the task data of the target code task, such as the code data to be processed or the code requirement information, to perform code processing or code development.
[0189] In practical applications, there are many ways to deploy the target code processing model, which can be selected based on actual conditions, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the target code processing model can be deployed on a cloud-side device using the infrastructure provided by a cloud service provider. In another possible implementation of this specification, a lightweight framework can be used to deploy the target code processing model on an edge device. For example, the target code processing model can be deployed on a distributed system, and based on the target code processing model, a code task processing interface can be constructed and provided to the terminal device, so that the terminal device can schedule the target code processing model to execute the target code task.
[0190] By applying the solution provided in the embodiments of this specification, deploying the target code processing model, and building a code task processing interface based on the target code processing model, the terminal device can efficiently call the target code processing model and improve the processing quality and response speed of the target code task.
[0191] See also Figure 7 , Figure 7 A schematic diagram of the structure of a task platform provided by an embodiment of the present specification is shown, and the task platform includes a request interface 702 and a response unit 704;
[0192] The request interface 702 is used to receive a model request sent by a terminal device, wherein the model request includes a scene identifier of a target scene, scene input data of the target scene, and at least one of a model specification parameter;
[0193] The response unit 704 is used to determine a target code processing model from a plurality of code processing models based on the model request, wherein the plurality of code processing models are trained based on a code processing model training method.
[0194] In an optional embodiment of the present specification, the task platform further includes a code task processing interface, and the code task processing interface is constructed based on the target code processing model;
[0195] The code task processing interface is used for terminal devices to schedule and execute target code tasks.
[0196] By applying the solution of the embodiments of this specification, the task platform adapts to user needs to obtain the target code processing model, realizes personalized model services, provides users with an efficient, flexible and easy-to-use model service platform, and improves user experience.
[0197] The above is a schematic scheme of a task platform of this embodiment. It should be noted that the technical scheme of the task platform and the technical scheme of the information processing method based on the code processing model mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the task platform can be found in the description of the technical scheme of the information processing method based on the code processing model mentioned above.
[0198] Corresponding to the above-mentioned code processing model training method embodiment, this specification also provides a code processing model training device embodiment, Figure 8 FIG. 1 is a schematic diagram showing the structure of a code processing model training device provided by an embodiment of the present specification. Figure 8 As shown, the device comprises:
[0199] A first acquisition module 802 is configured to acquire a sample code document of a sample project, wherein the sample code document includes a sample problem and a sample patch corresponding to the sample problem;
[0200] The simulation module 804 is configured to simulate the project development cycle of the sample project according to the sample problem and the sample patch, and obtain sample code data, wherein the sample code data includes sample phase data corresponding to multiple project development phases in the project development cycle;
[0201] The training module 806 is configured to train the pre-trained processing model using the sample code data to obtain a code processing model, wherein the pre-trained processing model is trained based on the sample code document.
[0202] Optionally, the sample code document also includes sample reference information, which includes at least one of sample comment information and sample description information of the sample patch; the simulation module 804 is further configured to simulate the project development cycle of the sample project based on the sample issues, sample patches and sample reference information to obtain sample code data.
[0203] Optionally, the simulation module 804 is further configured to input simulation prompt information, sample problems and sample patches of multiple project development stages into the data processing model to obtain sample code data, wherein the multiple project development stages include at least two of the search stage, positioning stage, encoding stage, debugging stage, repair stage and development stage.
[0204] Optionally, the device also includes: a third acquisition module, configured to acquire sample test code from a sample code document; run the sample test code to obtain a code test log, and run the sample code data to obtain a code run log; determine the test result of the sample code data based on the code test log and the code run log; and a training module 806, further configured to train the pre-trained processing model using the sample code data whose test result is a passed test to obtain a code processing model.
[0205] Optionally, the first acquisition module 802 is further configured to acquire historical submission information of the sample project; identify sample issues and sample patches corresponding to the sample issues in the historical submission information, and obtain sample code documents of the sample project.
[0206] Optionally, the device also includes: a fourth acquisition module, configured to obtain historical comment information of the sample project, wherein the historical comment information carries a comment object identifier; based on the comment object identifier and the submission object identifier of the sample patch, filter out sample comment information of the sample code document from the historical comment information; add the sample comment information to the sample code document to obtain an updated sample code document.
[0207] Optionally, the first acquisition module 802 is further configured to acquire the source code file of the sample project; parse the source code file to determine multiple code blocks and code relationships between the multiple code blocks; construct a code structure diagram with multiple code blocks as nodes and code relationships as edges; input the code structure diagram and the document template into the document generation model to obtain a sample code document of the sample project.
[0208] Optionally, the sample code data includes multiple sample stage data, the sample stage data includes sample sub-problems and sample sub-patches corresponding to the sample sub-problems; the training module 806 is further configured to use the multiple sample sub-problems to train the pre-trained processing model to obtain an initial code processing model; use the multiple sample sub-problems and the sample sub-patches corresponding to the multiple sample sub-problems to train the initial code processing model to obtain a code processing model.
[0209] Optionally, the device also includes: an adjustment module, configured to obtain multiple sample demand information; input the multiple sample demand information into the code processing model to obtain prediction processing results corresponding to the multiple sample demand information; adjust the model parameters of the code processing model according to the preference information fed back by the terminal device for the prediction processing results to obtain an updated code processing model.
[0210] By applying the solution of the embodiments of this specification, the code processing model training device obtains sample code data by simulating the project development cycle, so that the code processing model can understand the dynamic process of project development and learn the full process knowledge of code implementation, so as to handle complex code tasks, thereby comprehensively improving the code processing model's adaptability to project changes and code processing capabilities.
[0211] The above is a schematic scheme of a code processing model training device of this embodiment. It should be noted that the technical scheme of the code processing model training device and the technical scheme of the above-mentioned code processing model training method belong to the same concept, and the details not described in detail in the technical scheme of the code processing model training device can be referred to the description of the technical scheme of the above-mentioned code processing model training method.
[0212] Corresponding to the above-mentioned code task processing method embodiment, this specification also provides a code task processing device embodiment, Fig. 9 FIG. 1 shows a schematic diagram of the structure of a code task processing device provided by an embodiment of the present specification. Fig. 9 As shown, the device comprises:
[0213] The second acquisition module 902 is configured to acquire the code data to be processed of the target code task;
[0214] The first input module 904 is configured to input the code data to be processed into the code processing model to obtain the code processing result, wherein the code processing model is trained using the code processing model training method.
[0215] In the scheme of the embodiment of the present specification, since the code processing model is obtained by training the pre-trained processing model based on the sample code data, and the sample code data is obtained by simulating the project development cycle of the sample project according to the sample problem and the sample patch corresponding to the sample problem, the code processing model can understand the dynamic process of project development, learn the knowledge of the whole process of code implementation, and have the ability to adapt to complex changes in the project and high-quality code processing capabilities. Therefore, the code task processing device uses the code processing model to process the code data to be processed, taking into account the global factors of the project development cycle, so that the code processing results are more in line with the actual situation of the project, and the quality of the code processing results is improved.
[0216] The above is a schematic scheme of a code task processing device of this embodiment. It should be noted that the technical scheme of the code task processing device and the technical scheme of the above-mentioned code task processing method belong to the same concept, and the details not described in detail in the technical scheme of the code task processing device can be referred to the description of the technical scheme of the above-mentioned code task processing method.
[0217] Corresponding to the above-mentioned code development method embodiment, this specification also provides a code development device embodiment, Fig.10 FIG. 1 shows a schematic diagram of the structure of a code development device provided by an embodiment of the present specification. Fig.10 As shown, the device is applied to the server, including:
[0218] The first receiving module 1002 is configured to receive code requirement information sent by a terminal device;
[0219] The second input module 1004 is configured to input the code requirement information into the code processing model to obtain the target code, wherein the code processing model is trained using the code processing model training method;
[0220] The feedback module 1006 is configured to feed back the target code to the terminal device.
[0221] By applying the solution of the embodiment of this specification, the code requirement information is processed using a code processing model, and the global factors of the project development cycle are considered, so that the target code is more in line with the actual project situation and the code requirement information, and the quality of the target code is improved.
[0222] The above is a schematic scheme of a code development device of this embodiment. It should be noted that the technical scheme of the code development device and the technical scheme of the above code development method belong to the same concept, and the details not described in detail in the technical scheme of the code development device can be referred to the description of the technical scheme of the above code development method.
[0223] Corresponding to the above-mentioned information processing method embodiment based on the code processing model, this specification also provides an information processing device embodiment based on the code processing model. Fig.11 FIG. 1 shows a schematic diagram of the structure of an information processing device based on a code processing model provided by an embodiment of the present specification. Fig.11 As shown, the device is applied to a task platform and includes:
[0224] The second receiving module 1102 is configured to receive a model request sent by a terminal device;
[0225] The determination module 1104 is configured to determine a target code processing model from a plurality of code processing models based on the model request, wherein the plurality of code processing models are trained based on a code processing model training method.
[0226] Optionally, the model request includes a scene identifier of the target scene; the determination module 1104 is further configured to search for a target code processing model suitable for the target scene from a model library based on the scene identifier of the target scene, wherein the model library stores multiple code processing models suitable for different code processing scenarios.
[0227] Optionally, the model request includes scene input data of the target scene; the determination module 1104 is further configured to determine an initial code processing model suitable for the target scene from multiple code processing models; based on the scene input data of the target scene, the initial code processing model is trained to obtain the target code processing model.
[0228] Optionally, the model request includes model specification parameters; the determination module 1104 is further configured to search for a corresponding target code processing model from a model library based on the model specification parameters, wherein the model library stores a plurality of code processing models with different model specification parameters.
[0229] Optionally, the apparatus further includes: a deployment module configured to deploy a target code processing model, and construct a code task processing interface based on the target code processing model, so that the terminal device schedules the target code processing model to execute the target code task.
[0230] The solution of the embodiment of this specification is applied to obtain the target code processing model according to user needs, realize personalized model service, provide users with an efficient, flexible and easy-to-use model service method, and improve user experience.
[0231] The above is a schematic scheme of an information processing device based on a code processing model of this embodiment. It should be noted that the technical scheme of the information processing device based on the code processing model and the technical scheme of the information processing method based on the code processing model belong to the same concept, and the details not described in detail in the technical scheme of the information processing device based on the code processing model can be referred to the description of the technical scheme of the information processing method based on the code processing model.
[0232] Fig.12 The block diagram of a computing device provided by an embodiment of the present specification is shown. The components of the computing device 1200 include but are not limited to a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and the database 1250 is used to store data.
[0233] The computing device 1200 also includes an access device 1240 that enables the computing device 1200 to communicate via one or more networks 1260. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1240 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world microwave interconnection access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0234] In one embodiment of the present specification, the above components of the computing device 1200 and Fig.12 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.12 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0235] The computing device 1200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1200 may also be a mobile or stationary server.
[0236] Among them, processor 1220 is used to execute computer programs / instructions, which, when executed by the processor, implement the steps of the above-mentioned code processing model training method or code task processing method or code development method or information processing method based on the code processing model.
[0237] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned code processing model training method, code task processing method, code development method and information processing method based on the code processing model belong to the same concept. For details not described in detail in the technical scheme of the computing device, please refer to the description of the technical scheme of the above-mentioned code processing model training method or code task processing method or code development method or information processing method based on the code processing model.
[0238] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned code processing model training method or code task processing method or code development method or information processing method based on a code processing model.
[0239] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned code processing model training method, code task processing method, code development method and information processing method based on the code processing model belong to the same concept. For details not described in detail in the technical scheme of the storage medium, please refer to the description of the technical scheme of the above-mentioned code processing model training method or code task processing method or code development method or information processing method based on the code processing model.
[0240] One embodiment of the present specification also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned code processing model training method or code task processing method or code development method or information processing method based on the code processing model.
[0241] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the code processing model training method, code task processing method, code development method and information processing method based on the code processing model belong to the same concept. For details not described in detail in the technical scheme of the computer program product, please refer to the description of the technical scheme of the code processing model training method or code task processing method or code development method or information processing method based on the code processing model.
[0242] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0243] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the 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), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0244] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0245] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0246] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A code processing model training method, comprising: Obtain a sample code document of a sample project, wherein the sample code document includes a sample problem and a sample patch corresponding to the sample problem; According to the sample problem and the sample patch, a project development cycle of the sample project is simulated to obtain sample code data, wherein the sample code data includes sample stage data corresponding to a plurality of project development stages in the project development cycle, and the sample stage data includes sample sub-problems and sample sub-patches corresponding to the sample sub-problems; The pre-trained processing model is trained using the sample code data to obtain a code processing model, wherein the pre-trained processing model is trained based on the sample code document, and the pre-trained processing model is trained using the sample code data to obtain a code processing model, including: training the pre-trained processing model using a plurality of sample sub-problems and sample sub-patches corresponding to the plurality of sample sub-problems, to obtain a code processing model.
2. The method according to claim 1, wherein the sample code document further comprises sample reference information, wherein the sample reference information comprises at least one of sample comment information and sample description information of the sample patch; The step of simulating the project development cycle of the sample project according to the sample problem and the sample patch to obtain sample code data includes: According to the sample problem, the sample patch and the sample reference information, the project development cycle of the sample project is simulated to obtain sample code data.
3. The method according to claim 1, wherein simulating the project development cycle of the sample project according to the sample problem and the sample patch to obtain sample code data comprises: The simulation prompt information of multiple project development stages, the sample problems and the sample patches are input into a data processing model to obtain sample code data, wherein the multiple project development stages include at least two of the search stage, the positioning stage, the coding stage, the debugging stage, the repair stage and the development stage.
4. The method according to any one of claims 1 to 3, before using the sample code data to train the pre-trained processing model to obtain the code processing model, further comprising: Obtaining sample test code from the sample code document; Run the sample test code to obtain a code test log, and run the sample code data to obtain a code running log; Determining a test result of the sample code data according to the code test log and the code running log; The method of training the pre-trained processing model using the sample code data to obtain the code processing model includes: The pre-training processing model is trained using the sample code data whose test results are tested to obtain a code processing model.
5. The method according to claim 1, wherein obtaining a sample code document of a sample project comprises: Get the historical commit information of the sample project; The sample issues in the historical submission information and the sample patches corresponding to the sample issues are identified, and the sample code documents of the sample projects are obtained.
6. The method according to claim 5, after identifying the sample issues in the historical submission information and the sample patches corresponding to the sample issues and obtaining the sample code documents of the sample projects, further comprises: Acquire historical review information of the sample project, wherein the historical review information carries a review object identifier; Filtering sample comment information of the sample code document from the historical comment information according to the comment object identifier and the submission object identifier of the sample patch; The sample comment information is added to the sample code document to obtain an updated sample code document.
7. The method according to claim 1, wherein obtaining a sample code document of a sample project comprises: Obtain source code files of the sample project; Parsing the source code file to determine a plurality of code blocks and code relationships between the plurality of code blocks; Constructing a code structure graph using the multiple code blocks as nodes and the code relationships as edges; The code structure diagram and the document template are input into a document generation model to obtain a sample code document of the sample project.
8. The method according to claim 1, wherein the using the sample code data to train the pre-trained processing model to obtain the code processing model comprises: Using a plurality of sample sub-problems, training the pre-trained processing model to obtain an initial code processing model; The initial code processing model is trained using the multiple sample sub-problems and the sample sub-patches respectively corresponding to the multiple sample sub-problems to obtain a code processing model.
9. The method according to claim 1, wherein after the pre-training processing model is trained using the sample code data to obtain the code processing model, the method further comprises: Obtain multiple sample demand information; Inputting the plurality of sample demand information into the code processing model to obtain prediction processing results respectively corresponding to the plurality of sample demand information; According to the preference information fed back by the terminal device regarding the prediction processing result, the model parameters of the code processing model are adjusted to obtain an updated code processing model.
10. A code task processing method, comprising: Get the code data to be processed of the target code task; The code data to be processed is input into a code processing model to obtain a code processing result, wherein the code processing model is trained using the training method according to any one of claims 1 to 9.
11. A code development method, applied to a server, comprising: Receiving code requirement information sent by a terminal device; Inputting the code requirement information into a code processing model to obtain a target code, wherein the code processing model is trained using the training method according to any one of claims 1 to 9; The target code is fed back to the terminal device.
12. An information processing method based on a code processing model, applied to a task platform, comprising: Receiving a model request sent by a terminal device; Based on the model request, a target code processing model is determined from a plurality of code processing models, wherein the plurality of code processing models are trained based on the training method according to any one of claims 1 to 9.
13. The method according to claim 12, wherein the model request includes a scene identifier of a target scene; The step of determining a target code processing model from a plurality of code processing models based on the model request includes: Based on the scenario identifier of the target scenario, a target code processing model adapted to the target scenario is searched from a model library, wherein the model library stores a plurality of code processing models adapted to different code processing scenarios.
14. The method according to claim 12, wherein the model request includes scene input data of the target scene; The step of determining a target code processing model from a plurality of code processing models based on the model request includes: Determining an initial code processing model adapted to the target scenario from a plurality of code processing models; Based on the scenario input data of the target scenario, the initial code processing model is trained to obtain a target code processing model.
15. The method of claim 12, wherein the model request comprises model specification parameters; The step of determining a target code processing model from a plurality of code processing models based on the model request includes: Based on the model specification parameters, a corresponding target code processing model is searched from a model library, wherein the model library stores a plurality of code processing models with different model specification parameters.
16. The method according to any one of claims 12 to 15, after determining the target code processing model from a plurality of code processing models based on the model request, further comprising: The target code processing model is deployed, and based on the target code processing model, a code task processing interface is constructed so that the terminal device schedules the target code processing model to execute the target code task.
17. A task platform, comprising a request interface and a response unit; The request interface is used to receive a model request sent by a terminal device, wherein: The model request includes a scene identifier of a target scene, scene input data of the target scene, and at least one of a model specification parameter; The response unit is used to determine a target code processing model from a plurality of code processing models based on the model request, wherein the plurality of code processing models are trained based on the training method according to any one of claims 1 to 9.
18. The task platform according to claim 17, further comprising a code task processing interface, wherein the code task processing interface is constructed based on the target code processing model; The code task processing interface is used for the terminal device to schedule and execute the target code task.
19. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 16 are implemented.
20. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 16.
21. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Code quality analysis method and device, storage medium and electronic equipment
CN109871317A
Model training method and device, test method and device, electronic equipment and storage medium
CN113296836A
Training sample construction method and device, electronic equipment and medium
CN116521866A
Sample construction method, code generation method, electronic equipment and storage medium
CN117556263A
Task processing method, code completion method, code question and answer method and task processing model training method
CN117648079A
