Text screening method and device, electronic equipment and storage medium

The machine learning method uses the guidance model and the gating unit to process the evaluation value and weight value of the text, automatically screening the training text, solving the problems of uneven data distribution and insufficient coverage caused by manual screening, and improving the fine-tuning of large language models. effectiveness and screening efficiency.

CN118657192AActive Publication Date: 2024-09-17LANGCHAO ELECTRONIC INFORMATION IND CO LTD

Patent Information

Application Number
CN202410705644.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-17
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

In the fine-tuning process of large language models, manual screening of training texts leads to uneven data distribution and insufficient coverage, which affects the fine-tuning effect of the model, and the screening efficiency is low and the cost is high.

Method used

Using machine learning methods, multiple guidance models and gate control units are used to perform weighted summation processing of evaluation values ​​and weight values ​​on the original text, automatically screening out suitable training texts, avoiding problems caused by manual screening, and improving data balance and Coverage.

Benefits of technology

It improves the stability and data quality of the text screening strategy, avoids the problems of uneven data distribution and insufficient coverage, reduces screening costs, and improves screening efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657192A
    Figure CN118657192A
Patent Text Reader

Abstract

The invention provides a text screening method and device, electronic equipment and a storage medium, and relates to the field of machine learning, a plurality of guidance models and a gating unit can be set, and priori knowledge corresponding to a preset evaluation dimension is embedded in each guidance model; the gating unit learns the historical performance of the previously screened training text in the downstream model training task, and can generate a weight value corresponding to each guidance model for the input text based on the historical performance; the original texts to be screened can be input into the guidance models to obtain corresponding evaluation values generated by the original texts, the original texts can be input into the gating unit to obtain weight values generated by all the guidance models, and then all the weight values can be used for carrying out weighted summation processing on all the evaluation values to obtain screening values of all the original texts; and the original text is screened according to the screening value, so that the problems of unbalanced data distribution and narrow coverage caused by manual screening can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning, and in particular to a text screening method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of machine learning technology, large language models (LLM) have gradually been applied in various fields. Considering the cost of training large language models, the pre-training plus fine-tuning training method has become the mainstream means of training large language models. In the fine-tuning process, high-quality data sets (high-quality data sets should have the characteristics of sufficiency, diversity, and balance) are necessary conditions for stimulating the potential of large language models. However, in related technologies, the training texts for fine-tuning large language models are usually screened manually, which not only reduces the screening efficiency of training texts and increases the screening cost, but more importantly, it is easy to cause problems such as uneven data distribution and insufficient coverage, which in turn affects the fine-tuning effect of large language models. Summary of the invention

[0003] The purpose of the present invention is to provide a text screening method, device, electronic device and storage medium, which can set a data screening strategy based on machine learning means to avoid the problems of uneven data distribution and insufficient coverage caused by manual screening.

[0004] In order to solve the above technical problems, the present invention provides a text screening method, comprising:

[0005] Get the original text to be filtered;

[0006] Input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge;

[0007] Inputting the original text into a gating unit to obtain a weight value output by the gating unit for each of the guiding models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and the previously screened training text in the model training task;

[0008] All the evaluation values ​​are weighted and summed using all the weight values ​​to obtain screening values ​​for each of the original texts, and the original texts are screened according to the screening values ​​to obtain training texts for executing the model training task.

[0009] Optionally, the guiding model has the same conversion decoder structure as the model to be trained by the model training task, and the model parameter amount of the guiding model is smaller than the model parameter amount of the model to be trained.

[0010] Optionally, the obtaining of the original text to be screened includes:

[0011] Obtaining a preset prompt word, and inputting the preset prompt word into a trained text generation model to obtain a generated text corresponding to the preset prompt word;

[0012] The generated text is set as the original text.

[0013] Optionally, the guidance model includes, in order according to the data flow direction, a coding layer, a first transform decoder, a fully connected layer and a first normalization layer, the first transform decoder includes a plurality of transform decoder units connected in series, and the prior knowledge is embedded in the first transform decoder;

[0014] The step of inputting the original text into a plurality of guidance models to obtain evaluation values ​​output by each of the guidance models for the original text includes:

[0015] Inputting the original text into the encoding layer for position encoding to obtain a text embedding vector;

[0016] Inputting the text embedding vector into the first conversion decoder so that the first conversion decoder performs feature extraction on the text embedding vector according to the prior knowledge to obtain a feature extraction vector;

[0017] Inputting the feature extraction vector into the fully connected layer for feature conversion to obtain a feature conversion vector;

[0018] The feature conversion vector is input into the first normalization layer for normalization processing to obtain the evaluation value.

[0019] Optionally, before obtaining the original text to be filtered, the following steps are also included:

[0020] Obtaining the prior knowledge and a pre-trained transform decoder model;

[0021] Fine-tune the transform decoder model using the prior knowledge based on a low-rank adaptive method to embed the prior knowledge into a transform decoder in the transform decoder model;

[0022] The fully connected layer and the first normalization layer are added to the conversion decoder model that has completed the fine-tuning training to obtain the guidance model.

[0023] Optionally, after obtaining the training text for performing the model training task, the method further includes:

[0024] Utilizing the training text to perform the model training task, and determining a performance indicator value corresponding to the training text when performing the model training task according to a preset performance indicator;

[0025] The training texts whose performance indicator values ​​are greater than a preset threshold are set as fine-tuning texts, and the fine-tuning texts are used to perform fine-tuning training on the first conversion decoders in each of the directing models.

[0026] Optionally, before fine-tuning the first conversion decoder in each of the directing models using the fine-tuning text, the method further includes:

[0027] According to the weight values ​​generated by the gating unit for each of the guiding models according to the fine-tuning text, determining a preset number of guiding models with the largest weight values ​​as guiding models to be fine-tuned;

[0028] The fine-tuning training of the first conversion decoder in each of the directing models using the fine-tuning text includes:

[0029] The first conversion decoder in the guidance model to be fine-tuned is fine-tuned using the fine-tuning text.

[0030] Optionally, the gating unit includes an input layer, a second conversion decoder, a second normalization layer and a selection layer in sequence according to the data flow direction, the input layer includes a first input module and a second input module, the first input module corresponds to each of the guidance models one by one, the first input module includes a first linear layer, the input of the first linear layer is the output feature of each conversion decoder unit in the corresponding guidance model, the second input module includes a second linear layer, the input of the second linear layer is the original text;

[0031] The step of inputting the original text into a gating unit to obtain a weight value output by the gating unit for each of the guiding models includes:

[0032] Inputting the output features of each of the conversion decoder units of the corresponding guidance model into the first linear layer for weighted averaging to obtain a first input vector;

[0033] Inputting the original text into the second linear layer for linear layer processing to obtain a second input vector;

[0034] Inputting the first input vector and the second input vector into the second conversion decoder for feature extraction to obtain a feature extraction vector;

[0035] Inputting the feature extraction vector into the second normalization layer for normalization processing to obtain an output vector; wherein each element in the output vector corresponds to each of the guidance models, and the value of each element is the initial weight value of each of the guidance models;

[0036] The output vector is input into the selection layer so that the selection layer sets the initial weight values ​​of the first preset number with the largest values ​​in the output vector as the weight values, and sets the remaining initial weight values ​​to zero.

[0037] Optionally, before obtaining the original text to be filtered, the following steps are also included:

[0038] Get the gate unit training text;

