Model training method and device, data construction method and device, electronic equipment and storage medium

By modifying the information output by multiple models positively and negatively, answer information with a comparison of advantages and disadvantages is generated, which solves the problem of high cost of manual labeling in RLHF and achieves efficient construction and target alignment of preference data.

CN119721251APending Publication Date: 2025-03-28BEIJING DONGCHEZU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411872905.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, human feedback reinforcement learning (RLHF) methods require manual labeling of preferred data pairs, which are costly and difficult to effectively align machine goals and human goals.

Method used

By inputting the prompt information into multiple first models, each model reasons to obtain a set of output information, and performs positive and negative modifications on each output information, and generates multiple answer information with a comparison relationship between advantages and disadvantages, so that the preferred data pair can be obtained without manual sorting.

Benefits of technology

It realizes that preference data pairs with advantages and disadvantages can be obtained without manual sorting, which reduces the construction cost of preference data pairs and improves the efficiency of aligning machine goals and human goals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119721251A_ABST
    Figure CN119721251A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a model training method and device, a data construction method and device, electronic equipment and a storage medium, prompt information is input into a plurality of first models, so that each first model obtains a group of output information through reasoning, and each group of output information comprises a plurality of pieces of output information. Furthermore, positive modification and negative modification are carried out on each piece of output information to obtain a plurality of pieces of answer information with a comparison relationship aiming at the prompt information, that is, the plurality of pieces of answer information obtained according to the same piece of output information have a natural quality comparison relationship; therefore, the preference data pair with the advantage and disadvantage comparison relation can be obtained without manual sorting, and the construction cost of the preference data pair is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a model training, data construction method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of computer technology, computer technology has begun to be used to study and process natural language.

[0003] For example, the Large Language Model (LLM) can handle a variety of natural language tasks, such as text classification, question answering, and conversation, and is an important path to artificial intelligence. However, the goals of the large language model when performing tasks, that is, the machine goals and human goals, may be inconsistent, so it is necessary to align the machine goals and human goals.

[0004] In the prior art, reinforcement learning from human feedback (RLHF) is an alignment method. However, RLHF requires the use of preference data pairs, and the construction of preference data pairs relies on manual annotation, which is costly. Summary of the invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide a model training, data construction method, device, electronic device and storage medium, which realize that multiple answer information obtained from the same output information has a natural quality comparison relationship, so that preference data pairs with a quality comparison relationship can be obtained without manual sorting, thereby reducing the construction cost of the preference data pairs.

[0006] The present disclosure provides a model training method, which includes:

[0007] Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0008] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0009] The first target data is used to train at least one first model to obtain at least one second model.

[0010] The present disclosure provides a data construction method, which includes:

[0011] Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0012] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0013] A preference data set is constructed according to the first target data, and the preference data set is used to train at least one first model.

[0014] The present disclosure also provides a model training device, which includes:

[0015] An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0016] A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information;

[0017] A generating module, configured to generate first target data according to the plurality of answer information;

[0018] A training module is used to train at least one first model using the first target data to obtain at least one second model.

[0019] The present disclosure also provides a data construction device, which includes:

[0020] An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0021] A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information;

[0022] A generating module, configured to generate first target data according to the plurality of answer information;

[0023] A construction module is used to construct a preference data set based on the first target data, and the preference data set is used to train at least one first model.

[0024] The present disclosure also provides an electronic device, the electronic device comprising:

[0025] one or more processors;

[0026] A storage device for storing one or more programs;

[0027] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.

[0028] The embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.

[0029] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:

[0030] The model training and data construction method provided by the embodiment of the present disclosure inputs prompt information into multiple first models so that each first model infers a set of output information, and each set of output information includes multiple output information. Further, each output information is positively modified and negatively modified to obtain multiple answer information with a comparative relationship for the prompt information, that is, the multiple answer information obtained based on the same output information has a natural quality comparison relationship, so that preference data pairs with a comparative relationship can be obtained without manual sorting, reducing the construction cost of the preference data pairs. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0032] Figure 1 is a flow chart of a model training method in an embodiment of the present disclosure;

[0033] Figure 2 is a flowchart of another model training method in an embodiment of the present disclosure;

[0034] Figure 3 is a flowchart of another model training method in an embodiment of the present disclosure;

[0035] Figure 4 is a flowchart of another model training method in an embodiment of the present disclosure;

[0036] Figure 5 is a flowchart of another model training method in an embodiment of the present disclosure;

