Data generation method, device and system
Through a seed data-driven large-model data generation system, seed data and prompt statements are used to guide the generation of target code data pairs, which solves the problems of high cost and low quality of code data set generation in the prior art, and realizes efficient and automated data set expansion and model parameter adjustment.
Patent Information
- Application Number
- CN202410126123.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-29
- Publication Date
- 2025-08-01
AI Technical Summary
The prior art has high human, time and space costs when generating code data sets, and data production directly through large models is prone to generate low-quality data and hallucinations.
Through a seed data-driven large-scale model data generation system, seed data and prompt statements are used to guide large machine learning models to generate relevant data, including extracting a preset number of reference code data pairs, and generating target code data pairs through the data generation model. Combining unit testing and code repair mechanisms, we ensure data quality and availability.
It improves the efficiency and quality of code data generation, reduces costs, ensures the diversity, integrity and availability of the generated target code data pairs, and realizes automated data set expansion and model parameter adjustment.
Smart Images

Figure CN120407388A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technologies, and particularly to a data generation method, apparatus, and system. Background Art
[0002] In the current software development field, code large models have become the core tools for many enterprises to achieve intelligence. A code large model is a model specifically used to understand and generate code, and usually requires adjusting parameters by using millions of code data sets.
[0003] In the process of generating these millions of code data sets, due to the huge amount of data, the traditional method of relying on human labor to label code data will lead to problems such as high human, time, and space costs, and can no longer meet the actual needs. Therefore, there is an urgent need for an efficient data generation method to reduce costs such as human, time, and space. Summary of the Invention
[0004] In view of this, the embodiments of this specification provide a data generation method. One or more embodiments of this specification also relate to a data generation apparatus, 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 the embodiments of this specification, a data generation method is provided, including: obtaining a data generation task, where the data generation task carries a data set, the data set includes a plurality of code data pairs, and the code data pair includes an instruction description and a corresponding code; extracting a preset number of reference code data pairs from the plurality of code data pairs; inputting the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and a corresponding target code.
[0006] According to a second aspect of the embodiments of this specification, a data generation apparatus is provided, including: an obtaining module configured to obtain a data generation task, where the data generation task carries a data set, the data set includes a plurality of code data pairs, and the code data pair includes an instruction description and a corresponding code; an extraction module configured to extract a preset number of reference code data pairs from the plurality of code data pairs; an input module configured to input the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and a corresponding target code.
[0007] According to the third aspect of the embodiments of the present specification, a data generation system is provided. The data generation system includes an edge device and a cloud device; the edge device is configured to send a data generation request; the cloud device is configured to receive the data generation request, determine the data generation task and the data set carried thereby according to the data generation request, the data set including a plurality of code data pairs, the code data pair including an instruction description and the corresponding code; extract a preset number of reference code data pairs from the plurality of code data pairs; input the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and the corresponding target code.
[0008] According to the fourth aspect of the embodiments of the present specification, a computing device is provided, including: a memory and a processor; the memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, and when the computer programs / instructions are executed by the processor, the steps of the above data generation method are implemented.
[0009] According to the fifth aspect of the embodiments of the present specification, a computer-readable storage medium is provided, which stores computer programs / instructions, and when the instructions are executed by a processor, the steps of the above data generation method are implemented.
[0010] According to the sixth aspect of the embodiments of the present specification, a computer program product is provided, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the above data generation method are implemented.
[0011] An embodiment of the present specification obtains a data generation task, where the data generation task carries a data set, the data set including a plurality of code data pairs, the code data pair including an instruction description and the corresponding code; extracts a preset number of reference code data pairs from the plurality of code data pairs; inputs the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and the corresponding target code. By extracting a preset number of reference code data pairs from the data set carried in the data generation task, a data generation model is used to generate a target code data pair based on the preset number of reference code data pairs, ensuring the diversity of the generated target code data pairs, and the code data pairs in the data set include an instruction description and the corresponding code, so that the generated target code data pair also includes a target instruction description and the corresponding target code, ensuring the integrity and usability of the target code data pair, greatly improving the efficiency of generating data, and realizing the reduction of the cost of generating code data pairs. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1It is a schematic diagram of an interaction process under a data generation system architecture provided by an embodiment of this specification;
[0013] Figure 2 It is a framework diagram of a data generation system provided by an embodiment of this specification;
[0014] Figure 3 It is a flowchart of a data generation method provided by an embodiment of this specification;
[0015] Figure 4 It is a processing process flowchart of a data generation method provided by an embodiment of this specification;
[0016] Figure 5 It is a structural schematic diagram of a data generation device provided by an embodiment of this specification;
[0017] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of this specification. Specific embodiments
[0018] In the following description, numerous specific details are set forth in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of this specification. Therefore, this specification is not limited by the specific embodiments disclosed below.
[0019] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0020] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such 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 "when" or "while" or "in response to determining".
[0021] 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 for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data that have been authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0022] In one or more embodiments of this specification, a large model refers to a deep learning model with a large number of model parameters, usually including hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than one quadrillion model parameters. A large model can also be referred to as a Foundation Model. Through pre-training of the large model with a large amount of unlabeled corpus, a pre-trained model with over hundreds of millions of parameters is produced. This kind of model can adapt to a wide range of downstream tasks and has good generalization ability. For example, large language models (LLMs), multi-modal pre-training models, etc.
[0023] When a large model is actually applied, it only needs to be fine-tuned with a small number of samples for the pre-trained model to be applied to different tasks. Large models can be widely applied in the fields of natural language processing (NLP), computer vision, etc. Specifically, they can be applied to tasks in the field of computer vision such as visual question answering (VQA), image captioning (IC), image generation, etc., as well as tasks in the field of natural language processing such as text-based sentiment classification, text summary generation, machine translation, etc. The main application scenarios of large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0024] First, the noun terms involved in one or more embodiments of this specification are explained.
[0025] Code large model: It is a model specifically used to understand and generate code, usually trained on millions of publicly available source code libraries. The application of code large models is very extensive. It can help developers write code, debug code, understand complex code libraries, learn new programming languages or frameworks, and automate programming tasks, etc. In addition, it can also be used in education and research to help students and researchers better understand and master programming.
[0026] In the past few years, artificial intelligence has made remarkable progress in many fields, including natural language processing, image recognition and generation, and gaming. However, the understanding and generation of programming languages have always been a challenge because it requires in-depth understanding of syntax, semantics, and program logic.
[0027] Code large models have a very wide range of applications. They can help developers write code, debug code, understand complex code libraries, learn new programming languages or frameworks, and automate programming tasks, etc. In addition, they can also be used in education and research to help students and researchers better understand and master programming.
[0028] However, there are also some challenges and problems with code large models. Especially, how to align instructions for the pre-trained models is a core problem, and the lack of high-quality instruction data is a major difficulty. Manually annotating code data is time-consuming and laborious, and it is impossible to expand the data volume in a short time. Currently, large models have the ability to generate their own data, but directly generating data has a probability of producing unexecutable code, resulting in low-quality data and making the model more prone to hallucinations.
[0029] To solve the above technical problems, an embodiment of this specification provides a large model data generation system driven by seed data. This system uses seed data and prompt statements as initial inputs to guide a large machine learning model to generate more relevant data. Specifically, in this specification, a data generation method is provided. This specification also relates to a data generation device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments.
[0030] See Figure 1 , Figure 1 shows a schematic diagram of the interaction process under a data generation system architecture provided by an embodiment of this specification. As Figure 1 shown, the system includes a cloud-side device 100 and an edge-side device 200.
[0031] Edge-side device 200: used to send a data generation request;
[0032] Cloud-side device 100: used to receive a data generation request, determine a data generation task and the dataset carried by it according to the data generation request. The dataset includes multiple code data pairs, and a code data pair includes an instruction description and the corresponding code; extract a preset number of reference code data pairs from the multiple code data pairs; input the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and the corresponding target code.
[0033] Optionally, the cloud-side device 100 is further configured to add the target code data pair to the data set to obtain an updated data set.
[0034] By applying the solution of the embodiments of this specification, a preset number of reference code data pairs are extracted from the data set carried in the data generation task, so that the data generation model is used to generate target code data pairs based on the preset number of reference code data pairs, ensuring the diversity of the generated target code data pairs. Moreover, the code data pairs in the data set include instruction descriptions and corresponding codes, so that the generated target code data pairs also include target instruction descriptions and corresponding target codes, ensuring the integrity and availability of the target code data pairs, greatly improving the efficiency of data generation, and realizing the reduction of the cost of generating code data pairs.
[0035] See Figure 2 , Figure 2 FIG. shows a framework diagram of a data generation system provided by an embodiment of this specification. The system may include a cloud-side device 100 and multiple end-side devices 200. Communication connections can be established between the multiple end-side devices 200 through the cloud-side device 100. In the data generation scenario, the cloud-side device 100 is used to provide data generation services between the multiple end-side devices 200. The multiple end-side devices 200 can be used as sending ends or receiving ends respectively to achieve communication through the cloud-side device 100.
[0036] The user can interact with the cloud-side device 100 through the end-side device 200 to receive data sent by other end-side devices 200, or send data to other end-side devices 200, etc. In the data generation scenario, it can be that the user issues a data generation request to the cloud-side device 100 through the end-side device 200. The cloud-side device 100 generates a data generation result according to the data generation request and pushes the data generation result to other end-side devices 200 that have established communication.
[0037] Among them, a connection is established between the end-side device 200 and the cloud-side device 100 through a network. The network provides a medium for the communication link between the end-side device 200 and the cloud-side device 100. The network can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc. The data transmitted by the end-side device 200 may need to be processed such as encoded, transcoded, compressed, etc. before being published to the cloud-side device 100.
[0038] The edge device 200 can be a browser, an application (APP), or a web application such as a Hyper Text Markup Language 5 (H5) application, or a light application (also known as a mini-program, a lightweight application), or a cloud application, etc. The edge device 200 can be developed based on the Software Development Kit (SDK) of the corresponding services provided by the cloud device, such as developed based on the Real Time Communication (RTC) SDK. The edge device 200 can be deployed in an electronic device and needs to rely on the device or certain APPs in the device to run, etc. The electronic device can, for example, have a display screen and support information browsing, etc., such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can usually be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, mailbox edge devices, social platform software, etc.
[0039] The cloud device 100 can include servers that provide various services. For example, a server that provides communication services for multiple edge devices, or a server for background training that provides support for the models used on the edge devices, or a server that processes the data sent by the edge devices, etc. It should be noted that the cloud device 100 can be implemented as a distributed server cluster composed of multiple servers, or can be implemented as a single server. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server of basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.
[0040] It is worth noting that the data generation method provided in the embodiments of this specification is generally executed by the cloud device 100. However, in other embodiments of this specification, the edge device 200 can also have a similar function to the cloud device, so as to execute the data generation method provided in the embodiments of this specification. In other embodiments, the data generation method provided in the embodiments of this specification can also be jointly executed by the edge device 200 and the cloud device 100.
[0041] See Figure 3 , Figure 3The flowchart of a data generation method provided by an embodiment of this specification is shown, which specifically includes the following steps.
[0042] Step 302: Obtain a data generation task, where the data generation task carries a data set, and the data set includes multiple code data pairs, and each code data pair includes an instruction description and a corresponding code.
[0043] The embodiment of this specification is applied to the edge device and / or cloud device to which the project with the data generation model belongs. The following takes the cloud device as an example for illustration.
[0044] When there is a need for a data generation task, the cloud device will obtain the data generation task to perform data generation by using the code data pairs in the data set carried in the data generation task.
[0045] Specifically, a data generation task refers to a to-be-processed task generated accordingly when there is a need for data generation, and the data generation task is usually generated based on the data generation request of the front-end user. A data set refers to a data set composed of sample data required for parameter adjustment of the model. Among them, parameter adjustment can be to train the model using the data set or to fine-tune the model using the data set. Each code data pair includes an instruction description and a corresponding code. In different application scenarios, the role of the code data pair is different. In the field of model training, the instruction description in the code data is the input sample of the code generation model, and the code is the output label of the code generation model. Through the instruction description and the corresponding code, the model parameters of the code generation model can be adjusted so that the code generation model can perform code generation more accurately and efficiently. Among them, the code generation model is a large code model for generating code data based on the instruction description. In the Q&A scenario, the instruction description and the corresponding code included in the code data pair can form a data set, and the data set is used as the code database in the Q&A scenario. When the user inputs questions such as "instruction description", "code", or "code data pair to be verified", matching can be performed in the code database, and the answer "code" corresponding to the question "instruction description" can be obtained; the answer "instruction description" corresponding to the question "code"; the answer "verification result and code pair" corresponding to the question "code data pair to be verified". When the verification result is correct, the answer can specifically be "correct and the code data pair to be verified". When the verification result is incorrect, the answer can specifically be "incorrect and the correct code data pair found in the code database".
[0046] There are many ways to obtain data generation tasks. The front-end user can initiate a data generation request on the end-side device. The data generation request carries the index information of the data set. The cloud-side device obtains the data set based on the index information and generates a data generation task based on the data set and the data generation request. Alternatively, the front-end user can directly initiate and upload the data generation task to the cloud-side device through the end-side device.
[0047] Step 304 : Extract a preset number of reference code data pairs from the plurality of code data pairs.
[0048] Specifically, a reference code data pair refers to a code data pair extracted from multiple code data pairs included in a dataset. The reference code data pairs are randomly selected, thereby ensuring the diversity of target code data pairs generated based on the reference code data pairs. The preset number refers to a pre-set number of reference code data pairs. The preset number is determined based on one or more of the following: the processing requirements for generating new code data pairs from the data model, the diversity requirements for the generated target code data pairs, and the number of code data pairs contained in the dataset.
[0049] The method of extracting a preset number of reference code data pairs from a plurality of code data pairs may be to randomly extract a preset number of code data pairs from the plurality of code data pairs and determine the extracted preset number of code data pairs as reference code data pairs.
[0050] Step 306: Input a preset number of reference code data pairs into the data generation model to obtain target code data pairs corresponding to the data generation task, wherein the target code data pairs include target instruction descriptions and corresponding target codes.
[0051] Specifically, the data generation model is a large model that has the ability to generate data. The target code data pairs are code data pairs generated based on the data generation model using a preset number of random reference code data pairs. The target code data pairs also include target instruction descriptions and corresponding target codes.
[0052] An implementation method for inputting a preset number of reference code data pairs into a data generation model to obtain target code data pairs corresponding to a data generation task may be to obtain a first prompt statement, input a preset number of reference code data and the first prompt statement into the data model, obtain code data pairs output by the data generation model, and use the code data pairs as the target code data pairs corresponding to the data generation task. The first prompt statement is used to prompt the data generation model to generate code data pairs, wherein the first prompt statement may be uploaded by a user, or obtained from a designated location by a cloud-side device based on the acquired data generation task.
[0053] After obtaining the target code data pair corresponding to the data generation task, it is also possible to test whether the target code data can be successfully executed. In the case of successful execution, the target code data pair is added to the data set to obtain an updated data set; in the case of failed execution, the target code data pair is repaired and the repaired target code data pair is added to the data set to obtain an updated data set.
[0054] Optionally, the updated data set can be used as sample data for training, fine-tuning, etc. of the code generation model.
[0055] In an optional embodiment of this specification, the data generation task also carries a first prompt statement, and the first prompt statement is used to prompt the data generation model to generate a code data pair; the above step of inputting a preset number of reference code data pairs into the data generation model to obtain the target code data pair corresponding to the data generation task includes the following steps:
[0056] Concatenate a preset number of reference code data pairs with the first prompt statement, input the concatenation result into the data generation model, and obtain the target code data pair corresponding to the data generation task.
[0057] Specifically, the first prompt statement is used to prompt the data generation model to generate a code data pair, and the first prompt statement is carried in the data generation task, so that the cloud-side device generates data based on the first prompt statement carried in the data generation task.
[0058] The implementation method of concatenating a preset number of reference code data pairs with the first prompt statement, inputting the concatenation result into the data generation model, and obtaining the target code data pair corresponding to the data generation task can be to obtain a preset concatenation method, and based on the preset concatenation method, concatenate a preset number of reference code data pairs with the first prompt statement, input the concatenation result into the data generation model, obtain the code data pair output by the data generation model, and use this code data pair as the target code data pair corresponding to the task.
[0059] Among them, the preset concatenation method can include a first concatenation method and a second concatenation method. The first concatenation method is used to define the concatenation between a preset number of reference code data pairs, and the second concatenation method is used to define the concatenation between a preset number of reference code data pairs and the first prompt statement.
[0060] The data generation task also carries a first prompt statement for prompting the data generation model to generate code data pairs. The first prompt statement and a preset number of reference code data pairs are concatenated and input into the data generation model to obtain the target code data pairs corresponding to the data generation task, so that the generated target code data pairs meet the prompting purpose required by the first prompt statement, ensuring the adaptability between the generated target code data pairs and the data generation task, and further ensuring the accuracy of the generated target code data pairs.
[0061] In an optional embodiment of this specification, after the step of inputting a preset number of reference code data pairs into the data generation model to obtain the target code data pairs corresponding to the data generation task, the following steps are further included:
[0062] Obtain a code data testing task, where the code data testing task carries a second prompt statement for prompting the data generation model to generate unit tests;
[0063] Input the target code data pairs and the second prompt statement into the data generation model to obtain at least one unit test for the target code data pairs, where the unit test includes test input parameters and expected output parameters;
[0064] Based on the test input parameters and the expected output parameters, perform test execution on at least one unit test to determine the test execution result of the target code data pairs;
[0065] In the case where the test execution result is successful execution, add the target code data pairs to the data set.
[0066] Specifically, a code data test task refers to a test task for a code data pair generated based on a front-end user's request. The front-end user's request can be a data generation request. The cloud-side device generates a data generation task based on the data generation request. After generating the corresponding target code data pair based on the data generation task, the cloud-side device automatically generates a code data test task according to a predetermined processing flow. The front-end user's request can also be a code data test request. After generating the target code data pair, the target code data pair is displayed to the front-end user. The front-end user initiates a code data test request based on the displayed target code data pair, and generates a code data test task based on the code data test request, so that the cloud-side device tests the target code data pair based on the code data test task. The second prompt statement is used to prompt the data generation model to generate a unit test. Unit testing, also known as module testing, is the process of verifying the correctness of program modules. It can improve the quality of software development. The "unit" in unit testing refers to the program module. For example, a unit can be the smallest testable unit in a program. Unit testing takes the form of function calls, which can be understood as a test function for a program. For example, for a program called cap to capitalize a string, the unit test would typically be statements like assert cap("aab") == "AAB" or assert cap("AaB") == "AAB." For example, for a program called sort to sort, the unit test might be sort([2,3,1]) == [1,2,3]. Test execution results can be expressed as success or failure.
[0067] An implementation method for inputting the target code data pair and the second prompt statement into the data generation model to obtain at least one unit test of the target code data pair may be to splice the target code data pair and the second prompt statement, input the splicing result into the data generation model, obtain at least one unit test output by the data generation model, and determine the at least one unit test as at least one unit test of the target code data pair, where the unit test includes test input parameters and expected output parameters.
[0068] Based on the test input parameters and expected output parameters, at least one unit test is tested and executed, and there are many ways to determine the test execution results of the target code data pair. The specific implementation method is determined according to the actual situation and is not limited in this specification.
[0069] In a possible implementation of this specification, based on test input parameters and expected output parameters, test execution is performed on at least one unit test to determine the test execution result of the target code data pair. It can be to obtain a test executor, input the target code data pair and at least one test input parameter into the test executor, and obtain the prediction results of each test input parameter. Herein, the test executor is used to test the executability of the code data pair; based on the prediction results and the expected output parameters, determine the test execution result of the target code data pair.
[0070] In another possible implementation of this specification, based on test input parameters and expected output parameters, test execution is performed on at least one unit test to determine the test execution result of the target code data pair. It can be to determine a target unit test from at least one unit test, input the test input parameter of the target unit test and the target code data pair into the test executor, obtain the prediction result of the test input parameter, and based on the prediction result and the expected output parameters, determine the test execution result of the target code data pair.
[0071] By obtaining a code data test task, inputting the target code data pair and a second prompt statement into a data generation model, obtaining at least one unit test of the target code data pair, performing test execution on at least one unit test, determining the test execution result of the target code data pair, and determining the executability of the target code data pair, then add the target code data to the dataset. And it can automatically generate unit tests, thus saving the time and effort of manually writing test cases.
[0072] In an optional embodiment of this specification, the above steps of performing test execution on at least one unit test based on the test input parameters and the expected output parameters to determine the test execution result of the target code data pair include the following steps:
[0073] Input the target code data pair and at least one test input parameter into the test executor to obtain the prediction results of each test input parameter. Herein, the test executor is used to test the executability of the code data pair;
[0074] Based on the prediction results and the expected output parameters, determine the test execution result of the target code data pair.
[0075] There are many ways to input the target code data pair and at least one test input parameter into the test executor to obtain the prediction results of each test input parameter, which are determined according to the actual situation and are not limited herein.
[0076] In a possible implementation of this specification, inputting the target code data pair and at least one test input parameter into the test executor to obtain the prediction results of each test input parameter may be, for the first test input parameter, inputting the first test input parameter and the target code data pair into the test executor to obtain the prediction result of the first test input parameter, where the first test input parameter is any one of the at least one test input parameter.
[0077] In another possible implementation of this specification, inputting the target code data pair and at least one test input parameter into the test executor to obtain the prediction results of each test input parameter may also be inputting the target code data pair and at least one test input parameter into the test executor simultaneously to obtain the prediction results of each test input parameter output by the test executor.
[0078] Optionally, inputting the target code data pair and at least one test input parameter into the test executor may be splicing the target code data pair and at least one test input parameter and inputting the splicing result into the test executor so that the test executor performs test execution.
[0079] The implementation manner of determining the test execution result of the target code data pair based on the prediction result and the expected output parameter may be to perform a consistency comparison between the prediction result and the expected output parameter; based on the comparison result, determine the test execution result of the target code data pair.
[0080] Inputting the target code data pair and at least one test input parameter into the test executor to obtain the prediction results of each test input parameter, determining the test execution result of the target code data pair based on the prediction result and the expected output parameter, testing the executability of the target code data by using at least one test parameter and the test executor, and performing corresponding processing based on the test execution result ensure the accuracy of whether to add the target code data pair to the data set.
[0081] In an optional embodiment of this specification, after the above steps of performing test execution on at least one unit test based on the test input parameter and the expected output parameter to determine the test execution result of the target code data pair, the following steps are further included:
[0082] In the case where the test execution result is a failure, obtain a code data repair task, where the code data repair task carries a third prompt statement for prompting the data generation model to perform code data repair on the code data pair;
[0083] Input the target code data pair and the third prompt statement into the data generation model to obtain a repaired code data pair;
[0084] Determine the repaired code data pair as the updated target code data pair, and add the target code data pair to the data set.
[0085] Specifically, the code data repair task refers to the task of repairing the executability of the code data pair. The method of obtaining the code repair task is the same as the method of obtaining the code data test task. For specific details, please refer to the description of the above code data test task and will not be elaborated here. The repaired code data pair refers to the code data pair obtained after repairing the executability of the target code data pair. Generally, the executability of the repaired code data pair is higher than that of the target code data pair. The third prompt statement is used to prompt the data generation model to perform code data repair on the code data pair.
[0086] The implementation manner of inputting the target code data pair and the third prompt statement into the data generation model to obtain the repaired code data pair can be to splice the target code data pair and the third prompt statement, and input the splicing result into the data generation model to obtain the repaired code data pair.
[0087] Determine the repaired code data pair as the updated target code data pair, and add the target code data pair to the data set. It can be that after performing code repair on the target code data pair, the executability of the target code data pair is ensured. Therefore, the repaired code data pair is determined as the updated target code data pair, and the target code data pair is added to the data set, so that the target code data pair can be used as training data, fine-tuning data to adjust the model parameters of the code generation model, or as the code data in the code database in the question-and-answer scenario.
[0088] Optionally, after inputting the target code data pair and the third prompt statement into the data generation model to obtain the repaired code data pair, it can further include testing the executability of the repaired code data pair. When the test execution result of the repaired code data pair is successful, then add the target code data pair to the data set.
[0089] When the test execution result for the target code data pair is a failure, perform code repair on the target code data to obtain the repaired code data pair, and add the repaired code data pair to the data set to achieve the expansion of the data set. Moreover, the added data set is the repaired code data pair, which ensures the usability of the data set, and further ensures the application accuracy in the application stage after adjusting the parameters of the code generation model using the data set.
[0090] In an optional embodiment of this specification, after the above step of inputting the target code data pair and the third prompt statement into the data generation model to obtain the repaired code data pair, the following steps are further included:
[0091] Input the second prompt statement and the repair code data pair into the data generation model to obtain at least one repair unit test for the repair code data pair. The repair unit test includes repair test input parameters and repair expected output parameters;
[0092] Based on the repair test input parameters and the repair expected output parameters, test at least one repair test unit to determine the repair test execution result of the repair code data pair;
[0093] When the repair test execution result is successful execution, perform the step of determining the repair code data pair as the updated target code data pair.
[0094] Specifically, the repair test unit refers to the unit test corresponding to the repair code data pair. Through the repair test unit, the executability of the repair code data pair can be determined. The repair test unit includes repair test input parameters and repair expected output parameters.
[0095] The implementation manner of inputting the second prompt statement and the repair code data pair into the data generation model to obtain at least one repair unit test for the repair code data pair can be to splice the second prompt statement and the repair code data pair, input the splicing result into the data generation model, and obtain at least one repair unit test output by the data generation model.
[0096] The implementation manner of testing at least one repair test unit based on the repair test input parameters and the repair expected output parameters to determine the repair test execution result of the repair code data pair can be to input the repair code data pair and at least one repair test input parameter into the test executor to obtain the repair prediction result of each repair test input parameter; based on the repair prediction result and the repair expected output parameter, determine the repair test execution result of the repair code data pair.
[0097] When the repair test execution result is successful execution, the step of determining the repair code data pair as the updated target code data pair can be to determine the repair code data pair as the updated target code data pair when the executability test for the repair code data pair is successful, and add the target code data pair to the data set.
[0098] After inputting the target code data pair and the third prompt statement into the data generation model to obtain the repair code data pair, input the second prompt statement and the repair code data pair into the data generation model to obtain at least one repair unit test for the repair code data pair, and perform an execution test on at least one repair unit test to determine the repair execution test result of the repair code data. When the repair test execution result is successful execution, add the repair code data pair to the data set to adjust the parameters of the code generation model.
[0099] In an optional embodiment of this specification, after testing at least one repair test unit in the above step and determining the repair test execution result of the repair code data pair, the following steps are further included:
[0100] In the case where the repair test execution result is a failure, return to the step of executing the task of obtaining the code data repair until the iteration stop condition is reached.
[0101] Specifically, the iteration stop condition refers to the condition that limits the stop execution of the iteration process. The iteration stop condition can be that the repair test execution result is a success, the number of iterations reaches the upper limit, etc.
[0102] In the case where the repair test execution result for the repair code data pair fails, it is determined that the repair code data pair cannot be executed successfully and needs to be repaired again. That is, the repair code data pair is determined as the updated target code data pair, and return to the step of executing the repair of the target code data pair, so as to obtain the repair code data pair generated after code repair again, and add the repaired repair code data pair to the data set. Among them, before adding the repaired repair code data pair to the data set, the executability of the repaired repair code data pair can also be tested. In the case where the repair execution test result is a success, add it to the data set. If the repair execution test result is a failure, determine the repaired repair code data pair as the updated target code data pair, and perform such iteration until the iteration stop condition is reached.
[0103] In the case where the repair test execution result is a failure, return to the step of executing the task of obtaining the code data repair until the iteration stop condition is reached, determine the processing result of the target code data pair for this time, and execute the corresponding steps based on different iteration stop conditions.
[0104] In an optional embodiment of this specification, the iteration stop condition is that the repair test execution result is a success; after the above steps until the iteration stop condition is reached, the following steps are further included:
[0105] Execute the step of determining the repair code data pair as the updated target code data pair.
[0106] In the case where the iteration stop condition is that the repair test execution result for testing the executability of the repair code data pair is a success, it is determined that the repair code data pair can be executed normally. Therefore, execute the step of determining the repair code data pair as the updated target code data pair to add the repair code data pair to the data set.
[0107] When the reached iteration stop condition is that the result of the repair test execution is successful, the repaired code data pair is added to the dataset to expand the dataset. Moreover, the repaired code data pair is the code data pair that has been repaired and can be executed normally, ensuring the availability of the data in the dataset, and further ensuring the accuracy of the application phase after parameter adjustment of the code generation model using the dataset.
[0108] In an optional embodiment of this specification, the iteration stop condition is that the number of iterations reaches the upper limit; after the above steps until the iteration stop condition is reached, the following steps are further included:
[0109] Return to execute the step of extracting a preset number of reference code data pairs from multiple code data pairs.
[0110] When the iteration stop condition is that the number of iterations reaches the upper limit, if the iteration stop condition is reached, it is determined that the repaired code data pair cannot be executed normally, so the repaired code data pair is discarded, and the step of extracting a preset number of reference code data pairs from multiple code data pairs is returned to execute again to generate the target code data pair and add it to the dataset to expand the dataset. For example, the upper limit of the number of iterations can be 3 times.
[0111] The embodiment of this specification can produce high-quality code data quickly through large model production and compiler checking without manual intervention, achieving better instruction following effects.
[0112] The embodiment of this specification provides a large model data generation and test execution system driven by seed data. This system can effectively utilize the existing seed data, expand and enhance the dataset through the generation ability of the large model. At the same time, this system can also automatically generate unit tests and check the executability of the code, thereby ensuring the quality and reliability of the generated code data pairs.
[0113] In an optional embodiment of this specification, in the field of model training, the instruction description in the code data is the input sample of the code generation model, and the code is the output label of the code generation model. Through the instruction description and the corresponding code, the model parameters of the code generation model can be adjusted so that the code generation model can generate code more accurately and efficiently. That is, the above data generation method further includes the following steps:
[0114] Determine sample code data pairs from the dataset, where the sample code data pairs include instruction description samples and corresponding code labels;
[0115] Use the instruction description samples and code labels to train or fine-tune the code generation model.
[0116] Specifically, the data set is updated based on the generated target code data pairs to achieve the expansion of the data set. The sample code data pair is any one of the multiple code data pairs included in the data set.
[0117] The implementation manner of training or fine-tuning the code generation model by using the instruction description samples and code labels can be to input the sample instruction description into the code generation model to obtain a prediction result; based on the prediction result and the labeled code, adjust or fine-tune the model parameters of the code generation model, and return to execute the step of determining the sample code data pair from the data set until the training or fine-tuning stop condition is reached, and obtain the code generation model that has completed training.
[0118] Determine the sample code data pair from the data set to train the code generation model by using the code data pairs in the data set as sample data, and the data set is also expanded based on the generation of the target code data pairs, which solves the problem of insufficient sample data for the code generation model.
[0119] The implementation manner of adjusting or fine-tuning the model parameters of the code generation model based on the prediction result and the labeled code can be to calculate the loss value based on the prediction result and the labeled code, and adjust or fine-tune the model parameters of the code generation model based on the loss value.
[0120] Adjust or fine-tune the model parameters of the code generation model, and return to execute the process of determining the sample code data pair, so as to continue to use other code data pairs in the data set as new sample code data pairs to adjust or fine-tune the model parameters of the code generation model until the training stop condition is reached, and obtain the code generation model that has completed training or fine-tuning.
[0121] Optionally, the training or fine-tuning stop condition can be one of the loss value reaching the loss value threshold, the number of loops reaching the number threshold, etc.
[0122] By using the multiple code data pairs included in the data set as sample code pairs to train the code generation model, in the case of generating target code data pairs, add the target code data to the data set, which realizes the expansion of the data set, ensures the sufficiency of sample data, and further uses the code data pairs included in the expanded data set to train and fine-tune the code generation model, ensuring the model accuracy of the code generation model trained based on sufficient sample data.
[0123] The following combines the attached Figure 4 , taking the application of the data generation method provided in this specification in the training data generation of the code large model as an example, to further illustrate the data generation method. Among them, Figure 4 The flowchart of the processing process of a data generation method provided by an embodiment of this specification is shown, which specifically includes the following steps.
[0124] Obtain a dataset and the first prompt statement "Generate a new piece of data", and extract three reference code data from the dataset. The three reference code data pairs include reference code data pair 1, reference code data pair 2, and reference code data pair 3.
[0125] Input the three reference code data pairs and the first prompt statement into a data generation model to obtain the target code data pair output by the data generation model.
[0126] Obtain the second prompt statement "Generate unit tests for this code data pair", and input the second prompt statement and the target code data pair into the data generation model to obtain the unit tests for the target code data pair output by the data generation model. The unit tests include input test input parameters and expected output parameters.
[0127] Input the unit tests for the target code data pair into a test executor for test execution to obtain the test execution result for the target code data pair.
[0128] When the test execution result is successful execution, add the target code data pair to the dataset to achieve the expansion of the dataset.
[0129] When the test execution result is failed execution, obtain the third prompt statement "Modify this code data pair to be correct", input the third prompt statement and the target code data pair into the data generation model to obtain the repaired code data pair output by the data generation model, and generate the repaired unit tests for the repaired code data pair based on the second prompt statement.
[0130] Use the test executor to execute the repaired unit tests for the repaired code data pair again to obtain the repaired test execution result for the repaired code data pair.
[0131] When the repaired test execution result is successful execution, add the repaired code data pair to the dataset to achieve the expansion of the dataset.
[0132] When the repaired test execution result is failed execution, obtain the third prompt statement "Modify this code data pair to be correct", input the third prompt statement and the repaired code data pair into the data generation model to obtain the repaired code data pair output by the data generation model, and generate the repaired unit tests for the repaired code data pair based on the second prompt statement.
[0133] Iteratively execute in this way until the iteration stop condition is reached.
[0134] In the case where the iteration stop condition is that the number of iterations reaches the upper limit, if the iteration stop condition is reached, it is determined that the repaired code data pair cannot be executed normally. Therefore, the repaired code data pair is discarded, and the step of extracting a preset number of reference code data pairs from multiple code data pairs is returned to be executed again to generate target code data pairs and add them to the data set to realize the expansion of the data set.
[0135] In the case where the iteration stop condition is that the repair test execution result for testing the executability of the repaired code data pair is successful, it is determined that the repaired code data pair can be executed normally. Therefore, the step of determining the repaired code data pair as the updated target code data pair is executed to add the repaired code data pair to the data set.
[0136] Applying the solution of the embodiment of this specification, by extracting a preset number of reference code data pairs from the data set carried in the data generation task, and using the data generation model to generate target code data pairs based on the preset number of reference code data pairs, the diversity of the generated target code data pairs is ensured. And the code data pairs in the data set include instruction descriptions and corresponding codes, so that the generated target code data pairs also include target instruction descriptions and corresponding target codes, ensuring the integrity and usability of the target code data pairs, greatly improving the efficiency of generating data, and realizing the reduction of the cost of generating code data pairs.
[0137] Corresponding to the above method embodiment, this specification also provides an embodiment of a data generation device. Figure 5 The structural schematic diagram of a data generation device provided by an embodiment of this specification is shown. As Figure 5 shown, the device includes:
[0138] An acquisition module 502, configured to acquire a data generation task, where the data generation task carries a data set, the data set includes multiple code data pairs, and the code data pairs include instruction descriptions and corresponding codes;
[0139] An extraction module 504, configured to extract a preset number of reference code data pairs from multiple code data pairs;
[0140] An input module 506, configured to input the preset number of reference code data pairs into a data generation model to obtain target code data pairs corresponding to the data generation task, where the target code data pairs include target instruction descriptions and corresponding target codes.
[0141] Optionally, the data generation task also carries a first prompt statement, which is used to prompt the data generation model to generate code data pairs; the input module 506 is further configured to splice a preset number of reference code data pairs with the first prompt statement, input the splicing result into the data generation model, and obtain the target code data pairs corresponding to the data generation task.
[0142] Optionally, the data generation device further includes a test module, configured to obtain a code data test task, where the code data test task carries a second prompt statement, and the second prompt statement is used to prompt the data generation model to generate unit tests; input the target code data pairs and the second prompt statement into the data generation model to obtain at least one unit test of the target code data pairs, where the unit test includes test input parameters and expected output parameters; based on the test input parameters and the expected output parameters, perform test execution on at least one unit test to determine the test execution result of the target code data pairs; in the case where the test execution result is successful execution, add the target code data pairs to the data set.
[0143] Optionally, the test module is further configured to input the target code data pairs and at least one test input parameter into a test executor to obtain the prediction results of the respective test input parameters, where the test executor is used to test the executability of the code data pairs; based on the prediction results and the expected output parameters, determine the test execution result of the target code data pairs.
[0144] Optionally, the data generation device further includes a repair module, configured to, in the case where the test execution result is a failed execution, obtain a code data repair task, where the code data repair task carries a third prompt statement, and the third prompt statement is used to prompt the data generation model to perform code data repair on the code data pairs; input the target code data pairs and the third prompt statement into the data generation model to obtain repaired code data pairs; determine the repaired code data pairs as the updated target code data pairs, and add the target code data pairs to the data set.
[0145] Optionally, the data generation device further includes a result determination module, configured to input the second prompt statement and the repaired code data pairs into the data generation model to obtain at least one repaired unit test of the repaired code data pairs, where the repaired unit test includes repaired test input parameters and repaired expected output parameters; based on the repaired test input parameters and the repaired expected output parameters, perform tests on at least one repaired test unit to determine the repaired test execution result of the repaired code data pairs; in the case where the repaired test execution result is successful execution, perform the step of determining the repaired code data pairs as the updated target code data pairs.
[0146] Optionally, the data generation device further includes a first iteration module, configured to return to execute the step of obtaining the code data repair task until the iteration stop condition is reached when the repair test execution result is a failure.
[0147] Optionally, the iteration stop condition is that the repair test execution result is a success. The data generation device further includes a second iteration module, configured to execute the step of determining the repaired code data pair as the updated target code data pair.
[0148] Optionally, the iteration stop condition is that the number of iterations reaches the upper limit. The data generation device further includes a third iteration module, configured to return to execute the step of extracting a preset number of reference code data pairs from multiple code data pairs.
[0149] Optionally, the data generation device further includes a training module, configured to determine sample code data pairs from a dataset, where the sample code data pairs include instruction description samples and corresponding code labels; and use the instruction description samples and code labels to train or fine-tune the code generation model.
[0150] Applying the solution of the embodiment of this specification, by extracting a preset number of reference code data pairs from the dataset carried in the data generation task, and using the data generation model to generate target code data pairs based on the preset number of reference code data pairs, the diversity of the generated target code data pairs is ensured. And the code data pairs in the dataset include instruction descriptions and corresponding codes, so that the generated target code data pairs also include target instruction descriptions and corresponding target codes, ensuring the integrity and usability of the target code data pairs, greatly improving the efficiency of generating data, and realizing the reduction of the cost of generating code data pairs.
[0151] The above is a schematic solution of a data generation device in this embodiment. It should be noted that the technical solution of this data generation device and the technical solution of the above data generation method belong to the same concept. For the details not described in detail in the technical solution of the data generation device, reference can be made to the description of the technical solution of the above data generation method.
[0152] Figure 6 The structural block diagram of a computing device provided by an embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to store data.
[0153] The computing device 600 further includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of such networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interface (e.g., network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, Worldwide Interoperability for Microwave Access (Wi-MAX) interface, Ethernet interface, Universal Serial Bus (USB) interface, cellular network interface, Bluetooth interface, Near Field Communication (NFC).
[0154] In one embodiment of the present specification, the above components of the computing device 600 and Figure 6 other components not shown therein may also be connected to each other, for example, via a bus. It should be understood that Figure 6 the block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of the present specification. Those skilled in the art can add or replace other components as needed.
[0155] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.
[0156] Among them, the processor 620 is used to execute the following computer program / instructions, and when the computer program / instructions are executed by the processor, the steps of the above data generation method are implemented.
[0157] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above data generation method belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the description of the technical solution of the above data generation method.
[0158] An embodiment of this specification also provides a computer-readable storage medium that stores computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the above data generation method are implemented.
[0159] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above data generation method belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above data generation method.
[0160] An embodiment of this specification also provides a computer program product, including computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the above data generation method are implemented.
[0161] The above is a schematic solution of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above data generation method belong to the same concept. For the details not described in detail in the technical solution of the computer program product, reference can be made to the description of the technical solution of the above data generation method.
[0162] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired result. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.
[0163] The computer instructions include computer program code, which may be in the form of source code, object code, 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 media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memories, read-only memories (ROMs), random access memories (RAMs), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0164] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.
[0165] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0166] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The alternative embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can understand and utilize this specification well. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A data generation method, comprising: Obtaining a data generation task, wherein the data generation task carries a data set, the data set includes a plurality of code data pairs, and the code data pair includes an instruction description and a corresponding code; Extracting a preset number of reference code data pairs from the plurality of code data pairs; Inputting the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, wherein the target code data pair includes a target instruction description and a corresponding target code.
2. The method according to claim 1, wherein the data generation task further carries a first prompt statement for prompting the data generation model to generate a code data pair; The step of inputting the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task includes: Concatenating the preset number of reference code data pairs with the first prompt statement, and inputting the concatenation result into the data generation model to obtain a target code data pair corresponding to the data generation task.
3. The method according to claim 1 or 2, after the step of inputting the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, further comprising: Obtaining a code data testing task, wherein the code data testing task carries a second prompt statement for prompting the data generation model to generate unit tests; Inputting the target code data pair and the second prompt statement into the data generation model to obtain at least one unit test for the target code data pair, wherein the unit test includes test input parameters and expected output parameters; Based on the test input parameters and the expected output parameters, performing test execution on the at least one unit test to determine a test execution result of the target code data pair; When the test execution result is successful, adding the target code data pair to the data set.
4. The method according to claim 3, wherein the step of based on the test input parameters and the expected output parameters, performing test execution on the at least one unit test to determine a test execution result of the target code data pair includes: Inputting the target code data pair and at least one test input parameter into a test executor to obtain prediction results for the respective test input parameters, wherein the test executor is used to test the executability of the code data pair; Based on the prediction results and the expected output parameters, determining the test execution result of the target code data pair.
5. The method according to claim 3, after the step of based on the test input parameters and the expected output parameters, performing test execution on the at least one unit test to determine a test execution result of the target code data pair, further comprising: In the case where the test execution result is a failure, obtain a code data repair task, where the code data repair task carries a third prompt statement for prompting the data generation model to perform code data repair on a code data pair; Input the target code data pair and the third prompt statement into the data generation model to obtain a repaired code data pair; Determine the repaired code data pair as the updated target code data pair and add the target code data pair to the data set.
6. The method according to claim 5, after inputting the target code data pair and the third prompt statement into the data generation model to obtain a repaired code data pair, further comprising: Input the second prompt statement and the repaired code data pair into the data generation model to obtain at least one repaired unit test for the repaired code data pair, where the repaired unit test includes a repaired test input parameter and a repaired expected output parameter; Based on the repaired test input parameter and the repaired expected output parameter, test the at least one repaired test unit to determine the repair test execution result of the repaired code data pair; In the case where the repair test execution result is a success, execute the step of determining the repaired code data pair as the updated target code data pair.
7. The method according to claim 6, after testing the at least one repaired test unit to determine the repair test execution result of the repaired code data pair, further comprising: In the case where the repair test execution result is a failure, return to execute the step of obtaining the code data repair task until an iteration stop condition is reached.
8. The method according to claim 7, where the iteration stop condition is that the repair test execution result is a success; after until the iteration stop condition is reached, further comprising: Execute the step of determining the repaired code data pair as the updated target code data pair.
9. The method according to claim 7, where the iteration stop condition is that the number of iterations reaches an upper limit; after until the iteration stop condition is reached, further comprising: Return to execute the step of extracting a preset number of reference code data pairs from the multiple code data pairs.
10. The method according to claim 1, further comprising: Determine a sample code data pair from the data set, where the sample code data pair includes an instruction description sample and a corresponding code label; Use the instruction description sample and the code label to train or fine-tune a code generation model.
11. A data generation system, the data generation system includes an edge device and a cloud device; The edge device is used to send a data generation request; The cloud device is used to receive the data generation request, determine a data generation task and the data set carried thereby according to the data generation request, the data set includes multiple code data pairs, and the code data pair includes an instruction description and a corresponding code; Extract a preset number of reference code data pairs from the multiple code data pairs; input the preset number of reference code data pairs into a data generation model to obtain a target code data pair corresponding to the data generation task, where the target code data pair includes a target instruction description and a corresponding target code.
12. A computing device, comprising: A memory and a 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 according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium storing computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.