[0039] Inputting the gating unit training text into each of the guiding models and the gating unit at the same time, so that the guiding model outputs a training evaluation value for the gating unit training text, and the gating unit outputs a training weight vector for the gating unit training text; wherein the training weight vector includes the training initial weight value of each of the guiding models;

[0040] Using the training evaluation value of each guiding model and the training weight vector of the gating unit, the guiding models are sorted by a maximum marginal correlation method to obtain a sorting result;

[0041] Normalizing the sorting results to obtain a training target weight value;

[0042] The loss value is determined by using the training initial weight value and the training target weight value, and the parameters of the gating unit are updated according to the loss value.

[0043] Optionally, the using the training evaluation value of each guiding model and the training weight vector of the gating unit to sort the guiding models by a maximum marginal correlation method to obtain a sorting result includes:

[0044] The training evaluation values ​​of the guidance models and the training weight vectors of the gating units are used to sort the guidance models using the maximum marginal correlation method to obtain a sorting result through the following formula:

[0045]

[0046] Where MMR represents the ranking result determined based on the maximum marginal relevance, R represents the set of guidance models to be ranked, S represents the set of ranked guidance models, λ represents the hyperparameter, and D i represents the training evaluation value of the i-th guidance model, D j represents the training evaluation value of the j-th director model in the set S, Qk It represents the training weight vector obtained by the k-th gated unit training text after the gated unit, mean() represents the mean calculation function, Sim1() and Sim2() both represent the similarity calculation function.

[0047] Optionally, the determining the loss value by using the training initial weight value and the training target weight value includes:

[0048] The loss value is determined by using the training initial weight value and the training target weight value through the following formula:

[0049]

[0050] Among them, MSE represents the loss value, n represents the number of guidance models, and y i represents the training target weight value, Represents the initial weight value of the training.

[0051] Optionally, after obtaining the training text for performing the model training task, the method further includes:

[0052] When m batches of training texts are obtained, the model training task is performed using the training texts, a performance indicator value corresponding to the training texts when performing the model training task is determined according to a preset performance indicator, and the training texts are sorted according to the performance indicator value to obtain a training text sorting result; wherein each batch of training texts contains b training texts, m>0, b>0;

[0053] According to the evaluation value determined by the guidance model for the training text and the ranking position of the training text in the training text ranking result, the performance value of each guidance model is determined by the following formula;

[0054]

[0055] Among them, score i represents the performance value of the i-th guidance model, m represents the m-th batch of data, b represents the number of training texts contained in each batch of data, and rank j represents the ranking position of the jth training text in the training text ranking result, w ij represents the evaluation value determined by the i-th guidance model for the j-th training text, I(x) represents the indicator function, if x is greater than zero, I(x) is equal to 1, if x is not greater than zero, I(x) is equal to 0;

[0056] Normalizing the performance values ​​of each of the guidance models to obtain a target weight value;

[0057] A loss value is determined using the initial weight value and the target weight value, and parameters of the gating unit are updated according to the loss value.

[0058] Optionally, the training text is a code text, the model training task is a code task, and the preset performance indicator is a code pass rate of the code text.

[0059] The present invention also provides a text screening device, comprising:

[0060] An acquisition module is used to obtain the original text to be filtered;

[0061] A guidance model module, used to input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge;

[0062] A gating unit module, used for inputting the original text into the gating unit to obtain the weight value output by the gating unit for each of the guiding models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and the previously screened training text in the model training task;

[0063] The screening module is used to perform weighted sum processing on all the evaluation values ​​using all the weight values ​​to obtain the screening value of each original text, and screen the original text according to the screening value to obtain the training text for executing the model training task.

[0064] The present invention also provides an electronic device, comprising:

[0065] Memory for storing computer programs;

[0066] A processor is used to implement the text screening method as described above when executing the computer program.

[0067] The present invention also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the text screening method as described above is implemented.

[0068] The present invention provides a text screening method, comprising: obtaining an original text to be screened; inputting the original text into a plurality of guidance models to obtain an evaluation value output by each of the guidance models for the original text; wherein the guidance model belongs to a machine learning model, and different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge; inputting the original text into a gating unit to obtain a weight value output by the gating unit for each of the guidance models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and previously screened training texts in a model training task; performing weighted sum processing on all of the evaluation values ​​using all of the weight values ​​to obtain a screening value of each of the original texts, and screening the original text according to the screening value to obtain a training text for executing the model training task.

[0069] It can be seen that the present invention is particularly provided with a plurality of guidance models and a gating unit, wherein each guidance model is embedded with prior knowledge corresponding to a preset evaluation dimension, and then the guidance model can generate a corresponding evaluation value for the text according to the prior knowledge; and the gating unit can determine the weight value corresponding to each guidance model based on the historical performance of the current input text and the previously screened training text in the downstream model training task. Furthermore, after obtaining the original text to be screened, the present invention can first input it into a plurality of guidance models to obtain the evaluation value output by each guidance model for the original text, and then input it into the gating unit to obtain the weight value output by the gating unit for each guidance model, and then all the weight values ​​can be used to perform weighted sum processing on all the evaluation values ​​to obtain the screening value of each original text, and the original text can be screened according to the screening value to obtain the training text for executing the model training task. Furthermore, the present invention can not only adopt machine learning to screen training texts to avoid the problems of low screening efficiency and high screening cost in manual screening, but more importantly, it can determine the text screening strategy by embedding prior instructions into the guidance model and embedding the historical performance of the screened training texts in the downstream model training tasks into the gating unit, thereby improving the stability, data balance and data extensiveness of the text screening strategy, thereby avoiding the problems of uneven data distribution and insufficient coverage that are easily caused by manually determining the screening strategy. The present invention also provides a text screening device, an electronic device and a computer-readable storage medium, which have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0071] Figure 1 A structural block diagram of a text screening system provided by an embodiment of the present invention;

[0072] Figure 2 A flowchart of a text screening method provided by an embodiment of the present invention;

[0073] Figure 3 A structural block diagram of a guidance model provided by an embodiment of the present invention;

[0074] Figure 4 A structural block diagram of a guidance model provided by an embodiment of the present invention;

[0075] Figure 5 A flowchart of a text screening method provided by an embodiment of the present invention;

[0076] Figure 6 A structural block diagram of a text screening device provided by an embodiment of the present invention;

[0077] Figure 7 The present invention provides a structural block diagram of an electronic device. DETAILED DESCRIPTION

[0078] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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.

[0079] With the continuous development of machine learning technology, large language models (LLM, Large Language Model) are gradually being applied in various fields. Considering the cost of training large language models, the training method of pre-training plus fine-tuning has become the mainstream means of training large language models. In the fine-tuning process, high-quality data sets (high-quality data sets should have the characteristics of sufficiency, diversity and balance) are necessary conditions for stimulating the potential of large language models. However, in the related art, the training texts for fine-tuning large language models are usually screened manually, which not only reduces the screening efficiency of training texts and increases the screening cost, but more importantly, it is easy to cause problems of uneven data distribution and insufficient coverage, thereby affecting the fine-tuning effect of large language models. In view of this, the present invention can provide a text screening method, which can set a data screening strategy based on machine learning means to avoid the problems of uneven data distribution and insufficient coverage caused by manual screening.