[0037] Figure 6 is a flow chart of a data construction method in an embodiment of the present disclosure;

[0038] Figure 7 is a structural schematic diagram of a model training device in an embodiment of the present disclosure;

[0039] Figure 8 is a structural schematic diagram of a data construction device in an embodiment of the present disclosure;

[0040] Fig. 9 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0041] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0042] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0043] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0044] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0045] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0046] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0047] Figure 1This is a flowchart of a model training method in an embodiment of the present disclosure. The method can be executed by a model training device. The device can be implemented in software and / or hardware. The device can be configured on a server, a server cluster, or an electronic terminal. The server can be a cloud server, and the server cluster can be a cluster composed of multiple servers. The electronic terminal includes but is not limited to smart phones, PDAs, tablet computers, wearable devices with display screens, desktop computers, laptop computers, all-in-one computers, smart home devices, etc.

[0048] like Figure 1 As shown, the method may specifically include the following steps:

[0049] S101, inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information.

[0050] The first model in this embodiment can specifically be a supervised fine-tuning (SFT) model. The SFT model is a model obtained after fine-tuning the base model, and the base model can specifically be a large language model. For example, multiple SFT models are obtained after fine-tuning the base model using multiple different training parameters and training data. It can be understood that the training parameters here refer to the parameters used in the fine-tuning process, and the training parameters are different from the parameters inside the base model. The training data can be the training sample data used in the fine-tuning process.

[0051] Specifically, a prompt is input into multiple SFT models, and each SFT model infers a set of output information, and each set of output information includes multiple output information. For example, after any SFT model receives the prompt, it infers multiple output information under multiple different inference parameter conditions, and the multiple output information inferred by the same SFT model is recorded as a set of output information. Therefore, multiple SFT models infer multiple sets of output information. Among them, the inference parameter can be a parameter used in the inference process, and the inference parameter is different from the parameter inside the SFT model. The output information can specifically be text information.

[0052] S102, performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with the prompt information, and generating first target data according to the plurality of answer information.

[0053] Specifically, for each output information, positive modification and negative modification are performed respectively. The correctness of the output information can be improved through positive modification, and the correctness of the output information can be reduced through negative modification. The correctness can be the correctness of the output information itself, or can be the matching of the output information with the prompt information.

[0054] For example, any output information is recorded as output1, output1 is positively modified to obtain output1-1, and output1 is negatively modified to obtain output1-2 and output1-3. output1-1, output1, output1-2, and output1-3 are the answer information for the prompt information respectively, and the correctness of output1-1, output1, output1-2, and output1-3 decreases in sequence. Further, the first target data is generated according to output1-1, output1, output1-2, and output1-3. The first target data can be a preference data pair (chosen-rejected pair) with a comparative relationship of advantages and disadvantages formed by any two answer information among output1-1, output1, output1-2, and output1-3. In addition, there can be multiple first target data.

[0055] S103: Use the first target data to train at least one first model to obtain at least one second model.

[0056] Specifically, the first target data is used to train one or more of the multiple SFT models described above, and each trained SFT model is recorded as a second model, thereby obtaining one or more second models, and the second model can be a reward model.

[0057] The model training method provided by the embodiment of the present disclosure inputs prompt information into multiple first models so that each first model infers a set of output information, and each set of output information includes multiple output information. Further, each output information is positively modified and negatively modified to obtain multiple answer information with a comparative relationship for the prompt information, that is, the multiple answer information obtained based on the same output information has a natural quality comparison relationship, so that preference data pairs with a comparative relationship can be obtained without manual sorting, reducing the construction cost of the preference data pairs.

[0058] On the basis of the above embodiment, each output information is positively modified, including: correcting the output information, or deleting erroneous information in the output information.

[0059] For example, when positively modifying output1, information that is inconsistent with the facts or has no factual basis in output1 can be corrected or deleted.

[0060] Optionally, negatively modifying each output information includes: inserting erroneous information into the output information, or modifying correct information in the output information.

[0061] For example, when negatively modifying output1, you can insert false information into output1 or modify the originally correct value in output1.

[0062] Optionally, generating the first target data according to the multiple answer information includes: selecting any two answer information having a comparison relationship from the multiple answer information to constitute the first target data.

