Large model training method and device, equipment and storage medium
By screening and optimizing the training data of large language models, the problems of data redundancy and poor model effects in supervised fine-tuning are solved, and more efficient training effects are achieved.
Patent Information
- Application Number
- CN202411155992.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-27
AI Technical Summary
In the process of supervised fine-tuning of large language models, a large amount of supervised training data leads to data redundancy and poor model training results, and the model may answer illusion questions.
By predicting quality scores from the input training data, filtering out high-quality data, and gradually optimizing the training data until the model completes training. The specific methods include splicing the input text and label text in a preset format, inputting the model, calculating the score, calculating the quality score based on the score, filtering the data based on the score threshold, and repeating the iterative training process.
It improves the learning effect of large language models, reduces data redundancy, avoids the illusion of model answering, and improves the training effect.
Smart Images

Figure CN119202633A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a large model training method, device, computer equipment and storage medium. Background Art
[0002] In recent years, large language model (LLM) technology has developed rapidly and played an increasingly important role in people's work and life, such as mobile phone assistants, smart homes, etc. However, in order to make the large language model better understand people's various instructions and give correct answers, it is necessary to fully train the large language model to ensure the training effect of the model.
[0003] At present, in the process of training a large language model, it is usually necessary to pre-train the large language model based on training samples, and then perform supervised fine-tuning (SFT) on the pre-trained large language model, that is, use labeled training data to adjust a pre-trained large language model so that the final trained large language model has a better learning effect.
[0004] However, in the process of supervised fine-tuning of the large language model, in order to improve the learning effect of the large language model, a large amount of supervised fine-tuning training data is usually used to perform supervised fine-tuning on the large language model. However, a large amount of supervised fine-tuning training data is prone to data redundancy, which is not conducive to the efficient iteration of the large language model during the supervised fine-tuning process. In addition, complex data may also cause hallucinations in the answers of the large language model, which has a negative impact on the large language model and leads to poor training effect of the large language model.
[0005] Therefore, how to improve the learning effect of large language models is an urgent problem to be solved. Summary of the invention
[0006] The present invention provides a large model training method, device, computer equipment and storage medium.
[0007] To solve the problem of poor learning effect of large language models.
[0008] A large model training method, the method comprising:
[0009] Inputting the first training data into the target model to train the target model;
[0010] Determining whether the target model has completed training;
[0011] If the target model has not completed training, inputting the first training data into the target model to predict the quality score of each of the first training data;
[0012] Filtering the first training data according to the quality score to obtain second training data;
[0013] The second training data is used as the new first training data, and the following steps are performed again: the first training data is input into the target model to train the target model;
[0014] Until the target model completes training.
[0015] In the above method, optionally, the step of inputting the first training data into the target model to predict the quality score of each first training data includes:
[0016] splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data;
[0017] Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data;
[0018] The quality score is calculated according to the first score and the second score.
[0019] In the above method, optionally, the label text in the first format data is before the input text, and a relationship text is set between the input text and the label text.
[0020] In the above method, optionally, the second score is obtained by:
[0021] Inputting the first format data into the target model to obtain a probability value of the relational text in the first format data;
[0022] The probability value of the relational text is used as a second score of the first format data.
[0023] In the above method, optionally, the step of screening the first training data according to the quality score to obtain the second training data includes:
[0024] Determining whether the quality score exceeds a preset score threshold;
[0025] If the quality score exceeds the score threshold, discarding the first training data corresponding to the quality score;
[0026] If the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined to be the second training data.
[0027] In the above method, optionally, the step of inputting the first training data into the target model to train the target model includes:
[0028] splicing the input text and the label text in the first training data according to a preset second text format to obtain data in a second format;
[0029] The second format data is input into a target model to train the target model.
[0030] A large model training device, comprising:
[0031] A model training unit, configured to input the first training data into a target model to train the target model;
[0032] A model judgment unit, used to judge whether the target model has completed training;
[0033] a score calculation unit, configured to input the first training data into the target model when the target model has not completed training, and predict a quality score of each of the first training data;
[0034] a data screening unit, configured to screen the first training data according to the quality score to obtain second training data;
[0035] The data updating unit is used to use the second training data as the new first training data and return to execute the following steps: input the first training data into the target model to train the target model; until the target model completes the training.
[0036] In the above device, optionally, the score calculation unit is used for:
[0037] splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data;
[0038] Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data;
[0039] The quality score is calculated according to the first score and the second score.
[0040] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the large model training method as described in any one of the above items when executing the computer program.
[0041] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the large model training method as described in any one of the above items is implemented.
[0042] The above-mentioned large model training method, device, computer equipment and storage medium predict the quality score of each first training data by inputting the first training data into the trained target model, and then screen the first training data according to the quality score to obtain the second training data, and use the second training data as the new first training data, and return to perform the following steps: input the first training data into the target model to train the target model, and so on, continuously iteratively train the target model, and screen the first training data once in each iteration to obtain new first training data, that is, iteratively train the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention continuously simplifies and optimizes the first training data by predicting the quality score of the first training data during each iterative training of the target model, and trains the target model with the first training data after each simplification and optimization. Compared with the prior art, it can achieve the purpose of improving the learning effect of the target model. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0044] Figure 1 It is a flow chart for implementing a large model training method disclosed in one embodiment of the present invention;
[0045] Figure 2 It is a partial implementation flow chart of a large model training method disclosed in one embodiment of the present invention;
[0046] Figure 3 This is a flowchart of an implementation of a large model training method disclosed in one embodiment of the present invention;
[0047] Figure 4 It is a schematic diagram of a calculation process of a target model for a first score and a second score according to an embodiment of the present invention;
[0048] Figure 5 This is a flowchart of an implementation of a large model training method disclosed in one embodiment of the present invention;
[0049] Figure 6This is a flowchart of an implementation of a large model training method disclosed in one embodiment of the present invention;
[0050] Figure 7 is a schematic diagram of the structure of a large model training device in one embodiment of the present invention;
[0051] Figure 8 It is a structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0054] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0055] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0056] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0057] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0058] The present invention discloses a large model training method, device, computer equipment and storage medium, which predicts the quality score of each first training data by inputting the first training data into the trained target model, and then screens the first training data according to the quality score to obtain the second training data, and uses the second training data as the new first training data, and returns to perform the following steps: input the first training data into the target model to train the target model, and so on, continuously iteratively train the target model, and screen the first training data once in each iteration to obtain new first training data, that is, iteratively train the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention can achieve the purpose of improving the learning effect of the target model by predicting the quality score of the first training data and continuously streamlining and optimizing the first training data during the iterative training process of the target model compared with the prior art. This is explained below through specific embodiments.
[0059] like Figure 1 As shown, a large model training method disclosed in an embodiment of the present invention is applicable to electronic devices with data processing capabilities, such as mobile phones, tablet computers, laptops, personal computers or servers. The method in this embodiment may specifically include the following steps:
[0060] S101: Inputting first training data into a target model to train the target model.
[0061] The first training data includes a plurality of data, that is, the first training data is a data set for training the target model.
[0062] In a specific implementation, this embodiment can input all the first training data into the target model in sequence, so that the target model learns each first training data in sequence. After the target model learns all the first training data once, the training of the target model is completed. At this time, the target model has preliminary data processing capabilities.
[0063] Furthermore, in this embodiment, the target model can be trained in the following manner: Figure 2 As shown:
[0064] S201: splicing input text and label text in first training data according to a preset second text format to obtain second format data.
[0065] In a specific implementation, the target model in this embodiment may be a large language model, and the first training data required for training the large language model includes input text and text labels, and the input text and text labels in the first training data are spliced according to a preset second text format to obtain second format data. The input text may be a question text, and the text label is an answer text, and the question text corresponds to the answer text, that is, the answer text is the answer corresponding to the question text.
[0066] In one embodiment, the second text format in this embodiment may be as follows:
[0067] <|Q|>
Input text
Label text
[0068] For example, taking the first training data including: "The input text is: When did Virgin Australia start operations, and the label text is: Virgin Australia started providing services under the name of Virgin Blue on August 31, 2000" as an example, after the first training data is formatted, the second format data in the second text format obtained is: "<|Q|>When did Virgin Australia start operations? <|A|>Virgin Australia started providing services under the name of Virgin Blue on August 31, 2000". In this way, the input text and label text in the first training data can be spliced according to the preset second text format to obtain the second format data.
[0069] S202: Input the second format data into the target model to train the target model.
[0070] In this embodiment, all the second format data can be input into the target model in sequence, so that the target model can learn each second format data in sequence. After the target model learns all the second format data once, the training of the target model is completed. At this time, the target model has preliminary data processing capabilities.
[0071] In a specific implementation, in this embodiment, after the input text and label text in all the first training data are spliced according to the preset second text format to obtain the corresponding second format data, each second format data is input into the target model in turn, so that the target model learns each second format data in turn; or, in this embodiment, after the input text and label text in each pair of the first training data are spliced according to the preset second text format to obtain the corresponding second format data, the obtained second format data is input into the target model, so that the target model learns each second format data in turn.
[0072] It should be noted that the above is only a partial implementation method of inputting the first training data into the target model for training in this embodiment. In this embodiment, the first training data can also be input into the target model for training in other ways, such as splicing the input text and label text in each pair of a preset number of first training data according to a preset second text format, and after obtaining the corresponding second format data, the obtained second format data is input into the target model, so that the target model learns each second format data in turn. Therefore, this embodiment does not limit the specific implementation method of inputting the first training data into the target model for training.
[0073] S102: Determine whether the target model has completed training.
[0074] If the target model has completed training, the process ends, that is, the target model is no longer trained; if the target model has not completed training, the first training data is input into the target model, and the quality score of each first training data is predicted.
[0075] In one embodiment, the verification data in the verification set can be input into the target model to obtain the output result corresponding to the input text in the verification data output by the target model, and it is determined whether the output result corresponds to the label text in the verification data. If the ratio of the label text in the verification set to the output result exceeds a preset ratio, it is determined that the target model has completed training. The preset ratio includes but is not limited to 80%, 90% or 95%, etc., which is not limited in this embodiment.
[0076] In one embodiment, in this embodiment, whether the target model is fully trained can be determined by determining whether the model has converged. For example, the loss value of the target model on the first training data is calculated. When the loss value of the target model tends to be stable during the training process of the target model, it is determined that the target model has completed convergence, that is, the target model is fully trained. Furthermore, in this implementation, the training loss value of the target model on the first training data and the verification loss value of the target model on the verification set can be calculated at the same time. When the training loss value and the verification loss value both drop to a stable point, the generalization difference between the training loss value and the verification loss value is calculated. If the generalization difference approaches 0, it is determined that the target model has converged.
[0077] It should be noted that the above is only part of the implementation method of determining whether the target model has completed training in this embodiment. In this embodiment, other methods can also be used to determine whether the target model has completed training. Therefore, this embodiment does not limit the specific implementation method of determining whether the target model has completed training.
[0078] S103: If the target model has not completed training, the first training data is input into the target model to predict the quality score of each first training data.
[0079] The quality score of the first training data is at least used to measure the generation capability of the model itself for the label text, and to measure the correctness of the first training data itself.
[0080] In a specific implementation, in this embodiment, the first training data can be input into the target model through the following steps to predict the quality score of each first training data, such as Figure 3 As shown:
[0081] S301: splicing input text and label text in first training data according to a preset first text format to obtain first format data.
[0082] In one embodiment, the first text format in this embodiment may be as follows:
[0083] <|Q|> Is [label text] the answer to [input text]? <|A|>
[0084] For example, taking the first training data including: "The input text is: When did Virgin Australia start operations, and the label text is: Virgin Australia started providing services under the name of Virgin Blue on August 31, 2000" as an example, after the first training data is formatted, the second format data of the first text format obtained is: "<|Q|> [Virgin Australia started providing services under the name of Virgin Blue on August 31, 2000] is the answer to [When did Virgin Australia start operations]? <|A|>", thereby, the input text and label text in the first training data can be spliced according to the preset first text format to obtain the first format data.
[0085] It should be noted that the above is only one of the representation methods of the first text format in this embodiment. The first text format may also be as follows:
[0086] <|Q|> Is [label text] the answer to [input text]? <|A|>
[0087] Therefore, in this embodiment, the specific form of the first text format is not limited.
[0088] S302: Input the first format data into the target model to obtain a first score of the label text and a second score of the first format data.
[0089] Among them, the first score can be the perplexity of the label text, which is used to measure the model's ability to generate the label text. The smaller the perplexity, the stronger the target model's ability to generate the label text.
[0090] The second score represents the target model's judgment on the correctness of the first format data. The larger the second score is, the higher the correctness of the first format data is for the target model.
[0091] The first format data is input into the target model, and the first score and the second score are directly calculated during the process of the target model reasoning about the first format data. The calculation process of the target model for the first score and the second score can be as follows: Figure 4 As shown, during the process of the target model reasoning about the first format data, the first score and the second score are directly calculated.
[0092] In one embodiment, the expression of the first score output by the target model in this embodiment can be as follows:
[0093]
[0094] Among them, p θ (w i │w <i) represents the word probability calculated by the target model, PPL(X) represents the perplexity, n represents the number of words in the label text, and θ represents the model parameters of the target model.
[0095] In another embodiment, the expression of the second score output by the target model in this embodiment may be as follows:
[0096]
[0097] Among them, SFT Prompt represents the first format data, x i represents the model's prediction of the next word based on SFT Prompt, θ represents the model parameters of the target model, and SFT represents the second score.
[0098] S303: Calculate a quality score according to the first score and the second score.
[0099] The first score and the second score are input into a preset quality score calculation formula to calculate the quality score.
[0100] In one embodiment, the quality score calculation formula may be as follows:
[0101] Quality score = first score × (1-second score)
[0102] Based on the above quality score calculation formula, the quality score of each first training data is calculated, and the subsequent steps of data processing are performed according to the quality score of each first training data.
[0103] S104: Screen the first training data according to the quality score to obtain second training data.
[0104] When the quality score is smaller, the quality of the first training data is better and needs to be retained. When the quality score is larger, the quality of the first training data is worse. If the first training data with poor quality is retained, the training effect of the target model obtained by training will be worse. Therefore, the first training data with poor quality needs to be eliminated. Therefore, based on the size of the quality score, the first training data with poor quality is eliminated, and the first training data with good quality is retained, so as to screen the first training data according to the quality score and obtain the second training data.
[0105] In one embodiment, in this embodiment, the first training data can be screened according to the quality score through the following steps to obtain the second training data. Figure 5 As shown:
[0106] S501: Determine whether the quality score exceeds a preset score threshold.
[0107] If the quality score exceeds a preset score threshold, the first training data corresponding to the quality score is eliminated; if the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined to be the second training data.
[0108] S502: If the quality score exceeds the score threshold, the first training data corresponding to the quality score is eliminated.
[0109] That is to say, the first training data whose quality score exceeds the score threshold will no longer participate in the iterative training of the target model. Therefore, the first training data is directly eliminated, and so on, all the first training data whose quality score exceeds the score threshold are eliminated.
[0110] S503: If the quality score does not exceed the score threshold, determine the first training data corresponding to the quality score as the second training data.
[0111] That is to say, the first training data whose quality score exceeds the score threshold will need to continue to participate in the iterative training of the target model. Therefore, the first training data whose quality score does not exceed the score threshold is needed as the second training data. The second training data needs to continue to participate in the iterative training of the target model, and so on. All the first training data whose quality score does not exceed the score threshold are screened out as the second training data.
[0112] In summary, in this embodiment, by predicting the quality score of the first training data, continuously streamlining and optimizing the first training data, and iteratively training the target model based on the streamlined and optimized first training data, it is more conducive to improving the learning effect of the target model.
[0113] S105: Use the second training data as new first training data, and return to execute the following steps: input the first training data into the target model to train the target model until the target model is trained.
[0114] It can be understood that the second training data is obtained after screening the first training data, and the second training data is used as the new first training data, that is, the first training data is streamlined and optimized, and the streamlined and optimized first training data is input into the target model to continue training the target model, and so on. Before the target model completes the training, the first training data input into the target model is updated by the screened second training data, that is, the first training data input into the target model for each training is the screened second training data, and this cycle is repeated until the target model completes the training and the process ends.
[0115] In summary, the present invention discloses a large model training method, which predicts the quality score of each first training data by inputting the first training data into the trained target model, and then screens the first training data according to the quality score to obtain the second training data, and uses the second training data as the new first training data, and returns to perform the following steps: input the first training data into the target model to train the target model, and so on, continuously iteratively train the target model, and screen the first training data once in each iteration to obtain new first training data, that is, iteratively train the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention continuously simplifies and optimizes the first training data by predicting the quality score of the first training data in each iterative training process of the target model, and trains the target model with the first training data after each simplification and optimization. Compared with the prior art, the purpose of improving the learning effect of the target model can be achieved.
[0116] It should be noted that the label text in the first format data in this embodiment is before the input text, and a relationship text is set between the input text and the label text. On this basis, the second score in this embodiment can be obtained by the following steps: Figure 6 As shown:
[0117] S601: Inputting first format data into a target model to obtain probability values of relational texts in the first format data.
[0118] S602: Using the probability value of the relational text as the second score of the first format data.
[0119] It should be understood that in this embodiment, after the first training data is input into the target model for training, the target model has preliminarily acquired the ability to answer questions. After the first format data is input into the target model, the target model can answer based on the first format data to obtain the probability value of the relational text in the first format data. In addition, the probability value of the relational text is the second score of the first format data.
[0120] In a specific implementation, in this embodiment, after the first format data is input into the target model, the target model answers the relational text in the first format data based on the input text and label text in the first format data, that is, the probability value of the relational text in the first format data. The larger the probability value, the higher the correctness of the first format data, or it can be said that the target model recognizes the question and answer in the first format data. The smaller the probability value, the lower the correctness of the first format data, or it can be said that the target model does not recognize the question and answer in the first format data.
[0121] For example, the first format data includes: "<|Q|> Is [Virgin Australia began to provide services under the name of Virgin Blue on August 31, 2000] the answer to [When did Virgin Australia start operations]? <|A|>" as an example, where "yes" is the relational text. The first format data is input into the target model, and the target model performs data analysis on the input text "[When did Virgin Australia start operations]" and the label text "[Virgin Australia began to provide services under the name of Virgin Blue on August 31, 2000]", and outputs the probability value of the relational text "yes". Thus, the first format data can be input into the target model to obtain the probability value of the relational text in the first format data.
[0122] In summary, in this embodiment, the question and answer in the first format data is scored (i.e., the second score) by the target model, and the obtained second score is used to screen the subsequent first training data, which is conducive to improving the learning effect of the target model.
[0123] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0124] like Figure 7 The figure shows a schematic diagram of the structure of a large model training device disclosed in the present invention, which is suitable for electronic devices with data processing capabilities, such as mobile phones, tablet computers, laptops, personal computers or servers. The device in this embodiment may specifically include the following units:
[0125] A model training unit 701, configured to input first training data into a target model to train the target model;
[0126] A model determination unit 702 is used to determine whether the target model has completed training;
[0127] The score calculation unit 703 is used to input the first training data into the target model when the target model has not completed training, and predict the quality score of each first training data;
[0128] A data screening unit 704, configured to screen the first training data according to the quality score to obtain second training data;
[0129] The data updating unit 705 is used to use the second training data as new first training data and return to perform the following steps: input the first training data into the target model to train the target model; until the target model is trained.
[0130] In summary, a large model training device disclosed in this embodiment predicts the quality score of each first training data by inputting the first training data into the trained target model, and then screens the first training data according to the quality score to obtain the second training data, uses the second training data as the new first training data, and returns to perform the following steps: inputs the first training data into the target model to train the target model, and so on, continuously iteratively trains the target model, and screens the first training data once in each iteration to obtain new first training data, that is, iteratively trains the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention continuously simplifies and optimizes the first training data by predicting the quality score of the first training data during each iterative training of the target model, and trains the target model with the first training data after each simplification and optimization. Compared with the prior art, the purpose of improving the learning effect of the target model can be achieved.
[0131] In one implementation, the score calculation unit 703 is used to:
[0132] splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data;
[0133] Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data;
[0134] A quality score is calculated based on the first score and the second score.
[0135] In one implementation, the label text in the first format data is before the input text, and a relation text is set between the input text and the label text.
[0136] In one implementation, the second score is obtained by:
[0137] Inputting the first format data into the target model to obtain the probability value of the relation text in the first format data;
[0138] The probability value of the relation text is used as a second score of the first format data.
[0139] In one implementation, the data screening unit 704 is used to:
[0140] Determine whether the quality score exceeds a preset score threshold;
[0141] If the quality score exceeds the score threshold, the first training data corresponding to the quality score is eliminated;
[0142] If the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined as the second training data.
[0143] In one implementation, the model training unit 701 is used to:
[0144] splicing the input text and the label text in the first training data according to a preset second text format to obtain data in a second format;
[0145] The second format data is input into the target model to train the target model.
[0146] For the specific limitations of the large model training device, please refer to the relevant limitations of the large model training method above, which will not be repeated here. Each module in the above-mentioned large model training device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0147] The embodiment of the present application also discloses a computer device, which may be a server, and its internal structure diagram may be as shown in Figure 8 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a large model training method is implemented.
[0148] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0149] Inputting the first training data into the target model to train the target model;
[0150] Determine whether the target model has completed training;
[0151] If the target model has not completed training, the first training data is input into the target model to predict the quality score of each first training data;
[0152] Screening the first training data according to the quality score to obtain second training data;
[0153] The second training data is used as new first training data, and the following steps are performed again: the first training data is input into the target model to train the target model;
[0154] Until the target model is trained.
[0155] In summary, the computer device disclosed above predicts the quality score of each first training data by inputting the first training data into the trained target model, and then screens the first training data according to the quality score to obtain the second training data, uses the second training data as the new first training data, and returns to perform the following steps: inputs the first training data into the target model to train the target model, and so on, continuously iteratively trains the target model, and screens the first training data once in each iteration to obtain new first training data, that is, iteratively trains the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention continuously simplifies and optimizes the first training data by predicting the quality score of the first training data during each iterative training of the target model, and trains the target model with the first training data after each simplification and optimization. Compared with the prior art, the purpose of improving the learning effect of the target model can be achieved.
[0156] In one implementation, inputting the first training data into the target model to predict the quality score of each first training data includes:
[0157] splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data;
[0158] Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data;
[0159] The quality score is calculated according to the first score and the second score.
[0160] In an implementation manner, the label text in the first format data is before the input text, and a relation text is set between the input text and the label text.
[0161] In one implementation, the second score is obtained by:
[0162] Inputting the first format data into the target model to obtain a probability value of the relational text in the first format data;
[0163] The probability value of the relational text is used as a second score of the first format data.
[0164] In one implementation, the screening of the first training data according to the quality score to obtain the second training data includes:
[0165] Determining whether the quality score exceeds a preset score threshold;
[0166] If the quality score exceeds the score threshold, discarding the first training data corresponding to the quality score;
[0167] If the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined to be the second training data.
[0168] In one implementation, inputting the first training data into the target model to train the target model includes:
[0169] splicing the input text and the label text in the first training data according to a preset second text format to obtain data in a second format;
[0170] The second format data is input into a target model to train the target model.
[0171] The present application also discloses a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor in a computer device, the computer device can perform the steps of any embodiment of a large model training method disclosed in the present invention. The computer-readable storage medium can be non-volatile or volatile.
[0172] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0173] Inputting the first training data into the target model to train the target model;
[0174] Determine whether the target model has completed training;
[0175] If the target model has not completed training, the first training data is input into the target model to predict the quality score of each first training data;
[0176] Screening the first training data according to the quality score to obtain second training data;
[0177] The second training data is used as new first training data, and the following steps are performed again: the first training data is input into the target model to train the target model;
[0178] Until the target model is trained.
[0179] In summary, the computer-readable storage medium disclosed above predicts the quality score of each first training data by inputting the first training data into the trained target model, and then screens the first training data according to the quality score to obtain the second training data, and uses the second training data as the new first training data, and returns to perform the following steps: input the first training data into the target model to train the target model, and so on, continuously iteratively train the target model, and screen the first training data once in each iteration to obtain new first training data, that is, iteratively train the target model according to the new first training data each time until the target model is trained. It can be seen that the present invention continuously simplifies and optimizes the first training data by predicting the quality score of the first training data during each iterative training of the target model, and trains the target model with the first training data after each simplification and optimization. Compared with the prior art, the purpose of improving the learning effect of the target model can be achieved.
[0180] In one implementation, inputting the first training data into the target model to predict the quality score of each first training data includes:
[0181] splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data;
[0182] Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data;
[0183] The quality score is calculated according to the first score and the second score.
[0184] In an implementation manner, the label text in the first format data is before the input text, and a relation text is set between the input text and the label text.
[0185] In one implementation, the second score is obtained by:
[0186] Inputting the first format data into the target model to obtain a probability value of the relational text in the first format data;
[0187] The probability value of the relational text is used as a second score of the first format data.
[0188] In one implementation, the screening of the first training data according to the quality score to obtain the second training data includes:
[0189] Determining whether the quality score exceeds a preset score threshold;
[0190] If the quality score exceeds the score threshold, discarding the first training data corresponding to the quality score;
[0191] If the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined to be the second training data.
[0192] In one implementation, inputting the first training data into the target model to train the target model includes:
[0193] splicing the input text and the label text in the first training data according to a preset second text format to obtain data in a second format;
[0194] The second format data is input into a target model to train the target model.
[0195] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0196] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0197] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A large model training method, characterized in that: The method comprises: Inputting the first training data into the target model to train the target model; Determining whether the target model has completed training; If the target model has not completed training, inputting the first training data into the target model to predict the quality score of each of the first training data; Filtering the first training data according to the quality score to obtain second training data; The second training data is used as the new first training data, and the following steps are performed again: the first training data is input into the target model to train the target model; Until the target model completes training.
2. The large model training method according to claim 1, characterized in that: The step of inputting the first training data into the target model and predicting a quality score of each first training data includes: splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data; Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data; The quality score is calculated according to the first score and the second score.
3. The large model training method according to claim 2, characterized in that: The label text in the first format data is before the input text, and a relation text is set between the input text and the label text.
4. The large model training method according to claim 3, characterized in that: The second score is obtained by: Inputting the first format data into the target model to obtain a probability value of the relational text in the first format data; The probability value of the relational text is used as a second score of the first format data.
5. The large model training method according to claim 1, characterized in that: The step of screening the first training data according to the quality score to obtain second training data includes: Determining whether the quality score exceeds a preset score threshold; If the quality score exceeds the score threshold, discarding the first training data corresponding to the quality score; If the quality score does not exceed the score threshold, the first training data corresponding to the quality score is determined to be the second training data.
6. The large model training method according to any one of claims 1 to 5, characterized in that: The step of inputting the first training data into the target model to train the target model includes: splicing the input text and the label text in the first training data according to a preset second text format to obtain data in a second format; The second format data is input into a target model to train the target model.
7. A large model training device, characterized in that: The device comprises: A model training unit, configured to input the first training data into a target model to train the target model; A model judgment unit, used to judge whether the target model has completed training; a score calculation unit, configured to input the first training data into the target model when the target model has not completed training, and predict a quality score of each of the first training data; a data screening unit, configured to screen the first training data according to the quality score to obtain second training data; The data updating unit is used to use the second training data as the new first training data and return to execute the following steps: input the first training data into the target model to train the target model; until the target model completes the training.
8. The large model training device according to claim 7, characterized in that: The score calculation unit is used for: splicing the input text and the label text in the first training data according to a preset first text format to obtain first format data; Inputting the first format data into the target model to obtain a first score of the label text and a second score of the first format data; The quality score is calculated according to the first score and the second score.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the large model training method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the large model training method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Model iterative optimization method and device, electronic equipment and readable storage medium
CN113780466A
Training data enhancement method and device, computer equipment and storage medium
CN114743067A
Multilingual speech translation model construction method and speech translation method and device
CN116450771A
Large-model reliable medical knowledge injection method and device based on knowledge graph
CN118194996A
Machine learning ensemble for processing divergent input domains for automated scheduling systems
US20240242184A1