[0080] For easier understanding, please refer to Figure 1 , Figure 1 The structural block diagram of a text screening system provided by an embodiment of the present invention. The system may include multiple guidance models and a gating unit, and these guidance models and the gating unit will jointly screen the input original text to obtain a high-quality data set for executing downstream model training tasks. Among them, the guidance model belongs to a machine learning model, and each guidance model is embedded with prior knowledge corresponding to the preset evaluation dimension, and can give a corresponding evaluation value to the input text according to the prior knowledge. The gating unit also belongs to a machine learning model, which at least learns the historical performance of the screened text in the downstream model training task, and can generate a corresponding weight value for each guidance model based on this historical performance and the original text currently input to the gating unit. Then, when the original text to be screened is obtained, the embodiment of the present invention only needs to input the original text into the multiple guidance models and the gating unit respectively, and use each weight value generated by the gating unit to perform weighted summation on the evaluation value generated by each guidance model, so as to obtain the screening value of the original text, and then screen the original text according to the size of the screening value.

[0081] To put it more simply, since different guidance models are embedded with prior knowledge of different preset evaluation dimensions, each guidance model can independently evaluate the input original text from different preset evaluation dimensions to determine the quality of the original text from different preset evaluation dimensions. However, the contribution of these evaluations to the downstream model training task varies, and some evaluation values ​​contribute more to the downstream model training task, while others contribute less. In order to ensure that the evaluation value can better fit the actual situation of the downstream model training task, the embodiment of the present invention is also provided with a gating unit, which can learn the historical performance of the screened text in the downstream model training task, and can determine the contribution of the evaluation value of each guidance model to the model training task through this historical performance, and then generate a corresponding weight value for each guidance model according to the historical performance and the current input original text. In this way, by setting the guidance model and the gating unit, the embodiment of the present invention can not only use machine learning means to realize multi-dimensional automatic evaluation of the original text to be screened, but also use machine learning means to perform weighted correction on the evaluation values ​​of each dimension of the historical performance of the screened text in the downstream model training task, thereby improving the stability of the text screening strategy, data balance and data extensiveness, thereby avoiding the problems of uneven data distribution and insufficient coverage that are easily caused by manually determining the screening strategy.

[0082] It should be noted that the embodiments of the present invention do not limit the number of guidance models, which can be set according to actual application requirements. The embodiments of the present invention also do not limit the specific preset evaluation dimensions and the prior knowledge of the preset evaluation dimensions. For example, the dimensions of prior knowledge can be divided into logical reasoning, data security, semantic understanding, and proprietary domain knowledge, among which logical reasoning can be further subdivided into mathematical ability, code ability, and common sense reasoning, and data security can be divided into value alignment, bias alignment, and toxic data filtering. Semantic understanding can be divided into sentiment analysis and text summarization, and proprietary domain knowledge includes text data in finance, law, medicine, astronomy, and geography. The specific preset evaluation dimensions and prior knowledge required can be set according to actual application requirements.

[0083] It should also be noted that the embodiments of the present invention do not limit the deployment of the above-mentioned guidance model and gating unit in the hardware device. For example, the above-mentioned guidance model and gating unit can be deployed in the same server node; they can also be deployed in different server nodes and work based on a distributed system.

[0084] Based on the above system structure description, the text screening method provided by the embodiment of the present invention is introduced below. Figure 2 , Figure 2 A flowchart of a text screening method provided by an embodiment of the present invention, the method may include:

[0085] S201, obtaining the original text to be filtered.

[0086] In the embodiment of the present invention, the original text refers to unscreened, low-quality text data. The embodiment of the present invention does not limit the method of obtaining the original text. For example, it can be obtained manually from public channels such as the Internet, or it can be generated using a text generation model, which can be set according to actual application requirements. Specifically, the embodiment of the present invention can set a prompt word (Prompt) for the downstream model training task, and input the prompt word into the trained text generation model to obtain a generated text generated by the model and corresponding to the prompt word, and then set the generated text as the above-mentioned original text.

[0087] Based on this, the original text to be filtered can be obtained, which may include:

[0088] Step 11: Obtain a preset prompt word, and input the preset prompt word into a trained text generation model to obtain a generated text corresponding to the preset prompt word.

[0089] Step 12: Set the generated text as the original text.

[0090] S202. Input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text based on the prior knowledge.

[0091] As described above, the embodiment of the present invention can set up multiple guidance models, and embed the prior knowledge of the corresponding preset evaluation dimension in each guidance model, so that each guidance model can independently generate the evaluation value of the original text from different dimensions, thereby realizing the automatic evaluation of the original text. Among them, the evaluation value represents the probability of the original text being retained from the perspective of the corresponding preset evaluation dimension. The higher the evaluation value, the higher the quality of the original text in the corresponding preset evaluation dimension, and the higher the probability of being retained under the preset evaluation dimension.

[0092] It should be noted that the embodiment of the present invention does not limit the specific structure of the guidance model, and it can be set according to actual application requirements. For example, since the purpose of text screening in the embodiment of the present invention is to improve the fine-tuning training effect of the large language model, and the core module of the large language model is the transformer decoder (Transformer), in order to ensure that the screened training text can better tap the potential of the downstream model, the guidance model in the embodiment of the present invention can have the same transformer decoder structure as the model to be trained by the model training task. In addition, in order to avoid the guidance model being too large and inconvenient for deployment, the model parameter amount of the guidance model can also be set to be smaller than the model parameter amount of the model to be trained.

[0093] Further, the specific structure of the guidance model will be introduced below. Figure 3 , Figure 3 A structural block diagram of a guidance model provided by an embodiment of the present invention. The guidance model includes a coding layer, a first transformation decoder (Transformer module), a fully connected layer and a first normalization layer (softmax layer) in sequence according to the data flow direction. The first transformation decoder includes multiple transformation decoder units connected in series, and the first transformation decoder is embedded with prior knowledge. Among them, the input of the coding layer is the original text, which is used to position encode the original text to obtain a text embedding vector; the first transformation decoder can perform feature extraction on the text embedding vector based on prior knowledge to obtain a feature extraction vector; the fully connected layer can perform feature conversion on the feature extraction vector to obtain a feature conversion vector; finally, the first normalization layer can normalize the feature conversion vector to obtain an evaluation value.

[0094] Based on this, the original text is input into multiple guidance models to obtain the evaluation value output by each guidance model for the original text, which may include:

[0095] Step 21: Input the original text into the encoding layer for position encoding to obtain the text embedding vector;

[0096] Step 22: inputting the text embedding vector into the first conversion decoder, so that the first conversion decoder extracts features from the text embedding vector according to prior knowledge to obtain a feature extraction vector;

[0097] Step 23: Input the feature extraction vector into the fully connected layer for feature conversion to obtain a feature conversion vector;

[0098] Step 24: Input the feature conversion vector into the first normalization layer for normalization to obtain an evaluation value.

[0099] It is worth noting that, in order to facilitate the gating unit to determine the weight value of each guidance model, the output features of each layer of the conversion decoder unit are passed to the gating unit after weighted averaging, and this feature transfer operation provides the gating unit with features at different abstract levels. At the same time, in order for the guidance model to better determine whether to retain the current data, the embodiment of the present invention can embed prior knowledge into the V matrix of the conversion decoder module, so that the guidance model is more suitable for the current task.

[0100] It should be noted that the embodiment of the present invention does not limit the number of layers of transform decoder units that can be included in the first transform decoder, which can be set according to actual application requirements, for example, 32 layers. The embodiment of the present invention also does not limit the number of fully connected layers, for example, it can be two layers.

[0101] S203. Input the original text into the gating unit to obtain the weight value output by the gating unit for each guidance model; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and the previously screened training text in the model training task.

[0102] As described above, the embodiment of the present invention may also include a gating unit, which can learn the historical performance of the filtered text in the downstream model training task, and can determine the contribution of the evaluation value of each guiding model to the model training task through this historical performance, and then generate a corresponding weight value for each guiding model based on the historical performance and the currently input original text.