[0063] For example, any output information is recorded as output1, output1 is modified positively to obtain output1-1, and output1 is modified negatively to obtain output1-2 and output1-3. output1-1, output1, output1-2, and output1-3 are the answer information for the prompt information, that is, output1-1, output1, output1-2, and output1-3 can constitute a set of answer information for the prompt information. Since the correctness of output1-1, output1, output1-2, and output1-3 decreases in sequence, there is a superiority-inferiority comparison relationship between any two answer information in output1-1, output1, output1-2, and output1-3, that is, in the order of decreasing correctness, the answer information arranged in front is more correct than the answer information arranged in the back. Therefore, any two answer information taken from output1-1, output1, output1-2, and output1-3 can constitute a preference data pair (chosen-rejected pair) with a superiority-inferiority comparison relationship, that is, the first target data. Specifically, by taking any two of the multiple answer information, multiple preference data pairs can be taken out from output1-1, output1, output1-2, and output1-3, that is, multiple first target data can be generated based on output1-1, output1, output1-2, and output1-3. Since output1-1, output1, output1-2, and output1-3 are multiple answer information obtained based on any output information, that is, output1, multiple first target data can be obtained based on any output information. The same SFT model can infer multiple output information for the prompt information, and the number of SFT models is multiple. Therefore, the number of output information for the prompt information is large, and a large number of first target data can be obtained based on a large number of output information.

[0064] It is understandable that, in the process of model training, the more training samples there are, the more accurate the model obtained after training will be. Therefore, when using the first target data to train one or more of the multiple SFT models described above, the training accuracy can be improved not only by increasing the number of first target data, but also by adding other data. The following embodiment will introduce adding the second target data and / or the third target data on the basis of the first target data to train one or more of the multiple SFT models described above.

[0065] Based on the above embodiment, the method further includes: generating second target data according to output information in the same group; and / or generating third target data according to output information from different groups.

[0066] For example, each SFT model infers a set of output information (output), and each set of output information includes multiple output information. According to the correctness of multiple output information in the same group, multiple output information in the same group is sorted to obtain a first sorting result. Further, second target data is generated according to the first sorting result. The second target data can be a preference data pair with a comparative relationship of advantages and disadvantages formed by any two output information in the first sorting result. The second target data can be multiple.

[0067] Optionally, second target data is generated based on the output information in the same group, including Figure 2 The following steps are shown:

[0068] S201. Sort output information in the same group to obtain a first sorting result.

[0069] For example Figure 3As shown, the prompt information is input into m SFT models, and each SFT model uses multiple different inference parameters to perform inference to obtain a set of output information, and each set of output information includes n output information. For each output information, positive modification and negative modification are performed respectively to obtain 4 answer information for the prompt information. For example, the 4 answer information obtained after positive modification and negative modification of output information 1 are output information 1-1, output information 1, output information 1-2, and output information 1-3, respectively, wherein output information 1-1 is the result of positive modification of output information 1, and output information 1-2 and output information 1-3 are the results of negative modification of output information 1. It can be understood that the result after positive modification of any output information is not limited to one, but can be multiple. The result after negative modification of any output information is not limited to two, but can be one or other numbers. In addition, the answer information obtained after positive modification and negative modification of any output information may include the output information itself, or may not include it. In addition, the answer information obtained after positive modification and negative modification of any output information may not be limited to the following. Figure 3 The 4 shown can also be other quantities. Figure 3 This is just an illustrative description and does not constitute a specific limitation. Figure 3 As shown, output information 1-1, output information 1, output information 1-2, and output information 1-3 have a natural quality comparison relationship, and the order of quality is as follows: Figure 3 As shown. Further, any two are selected from output information 1-1, output information 1, output information 1-2, and output information 1-3 to form a preference data pair with a superiority-inferiority comparison relationship. There can be multiple such preference data pairs, and such preference data pairs are used as the first target data. Similarly, similar processing is performed on output information 2, ..., and output information n, so that multiple preference data pairs can be obtained according to any output information. For example Figure 3 The processing process of output information n is shown in FIG. 1 , which is similar to the processing process of output information 1 and will not be described in detail here. Figure 3 The output information 1, output information 2, ..., output information n shown are n output information inferred by SFT model 1. Other SFT models such as SFT model 2, ..., SFT model m can respectively infer n output information. The processing process for each output information inferred by other models is similar to the processing process for the above-mentioned output information 1, so that multiple preference data pairs are obtained according to each output information, and such preference data pairs are used as the first target data.

