Training data generation method, device, electronic device and storage medium
By identifying the attributes of the original instructions and using a generative large model to generate training data from multiple dimensions, the problem of low efficiency in generating training data in existing technologies is solved, and efficient, rich and diverse training data generation is achieved.
Patent Information
- Application Number
- CN202411303227.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-09-18
AI Technical Summary
The existing technology has high time and labor costs in generating training data, low generation efficiency, and is difficult to meet the training needs of large-scale neural network models.
A pre-trained attribute recognition model is used to identify the attribute information of the original instructions, and a generative large model is used to generate multiple generation instructions from four dimensions: synonymous, similar, different attributes, and increasing complexity. Training data is generated after rationality detection and processing.
It improves the efficiency of training data generation, enhances the scalability and diversity of training data, and provides rich and accurate training data support.
Smart Images

Figure CN119377663B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technologies such as machine learning and natural language processing, and more particularly to a method, device, electronic device, and storage medium for generating training data. Background Art
[0002] Large Language Models (LLMs) generally refer to large-scale neural network models that are trained to process, understand, and generate human language.
[0003] To enable LLM to process, understand, and generate human language, a large amount of pre-trained Supervised Fine Tuning (SFT) data is required for SFT training. Furthermore, training the Reward Function Model (RM), Proximal Policy Optimization (PPO), and Direct Preference Optimization (DPO) tasks in the preference alignment phase also requires large-scale training data.
[0004] In order to obtain accurate training data, in the prior art, manual labeling is usually used to generate training data. Summary of the Invention
[0005] The present disclosure provides a method, device, electronic device, and storage medium for generating training data.
[0006] According to one aspect of the present disclosure, a method for generating training data is provided, comprising:
[0007] Use a pre-trained attribute recognition model to identify the attribute information of the original instruction;
[0008] Based on the attribute information of the original instruction, a generative macro model is used to generate a plurality of generated instructions different from the original instruction;
[0009] Generate multiple training data based on multiple generation instructions.
[0010] According to another aspect of the present disclosure, there is provided a device for generating training data, comprising:
[0011] A recognition module, configured to use a pre-trained attribute recognition model to recognize attribute information of the original instruction;
[0012] An instruction generation module, configured to generate a plurality of generated instructions different from the original instructions using a generative macro model based on the attribute information of the original instruction;
[0013] A data generation module is configured to generate a plurality of training data based on a plurality of generation instructions. According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any possible implementation manner and the aspects described above.
[0017] According to yet another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method of the above-mentioned aspect and any possible implementation manner.
[0018] According to yet another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the above-mentioned aspects and any possible implementation method when executed by a processor.
[0019] According to the technology disclosed in the present invention, the efficiency of generating training data can be effectively improved.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0022] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0023] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0024] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0025] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0026] Figure 5 is a block diagram of an electronic device for implementing the method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0029] It should be noted that the terminal devices involved in the embodiments of the present disclosure may include but are not limited to mobile phones, personal digital assistants (PDAs), wireless handheld devices, tablet computers and other smart devices; display devices may include but are not limited to personal computers, televisions and other devices with display functions.
[0030] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.
[0031] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure; Figure 1 As shown, this embodiment provides a method for generating training data, which may specifically include the following steps:
[0032] S101, using a pre-trained attribute recognition model to identify attribute information of the original instruction;
[0033] S102, based on the attribute information of the original instruction, using a generative large model to generate multiple generated instructions different from the original instruction;
[0034] S103: Generate multiple pieces of training data based on multiple generation instructions.
[0035] The training data generation method of this embodiment can be executed by a training data generation device, which can be an electronic entity or a software-integrated application. When used, the training data generation device can generate multiple training data based on one original instruction.
[0036] The original instruction in this embodiment may be an artificially constructed instruction, or may be an existing instruction in an instruction library, and the instruction has very high accuracy and completeness.
[0037] In this embodiment, the attribute recognition model is pre-trained and can be used to identify specific attribute information of the original instruction. For example, it can be implemented using discriminative or generative models such as Transformer, Bidirectional Encoder Representations from Transformers (BERT), Enhanced Representation through Knowledge Integration (ERNIE), and Generative Pre-Trained (GPT).
[0038] Furthermore, in this embodiment, a generative large model can be used to generate multiple generated instructions different from the original instruction based on the attribute information of the identified original instruction and the original instruction. Although the multiple generated instructions are different from the original instruction, they are derived from the original instruction.
[0039] Furthermore, according to the generated multiple generation instructions, corresponding multiple training data can be generated, and each piece of training data includes a generation instruction.
[0040] In this embodiment, the generative large model used can also be called a generative language model (General Language Model; GLM), or a generative large language model.
[0041] The difficulty in constructing training data lies in constructing instructions. Existing techniques primarily rely on manual annotation to construct instructions, and then further annotate the responses to the instructions, or use the model's responses to the constructed instructions to generate training data. This results in high time and labor costs in generating training data, and low generation efficiency.
[0042] The training data generation method of this embodiment adopts a generative large model based on the attribute information of the identified original instructions, and can automatically generate multiple generation instructions, and then automatically generate multiple training data based on the multiple generation instructions. The training data generation process saves time and labor, and can effectively improve the efficiency of training data generation.
[0043] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure; the method for generating training data in this embodiment, in the above Figure 1Based on the technical solutions of the embodiments shown, the technical solutions of the present disclosure are further described in more detail. Figure 2 As shown, the method for generating training data in this embodiment may specifically include the following steps:
[0044] S201, using a pre-trained attribute recognition model to identify attribute information of the original instruction;
[0045] In this embodiment, the attribute information may include at least one of a category, a field, and a requirement. Specifically, the category, the field, and the requirement may be three levels from top to bottom. Using at least one of the category, the field, and the requirement can accurately characterize the attribute of the original instruction.
[0046] S202: Based on the attribute information of the original instruction, a generative large model is used to generate multiple generated instructions different from the original instruction from the dimension of synonymous instructions;
[0047] Specifically, synonymous commands are commands that have the same attribute information and semantics as the original command. For example, if the original command is "How to sell item A", the generated synonymous commands may include "What is the price of item A", "How much is item A", "How much is the seller of item A", etc.
[0048] The multiple generated instructions derived from the synonymous instruction dimension have the same semantics and attribute information as the original instruction. By generating synonymous instructions, the generalization of instructions can be enhanced, thereby enhancing the generalization of training data.
[0049] S203: Based on the attribute information of the original instruction, a generative large model is used to generate multiple generated instructions different from the original instruction from the dimensions of similar instructions;
[0050] Specifically, similar instructions refer to instructions with the same attributes and the same type of instruction content as the original instruction. By generating similar instructions, the scalability and diversity of instructions can be enhanced, thereby enhancing the scalability and diversity of training data.
[0051] Similar instructions are of the same type as the original instruction, but with different content information, they still share the same attributes. For example, the original instruction might be "A + B equals what," and the generated similar instructions might include "A + C equals what," "D + B equals what," "C + D equals what," and so on. In other words, based on the original instruction, many different instructions with the same type of content can be derived.
[0052] S204: Based on the attribute information of the original instruction, a generative macro model is used to generate multiple generated instructions different from the original instruction from the dimensions of instructions with different attributes;
[0053] Specifically, instructions with different attributes refer to instructions with attributes different from the original instructions; by generating instructions with different attributes, the scalability and diversity of instructions can be enhanced, thereby enhancing the scalability and diversity of training data.
[0054] Instructions with different attributes can be instructions with the same category and domain as the original instruction but different requirements; instructions with the same category and requirement as the original instruction but different domains; instructions with the same domain and requirement as the original instruction but different categories; or instructions with different categories, domains, and requirements. For example, the original instruction could be "How much is item A?", and the generated instructions with different attributes could be "What is the material of item B?", "How much is suite C in hotel B per night?", "What's the weather like today?", and so on.
[0055] S205: Based on the attribute information of the original instruction, a generative large model is used to generate multiple generated instructions that are different from the original instruction from the dimension of increasing the complexity of the instruction;
[0056] In this embodiment, increasing instruction complexity refers to increasing the complexity of the original instructions. For example, increasing instruction complexity may include adding constraints or limiting scenarios to the generated instructions relative to the original instructions. By generating more complex instructions, the scalability and diversity of the instructions can be enhanced, thereby enhancing the scalability and diversity of the training data.
[0057] For example, if the original instruction is "A + B equals how much," after adding constraints, the generated instructions can include "A + B + C equals how much," "A + B + C + D equals how much," and so on. Adding the restricted scenario of "candy distribution in a kindergarten" can generate instructions such as "In the kindergarten, the first child gets candy A and the second child gets candy B. How many candies do the two children have in total?" In actual applications, other methods can be used to increase the complexity of the generated instructions, which will not be detailed here.
[0058] The generative large model of this embodiment can be implemented using generative models such as GPT and ERNIE-Bot.
[0059] Steps S202-S205 of this embodiment are as described above. Figure 1 A specific implementation of the illustrated embodiment. This embodiment uses the example of generating multiple generation instructions from four dimensions: synonymous instructions, similar instructions, instructions with different attributes, and increasing instruction complexity. In practical applications, generation instructions may be generated from only one, two, or three of these dimensions, without limitation.
[0060] In this embodiment, by generating multiple generation instructions from the above four different dimensions, compared with the existing technology, the scalability and diversity of the instructions can be enhanced, thereby not only expanding the training data in quantity, but also effectively ensuring the diversity and richness of the training data, providing effective support for model training.
[0061] S206, detecting the rationality of multiple generation instructions;
[0062] S207, processing unreasonable generation instructions among the multiple generation instructions based on the detection result;
[0063] Specifically, in this embodiment, a pre-trained rationality detection model can be used to detect the rationality of multiple generated instructions.
[0064] The rationality detection model in this embodiment can specifically be a detection model obtained through supervised training. For each generation instruction, the rationality detection model can detect the rationality value of the generation instruction; then, based on the relationship between the rationality value of the generation instruction and a preset threshold, determine whether the generation instruction is reasonable. For example, if the rationality value is greater than or equal to the preset threshold, the generation instruction is considered reasonable. Otherwise, if the rationality value is less than the preset threshold, the generation instruction is considered unreasonable.
[0065] Optionally, in this embodiment, a generative large language model may be used to detect the rationality of multiple generation instructions. For each generation instruction, the generative large language model may directly output a detection result of whether the generation instruction is rational.
[0066] Furthermore, in this embodiment, if an unreasonable generation instruction is detected, it can be directly removed. Alternatively, it can be corrected. Specifically, a pre-trained error correction model can be used to correct the unreasonable generation instruction into a reasonable one. Alternatively, manual correction can be performed to obtain a reasonable generation instruction and continue to use it. This step can effectively improve the accuracy of the generation instruction, and thus the accuracy of the generated training data.
[0067] In this embodiment, the rationality detection model can detect whether the generated instructions have various problems such as unclearness, logical contradictions, and grammatical errors.
[0068] For example, the rationality detection model of this embodiment can be implemented using Transformer, BERT, ERNIE, or a generative model.
[0069] In this embodiment, the accuracy of subsequently generated training data can be effectively improved through the above rationality detection and processing of unreasonable generation instructions.
[0070] S208: Using the reasonable generation instruction as the original instruction, and based on the attribute information of the original instruction, using the generative macro model, generating multiple generation instructions different from the original instruction;
[0071] The specific implementation of this step is the same as above. Figure 1 The implementation of step S102 in the illustrated embodiment is the same. Specifically, at least one of steps S202 to S205 may be used to generate multiple generation instructions.
[0072] This embodiment uses a two-round generation method to generate multiple instructions as an example. In practical applications, a multi-round generation method can also be used to generate more generation instructions. The specific number of generation rounds to be used can be pre-configured. By using the two or more rounds of generation method of this embodiment, it is possible to achieve exponential generation of generation instructions, thereby achieving exponential generation of training data, effectively increasing the amount of training data.
[0073] S209: Based on each of the multiple generation instructions, using a pre-trained task model, generate a response result for each generation instruction;
[0074] S210: Generate multiple training data based on each generation instruction and the response result corresponding to each generation instruction.
[0075] Specifically, the task model of this embodiment is pre-trained. When a command is input to the task model, the task model can output a response result corresponding to the command. Based on this, the response result of each of the multiple generation commands can be obtained. Each generation command and the corresponding response result can constitute a piece of training data, thereby obtaining multiple pieces of training data.
[0076] The multiple training data generated in this embodiment are very accurate and diverse, and can be used for training other task model SFT tasks, or for training RM, PPO, and DPO tasks in the preference alignment stage.
[0077] The method for generating training data in this embodiment, by adopting the above-mentioned technical solution, can generate multiple generation instructions different from the original instructions from multiple dimensions, thereby effectively improving the efficiency of generating training data; and the technical solution of this embodiment can not only effectively enrich the amount of training data, but also effectively enhance the scalability and diversity of training data, so that the generated training data is very comprehensive and rich.
[0078] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure; Figure 3 As shown, this embodiment provides a training data generation device 300, including:
[0079] Identification module 301, used to identify attribute information of the original instruction using a pre-trained attribute recognition model;
[0080] An instruction generation module 302 is configured to generate a plurality of generated instructions different from the original instruction using a generative macro model based on the attribute information of the original instruction;
[0081] The data generation module 303 is used to generate multiple training data based on multiple generation instructions.
[0082] The training data generation device 300 of this embodiment uses the above modules to realize the implementation principle and technical effect of training data generation, which is the same as that of the above-mentioned related method embodiments. For details, please refer to the description of the above-mentioned related method embodiments, which will not be repeated here.
[0083] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure; this embodiment provides a training data generation device 400, in the above Figure 3 Based on the embodiment shown, the technical solution of the present disclosure is further described in more detail. Figure 4 As shown, the training data generation device 400 of this embodiment includes the above Figure 3 Modules with the same name and function are shown as follows: identification module 401 , instruction generation module 402 and data generation module 403 .
[0084] In this embodiment, the attribute information includes at least one of category, field, and requirement.
[0085] In this embodiment, the instruction generation module 402 is configured to be implemented in at least one of the following ways:
[0086] Based on the attribute information of the original instruction, the generative large model is used to generate a plurality of generated instructions different from the original instruction from the dimension of synonymous instructions; the synonymous instructions are instructions having the same attribute information and the same semantics as the original instruction;
[0087] Based on the attribute information of the original instruction, the generative macro model is used to generate a plurality of generated instructions different from the original instruction from the dimensions of similar instructions; the similar instructions are instructions having the same attributes and the same type of instruction content as the original instruction;
[0088] Based on the attribute information of the original instruction, the generative macro model is used to generate a plurality of generated instructions different from the original instruction from the dimensions of instructions with different attributes; the instructions with different attributes refer to instructions with different attributes from the original instruction; and
[0089] Based on the attribute information of the original instruction, the generative large model is adopted to generate multiple generated instructions different from the original instruction from the dimension of increasing instruction complexity; increasing instruction complexity refers to increasing the complexity of the original instruction.
[0090] Further optionally, in this embodiment, increasing the complexity of the instruction includes adding constraints or adding limited scenarios to the generated instruction relative to the original instruction.
[0091] Further optionally, as Figure 4 As shown, the training data generation device 400 of this embodiment further includes:
[0092] A detection module 404 is configured to detect the rationality of the plurality of generation instructions;
[0093] The processing module 405 is configured to process unreasonable generation instructions among the multiple generation instructions based on the detection result.
[0094] Further optionally, the detection module 404 is configured to:
[0095] A pre-trained rationality detection model is used to detect the rationality of the multiple generated instructions.
[0096] Further optionally, in this embodiment, the processing module 405 is configured to:
[0097] Deleting unreasonable generation instructions from the multiple generation instructions; or
[0098] A pre-trained error correction model is used to correct unreasonable generation instructions into reasonable generation instructions.
[0099] Further optionally, in this embodiment, the instruction generation module 402 is further configured to:
[0100] For each of the multiple generation instructions, if the generation instruction is reasonable, the generation instruction is further used as an original instruction, and based on the attribute information of the original instruction, the generative large model is used to generate multiple generation instructions different from the original instruction.
[0101] Further optionally, in this embodiment, the data generation module 403 is configured to:
[0102] Based on each of the multiple generation instructions, using a pre-trained task model, generate a response result for each generation instruction;
[0103] Based on each generation instruction and the response result corresponding to each generation instruction, multiple training data are generated.
[0104] The training data generation device 400 of this embodiment uses the above modules to realize the implementation principle and technical effect of training data generation, which is the same as that of the above-mentioned related method embodiments. For details, please refer to the description of the above-mentioned related method embodiments, which will not be repeated here.
[0105] In the technical solutions disclosed herein, the acquisition, storage, and application of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0106] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0107] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0108] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0109] Various components in device 500 are connected to I / O interface 505, including: an input unit 506, such as a keyboard, mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, optical disk, etc.; and a communication unit 509, such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0110] The computing unit 501 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the above-mentioned methods of the present disclosure. For example, in some embodiments, the above-mentioned methods of the present disclosure can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 08. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the above-mentioned methods of the present disclosure described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the above-mentioned methods of the present disclosure by any other appropriate means (e.g., by means of firmware).
[0111] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0112] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0113] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0114] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0115] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0116] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0117] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0118] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A method for generating training data, comprising: Use a pre-trained attribute recognition model to identify the attribute information of the original instruction; Based on the attribute information of the original instruction, a generative large model is used to generate a plurality of generated instructions different from the original instruction from at least one of a dimension of synonymous instructions, a dimension of similar instructions, a dimension of instructions with different attributes, and a dimension of increasing instruction complexity; the synonymous instructions refer to instructions having the same attribute information and semantics as the original instructions; the similar instructions refer to instructions having the same attributes and the same type of instruction content as the original instructions; the instructions with different attributes refer to instructions with different attributes from the original instructions; increasing instruction complexity refers to increasing the complexity of the original instructions; Based on each of the multiple generation instructions, using a pre-trained task model, generate a response result for each generation instruction; Based on each generation instruction and the response result corresponding to each generation instruction, multiple training data are generated.
2. The method according to claim 1, wherein The attribute information includes at least one of category, field, and requirement.
3. The method according to claim 1, wherein Increasing the complexity of the instruction includes adding constraints or limiting scenarios to the generated instruction relative to the original instruction.
4. The method according to any one of claims 1 to 3, wherein: After generating a plurality of generated instructions different from the original instructions using a generative large model based on the attribute information of the original instructions, and before generating a plurality of training data based on the plurality of generated instructions, the method further includes: detecting the rationality of the plurality of generated instructions; Based on the detection result, unreasonable generation instructions among the multiple generation instructions are processed.
5. The method according to claim 4, wherein Detecting the rationality of the multiple generation instructions includes: A pre-trained rationality detection model is used to detect the rationality of the multiple generated instructions.
6. The method according to claim 4, wherein: Processing unreasonable generation instructions among the multiple generation instructions based on the detection result includes: Deleting unreasonable generation instructions from the multiple generation instructions; or A pre-trained error correction model is used to correct unreasonable generation instructions into reasonable generation instructions.
7. The method according to claim 4, wherein: Based on the attribute information of the original instruction, a generative large model is used to generate a plurality of generated instructions different from the original instruction, further comprising: For each of the multiple generation instructions, if the generation instruction is reasonable, the generation instruction is further used as an original instruction, and based on the attribute information of the original instruction, the generative large model is used to generate multiple generation instructions different from the original instruction.
8. A device for generating training data, comprising: A recognition module, configured to use a pre-trained attribute recognition model to recognize attribute information of the original instruction; An instruction generation module is configured to generate, based on the attribute information of the original instruction and using a generative large model, a plurality of generated instructions different from the original instruction from at least one of a dimension of synonymous instructions, a dimension of similar instructions, a dimension of instructions with different attributes, and a dimension of increasing instruction complexity; the synonymous instructions are instructions having the same attribute information and semantics as the original instructions; the similar instructions are instructions having the same attributes and the same type of instruction content as the original instructions; the instructions with different attributes are instructions having different attributes from the original instructions; and increasing instruction complexity is increasing the complexity of the original instructions; Data generation module, used to: Based on each of the multiple generation instructions, using a pre-trained task model, generate a response result for each generation instruction; Based on each generation instruction and the response result corresponding to each generation instruction, multiple training data are generated.
9. The device according to claim 8, wherein The attribute information includes at least one of category, field, and requirement.
10. The device according to claim 8, wherein Increasing the complexity of the instruction includes adding constraints or limiting scenarios to the generated instruction relative to the original instruction.
11. The device according to any one of claims 8 to 10, wherein: The device further comprises: A detection module, configured to detect the rationality of the plurality of generation instructions; A processing module is used to process unreasonable generation instructions among the multiple generation instructions based on the detection result.
12. The device according to claim 11, wherein The detection module is used to: A pre-trained rationality detection model is used to detect the rationality of the multiple generated instructions.
13. The device according to claim 11, wherein The processing module is used to: Deleting unreasonable generation instructions from the multiple generation instructions; or A pre-trained error correction model is used to correct unreasonable generation instructions into reasonable generation instructions.
14. The device according to claim 11, wherein The instruction generation module is further used to: For each of the multiple generation instructions, if the generation instruction is reasonable, the generation instruction is further used as an original instruction, and based on the attribute information of the original instruction, the generative large model is used to generate multiple generation instructions different from the original instruction.
15. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.
17. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for enhancing training data of semantic recognition model
CN114896986A
Method for automatically generating instruction data set based on LLM
CN117667202A