[0103] It should be noted that the embodiment of the present invention does not limit the specific structure of the gating unit, which can be set according to actual application requirements. For example, since the purpose of text screening in the embodiment of the present invention is to improve the fine-tuning training effect of the large language model, and the core module of the large language model is the transformer, in order to ensure that the screened training text can better tap the potential of the downstream model, the gating unit in the embodiment of the present invention may also have the same transformer structure as the model to be trained by the model training task. In addition, as mentioned above, since the output features of each transformer unit in each guidance model are passed to the gating unit after weighted averaging, the input layer of the gating unit needs to include two branches, one for inputting the output features input by each guidance model, and the other for inputting the original text.

[0104] The specific structure of the gate control unit is introduced below. Figure 4 , Figure 4The present invention provides a structural block diagram of a guidance model provided by an embodiment of the present invention. The gate control unit includes an input layer, a second conversion decoder (Transformer module), a second normalization layer (softmax) and a selection layer (Topk) in sequence according to the data flow direction. The input layer includes a first input module and a second input module. The first input module corresponds to each guidance model one by one. The first input module includes a first linear layer. The input of the first linear layer is the output feature of each conversion decoder unit in the corresponding guidance model. The second input module includes a second linear layer. The input of the second linear layer is the original text. Among them, the first linear layer is used to perform weighted average processing on the output features of each conversion decoder unit of the corresponding guidance model to obtain a first input vector; the second thread layer is used to perform linear layer processing on the original text to obtain a second input vector; the second conversion decoder is used to perform feature extraction on the first input vector and the second input vector to obtain a feature extraction vector; the second normalization layer is used to perform normalization processing on the feature extraction vector to obtain an output vector containing the initial weight values ​​corresponding to each guidance model; finally, the selection layer is used to select the maximum value of the initial weight value of the preset number from the output vector as the final weight value, and set the remaining initial weight values ​​to zero. In other words, in the process of screening each original text, the gating unit will only select the preset number of guidance models with the largest weight values ​​to make a final evaluation on the original text. It should be noted that the embodiment of the present invention does not limit the specific value of the preset number, and can be set according to actual needs, such as k.

[0105] Based on this, the original text is input into the gating unit to obtain the weight values ​​output by the gating unit for each guidance model, which may include:

[0106] Step 31: Input the output features of each conversion decoder unit of each guidance model into the first linear layer for weighted average processing to obtain a first input vector;

[0107] Step 32: Input the original text into the second linear layer for linear layer processing to obtain a second input vector;

[0108] Step 33: inputting the first input vector and the second input vector into a second conversion decoder for feature extraction to obtain a feature extraction vector;

[0109] Step 34: Input the feature extraction vector into the second normalization layer for normalization processing to obtain an output vector; wherein each element in the output vector corresponds to each guidance model, and the value of each element is the initial weight value of each guidance model;

[0110] Step 35: Input the output vector into the selection layer, so that the selection layer sets the initial weight values ​​of the first preset number with the largest numerical value in the output vector as weight values, and sets the remaining initial weight values ​​to zero.

[0111] Specifically, the screening process of the gate control unit can be expressed by the following formula:

[0112] G(D input )=Top k (softmax(Transformer(WD input +b+W n O n +b n )));

[0113] Among them, G() represents the gate control unit, D input represents the original input text, W represents the weight of the second linear layer, W n represents the weight of the first linear layer, b represents the bias for the original text, b n represents the bias for the output feature of the guidance model, O n represents the bias of the guidance model.

[0114] The text screening system's screening process for the input original text can be expressed as:

[0115]

[0116] Among them, D h represents the filtered training text, T i (·) represents the output result of the i-th guidance model, G i (·) represents the weight of the gating unit for the output of the i-th guidance model.

[0117] S204: Perform weighted sum processing on all evaluation values ​​using all weight values ​​to obtain screening values ​​of each original text, and screen the original text according to the screening values ​​to obtain training text for executing the model training task.

[0118] After obtaining the weight values ​​and the evaluation values, the embodiment of the present invention uses all the weight values ​​to perform weighted summation processing on all the evaluation values ​​to obtain the screening values ​​of each original text, and screens the original text according to the screening values ​​to obtain the training text for performing the model training task. For example, only the original texts with screening values ​​greater than the preset threshold value can be retained, and the original texts with screening values ​​less than or equal to the preset threshold value can be removed. In this way, automatic screening of text data can be achieved.

[0119] It should be noted that the embodiment of the present invention does not limit the specific value of the preset threshold used for filtering the original text, and it can be set according to actual application requirements.

[0120] Based on the above embodiments, the present invention is particularly provided with a plurality of guidance models and a gating unit, wherein each guidance model is embedded with prior knowledge corresponding to a preset evaluation dimension, and then the guidance model can generate a corresponding evaluation value for the text according to the prior knowledge; and the gating unit can determine the weight value corresponding to each guidance model based on the historical performance of the current input text and the previously screened training text in the downstream model training task. Furthermore, after obtaining the original text to be screened, the present invention can first input it into a plurality of guidance models to obtain the evaluation value output by each guidance model for the original text, and then input it into the gating unit to obtain the weight value output by the gating unit for each guidance model, and then all the evaluation values ​​can be weighted and summed using all the weight values ​​to obtain the screening value of each original text, and the original text can be screened according to the screening value to obtain the training text for executing the model training task. Furthermore, the present invention can not only adopt machine learning methods to screen training texts so as to avoid the problems of low screening efficiency and high screening costs in manual screening, but more importantly, it can determine the text screening strategy by embedding prior indications into the guidance model and embedding the historical performance of the screened training texts in the downstream model training tasks into the gating unit, thereby improving the stability, data balance and data breadth of the text screening strategy, thereby avoiding the problems of uneven data distribution and insufficient coverage that are easily caused by manually determining the screening strategy.

[0121] Based on the above embodiment, the training method of the guidance model is introduced below. In the embodiment of the present invention, the training stage of the guidance model is divided into an initial stage and an online stage, wherein the initial stage is the stage of the first training of the guidance model, and the online stage is the training performed after the guidance model has screened a certain amount of training text. The training process of the guidance model in the initial stage will be first introduced below. Based on this, before obtaining the original text to be screened, it can also include:

[0122] S301, obtaining prior knowledge and a pre-trained conversion decoder model.

[0123] As described above, in order to fully tap the potential of the downstream model, the core structure of the guidance model in the embodiment of the present invention can also be a transform decoder. Therefore, in order to improve the training efficiency of the guidance model, the embodiment of the present invention can directly obtain a pre-trained transform decoder model as the basic model of the guidance model.

[0124] It should be noted that the embodiment of the present invention does not limit the specific process of pre-training, which can be set according to actual application requirements.

[0125] S302. Fine-tune the transformation decoder model using prior knowledge based on a low-rank adaptive method to embed the prior knowledge into the transformation decoder in the transformation decoder model.

[0126] In this step, in order to improve the training efficiency of the guidance model, the conversion decoder model can be fine-tuned (Fine-tune) based on the low-rank adaptive method (LoRa, Low-Rank Adaptation of Large Language Models) using prior knowledge to embed the prior knowledge into the conversion decoder in the conversion decoder model. The low-rank adaptive method is a training method to improve the efficiency of model fine-tuning training.

[0127] It should be noted that the embodiment of the present invention does not limit the specific fine-tuning training process, and reference may be made to the relevant knowledge of the training of the Transformer model.