[0070] like Figure 3As shown, each SFT model infers n output information, and the n output information inferred by the same SFT model is the output information in the same group. Further, the n output information inferred by each SFT model is sorted within the group. For example, the n output information inferred by SFT model 1 is sorted within the group to obtain the first sorting result. The n output information inferred by SFT model 2 is sorted within the group to obtain the first sorting result. Similarly, the n output information inferred by SFT model m is sorted within the group to obtain the first sorting result. The sorting within the group can specifically be sorting according to the correctness of each output information in the group. For example, the correctness of the n output information in the same group after sorting decreases in sequence.

[0071] S202: Select any two pieces of answer information having a contrast relationship from the first sorting results to form second target data.

[0072] For example, after the n output information obtained by SFT model 1 is sorted within the group to obtain the first sorting result, any two are selected from the first sorting result to form a preference data pair with a superiority-inferiority comparison relationship, and there may be multiple such preference data pairs, and such preference data pairs are used as the second target data. Similarly, after the n output information obtained by other SFT models are sorted within the group to obtain the first sorting result, any two are selected from the first sorting result to form a preference data pair with a superiority-inferiority comparison relationship, and there may be multiple such preference data pairs, and such preference data pairs are used as the second target data.

[0073] In addition, since there are multiple SFT models in the embodiment of the present disclosure, each SFT model infers a set of output information, and therefore, multiple SFT models can infer multiple sets of output information. Extracting one output information from each set of output information can make each extracted output information originate from a different group. Further, according to the correctness of the output information, the output information originating from different groups is sorted to obtain a second sorting result, and the third target data is generated based on the second sorting result. The third target data can be a preference data pair with a comparative relationship of advantages and disadvantages consisting of any two output information in the second sorting result. The third target data can be multiple.

[0074] Optionally, third target data is generated based on output information from different groups, including Figure 4 The following steps are shown:

[0075] S401: extract the best output information from each group of output information.

[0076] like Figure 3As shown in FIG. 1 , after a group of output information, that is, n output information, is sorted within the group to obtain a first sorting result, the output information ranked first in the first sorting result is the best output information in the group of output information. Similarly, the best output information can be extracted from each group of output information inferred by other SFT models. Figure 3 As shown, there are m SFT models, that is, there are m groups of output information, and after extracting the best output information from each group of output information, m output information can be finally extracted. The m output information are respectively derived from different groups.

[0077] S402: Sort the extracted multiple output information to obtain a second sorting result.

[0078] like Figure 3 As shown, the extracted m output information is sorted to obtain a second sorting result. Compared with the above-mentioned intra-group sorting, the sorting here can be understood as inter-group sorting, and the inter-group sorting can be similar to the intra-group sorting, that is, the m output information is sorted according to the correctness, so that the correctness of the sorted m output information decreases in sequence.

[0079] S403: Select any two pieces of answer information having a contrast relationship from the second sorting results to form third target data.

[0080] For example, any two are selected from the second sorting results to form a preference data pair having a comparative relationship of superiority and inferiority, and there may be multiple such preference data pairs, and such preference data pairs are used as the third target data.

[0081] Correspondingly, using the first target data to train at least one first model includes: using the first target data, the second target data and / or the third target data to train at least one first model.

[0082] Specifically, the embodiment of the present disclosure can add the second target data and / or the third target data on the basis of the first target data to train one or more of the multiple SFT models described above. Figure 3 The first target data, the second target data and the third target data shown constitute a preference data set, and one or more of the multiple SFT models are trained according to the preference data set, thereby increasing the training accuracy.

[0083] Optionally, after using the first target data to train at least one first model to obtain at least one second model, the method further includes: obtaining a reward score by reasoning with the at least one second model; and performing reinforcement learning training on the first model that has not been trained according to the reward score to obtain a target model, wherein the target model is used to perform a text generation task.

[0084] For example, one or more second models are obtained after training one or more of the multiple SFT models using the preference data set as described above, and each second model is a trained SFT model. The second model can also be called a reward model (RM). Further, a reward score is obtained by reasoning with the reward model, and reinforcement learning (RL) training is performed on the untrained SFT models in the multiple SFT models according to the reward score to obtain a target model. Since the reward score is obtained by reasoning with the reward model, the reward model is obtained by training with the preference data set, and each preference data pair in the preference data set reflects a good-bad comparison relationship, and this good-bad comparison relationship reflects human preferences and values. Therefore, after the untrained SFT model is subjected to reinforcement learning training according to the reward score to obtain a target model, the target model can reflect human preferences. Thereby, the goals of the target model when performing the task, that is, the machine goals and human goals can be consistent, that is, the alignment of the machine goals and human goals is achieved. Therefore, when the target model is used to perform text generation tasks, the text information generated by the target model can meet human preferences, thereby avoiding text content quality problems such as numerical illusions and repetitions in the text information generated by the target model. It can also avoid style problems in the text information, thereby improving the usability of the text information.

