Training data generation method and device, electronic equipment and storage medium
By using the pre -trained attribute recognition model and large -generating model, the training data is generated from multiple dimensions, and the problem of low training data in the existing technology has been solved, and efficient and diverse training data generation has been achieved.
Patent Information
- Application Number
- CN202411303227.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-18
AI Technical Summary
In the prior art, the process of generating training data relies on manual annotation, resulting in high time and labor costs and low generation efficiency.
采用预先训练的属性识别模型识别原始指令的属性信息,并利用生成式大模型从多个维度(同义指令、同类指令、不同属性的指令、增加指令复杂度)生成与原始指令不同的多个生成指令,最终生成多条训练数据。
It improves the production efficiency of training data, enriches the number and diversity of training data, and reduces the dependence of manual labeling.
Smart Images

Figure CN119377663A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology 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 Model (LLM) generally refers to large-scale neural network models that are trained to process, understand, and generate human language.
[0003] In order for LLM to process, understand and generate human language, a large amount of pre-trained (Supervised Fine Tuning; SFT) data is required for SFT training. In addition, the training of the reward function model (Reward Model; RM), proximal policy optimization (PPO), and direct preference optimization (DPO) tasks in the preference alignment stage 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] Using a pre-trained attribute recognition model to recognize 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] Based on multiple generation instructions, multiple training data are generated.
[0010] According to another aspect of the present disclosure, there is provided a device for generating training data, comprising:
[0011] A recognition module, used for recognizing attribute information of the original instruction by using a pre-trained attribute recognition model;
[0012] An instruction generation module, configured to generate a plurality of generated instructions different from the original instructions by using a generative macro model based on the attribute information of the original instructions;
[0013] A data generation module is used to generate multiple training data based on multiple generation instructions. According to another aspect of the present disclosure, an electronic device is provided, including:
[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, wherein when the computer program is executed by a processor, the computer program implements the above-mentioned aspects and any possible implementation method.
[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 content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are used to better understand the present solution 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 The block diagram is a block diagram of an electronic device for implementing the method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art 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, but not all of them. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in the 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 addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after 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 recognize attribute information of the original instruction;
[0033] S102, based on the attribute information of the original instruction, using a generative large model to generate a plurality of generated instructions different from the original instruction;
[0034] S103: Generate multiple training data based on multiple generation instructions.
[0035] The execution subject of the training data generation method of this embodiment can be 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 of 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 recognize the specific attribute information of the original instruction. For example, it can be implemented by 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 instructions based on the attribute information of the identified original instructions and the original instructions. Although the multiple generated instructions are different from the original instructions, they are derived from the original instructions.
[0039] Furthermore, according to the generated multiple generation instructions, corresponding multiple training data can be generated, and each 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 the construction of instructions. In the prior art, instructions are mainly constructed by manual annotation, and the response results of the instructions are further annotated or the response results of the constructed instructions are borrowed from the model to generate training data, resulting in high time and labor costs in the process of 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 effort and can effectively improve the generation efficiency of training data.
[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 in the figure, 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 recognize 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, using a generative large model, generating multiple generated instructions different from the original instruction from the dimension of synonymous instructions;
[0047] Specifically, synonymous instructions refer to instructions with the same attribute information and semantics as the original instructions. For example, if the original instruction is "how to sell item A", the generated synonymous instructions may include "what is the price of item A", "how much is item A", "how many sellers are there for item A", etc.
[0048] The multiple generated instructions derived from the synonymous instruction dimension have the same semantics as the original instruction and the same attribute information. 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, using a generative large model, generating multiple generated instructions different from the original instruction from the dimensions of the same type of instructions;
[0050] Specifically, the same type of instruction refers to an instruction with the same attributes and the same type of instruction content as the original instruction. By generating the same type of instructions, the scalability and diversity of the instructions can be enhanced, thereby enhancing the scalability and diversity of the training data.
[0051] The content of the same type of instruction belongs to the same type as the original instruction, but the specific content information is different, but the attributes are the same. For example, the content of the original instruction may be "A+B equals how much", and the generated similar instructions may include "A+C equals how much", "D+B equals how much", "C+D equals how much", etc. In other words, based on the content of the original instruction, many different instructions of the same type of content can be derived.
[0052] S204, based on the attribute information of the original instruction, using a generative large model, generating 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 different attributes from the original instructions; by generating instructions with different attributes, the scalability and diversity of the instructions can be enhanced, thereby enhancing the scalability and diversity of the training data.
[0054] Instructions with different attributes may be instructions with the same category and field as the original instruction but different requirements; instructions with the same category and field as the original instruction but different fields; instructions with the same field and requirement as the original instruction but different categories; or instructions with different categories, fields, and requirements. For example, the original instruction may be "How much is item A?", and the generated instructions with different attributes may be "What is the material of item B?", "How much is suite C in hotel B per night?", "What is the weather like today?", etc.
[0055] S205, based on the attribute information of the original instruction, using a generative large model, generating multiple generated instructions different from the original instruction from the dimension of increasing the complexity of the instruction;
[0056] In this embodiment, increasing the complexity of the instruction refers to increasing the complexity of the original instruction. For example, increasing the complexity of the instruction includes adding constraints or limiting scenarios in the generated instruction relative to the original instruction. By generating more complex instructions, the scalability and diversity of the instructions can also 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", the generated instructions after adding constraints may include "A+B+C equals how much", "A+B+C+D equals how much", etc.; if a limited scenario "the scene of distributing candies in kindergarten" is added, the generated generation instructions may include "In the kindergarten, the first child gets A candy and the second child gets B candy. 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 elaborated one by one 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. In this embodiment, the technical solution of the present disclosure is described by taking the generation of multiple generation instructions from four dimensions, namely, synonymous instructions, similar instructions, instructions with different attributes, and increasing instruction complexity, as an example. In practical applications, generation instructions may be generated from only one, two, or three of the dimensions, which is not limited here.
[0060] In this embodiment, by generating multiple generation instructions from the above four different dimensions, compared with the prior art, the scalability and diversity of the instructions can be enhanced, thereby not only being able to expand the training data in quantity, but also being able to effectively ensure the diversity and richness of the training data, providing effective support for model training.
[0061] S206, detecting 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 adopt a detection model obtained through supervised training. At this time, for each generation instruction in the generation instructions, 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 the 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 to be reasonable. Otherwise, if the rationality value is less than the preset threshold, the generation instruction is considered to be 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 reasonable.
[0066] Further optionally, in this embodiment, for the unreasonable generation instructions detected, they can be directly removed. Or they can be corrected. When making specific corrections, a pre-trained error correction model can be used to correct the unreasonable generation instructions into reasonable generation instructions; or they can be corrected manually to obtain the manually corrected reasonable generation instructions and continue to use them. Through the processing of this step, the accuracy of the generation instructions can be effectively improved, and then the accuracy of the generated training data can be effectively improved.
[0067] In this embodiment, the rationality detection model can detect whether the generated instructions have various problems such as unclearness, logical contradictions, grammatical errors, etc.
[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 the subsequently generated training data can be effectively improved through the above rationality detection and processing of unreasonable generation instructions.
[0070] S208, taking the reasonable generation instruction as the original instruction, and based on the attribute information of the original instruction, using the generative large model to generate multiple generation instructions different from the original instruction;
[0071] The specific implementation method 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-S205 may be used to generate multiple generation instructions.
[0072] In this embodiment, two rounds of generation are used as an example to generate multiple instructions. In practical applications, multiple rounds of generation can also be used to generate more generation instructions. The specific number of rounds of generation can be pre-configured. By using more than two rounds of generation methods in this embodiment, exponential generation of generation instructions can be achieved, thereby achieving exponential generation of training data, effectively enriching the amount of training data.
[0073] S209, based on each of the multiple generation instructions, using a pre-trained task model to 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. In use, an instruction is input to the task model, and the task model can output a response result corresponding to the instruction. Based on this, the response result of each generation instruction in multiple generation instructions can be obtained. Each generation instruction and the corresponding response result can constitute a training data, and then multiple training data can be obtained.
[0076] The multiple training data generated in this embodiment have very high accuracy and excellent diversity, and can be used for training SFT tasks of other task models, or training RM, PPO, and DPO tasks in the preference alignment stage.
[0077] The method for generating training data of the present embodiment, by adopting the above-mentioned technical scheme, can generate multiple generation instructions different from the original instructions from multiple dimensions, thereby effectively improving the generation efficiency of training data; and the technical scheme of the present 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] The recognition module 301 is used to recognize the attribute information of the original instruction by using a pre-trained attribute recognition model;
[0080] An instruction generation module 302, configured to generate a plurality of generated instructions different from the original instruction by 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, by adopting the above modules to realize the implementation principle and technical effect of the generation of training data, is the same as that of the above related method embodiments. For details, please refer to the records of the above related method embodiments, which will not be repeated here.
[0083] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure; this embodiment provides a training data generation device 400, in the above Figure 3 Based on the illustrated embodiment, 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 The modules with the same name and function are shown as: 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 used to implement in at least one of the following ways:
[0086] 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 dimension of synonymous instructions; the synonymous instructions refer to 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 dimension of the same type of instructions; the same type of instructions refers to instructions with 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 in the generated instruction relative to the original instruction.
[0091] Further optionally, if Figure 4 As shown, the training data generation device 400 of this embodiment further includes:
[0092] A detection module 404, configured to detect the rationality of the plurality of generation instructions;
[0093] The processing module 405 is used to process unreasonable generation instructions among the multiple generation instructions based on the detection result.
[0094] Further optionally, the detection module 404 is used 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 used 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 big 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 used to:
[0102] Based on each of the multiple generation instructions, a pre-trained task model is used to generate a response result for each generation instruction;
[0103] Based on each generation instruction and the response result corresponding to each generation instruction, a plurality of training data are generated.
[0104] The training data generation device 400 of this embodiment, by adopting the above modules to realize the implementation principle and technical effect of the generation of training data, is the same as that of the above related method embodiments. For details, please refer to the records of the above related method embodiments, which will not be repeated here.
[0105] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance 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 an embodiment 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 processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required 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. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. 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] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0110] The computing unit 501 may 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 running 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 may 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 may be loaded and / or installed on the device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the above-mentioned methods of the present disclosure described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the above-mentioned methods of the present disclosure in any other appropriate manner (e.g., by means of firmware).
[0111] Various implementations of the systems and techniques described above herein 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), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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 may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0113] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 may 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 may 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 with 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 may 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 the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0118] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating training data, comprising: Using a pre-trained attribute recognition model to recognize the attribute information of the original instruction; 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; Based on multiple generation instructions, 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: 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, including at least one of the following methods: 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 dimension of synonymous instructions; the synonymous instructions refer to instructions having the same attribute information and the same semantics as the original instruction; 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 dimension of the same type of instructions; the same type of instructions refers to instructions with the same attributes and the same type of instruction content as the original instruction; 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 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.
4. The method according to claim 3, wherein: Increasing the complexity of the instruction includes adding constraints or limiting scenarios to the generated instruction relative to the original instruction.
5. The method according to any one of claims 1 to 4, 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 rationality of the plurality of generation instructions; Based on the detection result, unreasonable generation instructions among the multiple generation instructions are processed.
6. The method according to claim 5, 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.
7. The method according to claim 5, 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.
8. The method according to claim 5, wherein: 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, and 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 big model is used to generate multiple generation instructions different from the original instruction.
9. The method according to any one of claims 1-4 and 6-8, wherein: Based on multiple generation instructions, multiple training data are generated, including: Based on each of the multiple generation instructions, a pre-trained task model is used to generate a response result for each generation instruction; Based on each generation instruction and the response result corresponding to each generation instruction, a plurality of training data are generated.
10. A training data generating device, comprising: A recognition module, used for recognizing attribute information of the original instruction by using a pre-trained attribute recognition model; An instruction generation module, configured to generate a plurality of generated instructions different from the original instructions by using a generative macro model based on the attribute information of the original instructions; The data generation module is used to generate multiple training data based on multiple generation instructions.
11. The device according to claim 10, wherein: The attribute information includes at least one of category, field, and requirement.
12. The device according to claim 10, wherein: The instruction generation module is used to implement in at least one of the following ways: 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 dimension of synonymous instructions; the synonymous instructions refer to instructions having the same attribute information and the same semantics as the original instruction; 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 dimension of the same type of instructions; the same type of instructions refers to instructions with the same attributes and the same type of instruction content as the original instruction; 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 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.
13. The device according to claim 12, wherein: Increasing the complexity of the instruction includes adding constraints or limiting scenarios to the generated instruction relative to the original instruction.
14. The device according to any one of claims 10 to 13, wherein: The device also includes: A detection module, used for detecting the rationality of the multiple generation instructions; A processing module is used to process unreasonable generation instructions among the multiple generation instructions based on the detection result.
15. The device according to claim 14, wherein: The detection module is used for: A pre-trained rationality detection model is used to detect the rationality of the multiple generated instructions.
16. The device according to claim 14, wherein: The processing module is used for: 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.
17. The device according to claim 14, wherein: The instruction generation module is further used for: 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 big model is used to generate multiple generation instructions different from the original instruction.
18. The device according to any one of claims 10-13 and 15-17, wherein: The data generation module is used to: Based on each of the multiple generation instructions, a pre-trained task model is used to generate a response result for each generation instruction; Based on each generation instruction and the response result corresponding to each generation instruction, a plurality of training data are generated.
19. 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 9.
20. 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-9.
21. 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 9.
Citation Information
Patent Citations
Pre-training language model generation method and device, electronic equipment and storage medium
CN113705187A
Method and device for enhancing training data of semantic recognition model
CN114896986A
Training data processing method and device, training method and device, equipment and medium
CN117436505A
Method for automatically generating instruction data set based on LLM
CN117667202A
Data construction method and device for fine tuning training of large language model
CN118035751A