[0128] S303, adding a fully connected layer and a first normalization layer to the conversion decoder model that has completed fine-tuning training to obtain a guidance model.

[0129] In the embodiment of the present invention, in order to ensure that the fine-tuned conversion decoder model can have the function of generating evaluation values, a fully connected layer and a normalization layer can be added to the conversion decoder model that has completed fine-tuning training, and the output of the conversion decoder model is converted by the fully connected layer, and the converted features are mapped to the evaluation value of the original text through the normalization operation (Softmax). In addition, the guidance model can generate evaluation values ​​for the original text according to the embedded prior knowledge.

[0130] The following will introduce the training process of the guidance model in the online stage. Based on this, after obtaining the training text for performing the model training task, it can also include:

[0131] S401: Execute a model training task using the training text, and determine a performance indicator value corresponding to the training text when executing the model training task according to a preset performance indicator.

[0132] In an embodiment of the present invention, training texts that have been screened by the guidance model and the gating unit and have performed well in the downstream model training task can be further embedded in the guidance model to improve the knowledge information reserve of the guidance model. In order to screen high-quality training texts, the embodiment of the present invention can specifically set a preset performance index for the downstream model training task, and determine the performance index value of each training text according to the corresponding historical performance of each training text when participating in the model training task.

[0133] It should be noted that the embodiments of the present invention do not limit specific preset performance indicators, which are related to specific model training tasks. For example, if the training text is a code text and the model training task is a code task, the preset performance indicator is the code pass rate of the code text. When the model training task is other content, the preset performance indicator can also be other content.

[0134] S402: setting the training texts whose performance index values ​​are greater than a preset threshold as fine-tuning texts, and using the fine-tuning texts to perform fine-tuning training on the first conversion decoders in each directing model.

[0135] In this step, after obtaining the training index value of each training text, the training text with a performance index value greater than a preset threshold value may be used as a fine-tuning text, and the fine-tuning text is used to fine-tune the first conversion decoder in each guidance model, so as to embed the high-quality fine-tuning text into the guidance model to improve the knowledge information reserve of the guidance model. It should be noted that the embodiment of the present invention does not limit the specific method of fine-tuning the first conversion decoder using the fine-tuning text, and reference may be made to the description in the above embodiment.

[0136] Furthermore, considering that not all guidance models contribute to the downstream model training task, in order to save computing resources, the fine-tuning text can also be used to perform fine-tuning training on some guidance models that contribute more. Specifically, since the weight value output by the gating unit in the embodiment of the present invention represents the contribution of each guidance model to the downstream model training task, before fine-tuning training, the embodiment of the present invention can also sort the guidance models according to the weight values ​​generated by the gating unit for each guidance model based on the fine-tuning text, and only perform fine-tuning training on the first conversion decoder of the first preset number of guidance models with the largest weight value.

[0137] Based on this, before fine-tuning the first conversion decoder in each directing model using the fine-tuning text, the following may also be included:

[0138] Step 41: according to the weight values ​​generated by the gating unit for each guiding model according to the fine-tuning text, determining a preset number of guiding models with the largest weight values ​​as guiding models to be fine-tuned;

[0139] The first conversion decoder in each directed model is fine-tuned using the fine-tuning text, including:

[0140] Step 42: Use the fine-tuning text to fine-tune the first conversion decoder in the fine-tuning guidance model.

[0141] Based on the above embodiment, the training method of the gating unit is introduced below. In an embodiment of the present invention, the training stage of the gating unit is also divided into an initial stage and an online stage, wherein the initial stage is the stage of the first training of the gating unit, and the online stage is the training performed by the gating unit after a certain amount of training text has been screened. It should be pointed out that the training in the online stage plays an important role in the historical performance of the screened training texts in the downstream model training tasks accumulated by the gating unit, and thus the training process in the online stage is the core training process required by the gating unit. The initial stage process can help the gating unit quickly enter the basic working state, and quickly initialize the weight value calculation and online stage training for it. The training process of the gating unit in the initial stage will be first introduced below. Based on this, before obtaining the original text to be screened, it can also include:

[0142] S501, obtaining gate control unit training text.

[0143] In order to quickly initialize the gate control unit, the embodiment of the present invention can first be trained on a small-volume high-quality data set. It should be noted that the embodiment of the present invention does not limit the number of gate control unit training texts, which can be set according to actual application requirements.

[0144] S502. Input the gating unit training text into each guiding model and the gating unit at the same time, so that the guiding model outputs a training evaluation value for the gating unit training text, and the gating unit outputs a training weight vector for the gating unit training text; wherein the training weight vector includes the initial training weight value of each guiding model.

[0145] In this step, it should be noted that the initial stage training of the guidance model should be earlier than the initial stage training of the gating unit. This is because the output features of each conversion decoder unit in the guidance model need to be input into the gating unit. Therefore, the guidance model needs to be trained in advance and the gating unit needs to be trained after the prior knowledge has been well embedded in the guidance model.

[0146] Furthermore, in the process of training the gated unit, the gated unit training text needs to be input into each guidance model and the gated unit at the same time. For the guidance model, in addition to generating corresponding evaluation values ​​(i.e., training evaluation values) for the gated unit training text, it is more important to use each layer of conversion decoder units to extract features from the gated unit training text and pass the output features into the gated unit. For the gated unit, it is necessary to perform feature extraction based on the input gated unit training text and the output features to generate corresponding initial weight values ​​(i.e., training initial weight values) for each guidance model.

[0147] S503 , using the training evaluation value of each guiding model and the training weight vector of the gating unit, adopting the maximum marginal correlation method to sort the guiding models to obtain a sorting result.

[0148] In the instantiation of the present invention, in order to improve the diversity of the training texts screened by the gating unit, the maximum marginal relevance method (MMR, Maximum Marginal Relevance) can be used to sort different guidance models, and the sorting results of the guidance models are used as the learning goals of the gating unit, wherein the maximum marginal relevance method is a method for improving the diversity of model recommendation results, and in the embodiment of the present invention, it is particularly used to improve the diversity of the guidance models selected by the gating unit, thereby improving the diversity of the evaluation dimensions of the screening training data. The present invention can specifically use the training evaluation value of each guidance model and the training weight vector of the gating unit to take the maximum marginal relevance method to sort each guidance model through the following formula to obtain the sorting result:

[0149]

[0150] Where MMR represents the ranking result determined based on the maximum marginal relevance, R represents the set of guidance models to be ranked, S represents the set of ranked guidance models, λ represents the hyperparameter, and D i represents the training evaluation value of the i-th guidance model, D j represents the training evaluation value of the j-th director model in the set S, Q k It represents the training weight vector obtained by the k-th gated unit training text after the gated unit, mean() represents the mean calculation function, Sim1() and Sim2() both represent the similarity calculation function.

[0151] It should be noted that the embodiment of the present invention does not limit the specific execution process of the above-mentioned sorting, and reference may be made to the relevant technology of the maximum marginal correlation method.

[0152] S504: Normalize the sorting results to obtain a training target weight value.

[0153] After completing the sorting of the guidance models, the embodiment of the present invention may represent the sorting results in a numerical manner, and normalize the sorting results to obtain the training target weight values.

[0154] S505 , determining a loss value using the training initial weight value and the training target weight value, and updating parameters of the gating unit according to the loss value.