[0085] In addition, according to the model training method described above, the current mainstream RLHF process can be improved, so that the improved RLHF process includes the following: Figure 5 The following are the 4 steps:

[0086] S501, SFT.

[0087] For example, a large language model is used as a base model, and multiple SFT models are obtained by fine-tuning the base model using multiple different training parameters and training data.

[0088] S502: Preference data construction.

[0089] For example, the first target data, the second target data, and the third target data are constructed by the method described in the above embodiment. The specific construction process is as described above and will not be repeated here.

[0090] S503: Train the SFT model to obtain a reward model.

[0091] For example, the first target data, the second target data, and the third target data constitute a preference data set, and one or more of the multiple SFT models are trained according to the preference data set to obtain a reward model.

[0092] S504, reinforcement learning training.

[0093] For example, a reward score is obtained through reward model reasoning, and reinforcement learning training is performed on an untrained SFT model among the multiple SFT models according to the reward score to obtain a target model.

[0094] The disclosed embodiment inputs prompt information into multiple first models so that each first model infers a set of output information, and each set of output information includes multiple output information. Further, each output information is positively modified and negatively modified to obtain multiple answer information with a comparative relationship for the prompt information, that is, the multiple answer information obtained based on the same output information has a natural quality comparison relationship, so that preference data pairs with a comparative relationship can be obtained without manual sorting, reducing the construction cost of the preference data pairs needed in the RLHF.

[0095] Figure 6 This is a flowchart of a data construction method in an embodiment of the present disclosure. The method can be executed by a data construction device. The device can be implemented in software and / or hardware. The device can be configured on a server, a server cluster, or an electronic terminal. The server can be a cloud server, the server cluster can be a cluster composed of multiple servers, and the electronic terminal includes but is not limited to smart phones, PDAs, tablet computers, wearable devices with display screens, desktop computers, laptop computers, all-in-one computers, smart home devices, etc.

[0096] like Figure 6 As shown, the method may specifically include the following steps:

[0097] S601, inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information.

[0098] The first model in this embodiment can be a supervised fine-tuning (SFT) model. The SFT model is a model obtained by fine-tuning the base model, and the base model can be a large language model. For example, multiple SFT models are obtained by fine-tuning the base model using multiple different training parameters and training data.

[0099] Specifically, the prompt information is input into multiple SFT models, and each SFT model infers a set of output information, and each set of output information includes multiple output information. For example, after any SFT model receives the prompt information, it infers multiple output information under multiple different inference parameter conditions, and the multiple output information inferred by the same SFT model is recorded as a set of output information. Therefore, multiple SFT models infer multiple sets of output information.

[0100] S602: Perform positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with the prompt information, and generate first target data according to the plurality of answer information.

[0101] Specifically, for each output information, positive modification and negative modification are performed respectively. The correctness of the output information can be improved through positive modification, and the correctness of the output information can be reduced through negative modification. The correctness can be the correctness of the output information itself, or can be the matching of the output information with the prompt information.

[0102] For example, any output information is recorded as output1, output1 is positively modified to obtain output1-1, and output1 is negatively modified to obtain output1-2 and output1-3. output1-1, output1, output1-2, and output1-3 are the answer information for the prompt information respectively, and the correctness of output1-1, output1, output1-2, and output1-3 decreases in sequence. Further, the first target data is generated according to output1-1, output1, output1-2, and output1-3. The first target data can be a preference data pair (chosen-rejected pair) with a comparative relationship of advantages and disadvantages formed by any two answer information among output1-1, output1, output1-2, and output1-3. In addition, there can be multiple first target data.

[0103] S603: Construct a preference data set according to the first target data, where the preference data set is used to train at least one first model.

[0104] For example, a preference data set is constructed according to a plurality of first target data, and the plurality of first target data may be partial data in the preference data set. The preference data set is used to train one or more of the plurality of SFT models.

[0105] Optionally, the method further includes: generating second target data based on output information within the same group; and / or generating third target data based on output information from different groups.

[0106] like Figure 3 As shown, each SFT model infers a set of output information (output), and each set of output information includes multiple output information. According to the correctness of multiple output information in the same group, multiple output information in the same group is sorted to obtain a first sorting result. Further, second target data is generated according to the first sorting result. The second target data can be a preference data pair with a comparative relationship of advantages and disadvantages formed by any two output information in the first sorting result. The second target data can be multiple.

