Data processing method and device
By using the first model to generate the second and third instruction data of diversity and timeliness according to the first instruction data, the problems of insufficient customization, outdatedness and poor quality of instruction data in the prior art are solved, and efficient , low-cost instruction data generation.
Patent Information
- Application Number
- CN202411466651.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, there are problems involving insufficient customization, outdated data, poor data quality, and legal and copyright acquisition using public data sets.
By obtaining a small amount of first instruction data, a large amount of second instruction data and third instruction data are generated using the first model, ensuring that these data are diverse and time-consuming and used to train the second model.
It realizes high-quality, customizable, real-time instruction data at high efficiency and low cost, solves the problems of insufficient customization, outdatedness and poor quality of data in the prior art, and avoids legal and copyright issues.
Smart Images

Figure CN119441872A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a data processing method and device. Background Art
[0002] Instruction data is needed in the process of training and fine-tuning the model. Currently, instruction data is obtained through public data sets. However, the instruction data in some public data sets are not updated in time, the data is relatively old, and the diversity is relatively poor, resulting in poor model training and fine-tuning effects.
[0003] Therefore, how to obtain diverse instruction data is a problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a data processing method and device for acquiring instruction data with diversity.
[0005] In a first aspect, the present invention provides a data processing method, comprising: obtaining first instruction data, sending the first instruction data to a first model using a first speech template, and obtaining second instruction data output by the first model, sending the first instruction data and the second instruction data to the first model using the first speech template, and obtaining third instruction data output by the first model, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs, and the first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
[0006] Through the above scheme, the task requirements can be customized according to the first speech template, so as to generate customized multiple instruction data, including the second instruction data and the third instruction data, to ensure that these multiple instruction data can match specific fields or application scenarios, improve diversity, and meet the customized requirements of the field. In addition, by using the first model and the first instruction data, instruction data that is newer than the first instruction data can be generated, thereby ensuring the timeliness of the data, while also having a relatively low cost and high generation efficiency, and not involving legal and copyright issues. Based on this, the above scheme can efficiently and low-cost generate high-quality, customizable, real-time instruction data for use in training or fine-tuning the second model, solving the problems of insufficient customization, outdated data, poor data quality, and legal and copyright issues in the prior art of obtaining instruction data using public data sets. Compared with the limited amount of data and high cost of obtaining data using own data and crowdsourcing data in some schemes, this scheme can obtain a large amount of instruction data at a low cost and high efficiency.
[0007] Optionally, after obtaining the third instruction data output by the first model, it also includes: using the third instruction data and the second instruction data as updated second instruction data, sending the first instruction data and the updated second instruction data to the first model using the first speech template, and obtaining the third instruction data output by the first model, repeating the above steps until the number of all instruction data reaches the set number.
[0008] Through the above scheme, the instructions subsequently sent to the first model include both the manually written first instruction data and the second instruction data or the third instruction data previously generated by the first model. The first model can combine the two instruction data to generate new instruction data. By mixing the first instruction data and the instruction data generated by the first model, the generalization of the data can be increased; if it relies entirely on the first instruction data, the first model may overfit these specific instructions and lack universality. By continuously generating further instructions based on the instructions generated by the first model, the generated data can be made more semantically diverse and complex.
[0009] Optionally, after obtaining the second instruction data or the third instruction data output by the first model, it also includes: deleting instruction data in the second instruction data or the third instruction data that contains preset keywords, wherein the instruction data containing the preset keywords is instruction data that cannot be processed by the first model, and\or, deleting instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold.
[0010] Through the above scheme, low-quality data can be filtered out, high-quality and diverse data can be retained, and noise and erroneous information can be reduced.
[0011] Optionally, after obtaining the third instruction data output by the first model, it also includes: using the second speech template to send the second instruction data and the third instruction data to the first model, and obtaining the response data output by the first model.
[0012] By sending the generated instruction data and the preset second speech template to the first model, the input data and output data corresponding to the instruction data can be obtained. By combining the instruction data, input data and output data together, complete instruction fine-tuning data can be constructed.
[0013] Optionally, the first speech template includes output data requirements and output format requirements, the output data requirements are used to limit the scope and quantity of the first model output instruction data, and the output format requirements are used to limit the format of the first model output instruction data.
[0014] Through the above scheme, by modifying the output data requirements or output format requirements of the first speech template, a set amount of data focusing on a certain field can be generated, thereby realizing customized data generation.
[0015] Optionally, the first instruction data has N pieces, the second instruction data has M pieces, and the third instruction data is generated using part of the N pieces of first instruction data and all or part of the M pieces of second instruction data, where N is an integer greater than or equal to 2, and M is a positive integer. In this way, by selecting part of the instruction data, the randomness of the third instruction data generated by the first model can be increased.
[0016] Optionally, before using the first speech template to send the first instruction data to the first model, it also includes: determining the field to which the first instruction data belongs, and obtaining the first speech template corresponding to the field from the correspondence between the preset multiple fields and speech templates. In this way, the corresponding relationship can be directly queried to find the corresponding template without re-analyzing and identifying, which is more efficient, and when the second instruction data is obtained based on the first speech template and the first instruction data, it can be ensured that the first instruction data and the second instruction data belong to the same field.
[0017] In a second aspect, the present invention provides a data processing device, the device comprising:
[0018] An acquisition module, used for acquiring first instruction data;
[0019] A sending module, which sends the first instruction data to the first model according to the first speech template, and obtains the second instruction data output by the first model, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs;
[0020] The sending module is also used to use the first speech template to send the first instruction data and the second instruction data to the first model, and obtain the third instruction data output by the first model. The first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
[0021] In one possible implementation, the sending module is also used to: use the third instruction data and the second instruction data as updated second instruction data, use the first speech template to send the first instruction data and the updated second instruction data to the first model, and obtain the third instruction data output by the first model, and repeat the above steps until the number of all instruction data reaches the set number.
[0022] In a possible implementation, it also includes a deletion module, which is used to: delete instruction data containing preset keywords in the second instruction data or the third instruction data, wherein the instruction data containing the preset keywords is instruction data that cannot be processed by the first model, and\or, delete instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold.
[0023] In a possible implementation, the sending module is also used to: use the second speech template to send the second instruction data and the third instruction data to the first model, and obtain the response data output by the first model.
[0024] In one possible implementation, the first speech template includes output data requirements and output format requirements. The output data requirements are used to limit the scope and quantity of the first model output instruction data, and the format requirements are used to limit the format of the first model output instruction data.
[0025] In one possible implementation, there are N first instruction data, there are M second instruction data, and the third instruction data is generated using part of the N first instruction data and all or part of the M second instruction data, where N is an integer greater than or equal to 2, and M is a positive integer.
[0026] In a possible implementation, the acquisition module is further used to: determine the field to which the first instruction data belongs, and acquire the first speech template corresponding to the field from the preset correspondence between multiple fields and speech templates.
[0027] In a third aspect, the present application also provides a data processing device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method described in the various possible designs of the first aspect.
[0028] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program or instructions are stored. When the computer program or instructions are executed by a processor, the method described in the various possible designs of the first aspect is implemented.
[0029] In a fifth aspect, an embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0030] These implementations or other implementations of the present application will be more concise and understandable in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 A flowchart of a data processing method provided by an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of first instruction data and its corresponding input data and output data in the field of software testing provided by an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of a first speech template in the field of software testing provided by an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of a portion of instructions after screening provided by an embodiment of the present invention;
[0036] Figure 5 A schematic diagram of a second speech template provided by an embodiment of the present invention;
[0037] Figure 6 A schematic diagram of instruction fine-tuning data generated by a first model provided in an embodiment of the present invention;
[0038] Figure 7 A flowchart of another data processing method provided by an embodiment of the present invention;
[0039] Figure 8 A schematic diagram of a data processing device provided by an embodiment of the present invention;
[0040] Fig. 9 A schematic diagram of another data processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] Below, some terms in this application are explained. It should be noted that these explanations are for the convenience of understanding by those skilled in the art and do not constitute a limitation on the scope of protection claimed in this application.
[0043] 1. Fine-tune instructions.
[0044] Instruction fine-tuning is the process of further training or fine-tuning a model. During the model fine-tuning phase, the model receives a lot of data with explicit instructions. These instructions explicitly tell the model how it should respond to specific inputs. Through instruction fine-tuning, the model not only performs well in ordinary contextual conversations, but also demonstrates higher execution capabilities when faced with specific tasks or commands. Instruction fine-tuning data is usually designed by humans and covers a variety of tasks to help the model learn how to respond to instructions in these tasks. Instruction fine-tuning data includes instruction data and response data, where the response data specifically includes input data and output data. For example, the following is the format of instruction fine-tuning data:
[0045]
[0046] 2. Instruction data (instruction).
[0047] The model's behavior is guided by clearly defined tasks, which instruct the model what kind of work needs to be done in the next process. For example, the instructions may be to answer a question, generate a specific type of text, or perform some kind of information retrieval task.
[0048] 3. Input data (i nput).
[0049] Provides the required background information or specific data for the instruction, allowing the model to complete the task more accurately in a specific context. Not all instructions require additional input, and in some cases this field can be left empty.
[0050] 4. Output data (output).
[0051] Provides the correct answer or response that the model should generate given the instructions and input.
[0052] As described in the background technology, in the process of training and fine-tuning the model, instruction fine-tuning data is needed to optimize the performance of the open source model in software testing. At present, the methods of obtaining instruction data are: public data sets, proprietary data (i.e., data owned by the enterprise), crawled data (i.e., using web crawlers to collect relevant data from the Internet), and crowdsourced data (i.e., letting experts participate in data annotation through crowdsourcing platforms). However, the above instruction data acquisition methods all have shortcomings. Specifically, the data in the public data sets are usually general and cannot meet the requirements of specific fields. The data in the public data sets are not updated in time, and the data is relatively old. In addition, the data quality in the public data sets is poor; for proprietary data and crowdsourced data, their data volume is limited and a large amount of data cannot be obtained; for crawled data, legal and copyright issues may be involved; if manually written data is used, the efficiency is low and the data diversity is insufficient. Therefore, how to legally obtain the latest instruction data is a problem that needs to be solved urgently.
[0053] Based on this, the present invention provides a data processing method, which generates a large amount of second instruction data by using a first model through a small amount of first instruction data.
[0054] The present application scheme is described in detail below in conjunction with the accompanying drawings.
[0055] See also Figure 1 , a flow chart of a data processing method is shown, which specifically includes the following steps:
[0056] Step 110: Obtain first instruction data.
[0057] Optionally, multiple first instruction data may be manually written, and the first instruction data may be used as seed data to generate subsequent second instruction data.
[0058] Optionally, after manually writing the first instruction data, you can also write input data and output data corresponding to the instruction data. Input data refers to data that provides the required background information for the instruction data, and output data refers to response data generated under given instruction data and input data. In some scenarios, there may be only input data and no output data.
[0059] For example, taking the field of software testing as an example, Figure 2Two examples of the first instruction data and its corresponding input data and output data in this field are shown. In Example 1, "Design a performance test plan to evaluate whether the response time of the application server is less than 2 seconds when 1,000 concurrent users log in at the same time" is the first instruction data, "Use a performance testing tool (such as JMeter) to simulate 1,000 concurrent user requests, and the target URL is 'https: / / example.com / login'" is the input data, and "The average response time is less than 2 seconds, and the server has not timed out or crashed" is the output data. In Example 2, "Write a test case to check whether the application is protected against SQL injection attacks, especially the SQL query part when the user logs in" is the first instruction data, "The username is entered as 'admin' OR '1'='1', and the password is entered as 'password'" is the input data, and "The login failed, and the message 'Incorrect username or password' is displayed, and there is no SQL exception or error prompt in the system log" is the output data.
[0060] It is understandable that since the first instruction data will be used to guide the entire data generation process and help the model learn how to generate and understand instructions, the first instruction data has the following characteristics:
[0061] 1. Diversity: First, the instruction data should cover a wide range of fields and task types, including but not limited to dialogue generation, text classification, translation, summarization, question answering, etc. By covering a variety of tasks, it ensures that the generated instruction dataset can be widely used in different scenarios.
[0062] 2. Basicity: The model can perform the task well through the first instruction data. Therefore, the first instruction data is usually simple and basic to ensure that the model can understand and execute it.
[0063] 3. Easy to understand: The task description corresponding to the first instruction data is usually concise and clear, and easy for the model to understand. This ensures that when the model generates instructions, there will be no ambiguity or misunderstanding due to complex descriptions.
[0064] Therefore, when writing the first instruction data and its corresponding input data and output data, it is necessary to consider the diversity of data (covering multiple types such as functional testing, performance testing, security testing, automated testing, boundary testing, localization testing, and negative testing), domain relevance (focusing on common tasks and tools for software testing), clarity and conciseness of instructions (using clear natural language descriptions), and coverage of context and boundary cases (ensuring that scenarios of different complexities, extreme cases, and negative tests are included). This ensures that the generated data can fully reflect the needs of the field (such as the software testing field), and facilitates guiding the first model to generate a large amount of high-quality second instruction data based on the first instruction data, input data, and output data.
[0065] Step 120: Use the first speech template to send the first instruction data to the first model, and obtain the second instruction data output by the first model.
[0066] The first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs. For example, the first model can be a paid or free public large model for commercial applications, for example, it can be a generative pre-trained transformer (GPT), or a pre-trained language model (PLM), etc., without limitation. When the first model is a GPT model, the GPT model can generate the latest instruction data in the same field according to the first instruction data, that is, the second instruction data.
[0067] Optionally, after obtaining the first instruction data, the field to which the first instruction data belongs can also be determined, and then the first speech template corresponding to the field can be obtained from the preset correspondence between multiple fields and speech templates, and then the first speech template can be used to send the first instruction data to the first model. In other words, each speech template corresponds to a field. Before step 120, the field to which the first instruction data belongs is first determined, and the first speech template is determined based on the correspondence between the field and the speech template. In this way, the corresponding template can be directly queried to find the corresponding template without re-analysis and identification, which is more efficient, and when the second instruction data is subsequently obtained based on the first speech template and the first instruction data, it can be ensured that the first instruction data and the second instruction data belong to the same field.
[0068] Optionally, the first speech template includes output data requirements and output format requirements, the output data requirements are used to limit the scope and quantity of the first model output instruction data, and the output format requirements are used to limit the format of the first model output instruction data.
[0069] The output data requirement can be understood as the requirement for generating the second instruction data, that is, requiring the first model to generate the second instruction data according to the output data requirement. It can be written according to the requirements. For example, if the second instruction data related to software testing is required, the first model can be allowed to generate the second instruction data related to software testing. For another example, if 50 second data instructions are required, the first model can be allowed to generate 50 second data instructions.
[0070] The output format requirement can be understood as requiring the first model to return the second instruction data in a specified format so as to parse and process the instructions generated by the first model. The format can be, for example, a json string array format, which is not specifically limited.
[0071] Optionally, when the first model returns the second instruction data, if the data is not returned in accordance with the format requirements, the returned data can also be verified. The verification condition is whether the format of the "format requirements" part is met. If the verification result is not met, the abnormal format is converted to the correct format.
[0072] for example, Figure 3 For an example of the first script template in the field of software testing, see Figure 3 , where "You are an expert in the field of software testing and are asked to continue writing 50 diverse instructions. I will give you 8 examples, all of which belong to the field of software testing." is an output data requirement, and "The continued instructions are returned in the format of a json string array, without any extra text or sequence numbers, and the return format is as follows" is an output format requirement. The example in the middle is the first instruction data in the first database. Figure 3 The content is sent to the first model, and one or more second instruction data can be obtained.
[0073] Through the above scheme, by modifying the output data requirements or output format requirements of the first speech template, a set amount of data focusing on a certain field can be generated, thereby realizing customized data generation.
[0074] Step 130: Use the first speech template to send the first instruction data and the second instruction data to the first model, and obtain the third instruction data output by the first model.
[0075] Among them, the third instruction data and the first instruction data and the second data instruction belong to instruction data in the same field, and the first instruction data, the second instruction data and the third instruction data are used together as training data for the second model, wherein the second model can be a large model built based on an open source model and fine-tuned using enterprise private data, or it can be other offline large models or private large models, without specific restrictions.
[0076] Optionally, the first instruction data has N pieces, the second instruction data has M pieces, and the third instruction data is generated using part of the N pieces of first instruction data and all or part of the M pieces of second instruction data, where N is an integer greater than or equal to 2, and M is a positive integer. In this way, by selecting part of the instruction data, the randomness of the third instruction data generated by the first model can be increased.
[0077] Optionally, part of the N first instruction data and all or part of the M second instruction data may be randomly selected, or may be selected according to set rules, such as selecting a set number of data from front to back, etc., without restriction.
[0078] For example, there are 20 first instruction data and 10 second instruction data. Six first instruction data and two second instruction data are randomly selected, put into the first speech template and sent to the first model, so as to obtain one or more third instruction data output by the first model.
[0079] Optionally, after obtaining the third instruction data output by the first model, the third instruction data and the second instruction data can be used as updated second instruction data, and the first instruction data and the updated second instruction data can be sent to the first model using the first speech template to obtain the third instruction data output by the first model, and this step is repeated until the number of all instruction data reaches the set number.
[0080] Through the above scheme, the instructions subsequently sent to the first model include both the manually written first instruction data and the second instruction data or the third instruction data previously generated by the first model. The first model can combine the two instruction data to generate new instruction data. By mixing the first instruction data and the instruction data generated by the first model, the generalization of the data can be increased; if it relies entirely on the first instruction data, the first model may overfit these specific instructions and lack universality. By continuously generating further instructions based on the instructions generated by the first model, the generated data can be made more semantically diverse and complex.
[0081] Optionally, the ratio of the first instruction data to the instruction data generated by the first model can be selected according to specific application scenarios and task requirements. If the ratio of the first instruction data is high, the basic quality and stability of the model can be ensured; if the ratio of the instruction data generated by the first model is high, the diversity and self-improvement ability of the model can be improved.
[0082] Understandably, the total amount of instruction data is not the more the better, high-quality instruction data is the key. However, if the quality of instruction data is not high, even if the amount is large, the model may learn inaccurate information or generate low-quality instructions, and increase training time and computing costs.
[0083] Optionally, after obtaining the second instruction data or the third instruction data output by the first model, instruction data containing preset keywords in the second instruction data or the third instruction data may be deleted. The instruction data containing preset keywords is instruction data that cannot be processed by the first model, and / or the instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold is deleted.
[0084] In other words, after the first model generates instruction data, the instruction data generated by the first model needs to be filtered, that is, the instruction data containing preset keywords in the second instruction data or the third instruction data is deleted, and\or, the instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold is deleted.
[0085] The preset keyword may be an image, audio, video, etc., without limitation. The instruction containing the preset keyword cannot be processed by the first model, and therefore needs to be deleted.
[0086] Optionally, in order to make the generated data diverse, ROUGE-L (a longest common subsequence evaluation method) can also be used to compare the newly generated instructions with the first instruction data. When the ROUGE-L overlap between the new instruction and any first instruction data is greater than 0.7, the instruction is deleted.
[0087] Through the above scheme, low-quality data can be filtered out, high-quality and diverse data can be retained, and noise and erroneous information can be reduced. For example, Figure 4 The following are examples of some instructions after filtering.
[0088] Optionally, after obtaining the third instruction data output by the first model, the second instruction data and the third instruction data can be sent to the first model using the second speech template, and the response data output by the first model can be obtained. The response data includes input data and output data, or only output data, and the input data, output data and instruction data correspond one to one.
[0089] Based on this, the generated instruction data and the preset second speech template are sent to the first model, and the input data and output data corresponding to the instruction data can be obtained. By combining the instruction data, input data and output data together, complete instruction fine-tuning data can be constructed.
[0090] Optionally, the second speech template has output data requirements and output format requirements. The output data requirements are the input data and expected output data corresponding to the instruction data. Some instruction data do not require additional input data, and only the expected output data is generated; the output format requirements are to limit the format of the data returned by the first model.
[0091] for example, Figure 5 This is an example of the second script template. Among them, "Please generate input and output for the following instructions. If the instruction does not require additional input, the input can be left blank and the output can be generated directly" is the output data requirement, and "Return in the format of a json string array, without any extra text or sequence number, and the return format is as follows" is the output format requirement. The instructions in the middle are the second instruction data or the third instruction data.
[0092] based on Figure 5 The second script template shown can generate a complete instruction fine-tuning data including instruction data, input data, and output data. Figure 6 , 3 examples of instruction fine-tuning data generated by the first model are given. Through the above scheme, the input data and output data of the instruction data can be generated by the first model. It can be understood that the first model can be OpenAIAPI GPT4, etc., without limitation.
[0093] Through the above scheme, high-quality, customizable, real-time instruction data can be generated efficiently and at low cost for use in training or fine-tuning the second model. Compared with the existing technology of using public data sets to obtain instruction data, which has insufficient customization, outdated data, poor data quality, legal and copyright issues, this scheme can customize task requirements according to the first speech template to generate customized data, ensuring that the data can match specific fields or application scenarios. In addition, this scheme generates the latest instruction data according to the first model, which can ensure the timeliness of the data and does not involve legal and copyright issues. Compared with the existing technology of using own data and crowdsourced data to obtain data, which has limited data volume and high cost, this scheme can obtain a large number of instructions at low cost and high efficiency.
[0094] The above content introduces a data processing method, which can generate a large amount of second instruction data for training the model. The following introduces another data processing method, which can also generate a large amount of second instruction data. Figure 7 , showing a flow chart of the data processing method, comprising the following steps:
[0095] Step 710: Acquire first instruction data, and store the first instruction data in a database.
[0096] Optionally, before obtaining the first instruction data, the method further includes: writing a plurality of first instruction data and their corresponding input data and output data.
[0097] Step 720: Determine whether the amount of data in the database is greater than a first threshold, if not, execute step 730, if yes, execute step 760.
[0098] Step 730: Send the instruction data in the database to the first model according to the first speech template, and obtain the second instruction data output by the first model.
[0099] Step 740: Filter and screen the second instruction data.
[0100] That is, the instruction data containing the preset keyword in the second instruction data is deleted, and / or the instruction data in the second instruction data whose similarity with the first instruction data is greater than a preset threshold is deleted.
[0101] Step 750: Use the second speech template to send the second instruction data to the first model, obtain the response data output by the first model, and return to step 720.
[0102] Optionally, the response data includes input data and output data, wherein the input data and the output data correspond one-to-one to the instruction data.
[0103] Step 760: Use the data in the database to train the second model.
[0104] It can be understood that the above steps 710 to 760 can refer to steps 110 to 130, which will not be described in detail here.
[0105] The present application obtains first instruction data, sends the first instruction data to the first model according to a first speech template, and obtains second instruction data output by the first model, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs, sends the first instruction data and the second instruction data to the first model using the first speech template, and obtains third instruction data output by the first model, and the first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
[0106] Through the above scheme, the task requirements can be customized according to the first speech template, so as to generate customized multiple instruction data, including the second instruction data and the third instruction data, to ensure that these multiple instruction data can match specific fields or application scenarios, improve diversity, and meet the customized requirements of the field. In addition, by using the first model and the first instruction data, instruction data that is newer than the first instruction data can be generated, thereby ensuring the timeliness of the data, while also having a relatively low cost and high generation efficiency, and not involving legal and copyright issues. Based on this, the above scheme can efficiently and low-cost generate high-quality, customizable, real-time instruction data for use in training or fine-tuning the second model, solving the problems of insufficient customization, outdated data, poor data quality, and legal and copyright issues in the prior art of obtaining instruction data using public data sets. Compared with the limited amount of data and high cost of obtaining data using own data and crowdsourcing data in some schemes, this scheme can obtain a large amount of instruction data at a low cost and high efficiency.
[0107] Based on the same concept, an embodiment of the present application also provides a data processing device, which can execute the prediction method introduced in the above content.
[0108] See also Figure 8 , a schematic diagram of the structure of a data processing device provided in an embodiment of the present application is given, such as Figure 8 As shown, the data processing device includes:
[0109] An acquisition module 801 is used to acquire first instruction data;
[0110] The sending module 802 sends the first instruction data to the first model according to the first speech template, and obtains the second instruction data output by the first model, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs;
[0111] The sending module 802 is also used to send the first instruction data and the second instruction data to the first model using the first speech template, and obtain the third instruction data output by the first model. The first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
[0112] In one possible implementation, the sending module 802 is also used to: use the third instruction data and the second instruction data as updated second instruction data, use the first speech template to send the first instruction data and the updated second instruction data to the first model, and obtain the third instruction data output by the first model, and repeat the above steps until the number of all instruction data reaches the set number.
[0113] In a possible implementation, it also includes a deletion module 803, which is used to: delete instruction data containing preset keywords in the second instruction data or the third instruction data, wherein the instruction data containing the preset keywords is instruction data that cannot be processed by the first model, and\or, delete instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold.
[0114] In a possible implementation, the sending module 802 is further used to: use the second speech template to send the second instruction data and the third instruction data to the first model, and obtain the response data output by the first model.
[0115] In one possible implementation, the first speech template includes output data requirements and output format requirements. The output data requirements are used to limit the scope and quantity of the first model output instruction data, and the format requirements are used to limit the format of the first model output instruction data.
[0116] In one possible implementation, there are N first instruction data, there are M second instruction data, and the third instruction data is generated using part of the N first instruction data and all or part of the M second instruction data, where N is an integer greater than or equal to 2, and M is a positive integer.
[0117] In a possible implementation, the acquisition module 801 is further used to: determine the field to which the first instruction data belongs, and acquire the first speech template corresponding to the field from the preset correspondence between multiple fields and speech templates.
[0118] See also Fig. 9 , showing a schematic diagram of the structure of another data processing device provided in an embodiment of the present application, such as Fig. 9 As shown, the test device includes: a memory 901 and a processor 902, and the processor 902 is coupled to the memory 901. The memory 901 is used to store program instructions, and the processor 902 is used to call the program instructions stored in the memory 901 and execute the above data processing method according to the obtained program.
[0119] Optionally, the data processing device may further include an interface circuit 903, which may be a transceiver or an input / output interface. The input / output interface is used to input and / or output information, where output may be understood as sending and input may be understood as receiving. The processor 902 may communicate with other devices in the test device or other devices other than the test device through the interface circuit 903 to obtain information required for executing the above data processing method.
[0120] When the data processing device 900 is used to implement Figure 1When performing the method shown, the processor 902 is used to implement the functions of the above-mentioned acquisition module 801, the sending module 802, and the deletion module 803.
[0121] It is understandable that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0122] The memory in the embodiments of the present application can be a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a register, a hard disk, a mobile hard disk, a compact disc read-only memory (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. The storage medium can also be a component of the processor.
[0123] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the computer executes the above-mentioned data processing method.
[0124] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable program product, which, when executed, enables a computer to execute the above data processing method.
[0125] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0126] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0129] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data processing method, characterized in that: The method comprises: Obtaining first instruction data; The first instruction data is sent to the first model using a first speech template, and second instruction data output by the first model is obtained, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs; The first instruction data and the second instruction data are sent to the first model using the first speech template, and the third instruction data output by the first model is obtained, and the first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
2. The method according to claim 1, characterized in that After obtaining the third instruction data output by the first model, the method further includes: using the third instruction data and the second instruction data as updated second instruction data; Use the first speech template to send the first instruction data and the updated second instruction data to the first model, and obtain the third instruction data output by the first model; Repeat the above steps until the total number of instruction data reaches the set number.
3. The method according to claim 1, characterized in that After obtaining the second instruction data or the third instruction data output by the first model, the method further includes: deleting instruction data containing a preset keyword in the second instruction data or the third instruction data, wherein the instruction data containing the preset keyword is instruction data that cannot be processed by the first model; and / or, Delete the instruction data in the second instruction data or the third instruction data whose similarity with the first instruction data is greater than a preset threshold.
4. The method according to claim 1, characterized in that After obtaining the third instruction data output by the first model, the method further includes: Use the second speech template to send the second instruction data and the third instruction data to the first model, and obtain the response data output by the first model.
5. The method according to claim 1, characterized in that The first speech template includes output data requirements and output format requirements. The output data requirements are used to limit the scope and quantity of the first model output instruction data, and the output format requirements are used to limit the format of the first model output instruction data.
6. The method according to any one of claims 1 to 5, characterized in that The first instruction data has N items, the second instruction data has M items, and the third instruction data is generated using part of the N items of the first instruction data and all or part of the M items of the second instruction data, where N is an integer greater than or equal to 2, and M is a positive integer.
7. A data processing device, characterized in that: include: An acquisition module, used for acquiring first instruction data; A sending module, used to send the first instruction data to the first model using a first speech template, and obtain second instruction data output by the first model, wherein the first model is used to output other instruction data in the same field according to the field to which the input instruction data belongs; The sending module is also used to use the first speech template to send the first instruction data and the second instruction data to the first model, and obtain the third instruction data output by the first model. The first instruction data, the second instruction data and the third instruction data are used together as training data for the second model.
8. A data processing device, characterized in that: include: A processor, wherein the processor is coupled to a memory, the memory is used to store a computer program or an instruction, and the processor is used to execute the computer program or the instruction to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device, and when the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 6.
10. A computer program product, characterized in that When the method is executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.