[0155] As described above, in order to quickly initialize the gating unit, the embodiment of the present invention can use the sorting result of the guidance model by the MMR algorithm as the learning target of the gating unit. Therefore, the present invention can use the training initial weight value and the training target weight value to determine the loss value, and update the parameters of the gating unit according to the loss value. It should be noted that the embodiment of the present invention does not limit the specific loss function, and can be set according to the actual application requirements. For example, the MSE loss function (Mean square error) can be used. Specifically, the loss value can be determined using the training initial weight value and the training target weight value by the following formula:

[0156]

[0157] Among them, MSE represents the loss value, n represents the number of guidance models, and y i represents the training target weight value, Represents the initial weight value for training.

[0158] The following will introduce the training process of the gate control unit in the online stage. Based on this, after obtaining the training text for performing the model training task, it can also include:

[0159] S601. When m batches of training texts are obtained, the training texts are used to perform a model training task, and the performance indicator values ​​corresponding to the training texts when performing the model training task are determined according to preset performance indicators, and the training texts are sorted according to the performance indicator values ​​to obtain a training text sorting result; wherein each batch of training texts contains b training texts, m>0, b>0.

[0160] In an embodiment of the present invention, in order to quantify the historical performance of each training text in the downstream model training task, a corresponding preset performance indicator can be set for the model training task, and the preset performance indicator can be used to calculate the corresponding performance indicator value for each training text, and then each training text can be sorted according to the performance indicator value to determine the historical performance of each training text. It should be noted that the embodiment of the present invention does not limit the specific preset performance indicator, which is related to the specific model training task. For example, the training text is a code text, and the model training task is a code task, then the preset performance indicator is the code pass rate of the code text. When the model training task is other content, the preset performance indicator can also be other content.

[0161] Furthermore, in an embodiment of the present invention, in order to avoid high-frequency training of the gate control unit, when it is determined that the text screening system has screened out m batches of training texts, the gate control unit can be trained online based on the m batches of training texts. Each batch of training texts contains b training texts, and m and b can be set arbitrarily.

[0162] S602: According to the evaluation value determined by the guidance model for the training text and the ranking position of the training text in the training text ranking result, the performance value of each guidance model is determined by the following formula:

[0163]

[0164] Among them, score i represents the performance value of the i-th guidance model, m represents the m-th batch of data, b represents the number of training texts contained in each batch of data, and rank j represents the ranking position of the jth training text in the training text ranking results, w ij It represents the evaluation value determined by the i-th guidance model for the j-th training text. I(x) represents the indicator function. If x is greater than zero, I(x) is equal to 1; if x is not greater than zero, I(x) is equal to 0.

[0165] It is understandable that the evaluation of each guidance model contributes differently to the downstream model training task, and this contribution will affect the weight value determined by the gating unit for it. In order to effectively quantify the contribution of the guidance model, the embodiment of the present invention can calculate the corresponding performance value for each guidance model based on the evaluation value determined by each guidance model for the training text and the ranking position of the training text in the training text ranking result, so as to determine the actual performance of each guidance model.

[0166] S603, normalizing the performance values ​​of each guidance model to obtain a target weight value;

[0167] After obtaining the performance value of each guiding model, the embodiment of the present invention can normalize all the performance values ​​to obtain the actual contribution ratio (ie, target weight value) of each guiding model in the downstream model training task.

[0168] S604: Determine a loss value using the initial weight value and the target weight value, and update parameters of the gating unit according to the loss value.

[0169] It can be understood that since the weight value generated by the gating unit may differ from the actual performance of the downstream, that is, there is a difference between the initial weight value (without passing through the selection layer) generated by the gating unit for each guiding model and the actual contribution ratio of each guiding model (that is, the target weight value), the present invention can use the initial weight value and the target weight value to determine the loss value, and update the parameters of the gating unit according to the loss value, thereby ensuring that the gating unit learns the historical performance of the screened training text in the downstream model training task, thereby ensuring that the gating unit gives a reliable weight value for each guiding model.

[0170] Based on the above embodiment, the above text screening method is fully introduced below based on a specific flow chart. Figure 5 , Figure 5 The following is a flow chart of a text screening method provided by an embodiment of the present invention. The method includes the following process:

[0171] 1) When the present invention is working, the first step is to obtain the original data set, which is usually larger than the final high-quality data set. The source of the original data is divided into two parts. The first part is obtained from the open source community and public channels, and the second part is to generate data using a generative model. The acquisition of the first part of the data requires relaxing the acquisition standards to ensure the breadth of the data source. The acquisition of the second part of the data requires the selection of a high-performance generative model to ensure the quality of data generation. At the same time, it is necessary to select the prompt and the model parameters when generating the data to ensure the diversity of the data.

[0172] 2) The second step is to screen the original data set, and different screening strategies should be selected for different tasks. The screening strategies of the present invention are divided into two categories, the first category is screening according to rules, and the second category is intelligent screening using intelligent models. The first type of screening method mainly includes operations such as deduplication, error correction, standardization and consistency verification. This screening method can improve data quality to a certain extent and ensure the breadth of data sources. The second type of screening method can adaptively learn screening strategies, thereby ensuring the richness of data while ensuring the performance of downstream tasks.

[0173] 3) The third step is to format and store the data set.

[0174] The text screening device, electronic device, computer program product, and computer-readable storage medium provided in the embodiments of the present invention are introduced below. The text screening device, electronic device, computer program product, and computer-readable storage medium described below can be referenced to the text screening method described above.

[0175] Please refer to Figure 6 , Figure 6 A structural block diagram of a text screening device provided by an embodiment of the present invention, the device may include:

[0176] The acquisition module 601 is used to acquire the original text to be screened;

[0177] The guidance model module 602 is used to input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, and different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge;

[0178] A gate control unit module 603 is used to input the original text into the gate control unit to obtain the weight value output by the gate control unit for each guidance model; wherein the gate control unit belongs to a machine learning model, and the gate control unit determines the weight value according to the historical performance of the original text and the previously selected training text in the model training task;

[0179] The screening module 604 is used to perform weighted sum processing on all evaluation values ​​using all weight values ​​to obtain screening values ​​of each original text, and screen the original text according to the screening values ​​to obtain training text for executing the model training task.

[0180] Optionally, the guidance model has the same conversion decoder structure as the model to be trained by the model training task, and the model parameter amount of the guidance model is smaller than the model parameter amount of the model to be trained.

[0181] Optionally, the acquisition module 601 may include:

[0182] The text generation submodule is used to obtain a preset prompt word and input the preset prompt word into the trained text generation model to obtain a generated text corresponding to the preset prompt word;

[0183] The text setting submodule is used to set the generated text to the original text.

[0184] Optionally, the guidance model includes an encoding layer, a first transform decoder, a fully connected layer and a first normalization layer in sequence according to a data flow direction, the first transform decoder includes a plurality of transform decoder units connected in series, and the first transform decoder is embedded with prior knowledge;

[0185] The guidance model module 602 can be used to:

[0186] Input the original text into the encoding layer for position encoding to obtain the text embedding vector;

[0187] Inputting the text embedding vector into a first conversion decoder so that the first conversion decoder extracts features from the text embedding vector according to prior knowledge to obtain a feature extraction vector;

[0188] Input the feature extraction vector into the fully connected layer for feature conversion to obtain a feature conversion vector;

[0189] The feature conversion vector is input into the first normalization layer for normalization to obtain the evaluation value.

[0190] Optionally, the device may further include:

[0191] A data acquisition module to guide model training, used to obtain prior knowledge and pre-trained transformation decoder models;

[0192] A guided model initial fine-tuning module, for fine-tuning the transformation decoder model using prior knowledge based on a low-rank adaptive method, so as to embed the prior knowledge into the transformation decoder in the transformation decoder model;