[0107] In addition, since there are multiple SFT models in the embodiment of the present disclosure, each SFT model infers a set of output information, and therefore, multiple SFT models can infer multiple sets of output information. Extracting one output information from each set of output information can make each extracted output information originate from a different group. Further, according to the correctness of the output information, the output information originating from different groups is sorted to obtain a second sorting result, and the third target data is generated based on the second sorting result. The third target data can be a preference data pair with a comparative relationship of advantages and disadvantages consisting of any two output information in the second sorting result. The third target data can be multiple.

[0108] Correspondingly, constructing a preference data set according to the first target data includes: constructing a preference data set according to the first target data, and the second target data and / or the third target data.

[0109] For example, the present disclosure can be Figure 3 The first target data, the second target data and the third target data shown constitute a preference data set, and one or more of the multiple SFT models are trained according to the preference data set, thereby increasing the training accuracy.

[0110] Figure 7 Schematic diagram of the structure of a model training device in an embodiment of the present disclosure. The device provided in the embodiment of the present disclosure can be configured in a server, a server cluster, or an electronic terminal. Figure 7 As shown, the model training device 70 specifically includes: an input module 71, a modification module 72, a generation module 73, and a training module 74.

[0111] Among them, the input module 71 is used to input the prompt information into multiple first models, each first model infers a group of output information, and each group of output information includes multiple output information; the modification module 72 is used to perform positive and negative modifications on each output information to obtain multiple answer information with a comparative relationship for the prompt information; the generation module 73 is used to generate first target data according to the multiple answer information; the training module 74 is used to use the first target data to train at least one first model to obtain at least one second model.

[0112] Optionally, the generation module 73 is also used to: generate second target data based on output information within the same group; and / or generate third target data based on output information from different groups; when the training module 74 uses the first target data to train at least one first model, it is specifically used to: use the first target data, the second target data and / or the third target data to train at least one first model.

[0113] Optionally, when the modification module 72 performs positive modification on each output information, it is specifically used to: correct the output information, or delete erroneous information in the output information.

[0114] Optionally, when the modification module 72 performs negative modification on each output information, it is specifically used to: insert error information into the output information, or modify correct information in the output information.

[0115] Optionally, when the generating module 73 generates the first target data according to the multiple answer information, it is specifically used to: select any two answer information having a comparison relationship from the multiple answer information to constitute the first target data.

[0116] Optionally, when the generation module 73 generates the second target data according to the output information in the same group, it is specifically used to: sort the output information in the same group to obtain a first sorting result; and select any two answer information having a comparative relationship from the first sorting result to constitute the second target data.

[0117] Optionally, when the generation module 73 generates the third target data based on the output information from different groups, it is specifically used to: extract the optimal output information from each group of output information; sort the extracted multiple output information to obtain a second sorting result; and select any two answer information with a comparative relationship from the second sorting result to constitute the third target data.

[0118] Optionally, the model training device 70 also includes: an inference module 75, which is used to obtain a reward score by inferring the at least one second model; the training module 74 is also used to perform reinforcement learning training on the first model that has not been trained according to the reward score to obtain a target model, and the target model is used to perform the text generation task.

[0119] The device provided in the embodiment of the present disclosure can execute the method steps provided in the method embodiment of the present disclosure, and the beneficial effects thereof are not described in detail here.

[0120] Figure 8 Schematic diagram of the structure of a model training device in an embodiment of the present disclosure. The device provided in the embodiment of the present disclosure can be configured in a server, a server cluster, or an electronic terminal. Figure 8 As shown, the model training device 80 specifically includes: an input module 81, a modification module 82, a generation module 83, and a construction module 84.

[0121] Among them, the input module 81 is used to input the prompt information into multiple first models, each first model infers a group of output information, and each group of output information includes multiple output information; the modification module 82 is used to perform positive and negative modifications on each output information to obtain multiple answer information with a comparative relationship for the prompt information; the generation module 83 is used to generate the first target data according to the multiple answer information; the construction module 84 is used to construct a preference data set according to the first target data, and the preference data set is used to train at least one first model.

[0122] Optionally, the generating module 83 is further configured to: generate second target data according to output information in the same group; and / or generate third target data according to output information from different groups. When the constructing module 84 constructs the preference data set according to the first target data, it is specifically configured to: construct the preference data set according to the first target data, the second target data and / or the third target data.