[0193] The guidance model setting module is used to add a fully connected layer and a normalization layer to the conversion decoder model that has completed fine-tuning training to obtain a guidance model.

[0194] Optionally, the device may further include:

[0195] A performance indicator value determination module is used to perform a model training task using a training text, and determine a performance indicator corresponding to the training text when performing the model training task according to a preset performance indicator;

[0196] The guidance model online fine-tuning module is used to set the training text with a performance index greater than a preset threshold as the fine-tuning text, and use the fine-tuning text to fine-tune the first conversion decoder in each guidance model.

[0197] Optionally, the guidance model online fine-tuning module may include:

[0198] A sorting submodule, configured to determine, according to the weight values ​​generated by the gating unit for each guiding model for the fine-tuning text, a preset number of guiding models with the largest weight values ​​as guiding models to be fine-tuned;

[0199] The first conversion decoder in each directed model is fine-tuned using the fine-tuning text, including:

[0200] The online fine-tuning submodule is used to fine-tune the first conversion decoder in the fine-tuning guidance model using the fine-tuning text.

[0201] Optionally, the gating unit includes an input layer, a second transform decoder, a second normalization layer and a selection layer in sequence according to the data flow direction, the input layer includes a first input module and a second input module, the first input module corresponds to each guidance model one by one, the first input module includes a first linear layer, the input of the first linear layer is the output feature of each transform decoder unit in the corresponding guidance model, the second input module includes a second linear layer, the input of the second linear layer is the original text;

[0202] The gate control unit module 603 can be used for:

[0203] Input the output features of each conversion decoder unit of the corresponding guidance model into the first linear layer for weighted average processing to obtain a first input vector;

[0204] Input the original text into the second linear layer for linear layer processing to obtain a second input vector;

[0205] Inputting the first input vector and the second input vector into a second conversion decoder for feature extraction to obtain a feature extraction vector;

[0206] The feature extraction vector is input into the second normalization layer for normalization processing to obtain an output vector; wherein each element in the output vector corresponds to each guidance model, and the value of each element is the initial weight value of each guidance model;

[0207] The output vector is input into the selection layer so that the selection layer sets the initial weight values ​​of the first preset number with the largest values ​​in the output vector as the weight values, and sets the remaining initial weight values ​​to zero.

[0208] Optionally, before obtaining the original text to be filtered, the following steps are also included:

[0209] A gate control unit training text acquisition module, used to acquire gate control unit training text;

[0210] A gated unit initial training module, used to input the gated unit training text into each guidance model and the gated unit at the same time, so that the guidance model outputs a training evaluation value for the gated unit training text, and the gated unit outputs a training weight vector for the gated unit training text; wherein the training weight vector includes the initial training weight value of each guidance model;

[0211] A sorting module, used to sort the guidance models by using the training evaluation value of each guidance model and the training weight vector of the gate control unit to obtain a sorting result;

[0212] The normalization module is used to normalize the sorting results to obtain the training target weight value;

[0213] The gating unit initial update module is used to determine the loss value using the training initial weight value and the training target weight value, and to update the parameters of the gating unit according to the loss value.

[0214] Optionally, the sorting module is specifically used to:

[0215] The training evaluation values ​​of each guidance model and the training weight vector of the gate control unit are used to sort the guidance models using the maximum marginal correlation method to obtain the sorting result:

[0216]

[0217] Where MMR represents the ranking result determined based on the maximum marginal relevance, R represents the set of guidance models to be ranked, S represents the set of ranked guidance models, λ represents the hyperparameter, and D i represents the training evaluation value of the i-th guidance model, D jrepresents the training evaluation value of the j-th director model in the set S, Q k It represents the training weight vector obtained by the k-th gated unit training text after the gated unit, mean() represents the mean calculation function, Sim1() and Sim2() both represent the similarity calculation function.

[0218] Optionally, the gate control unit initial update module may include:

[0219] The loss value calculation submodule is used to determine the loss value using the training initial weight value and the training target weight value through the following formula:

[0220]

[0221] Among them, MSE represents the loss value, n represents the number of guidance models, and y i represents the training target weight value, Represents the initial weight value for training.

[0222] Optionally, the device may further include:

[0223] A training text sorting module is used to perform a model training task using the training texts when m batches of training texts are obtained, determine the performance indicators corresponding to the training texts when performing the model training task according to preset performance indicators, and sort the training texts according to the performance indicators to obtain a training text sorting result; wherein each batch of training texts contains b training texts, m>0, b>0;

[0224] The performance value calculation module is used to determine the performance value of each guidance model through the following formula according to the evaluation value determined by the guidance model for the training text and the ranking position of the training text in the training text ranking result;

[0225]

[0226] Among them, score i represents the performance value of the i-th guidance model, m represents the m-th batch of data, b represents the number of training texts contained in each batch of data, and rank j represents the ranking position of the jth training text in the training text ranking results, w ij represents the evaluation value determined by the i-th guidance model for the j-th training text, I(x) represents the indicator function, if x is greater than zero, I(x) is equal to 1, if x is not greater than zero, I(x) is equal to 0;

[0227] A target weight value setting module is used to normalize the performance values ​​of each guidance model to obtain a target weight value;

[0228] The gating unit online update module is used to determine the loss value using the initial weight value and the target weight value, and to update the parameters of the gating unit according to the loss value.

[0229] Optionally, the training text is a code text, the model training task is a code task, and the preset performance indicator is a code pass rate of the code text.

[0230] Please refer to Figure 7 , Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. The embodiment of the present invention provides an electronic device 70, including a processor 71 and a memory 72; wherein the memory 72 is used to store a computer program; and the processor 71 is used to execute the text screening method provided in the aforementioned embodiment when executing the computer program.

[0231] For the specific process of the above text screening method, please refer to the corresponding content provided in the above embodiments, which will not be repeated here.

[0232] Furthermore, the memory 72 as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.

[0233] In addition, the electronic device 70 also includes a power supply 73, a communication interface 74, an input / output interface 75 and a communication bus 76; wherein the power supply 73 is used to provide working voltage for each hardware device on the electronic device 70; the communication interface 74 can create a data transmission channel between the electronic device 70 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, and is not specifically limited here; the input / output interface 75 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0234] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the text screening method described in the above embodiment is implemented.

[0235] Since the embodiments of the computer program product part correspond to the embodiments of the text screening method part, please refer to the description of the embodiments of the text screening method part for the embodiments of the computer program product part, which will not be repeated here.

[0236] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the text screening method described in the above embodiment is implemented.

[0237] Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the text screening method part, the embodiments of the storage medium part refer to the description of the embodiments of the text screening method part, which will not be repeated here.

[0238] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0239] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0240] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0241] The above is a detailed introduction to a text screening method, device, electronic device and storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A text screening method, characterized in that: include: Get the original text to be filtered; Input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge; Inputting the original text into a gating unit to obtain a weight value output by the gating unit for each of the guiding models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and the previously screened training text in the model training task; All the evaluation values ​​are weighted and summed using all the weight values ​​to obtain screening values ​​for each of the original texts, and the original texts are screened according to the screening values ​​to obtain training texts for executing the model training task.

2. The text screening method according to claim 1, characterized in that: The guiding model has the same conversion decoder structure as the model to be trained by the model training task, and the model parameter amount of the guiding model is smaller than the model parameter amount of the model to be trained.

3. The text screening method according to claim 1, characterized in that: The obtaining of the original text to be screened includes: Obtaining a preset prompt word, and inputting the preset prompt word into a trained text generation model to obtain a generated text corresponding to the preset prompt word; The generated text is set as the original text.