[0123] The device provided in the embodiment of the present disclosure can execute the method steps provided in the method embodiment of the present disclosure, and the beneficial effects thereof are not described in detail here.

[0124] Fig. 9 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Fig. 9, which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure. The electronic device 900 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0125] like Fig. 9 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes to implement the method of the embodiment described in the present disclosure according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage device 908 to the random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0126] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig. 9 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0127] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart, thereby implementing the method as described above. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0128] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0129] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with 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"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0130] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0131] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0132] Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0133] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0134] The first target data is used to train at least one first model to obtain at least one second model.

[0135] Alternatively, when the above one or more programs are executed by the electronic device, the electronic device:

[0136] Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0137] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0138] A preference data set is constructed according to the first target data, and the preference data set is used to train at least one first model.

[0139] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.

[0140] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0143] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0144] 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.

[0145] According to one or more embodiments of the present disclosure, the present disclosure provides a model training method, including:

[0146] Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0147] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0148] The first target data is used to train at least one first model to obtain at least one second model.

[0149] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, the method further includes:

[0150] generating second target data according to the output information in the same group; and / or

[0151] generating third target data based on the output information from the different groups;

[0152] Accordingly, using the first target data to train at least one first model includes:

[0153] At least one first model is trained using the first target data, the second target data and / or the third target data.

[0154] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, each output information is positively modified, including:

[0155] Correct the output information, or delete the erroneous information in the output information.

[0156] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, each output information is negatively modified, including:

[0157] Insert error information into the output information, or modify correct information in the output information.

[0158] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, generating first target data according to the plurality of answer information includes:

[0159] Any two pieces of answer information having a contrasting relationship are selected from the plurality of answer information to form the first target data.

[0160] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, generating second target data according to output information in the same group includes:

[0161] Sorting the output information in the same group to obtain a first sorting result;

[0162] Any two pieces of answer information having a contrasting relationship are selected from the first sorting results to form second target data.

[0163] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, generating third target data according to output information from different groups includes:

[0164] Extracting the best output information from each group of output information;

[0165] Sorting the extracted multiple output information to obtain a second sorting result;

[0166] Any two pieces of answer information having a contrasting relationship are selected from the second sorting results to form third target data.

[0167] According to one or more embodiments of the present disclosure, in the method provided by the present disclosure, optionally, after training at least one first model using the first target data to obtain at least one second model, the method further includes:

[0168] Obtaining a reward score through the at least one second model reasoning;

[0169] According to the reward score, reinforcement learning training is performed on the first model that has not been trained to obtain a target model, and the target model is used to perform the text generation task.

[0170] According to one or more embodiments of the present disclosure, the present disclosure provides a data construction method, including: inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0171] Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information;

[0172] A preference data set is constructed according to the first target data, and the preference data set is used to train at least one first model.

[0173] According to one or more embodiments of the present disclosure, in a data construction method provided in the present disclosure, optionally, the method further includes:

[0174] generating second target data according to the output information in the same group; and / or

[0175] generating third target data based on the output information from the different groups;

[0176] Accordingly, according to the first target data, a preference data set is constructed, including:

[0177] A preference data set is constructed according to the first target data, and the second target data and / or the third target data.

[0178] According to one or more embodiments of the present disclosure, the present disclosure provides a model training device, including:

[0179] An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0180] A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information;

[0181] A generating module, configured to generate first target data according to the plurality of answer information;

[0182] A training module is used to train at least one first model using the first target data to obtain at least one second model.

[0183] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, the generation module is also used to: generate second target data based on output information within the same group; and / or generate third target data based on output information from different groups; when the training module uses the first target data to train at least one first model, it is specifically used to: use the first target data, and the second target data and / or the third target data to train at least one first model.

[0184] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, when the modification module performs positive modification on each output information, it is specifically used to: correct the output information, or delete erroneous information in the output information.

[0185] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, when the modification module performs negative modification on each output information, it is specifically used to: insert error information into the output information, or modify the correct information in the output information.

[0186] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, when the generation module generates the first target data according to the multiple answer information, it is specifically used to: select any two answer information having a comparative relationship from the multiple answer information to constitute the first target data.

[0187] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, when the generation module generates the second target data based on the output information within the same group, it is specifically used to: sort the output information within the same group to obtain a first sorting result; and select any two answer information having a comparative relationship from the first sorting result to constitute the second target data.