4. The text screening method according to any one of claims 1 to 3, characterized in that: The guidance model includes, in order according to the data flow direction, a coding layer, a first transform decoder, a fully connected layer, and a first normalization layer, wherein the first transform decoder includes a plurality of transform decoder units connected in series, and the prior knowledge is embedded in the first transform decoder; The step of inputting the original text into a plurality of guidance models to obtain evaluation values ​​output by each of the guidance models for the original text includes: Inputting the original text into the encoding layer for position encoding to obtain a text embedding vector; Inputting the text embedding vector into the first conversion decoder so that the first conversion decoder performs feature extraction on the text embedding vector according to the prior knowledge to obtain a feature extraction vector; Inputting the feature extraction vector into the fully connected layer for feature conversion to obtain a feature conversion vector; The feature conversion vector is input into the first normalization layer for normalization processing to obtain the evaluation value.

5. The text screening method according to claim 4, characterized in that: Before obtaining the original text to be filtered, it also includes: Obtaining the prior knowledge and a pre-trained transform decoder model; Fine-tune the transform decoder model using the prior knowledge based on a low-rank adaptive method to embed the prior knowledge into a transform decoder in the transform decoder model; The fully connected layer and the first normalization layer are added to the conversion decoder model that has completed the fine-tuning training to obtain the guidance model.

6. The text screening method according to claim 5, characterized in that: After obtaining the training text for executing the model training task, the method further includes: Utilizing the training text to perform the model training task, and determining a performance indicator value corresponding to the training text when performing the model training task according to a preset performance indicator; The training texts whose performance indicator values ​​are greater than a preset threshold are set as fine-tuning texts, and the fine-tuning texts are used to perform fine-tuning training on the first conversion decoders in each of the directing models.

7. The text screening method according to claim 4, characterized in that: The gating unit includes an input layer, a second conversion decoder, a second normalization layer and a selection layer in sequence according to the data flow direction, the input layer includes a first input module and a second input module, the first input module corresponds to each of the guidance models one by one, the first input module includes a first linear layer, the input of the first linear layer is the output feature of each conversion decoder unit in the corresponding guidance model, the second input module includes a second linear layer, the input of the second linear layer is the original text; The step of inputting the original text into a gating unit to obtain a weight value output by the gating unit for each of the guiding models includes: Inputting the output features of each of the conversion decoder units of the corresponding guidance model into the first linear layer for weighted averaging to obtain a first input vector; Inputting the original text into the second linear layer for linear layer processing to obtain a second input vector; Inputting the first input vector and the second input vector into the second conversion decoder for feature extraction to obtain a feature extraction vector; Inputting the feature extraction vector into the second normalization layer for normalization processing to obtain an output vector; wherein each element in the output vector corresponds to each of the guidance models, and the value of each element is the initial weight value of each of the guidance models; The output vector is input into the selection layer so that the selection layer sets the initial weight values ​​of the first preset number with the largest values ​​in the output vector as the weight values, and sets the remaining initial weight values ​​to zero.

8. The text screening method according to claim 7, characterized in that: Before obtaining the original text to be filtered, it also includes: Get the gate unit training text; Inputting the gating unit training text into each of the guiding models and the gating unit at the same time, so that the guiding model outputs a training evaluation value for the gating unit training text, and the gating unit outputs a training weight vector for the gating unit training text; wherein the training weight vector includes the training initial weight value of each of the guiding models; Using the training evaluation value of each guiding model and the training weight vector of the gating unit, the guiding models are sorted by a maximum marginal correlation method to obtain a sorting result; Normalizing the sorting results to obtain a training target weight value; The loss value is determined by using the training initial weight value and the training target weight value, and the parameters of the gating unit are updated according to the loss value.

9. The text screening method according to claim 8, characterized in that: The training evaluation values ​​of the guidance models and the training weight vectors of the gating units are used to sort the guidance models using the maximum marginal correlation method to obtain a sorting result, including: The training evaluation values ​​of the guidance models and the training weight vectors of the gating units are used to sort the guidance models using the maximum marginal correlation method to obtain a sorting result through the following formula: Where MMR represents the ranking result determined based on the maximum marginal relevance, R represents the set of guidance models to be ranked, S represents the set of ranked guidance models, λ represents the hyperparameter, and D i represents the training evaluation value of the i-th guidance model, D j represents the training evaluation value of the j-th director model in the set S, Q k It represents the training weight vector obtained by the k-th gated unit training text after the gated unit, mean() represents the mean calculation function, Sim1() and Sim2() both represent the similarity calculation function.

10. The text screening method according to claim 8, characterized in that: The determining of the loss value by using the training initial weight value and the training target weight value comprises: The loss value is determined by using the training initial weight value and the training target weight value through the following formula: Among them, MSE represents the loss value, n represents the number of guidance models, and y i represents the training target weight value, Represents the initial weight value of the training.

11. The text screening method according to claim 8, characterized in that: After obtaining the training text for executing the model training task, the method further includes: When m batches of training texts are obtained, the model training task is performed using the training texts, a performance indicator value corresponding to the training texts when performing the model training task is determined according to a preset performance indicator, and the training texts are sorted according to the performance indicator value to obtain a training text sorting result; wherein each batch of training texts contains b training texts, m>0, b>0; According to the evaluation value determined by the guidance model for the training text and the ranking position of the training text in the training text ranking result, the performance value of each guidance model is determined by the following formula; Among them, score i represents the performance value of the i-th guidance model, m represents the m-th batch of data, b represents the number of training texts contained in each batch of data, and rank j represents the ranking position of the jth training text in the training text ranking result, w ij represents the evaluation value determined by the i-th guidance model for the j-th training text, I(x) represents the indicator function, if x is greater than zero, I(x) is equal to 1, if x is not greater than zero, I(x) is equal to 0; Normalizing the performance values ​​of each of the guidance models to obtain a target weight value; A loss value is determined using the initial weight value and the target weight value, and parameters of the gating unit are updated according to the loss value.

12. The text screening method according to claim 11, characterized in that: The training text is a code text, the model training task is a code task, and the preset performance indicator is a code pass rate of the code text.

13. A text screening device, characterized in that: include: An acquisition module is used to obtain the original text to be filtered; A guidance model module, used to input the original text into multiple guidance models to obtain the evaluation value output by each guidance model for the original text; wherein the guidance model is a machine learning model, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance model determines the evaluation value corresponding to the original text according to the prior knowledge; A gating unit module, used for inputting the original text into the gating unit to obtain the weight value output by the gating unit for each of the guiding models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the historical performance of the original text and the previously screened training text in the model training task; The screening module is used to perform weighted sum processing on all the evaluation values ​​using all the weight values ​​to obtain the screening value of each original text, and screen the original text according to the screening value to obtain the training text for executing the model training task.

14. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the text screening method according to any one of claims 1 to 12 when executing the computer program.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, the text screening method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Text quality evaluation model training method and text quality determination method

    CN113392218A

  • Comment processing model training method, comment sorting method, comment processing model training device, comment sorting device, equipment and medium

    CN115374277A

  • Method and device for carrying out sample screening on large language model for questions and answers

    CN117493890A

  • Multi-index evaluation model training method, article selection method and related equipment

    CN117557302A

  • Large language model artificial intelligence text evaluation system

    US11995411B1

Cited By

  • Large-model multi-dimensional data filtering method and system based on adaptive reinforcement learning

    CN121903002A