[0188] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, when the generation module generates the third target data based on the output information from different groups, it is specifically used to: extract the optimal output information from each group of output information; sort the extracted multiple output information to obtain a second sorting result; select any two answer information having a comparative relationship from the second sorting result to constitute the third target data.

[0189] According to one or more embodiments of the present disclosure, in the model training device provided by the present disclosure, optionally, the model training device also includes: an inference module, used to obtain a reward score by inferring the at least one second model; the training module is also used to perform reinforcement learning training on the first model that has not been trained according to the reward score to obtain a target model, and the target model is used to perform a text generation task.

[0190] According to one or more embodiments of the present disclosure, the present disclosure provides a data construction device, including:

[0191] An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information;

[0192] A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information;

[0193] A generating module, configured to generate first target data according to the plurality of answer information;

[0194] A construction module is used to construct a preference data set based on the first target data, and the preference data set is used to train at least one first model.

[0195] According to one or more embodiments of the present disclosure, in the data construction device provided by the present disclosure, optionally, the generation module is further used to: generate the second target data according to the output information in the same group; and / or generate the third target data according to the output information from different groups. When the construction module constructs the preference data set according to the first target data, it is specifically used to: construct the preference data set according to the first target data, the second target data and / or the third target data.

[0196] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:

[0197] one or more processors;

[0198] A memory for storing one or more programs;

[0199] When the one or more programs are executed by the one or more processors, the one or more processors implement any method provided in the present disclosure.

[0200] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, any method provided by the present disclosure is implemented.

[0201] The embodiments of the present disclosure further provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the method described above is implemented.

[0202] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0203] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0204] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A model training method, characterized in that: The method comprises: Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information; Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information; The first target data is used to train at least one first model to obtain at least one second model.

2. The method according to claim 1, characterized in that The method further comprises: generating second target data according to the output information in the same group; and / or generating third target data based on the output information from the different groups; Accordingly, using the first target data to train at least one first model includes: At least one first model is trained using the first target data, the second target data and / or the third target data.

3. The method according to claim 1, characterized in that Make positive modifications to each output message, including: Correct the output information, or delete the erroneous information in the output information.

4. The method according to claim 1, characterized in that: Negatively modify each output message, including: Insert error information into the output information, or modify correct information in the output information.

5. The method according to claim 1, characterized in that Generating first target data according to the plurality of answer information includes: Any two pieces of answer information having a contrasting relationship are selected from the plurality of answer information to form the first target data.

6. The method according to claim 2, characterized in that Generating second target data according to the output information in the same group includes: Sorting the output information in the same group to obtain a first sorting result; Any two pieces of answer information having a contrasting relationship are selected from the first sorting results to form second target data.

7. The method according to claim 2, characterized in that Generating third target data based on output information from different groups includes: Extracting the best output information from each group of output information; Sorting the extracted multiple output information to obtain a second sorting result; Any two pieces of answer information having a contrasting relationship are selected from the second sorting results to form third target data.

8. The method according to claim 1, characterized in that After training at least one first model using the first target data to obtain at least one second model, the method further includes: Obtaining a reward score through the at least one second model reasoning; According to the reward score, reinforcement learning training is performed on the first model that has not been trained to obtain a target model, and the target model is used to perform the text generation task.

9. A data construction method, characterized in that: include: Inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information; Performing positive modification and negative modification on each output information to obtain a plurality of answer information having a contrast relationship with respect to the prompt information, and generating first target data according to the plurality of answer information; A preference data set is constructed according to the first target data, and the preference data set is used to train at least one first model.

10. The method according to claim 9, characterized in that The method further comprises: generating second target data according to the output information in the same group; and / or generating third target data based on the output information from the different groups; Accordingly, according to the first target data, a preference data set is constructed, including: A preference data set is constructed according to the first target data, and the second target data and / or the third target data.

11. A model training device, characterized in that: include: An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information; A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information; A generating module, configured to generate first target data according to the plurality of answer information; A training module is used to train at least one first model using the first target data to obtain at least one second model.

12. A data construction device, characterized in that: include: An input module, used for inputting prompt information into a plurality of first models, each first model inferring to obtain a set of output information, each set of output information including a plurality of output information; A modification module, used for performing positive modification and negative modification on each output information to obtain a plurality of answer information with a comparative relationship with respect to the prompt information; A generating module, configured to generate first target data according to the plurality of answer information; A construction module is used to construct a preference data set based on the first target data, and the preference data set is used to train at least one first model.

13. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 10.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.