A text screening method and device, electronic equipment and storage medium

By employing machine learning methods to utilize multiple guided models and gating units embedded with prior knowledge for text filtering, the problems of low efficiency and data imbalance in manual filtering during the fine-tuning of large language models are solved, achieving efficient and balanced text filtering and improving model training results.

CN118657192BActive Publication Date: 2025-12-12LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

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

Method used

By employing multiple machine learning guidance models and gating units with different preset evaluation dimensions, text evaluation values ​​and weight values ​​are determined through prior knowledge and historical performance, and automated text filtering is performed to generate a high-quality dataset for model training.

Benefits of technology

It improves the stability and data balance of the text filtering strategy, avoids the problems of uneven data distribution and insufficient coverage caused by manual filtering, and improves filtering efficiency and cost-effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657192B_ABST
    Figure CN118657192B_ABST
Patent Text Reader

Abstract

The application provides a text screening method and device, electronic equipment and storage medium, and relates to the field of machine learning. A plurality of guide models and a gate unit can be set, wherein each guide model is embedded with prior knowledge corresponding to a preset evaluation dimension; the gate unit learns the historical performance of previously screened training texts in a downstream model training task, and can generate weight values corresponding to each guide model for an input text based on the historical performance; then, the original text to be screened can be input into the guide model to obtain the corresponding evaluation value generated by the original text, and the original text can be input into the gate unit to obtain the weight values generated by each guide model; then, all weight values can be used to perform weighted summation processing on all evaluation values to obtain the screening value of each original text, and the original text can be screened according to the screening value, so that the problems of uneven data distribution and insufficient 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 application relates to the field of machine learning, and in particular to a text screening method and device, electronic equipment and storage medium. BACKGROUND

[0002] With the continuous development of machine learning technology, large language models (LLM) are gradually applied in various fields. Considering the cost of training large language models, the pre-training and fine-tuning training method has become the mainstream means for training large language models. In the fine-tuning process, a high-quality data set (a high-quality data set should have the characteristics of sufficiency, diversity, and balance) is a necessary condition to stimulate the potential of a large language model. However, in related technologies, the training text for fine-tuning a large language model is usually manually screened, which not only reduces the screening efficiency of the training text and increases the screening cost, but more importantly, it easily leads to problems of uneven data distribution and insufficient coverage, thereby affecting the fine-tuning effect of the large language model. SUMMARY

[0003] The purpose of the present application is to provide a text screening method, device, electronic equipment 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] To solve the above technical problems, the present application provides a text screening method, comprising:

[0005] obtaining original text to be screened;

[0006] inputting the original text into a plurality of guidance models to obtain evaluation values output by the guidance models for the original text; wherein the guidance models belong to machine learning models, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance models determine the evaluation values corresponding to the original text according to the prior knowledge;

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

[0008] performing weighted sum processing on all the evaluation values using all the weight values to obtain screening values of the original text, and screening the original text according to the screening values to obtain training text for performing the model training task.

[0009] Optionally, the guide model has the same conversion decoder structure as a to-be-trained model trained by the model training task, and the guide model has a smaller number of model parameters than the to-be-trained model.

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

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

[0012] setting the generative text as the original text.

[0013] Optionally, the guide model sequentially comprises an encoding layer, a first conversion decoder, a full connection layer and a first normalization layer in data flow direction, the first conversion decoder comprises a plurality of conversion decoder units connected in series, and the first conversion decoder is embedded with the prior knowledge;

[0014] The inputting the original text into a plurality of guide models to obtain evaluation values output by the guide models for the original text comprises:

[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 to enable the first conversion decoder to extract features from the text embedding vector according to the prior knowledge to obtain a feature extraction vector;

[0017] inputting the feature extraction vector into the full connection layer for feature conversion to obtain a feature conversion vector;

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

[0019] Optionally, before obtaining the original text to be screened, the method further comprises:

[0020] obtaining the prior knowledge and a pre-trained conversion decoder model;

[0021] fine-tuning the conversion decoder model based on a low-rank adaptive method using the prior knowledge to embed the prior knowledge into a conversion decoder of the conversion decoder model;

[0022] adding the full connection layer and the first normalization layer to the fine-tuned conversion decoder model to obtain the guide model.

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

[0024] perform the model training task by using the training text, and determine a performance index value corresponding to the training text when performing the model training task according to a preset performance index;

[0025] set the training text with the performance index value greater than the preset threshold as a fine-tuning text, and perform fine-tuning training on the first conversion decoder in each of the guidance models by using the fine-tuning text.

[0026] Optionally, before performing fine-tuning training on the first conversion decoder in each of the guidance models by using the fine-tuning text, the method further comprises:

[0027] determine, according to the weight values generated by the gating unit for each of the guidance models for the fine-tuning text, that the first preset number of guidance models with the maximum weight values are to-be-fine-tuned guidance models;

[0028] the performing fine-tuning training on the first conversion decoder in each of the guidance models by using the fine-tuning text comprises:

[0029] performing fine-tuning training on the first conversion decoder in the to-be-fine-tuned guidance models by using the fine-tuning text.

[0030] Optionally, the gating unit sequentially comprises an input layer, a second conversion decoder, a second normalization layer and a selection layer in the order of data flow, the input layer comprises 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 comprises a first linear layer, an input of the first linear layer is an output feature of each conversion decoder unit in the corresponding guidance model, the second input module comprises a second linear layer, an input of the second linear layer is the original text.

[0031] the inputting the original text into the gating unit to obtain the weight values output by the gating unit for each of the guidance models comprises:

[0032] inputting the output features of each of the conversion decoder units of the corresponding guidance model into the first linear layer for weighted average processing 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; each element in the output vector corresponds to each guide model, and a value of each element is an initial weight value of each guide model;

[0036] inputting the output vector into the selection layer to set the initial weight values of the first preset number of elements with the largest values in the output vector as the weight values and set the remaining initial weight values as zero.

[0037] Optionally, before the original text to be screened is obtained, the method further comprises:

[0038] obtaining a gating unit training text;

[0039] inputting the gating unit training text into each guide model and the gating unit simultaneously to enable the guide models to output training evaluation values for the gating unit training text and enable the gating unit to output a training weight vector for the gating unit training text; the training weight vector comprises training initial weight values of each guide model;

[0040] sorting each guide model by using the training evaluation values of each guide model and the training weight vector of the gating unit by a maximum marginal relevance method to obtain a sorting result;

[0041] normalizing the sorting result to obtain a training target weight value;

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

[0043] Optionally, the sorting each guide model by using the training evaluation values of each guide model and the training weight vector of the gating unit by the maximum marginal relevance method to obtain the sorting result comprises:

[0044] the sorting each guide model by using the training evaluation values of each guide model and the training weight vector of the gating unit by the maximum marginal relevance method to obtain the sorting result is performed by the following formula:

[0045] ;

[0046] wherein MMR represents the sorting result determined based on the maximum marginal relevance, R represents a set of guide models to be sorted, S represents a set of guide models that have been sorted, represents a hyperparameter, represents a training evaluation value of an i-th guide model, represents a training evaluation value of a j-th guide model in the set S, represents the training weight vector obtained by the kth gating unit training text through the gating unit, and mean() represents a mean calculation function, and both represent a similarity calculation function.

[0047] Optionally, the loss value is determined by using the training initial weight value and the training target weight value, comprising:

[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] wherein, MSE represents the loss value, n represents the number of guide models, represents the training target weight value, represents the training initial weight value.

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

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

[0053] The performance value of each guide model is determined by using the following formula according to the evaluation value determined by the guide model for the training text and the sorting position of the training text in the training text sorting result.

[0054] ;

[0055] wherein, represents the performance value of the ith guide model, m represents the mth batch of data, and b represents the number of training texts contained in each batch of data, represents the sorting position of the jth training text in the training text sorting result, represents the evaluation value determined by the ith guide model for the jth training text, represents an indicator function, if x is greater than zero, equal to 1, if x is not greater than zero, equal to 0;

[0056] The performance value of each guide model is normalized to obtain a target weight value.

[0057] determine a loss value by using the initial weight value and the target weight value, and perform parameter updating on the gating unit 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 passing rate of the code text.

[0059] The application further provides a text screening device, comprising:

[0060] An acquisition module is configured to acquire original texts to be screened.

[0061] A guide model module is configured to input the original texts into a plurality of guide models to obtain evaluation values output by the guide models for the original texts.

[0062] A gating unit module is configured to input the original texts into a gating unit to obtain weight values output by the gating unit for the guide models.

[0063] A screening module is configured to perform weighted summation processing on the evaluation values by using all the weight values to obtain screening values of the original texts, and screen the original texts according to the screening values to obtain training texts for performing the model training task.

[0064] The application further provides an electronic device, comprising:

[0065] A memory is configured to store a computer program.

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

[0067] The application further provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and the computer executable instructions are loaded and executed by a processor to implement the text screening method as described above.

[0068] The application provides a text screening method, comprising: obtaining original texts to be screened; inputting the original texts into a plurality of guidance models to obtain evaluation values output by the guidance models for the original texts; wherein the guidance models belong to machine learning models, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance models determine the evaluation values corresponding to the original texts according to the prior knowledge; inputting the original texts into a gate unit to obtain weight values output by the gate unit for the guidance models; wherein the gate unit belongs to a machine learning model, and the gate unit determines the weight values according to historical performances of the original texts and previously screened training texts in a model training task; performing weighted summation processing on all the evaluation values by using all the weight values to obtain screening values of the original texts, and screening the original texts according to the screening values to obtain training texts used for performing the model training task.

[0069] It can be seen that the application is particularly provided with a plurality of guidance models and a gate unit, wherein the prior knowledge of the corresponding preset evaluation dimension is embedded in each guidance model, and then the guidance model can generate the corresponding evaluation value for the text according to the prior knowledge; and the gate 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. Then, after obtaining the original texts to be screened, the application can first input the original texts into a plurality of guidance models to obtain the evaluation values output by the guidance models for the original texts, and then input the original texts into the gate unit to obtain the weight values output by the gate unit for the guidance models, and then perform weighted summation processing on all the evaluation values by using all the weight values to obtain the screening values of the original texts, and screen the original texts according to the screening values to obtain the training texts used for performing the model training task. Furthermore, the application can not only adopt the machine learning method to screen the training texts to avoid the problems of low screening efficiency and high screening cost of manual screening, but more importantly, the text screening strategy can be determined by embedding the prior indication into the guidance model and embedding the historical performance of the previously screened training text in the downstream model training task into the gate unit, so that the stability, data balance and data comprehensiveness of the text screening strategy can be improved, thereby avoiding the problems of uneven data distribution and insufficient coverage caused by manual determination of the screening strategy. The application also provides a text screening device, an electronic device and a computer readable storage medium, which have the above beneficial effects. BRIEF DESCRIPTION OF DRAWINGS

[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without any creative effort.

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

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

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

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

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

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

[0077] Figure 7 A structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0078] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without any creative effort belong to the protection scope of the present application.

[0079] With the continuous development of machine learning technology, large language models (LLM) are gradually applied in various fields. Considering the cost of training large language models, the pre-training and fine-tuning training method has become the mainstream means for training large language models. In the fine-tuning process, a high-quality data set (a high-quality data set should have the characteristics of sufficiency, diversity, balance, etc.) is a necessary condition to stimulate the potential of a large language model. However, in the related art, the training text for fine-tuning a large language model is usually manually screened, which not only reduces the screening efficiency of the training text and increases the screening cost, but more importantly, it easily leads to problems of uneven data distribution and insufficient coverage, thereby affecting the fine-tuning effect of the large language model. Therefore, the present application provides a text screening method that can set a data screening strategy based on machine learning methods to avoid the problems of uneven data distribution and insufficient coverage caused by manual screening.

[0080] For easy understanding, please refer to Figure 1 , Figure 1 The structure block diagram of a text screening system provided by an embodiment of the present application. The system can include multiple guide models and a gating unit. These guide models and the gating unit will jointly screen the input raw text to obtain a high-quality data set for performing a downstream model training task. Among them, the guide model belongs to a machine learning model, and prior knowledge corresponding to a preset evaluation dimension is embedded in each guide model, and each guide model 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 guide model according to this historical performance and the current input raw text of the gating unit. Further, when the raw text to be screened is obtained, the embodiment of the present application only needs to input the raw text into the multiple guide models and the gating unit, and use each weight value generated by the gating unit to weight and sum the evaluation value generated by each guide model. The screening value of the raw text can be obtained, and then the raw text can be screened according to the size of the screening value.

[0081] More simply, since different preset evaluation dimensions are embedded in different guide models, each guide 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 is not the same, and some evaluation values have a higher contribution to the downstream model training task, and some have a lower contribution. To ensure that the evaluation value can better fit the actual situation of the downstream model training task, the embodiment of the present application also sets 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 guide model to the model training task through the historical performance, and then generate a corresponding weight value for each guide model according to the historical performance and the current input original text. In this way, by setting the guide model and the gating unit, the embodiment of the present application not only can realize the multi-dimensional automatic evaluation of the original text to be filtered by using machine learning means, but also can use machine learning means to weight and correct the evaluation value of each dimension of the historical performance of the filtered text in the downstream model training task, so as to improve the stability, data balance and data comprehensiveness of the text filtering strategy, thereby avoiding the problems of uneven data distribution and insufficient coverage caused by manually determining the filtering strategy.

[0082] It should be noted that the number of guide models is not limited by the embodiment of the present application, and can be set according to actual application requirements. The embodiment of the present application does not limit the specific preset evaluation dimensions and the prior knowledge of the preset evaluation dimensions. For example, the dimensions of the prior knowledge can be divided into logical reasoning, data security, semantic understanding and domain-specific knowledge, wherein the logical reasoning can be further divided into mathematical ability, code ability and common sense reasoning, the data security can be divided into value alignment, bias alignment and toxic data filtering, the semantic understanding can be divided into sentiment analysis and text summary, and the domain-specific knowledge includes financial, legal, medical, astronomical and geographical text data. The specific preset evaluation dimensions and prior knowledge required can be set according to actual application requirements.

[0083] It should be noted that the deployment of the guide model and the gating unit in the hardware device is not limited by the embodiment of the present application. For example, the guide model and the gating unit can be deployed in the same server node; or can be deployed in different server nodes and work based on a distributed system.

[0084] Based on the above system structure description, the text filtering method provided by the embodiment of the present application will be introduced. Please refer to Figure 2 , Figure 2 The flowchart of the text filtering method provided by the embodiment of the present application can include:

[0085] S201, acquire original text to be screened.

[0086] In the embodiment of the present application, the original text refers to text data that has not been screened and has low quality. The embodiment of the present application does not limit the acquisition method of the original text. For example, the original text can be acquired manually from public channels such as the network, or generated by using a text generation model. The original text can be set according to actual application requirements. Specifically, the embodiment of the present application can set a prompt word (Prompt) for a downstream model training task, and input the prompt word into a trained text generation model to obtain a generative text corresponding to the prompt word generated by the model, and then set the generative text as the original text.

[0087] Based on this, acquiring the original text to be screened can include:

[0088] Step 11: acquiring a preset prompt word, and inputting the preset prompt word into a trained text generation model to obtain a generative text corresponding to the preset prompt word.

[0089] Step 12: setting the generative text as the original text.

[0090] S202, input the original text into a plurality of guidance models to obtain evaluation values output by the guidance models for the original text; wherein the guidance model belongs to 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.

[0091] As described above, the embodiment of the present application can set a plurality of guidance models, and embed prior knowledge of a corresponding preset evaluation dimension in each guidance model, so that each guidance model can independently generate an evaluation value of the original text from different dimensions, thereby realizing automatic evaluation of the original text. The evaluation value represents the probability that the original text is retained in 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 in the preset evaluation dimension.

[0092] It should be noted that the embodiment of the present application does not limit the specific structure of the guidance model, which can be set according to actual application requirements. For example, since the purpose of the text screening in the embodiment of the present application 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 guidance model in the embodiment of the present application can have the same Transformer structure as the to-be-trained model trained by the model training task. In addition, in order to avoid that the guidance model has too large a size and is not conducive to deployment, the model parameter amount of the guidance model can also be set to be less than the model parameter amount of the to-be-trained model.

[0093] Further, the specific structure of the guidance model will be introduced below. Please refer to Figure 3 , Figure 3 The structure block diagram of the guidance model provided by the embodiment of the present application. The guidance model includes an encoding layer, a first transformer decoder, a fully connected layer and a first normalization layer (softmax layer) in sequence according to the data flow direction. The first transformer decoder contains multiple serial transformer decoder units, and prior knowledge is embedded in the first transformer decoder. The input of the encoding layer is the original text, which is used for position encoding of the original text to obtain a text embedding vector. The first transformer decoder can extract features from the text embedding vector based on the prior knowledge to obtain a feature extraction vector. The fully connected layer can convert the features of 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 values output by the guidance models for the original text, which can include:

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

[0096] Step 22: input the text embedding vector into the first transformer decoder to enable the first transformer decoder to extract features from the text embedding vector according to the 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 gate unit to determine the weight value of each guidance model, the output features of each layer of the transformer decoder unit are transmitted to the gate unit after weighted averaging, and this feature transmission operation provides different abstract level features for the gate unit. At the same time, in order to enable the guidance model to better determine whether to retain the current data, the embodiment of the present application can embed the prior knowledge into the V matrix of the transformer 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 application does not limit the number of layers of the transformer decoder units that the first transformer decoder can contain, which can be set according to actual application requirements, for example, it can be 32 layers. The embodiment of the present application also does not limit the number of layers of the fully connected layer, for example, it can be two layers.

[0101] S203, input the original text into the gate unit to obtain the weight value output by the gate unit for each guide model; wherein the gate unit belongs to a machine learning model, and the gate 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 application can also have a gate 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 guide model to the model training task through the historical performance, and then generate the corresponding weight value for each guide model according to the historical performance and the currently input original text.

[0103] It should be noted that the embodiment of the present application does not limit the specific structure of the gate unit, which can be set according to actual application requirements. For example, since the purpose of the text screening of the embodiment of the present application 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 gate unit in the embodiment of the present application can also have the same Transformer structure as the to-be-trained model trained by the model training task. In addition, as described above, since the output features of each Transformer unit in each guide model are transmitted to the gate unit after weighted averaging, the input layer of the gate unit needs to include two branches, one for inputting the output features input by each guide model, and the other for inputting the original text.

[0104] The specific structure of the gate unit will be introduced below. Please refer to Figure 4 , Figure 4A structural block diagram of a guidance model provided by an embodiment of the present application. The gating unit sequentially comprises an input layer, a second transformation decoder (Transformer module), a second normalization layer (softmax), and a selection layer (Topk) according to a data flow direction. The input layer comprises 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 comprises a first linear layer. The input of the first linear layer is the output feature of each transformation decoder unit in the corresponding guidance model. The second input module comprises a second linear layer. The input of the second linear layer is the original text. The first linear layer is used to perform weighted average processing on the output features of each transformer 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 transformation decoder is used to extract features from the first input vector and the second input vector to obtain a feature extraction vector. The second normalization layer is used to normalize the feature extraction vector to obtain an output vector comprising initial weight values corresponding to each guidance model. Finally, the selection layer is used to select the top preset number of initial weight values with the largest values from the output vector as the final weight values, 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 top preset number of guidance models with the largest weight values to perform the final evaluation on the original text. It should be noted that the embodiment of the present application does not limit the specific value of the preset number, which can be set according to actual needs, for example, 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 can include:

[0106] Step 31: input the output features of each transformation 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: input the first input vector and the second input vector into the second transformation 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. Each element in the output vector corresponds to each guidance model. 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 top preset number of initial weight values with the largest values in the output vector as the weight values, and sets the remaining initial weight values to zero.

[0111] Specifically, the gating process for gating units can be represented by the following formula:

[0112] ;

[0113] Where G() represents the gating unit, This represents the original text input. This represents the weights of the second linear layer. represents the weights of the first linear layer, and b represents the bias relative to the original text. This represents the bias relative to the output features of the guiding model. This indicates the bias of the guiding model.

[0114] The process of filtering input raw text by a text filtering system can be represented as follows:

[0115] ;

[0116] in, This represents the filtered training text. Indicates the first The output of the guided model Indicates that the gating unit is targeting the first The weights output by the guidance model.

[0117] S204. Use all weight values ​​to perform weighted summation on all evaluation values ​​to obtain the screening value of each original text, and then screen the original text according to the screening value to obtain the training text for performing the model training task.

[0118] After obtaining the weight values ​​and evaluation values, this embodiment of the invention performs a weighted summation of all evaluation values ​​using all weight values ​​to obtain the filtering value for each original text. The original text is then filtered based on these filtering values ​​to obtain the training text used for model training. For example, only original text with filtering values ​​greater than a preset threshold can be retained, while original text with filtering values ​​less than or equal to the preset threshold can be removed. This enables automatic filtering of text data.

[0119] It should be noted that the embodiments of the present invention do not limit the specific value of the preset threshold used to filter the original text, and can be set according to actual application needs.

[0120] Based on the above embodiment, the present application is particularly provided with multiple guidance models and a gating unit, wherein the prior knowledge corresponding to the preset evaluation dimension is embedded in each guidance model, and the guidance model can generate the 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. Then, after obtaining the original text to be screened, the present application can first input it into multiple 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 use all weight values to perform weighted summation processing on all evaluation 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 performing the model training task. Further, the present application can not only adopt the machine learning method to screen the training text to avoid the problems of low screening efficiency and high screening cost of manual screening, but more importantly, the text screening strategy can be determined by embedding the prior indication into the guidance model and embedding the historical performance of the screened training text in the downstream model training task into the gating unit, so that the stability, data balance and data comprehensiveness of the text screening strategy can be improved, thereby avoiding the problems of uneven data distribution and insufficient coverage caused by manually determining the screening strategy.

[0121] Based on the above embodiment, the training method of the guidance model is introduced as follows. In the embodiment of the present application, the training stage of the guidance model is divided into an initial stage and an online stage, wherein the initial stage is the first training stage of the guidance model, and the online stage is the training after a certain amount of training text screening. The training process of the guidance model in the initial stage will be introduced first. 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 application can also be a conversion decoder. Therefore, in order to improve the training efficiency of the guidance model, the embodiment of the present application can directly obtain a pre-trained (Pre-trained) conversion decoder model as the basic model of the guidance model.

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

[0125] S302, fine-tuning the conversion decoder model using the prior knowledge based on the low-rank adaptive method to embed the prior knowledge into the conversion decoder in the conversion decoder model.

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

[0127] It should be noted that the embodiments of the present application do not limit the specific fine-tuning training process, and related knowledge of the conversion decoder model (Transformer model) training can be referred to.

[0128] S303, add a full connection layer and a first normalization layer to the conversion decoder model after fine-tuning to obtain a guidance model.

[0129] In the embodiments of the present application, to ensure that the fine-tuned conversion decoder model can have the evaluation value generation function, a full connection layer and a normalization layer can also be added to the conversion decoder model after fine-tuning, the output of the conversion decoder model is converted by the full connection layer, and the converted features are mapped to the evaluation value of the original text by the normalization operation (Softmax). Further, the guidance model can generate the evaluation value for the original text according to the embedded prior knowledge.

[0130] The training process of the guidance model in the online phase will be introduced below. Based on this, after obtaining the training text for performing the model training task, the following can also be included:

[0131] S401, performing a model training task using the training text, and determining a performance index value corresponding to the training text when performing the model training task according to a preset performance index.

[0132] In the embodiments of the present application, the training text that is filtered by the guidance model and the gating unit and performs well in the downstream model training task can be further embedded into the guidance model to improve the knowledge information reserve of the guidance model. To select high-quality training texts, the embodiments of the present application 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 historical performance of each training text when participating in the model training task.

[0133] It should be noted that the preset performance index in the embodiments of the present application is not limited to a specific one, which is related to a specific model training task. For example, when the training text is code text and the model training task is a code task, the preset performance index is the code pass rate of the code text. When the model training task is other content, the preset performance index can also be other content.

[0134] S402, set the training text with the performance index value greater than the preset threshold as a fine-tuning text, and fine-tune the first conversion decoder in each guide model using the fine-tuning text.

[0135] In this step, after obtaining the training index value of each training text, the training text with the performance index value greater than the preset threshold can be set as a fine-tuning text, and the first conversion decoder in each guide model can be fine-tuned using the fine-tuning text, so as to embed high-quality fine-tuning text into the guide model, thereby improving the knowledge information reserve of the guide model. It should be noted that the specific way of fine-tuning the first conversion decoder using the fine-tuning text is not limited in the embodiments of the present application, which can be referred to the description in the above embodiments.

[0136] Further, considering that not all guide models have a contribution to the downstream model training task, in order to save computing resources, the fine-tuning training can also be performed on the guide models with greater contribution. Specifically, since the weight value output by the gating unit in the embodiments of the present application represents the contribution of each guide model to the downstream model training task, before fine-tuning training, the embodiments of the present application can also sort the guide models according to the weight values generated by the gating unit for each guide model with respect to the fine-tuning text, and only fine-tune the first conversion decoder in the guide models with the largest weight values in the first preset number of guide models.

[0137] Based on this, before fine-tuning the first conversion decoder in each guide model using the fine-tuning text, it can also include:

[0138] Step 41: determining, according to the weight values generated by the gating unit for each guide model with respect to the fine-tuning text, that the guide models with the largest weight values in the first preset number are to-be-fine-tuned guide models;

[0139] Fine-tuning the first conversion decoder in each guide model using the fine-tuning text includes:

[0140] Step 42: fine-tuning the first conversion decoder in the to-be-fine-tuned guide model using the fine-tuning text.

[0141] Based on the above embodiments, the training method of the gating unit is introduced as follows. In the embodiments of the present application, the training stage of the gating unit is also divided into an initial stage and an online stage, wherein the initial stage is the first training stage of the gating unit, and the online stage is the training stage of the gating unit after a certain amount of training text is screened. It should be pointed out that the training in the online stage plays an important role in accumulating the historical performance of the screened training text of the gating unit in the downstream model training task, 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. The training process of the gating unit in the initial stage is introduced first as follows. Before the original text to be screened is obtained, the following steps can also be included:

[0142] S501, obtaining the gating unit training text.

[0143] In order to quickly initialize the gating unit, the embodiments of the present application can first train on a small amount of high-quality data set. It should be noted that the number of gating unit training texts in the embodiments of the present application is not limited, and can be set according to the actual application requirements.

[0144] S502, inputting the gating unit training text into each guide model and the gating unit at the same time, so that the guide 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 guide model.

[0145] In this step, it should be first noted that the initial stage training of the guide model should be earlier than the initial stage training of the gating unit, because the output features of each conversion decoder unit in the guide model need to be input into the gating unit, so the guide model needs to be trained in advance, and the prior knowledge is embedded into the guide model, and then the gating unit is trained.

[0146] Further, in the process of training the gating unit, the gating unit training text needs to be input into each guide model and the gating unit at the same time. For the guide model, in addition to generating the corresponding evaluation value (i.e. training evaluation value) for the gating unit training text, it is more important to use each layer of the conversion decoder unit to extract features from the gating unit training text, and to pass the output features into the gating unit. For the gating unit, it needs to extract features according to the input gating unit training text and the output features to generate the corresponding initial weight value (i.e. training initial weight value) for each guide model.

[0147] S503, adopt a maximal marginal relevance method to sort the guide models according to the training evaluation values of the guide models and the training weight vectors of the gating units, and obtain a sorting result.

[0148] In the embodiment of the present application, to improve the diversity of the training texts screened by the gating unit, a maximal marginal relevance method (MMR) can be used to sort different guide models, and the sorting result of the guide models is used as the learning target of the gating unit. The maximal marginal relevance method is a method for improving the diversity of the recommended results of a model, and is particularly used in the embodiment of the present application to improve the diversity of the guide models selected by the gating unit, thereby improving the diversity of the evaluation dimensions of the screened training data. The present application can adopt the maximal marginal relevance method to sort the guide models according to the training evaluation values of the guide models and the training weight vectors of the gating units by the following formula, and obtain a sorting result:

[0149] ;

[0150] wherein MMR represents the sorting result determined based on the maximal marginal relevance, R represents a set of guide models to be sorted, S represents a set of sorted guide models, represents a hyperparameter, represents the training evaluation value of the i-th guide model, represents the training evaluation value of the j-th guide model in the set S, represents the training weight vector of the k-th gating unit training text obtained by the gating unit, and mean() represents a mean value calculation function, and both represent a similarity calculation function.

[0151] It should be noted that the embodiment of the present application does not limit the specific execution process of the above sorting, and the related technologies of the maximal marginal relevance method can be referred to.

[0152] S504, normalize the sorting result to obtain a training target weight value.

[0153] After the sorting of the guide models is completed, the embodiment of the present application can represent the sorting result in a numerical form, and normalize the sorting result to obtain a training target weight value.

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

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

[0156] ;

[0157] Wherein, MSE represents the loss value, n represents the number of guide models, represents the training target weight value, represents the training initial weight value.

[0158] The training process of the gating unit in the online phase will be introduced below. Based on this, after obtaining the training text used to perform 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 the model training task, the performance index value corresponding to the training text when performing the model training task is determined according to the preset performance index, and the training text is sorted according to the performance index value, and the training text ranking result is obtained; wherein each batch of training texts contains b training texts, m>0, b>0.

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

[0161] Further, in the embodiment of the present application, in order to avoid high-frequency training of the gating unit, the gating unit can be trained based on the m batches of training texts when the text screening system has screened out m batches of training texts. Each batch of training texts contains b training texts, and m and b can be set arbitrarily.

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

[0163]

[0164] wherein, represents the performance value of the i th guide model, m represents the m th batch of data, b represents the number of training texts contained in each batch of data, represents the ranking position of the j th training text in the training text ranking result, represents the evaluation value determined by the i th guide model for the j th training text, represents the indicator function, if x is greater than zero, 1, if x is not greater than zero, 0.

[0165] It can be understood that the contribution of the evaluation of each guide model to the downstream model training task is different, and this contribution will affect the weight value determined by the gating unit. In order to effectively quantify the contribution of the guide model, the embodiment of the present application can calculate the corresponding performance value of each guide model based on the evaluation value determined by each guide model for the training text and the ranking position of the training text in the training text ranking result, to determine how the actual performance of each guide model.

[0166] S603, normalize the performance value of each guide model to obtain the target weight value;

[0167] After obtaining the performance value of each guide model, the embodiment of the present application can normalize all performance values to obtain the actual contribution proportion (i.e. target weight value) of each guide model in the downstream model training task.

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

[0169] It can be understood that, since there may be differences between the weight value generated by the gating unit and the actual downstream performance, i.e. there are differences between the initial weight value (not passed through the selection layer) generated by the gating unit for each guide model and the actual contribution proportion (i.e. target weight value) of each guide model, therefore the present application can determine the loss value using the initial weight value and the target weight value, and update the parameters of the gating unit according to the loss value, so as to ensure that the gating unit learns the historical performance of the filtered training text in the downstream model training task, thereby ensuring that the gating unit gives reliable weight values for each guide model.

[0170] ​Based on the above embodiments, the following is based on a specific flowchart to introduce the above text screening method. Please refer to Figure 5 , Figure 5 The flowchart of a text screening method provided by an embodiment of the application. The method includes the following processes:

[0171] 1) In the working of the application, the first step is to obtain an original data set, which is usually larger in size than the final high-quality data set. The source of the original data is divided into two parts: the first part is obtained from open source communities and public channels, and the second part is generated by using a generative model. The acquisition of the first part of data requires that the acquisition standard be relaxed to ensure the diversity of the data source. The acquisition of the second part of data requires the selection of a high-performance generative model to ensure the quality of data generation, and the selection of the best Prompt and model parameters for generating data to ensure the diversity of the data.

[0172] 2) The second step is to screen the original data set. Different screening strategies should be selected for different tasks. The screening strategies of the application are divided into two categories: the first category is to screen according to rules, and the second category is to use intelligent models for intelligent screening. The first screening method mainly includes operations such as deduplication, error correction, standardization and consistency check, which can improve the data quality to a certain extent and ensure the diversity of the data source. The second screening method can adaptively learn the screening strategy, thereby ensuring the richness of the data under the premise of ensuring the performance of the downstream task.

[0173] 3) The third step is to format the data set for storage.

[0174] The text screening device, electronic equipment, computer program product and computer readable storage medium provided by the embodiment of the application are introduced below. The text screening device, electronic equipment, computer program product and computer readable storage medium described below can be mutually corresponding with the text screening method described above.

[0175] Please refer to Figure 6 , Figure 6 The structure block diagram of a text screening device provided by an embodiment of the application. The device can include:

[0176] The acquisition module 601 is configured to acquire the original text to be screened.

[0177] The guidance model module 602 is configured to input the original text into a plurality of guidance models to obtain evaluation values output by the guidance models for the original text. The guidance models belong to machine learning models, and different guidance models have embedded prior knowledge of different preset evaluation dimensions. The guidance models determine the evaluation values corresponding to the original text according to the prior knowledge.

[0178] The gating unit module 603 is configured to input the original text into the gating unit to obtain a weight value output by the gating unit for each guidance model; the gating unit belongs to a machine learning model, and the gating unit determines the weight value according to the original text and historical performance of the previously screened training text in a model training task;

[0179] The screening module 604 is configured to perform weighted summation processing on all evaluation values by using all weight values to obtain a screening value of each original text, and screen the original text according to the screening value to obtain a training text used to perform the model training task.

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

[0181] Optionally, the obtaining module 601 can include:

[0182] The text generation sub-module is configured to obtain a preset prompt word, and input the preset prompt word into a trained text generation model to obtain a generative text corresponding to the preset prompt word;

[0183] The text setting sub-module is configured to set the generative text as the original text.

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

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

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

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

[0188] input the feature extraction vector into the full connection layer for feature conversion to obtain a feature conversion vector;

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

[0190] Optionally, the apparatus can further include:

[0191] The guidance model training data obtaining module is configured to obtain the prior knowledge and a pre-trained conversion decoder model;

[0192] The guiding model initial fine-tuning module is configured to fine-tune the conversion decoder model based on a low-rank adaptive method and utilize prior knowledge to embed the prior knowledge into the conversion decoder model.

[0193] The guiding model setting module is configured to add a full connection layer and a normalization layer to the conversion decoder model after the fine-tuning training is completed, to obtain the guiding model.

[0194] Optionally, the apparatus can further include:

[0195] The performance index value determination module is configured to perform a model training task by using the training text, and determine a performance index corresponding to the training text when performing the model training task according to a preset performance index.

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

[0197] Optionally, the guiding model online fine-tuning module can include:

[0198] The sorting sub-module is configured to determine the first preset number of guiding models with the greatest weight values as the fine-tuning guiding models according to the weight values generated by the gating unit for each guiding model with respect to the fine-tuning text.

[0199] The fine-tuning of the first conversion decoder in each guiding model by using the fine-tuning text includes:

[0200] The online fine-tuning sub-module is configured to fine-tune the first conversion decoder in the fine-tuning guiding model by using the fine-tuning text.

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

[0202] The gating unit module 603 can be configured to:

[0203] The output features of each conversion decoder unit of the corresponding guiding model are input into the first linear layer for weighted average processing to obtain a first input vector.

[0204] The original text is input into the second linear layer for linear layer processing to obtain a second input vector.

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

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

[0207] The output vector is input into a selection layer, so that the selection layer sets the initial weight values with the largest values in the output vector to weight values, and sets the remaining initial weight values to zero.

[0208] Optionally, before the original text to be screened is obtained, the method further comprises:

[0209] The gating unit training text acquisition module is configured to acquire a gating unit training text;

[0210] The gating unit initial training module is configured to input the gating unit training text into each guide model and the gating unit simultaneously, so that the guide 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; the training weight vector comprises training initial weight values of the guide models;

[0211] The sorting module is configured to sort the guide models by using the training evaluation values of the guide models and the training weight vector of the gating unit by a maximum marginal relevance method to obtain a sorting result;

[0212] The normalization module is configured to normalize the sorting result to obtain a training target weight value;

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

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

[0215] The guide models are sorted by using the training evaluation values of the guide models and the training weight vector of the gating unit by a maximum marginal relevance method to obtain a sorting result according to the following formula:

[0216] ;

[0217] wherein MMR represents a sorting result determined based on a maximum marginal relevance, R represents a set of guide models to be sorted, S represents a set of guide models that have been sorted, represents a hyperparameter, represents a training evaluation value of an i-th guide model, a training evaluation value of a jth guide model in the set S, a training weight vector of the kth gate unit obtained by passing the training text through the gate unit, and mean() represents a mean value calculation function, and both represent a similarity calculation function.

[0218] Optionally, the gate unit initial update module can comprise:

[0219] a loss value calculation sub-module configured to determine a loss value by using the training initial weight value and the training target weight value according to the following formula:

[0220] ;

[0221] wherein, MSE represents the loss value, n represents the number of guide models, represents the training target weight value, and represents the training initial weight value.

[0222] Optionally, the apparatus can further comprise:

[0223] a training text ranking module configured to, when m batches of training texts are obtained, use the training text execution model to train a model, determine a performance index corresponding to the training text in the execution of the model training task according to a preset performance index, and rank the training texts according to the performance index to obtain a training text ranking result; wherein each batch of training texts comprises b training texts, m>0, and b>0;

[0224] a performance value calculation module configured to determine the performance value of each guide model according to the evaluation value determined by the guide model for the training text and the ranking position of the training text in the training text ranking result according to the following formula:

[0225] ;

[0226] wherein, represents the performance value of the ith guide model, m represents the mth batch of data, and b represents the number of training texts contained in each batch of data, represents the ranking position of the jth training text in the training text ranking result, represents the evaluation value determined by the ith guide model for the jth training text, represents an indicator function, which is equal to 1 if x is greater than zero, and is equal to 0 if x is not greater than zero;

[0227] a target weight value setting module configured to normalize the performance value of each guide model to obtain a target weight value;

[0228] ​​The gating unit online updating module is configured to determine a loss value by using the initial weight value and the target weight value, and to perform parameter updating on the gating unit according to the loss value.

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

[0230] Reference is made to Figure 7 , Figure 7 A structural block diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 7. The electronic device 70 includes a processor 71 and a memory 72. The memory 72 is configured to store a computer program. The processor 71 is configured to execute the computer program to perform the text screening method provided by the foregoing embodiments.

[0231] The specific process of the text screening method is described in the foregoing embodiments, and thus is not described herein.

[0232] The memory 72 can be a read-only memory, a random access memory, a magnetic disk, an optical disk, or the like, and can be temporarily or permanently stored.

[0233] In addition, the electronic device 70 further includes a power supply 73, a communication interface 74, an input / output interface 75, and a communication bus 76. The power supply 73 is configured to provide working voltage for each hardware device on the electronic device 70. The communication interface 74 is configured to create a data transmission channel between the electronic device 70 and external devices, and can use any communication protocol suitable for the technical solution of the present application, and thus is not limited herein. The input / output interface 75 is configured to obtain external input data or output data to the outside, and the specific interface type can be selected according to the specific application, and thus is not limited herein.

[0234] An embodiment of the present application further provides a computer program product including computer programs / instructions, which, when executed by a processor, implement the text screening method described in the foregoing embodiments.

[0235] Since the embodiments of the computer program product part correspond to the embodiments of the text screening method part, the embodiments of the computer program product part are described in the embodiments of the text screening method part, and thus are not described herein.

[0236] An embodiment of the present application further provides a computer readable storage medium, which stores a computer program. When the computer program is executed by a processor, the text screening method described in the foregoing embodiments 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 are described in the description of the embodiments of the text screening method part, and will not be described 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 embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts are described in the method part.

[0239] The skilled person can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly show the interchangeability of hardware and software, the components and steps of each example have been described in the above description. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

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

[0241] The above provides a detailed introduction to the text screening method, device, electronic equipment and storage medium provided by the present application. The principles and implementation modes of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary skilled person in the art, without departing from the principles of the present application, the present application can be improved and modified in several ways. These improvements and modifications also fall within the scope of protection of the present application.

Claims

1. A method of text filtering, characterized by, The method comprises the following steps: obtaining original texts to be screened; inputting the original texts into a plurality of guidance models to obtain evaluation values output by the guidance models for the original texts; wherein the guidance models belong to machine learning models, different guidance models have embedded prior knowledge of different preset evaluation dimensions, and the guidance models determine the evaluation values corresponding to the original texts according to the prior knowledge; inputting the original texts into a gating unit to obtain weight values output by the gating unit for the guidance models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight values according to the historical performance of the original texts and previously screened training texts in a model training task; performing weighted sum processing on all the evaluation values by using all the weight values to obtain screening values of the original texts, and screening the original texts according to the screening values to obtain training texts for performing the model training task; the guidance models sequentially include an encoding layer, a first conversion decoder, a fully connected layer and a first normalization layer according to a data flow direction, the first conversion decoder includes a plurality of conversion decoder units connected in series, and the prior knowledge is embedded in the first conversion decoder; the step of inputting the original texts into a plurality of guidance models to obtain evaluation values output by the guidance models for the original texts comprises the following steps: inputting the original texts into the encoding layer for position encoding to obtain text embedding vectors; inputting the text embedding vectors into the first conversion decoder to enable the first conversion decoder to extract features from the text embedding vectors according to the prior knowledge to obtain feature extraction vectors; inputting the feature extraction vectors into the fully connected layer for feature conversion to obtain feature conversion vectors; inputting the feature conversion vectors into the first normalization layer for normalization processing to obtain the evaluation values.

2. The text screening method of claim 1, wherein, The guidance models have the same conversion decoder structure as a to-be-trained model trained by the model training task, and the model parameter quantity of the guidance models is less than the model parameter quantity of the to-be-trained model.

3. The text screening method of claim 1, wherein, The step of obtaining original texts to be screened comprises the following steps: obtaining a preset prompt word, inputting the preset prompt word into a trained text generation model to obtain a generated text corresponding to the preset prompt word; and setting the generated text as the original text.

4. The text screening method of claim 1, wherein, Before obtaining the original texts to be screened, the method further comprises the following steps: obtaining the prior knowledge and a pre-trained conversion decoder model; fine-tuning the conversion decoder model by using the prior knowledge based on a low-rank adaptive method to embed the prior knowledge into a conversion decoder of the conversion decoder model; and adding the fully connected layer and the first normalization layer to the conversion decoder model that has completed the fine-tuning to obtain the guidance model.

5. The text screening method of claim 4, wherein, After obtaining the training texts for performing the model training task, the method further comprises the following steps: performing the model training task by using the training texts, and determining a performance index value corresponding to the training texts in performing the model training task according to a preset performance index. The performance indicator value greater than the preset threshold is set as a fine-tuning text, and the first conversion decoder in each of the guidance models is fine-tuned and trained by using the fine-tuning text.

6. The text screening method of claim 1, wherein, The gating unit sequentially comprises an input layer, a second conversion decoder, a second normalization layer and a selection layer in the direction of data flow, the input layer comprises 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 comprises 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, and the second input module comprises a second linear layer, the input of the second linear layer is the original text. The input of the original text into the gating unit comprises: The output feature of each conversion decoder unit of the corresponding guidance model is input into the first linear layer for weighted average processing to obtain a first input vector; The original text is input into the second linear layer for linear layer processing to obtain a second input vector; The first input vector and the second input vector are jointly input into the second conversion decoder for feature extraction to obtain a feature extraction vector; The feature extraction vector is input into the second normalization layer for normalization processing to obtain an output vector; 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; The output vector is input into the selection layer, so that the selection layer sets the initial weight values of the first preset number of values in the output vector as the weight values, and sets the remaining initial weight values as zero.

7. The text screening method of claim 6, wherein, Before the original text to be screened is obtained, the method further comprises: obtaining a gating unit training text; The gating unit training text is input into each of the guidance models and the gating unit at the same time, so that the guidance models output training evaluation values 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 comprises training initial weight values of each guidance model; The training evaluation values of each guidance model and the training weight vector of the gating unit are used to sort each guidance model by using a maximum marginal correlation method to obtain a sorting result; The sorting result is normalized to obtain a training target weight value; The training initial weight value and the training target weight value are used to determine a loss value, and the gating unit is parameter updated according to the loss value.

8. The text screening method of claim 7, wherein, The training evaluation values of each guidance model and the training weight vector of the gating unit are used to sort each guidance model by using a maximum marginal correlation method to obtain a sorting result, comprising: The training evaluation values of each guidance model and the training weight vector of the gating unit are used to sort each guidance model by using a maximum marginal correlation method to obtain a sorting result by the following formula: ; wherein MMR represents a ranking result determined based on maximum marginal relevance, R represents a set of guide models to be ranked, S represents a set of ranked guide models, represents a hyperparameter, represents a training evaluation value of the i-th guide model, represents a training evaluation value of the j-th guide model in the set S, represents a training weight vector obtained by the k-th gating unit from the training text passing through the gating unit, mean() represents a mean calculation function, and both represent a similarity calculation function.

9. The text screening method of claim 7, wherein, The training initial weight value and the training target weight value are used to determine a loss value, comprising: A loss value is determined by using the training initial weight value and the training target weight value according to the following formula: ; Wherein, MSE represents a loss value, n represents a number of guide models, represents the training target weight value, represents the training initial weight value.

10. The text screening method of claim 7, wherein, After obtaining the training text for performing the model training task, further comprising: After obtaining m batches of training texts, the model training task is performed by using the training texts, a performance index value corresponding to the training text when performing the model training task is determined according to a preset performance index, and the training texts are sorted according to the performance index value to obtain a training text sorting result; wherein each batch of training texts contains b training texts, m>0, and b>0; According to the evaluation value determined by the guide model for the training text and the sorting position of the training text in the training text sorting result, the performance value of each guide model is determined by the following formula: ; wherein, represents the performance value of the i-th guide model, m represents the m-th batch of data, and b represents the number of training texts contained in each batch of data, represents the ranking position of the j-th training text in the training text ranking result, represents the evaluation value determined by the i-th guide model for the j-th training text, represents an indicator function, and if x is greater than zero, equals 1, and if x is not greater than zero, equals 0. The performance values of each guide model are normalized to obtain a target weight value; A loss value is determined by using the initial weight value and the target weight value, and the parameter of the gating unit is updated according to the loss value.

11. The text screening method of claim 10, wherein, The training text is a code text, the model training task is a code task, and the preset performance index is a code pass rate of the code text.

12. A text screening device characterized by comprising: Comprising: An acquisition module is configured to acquire original texts to be screened; A guide model module is configured to input the original texts into a plurality of guide models to obtain evaluation values output by the guide models for the original texts; wherein the guide models belong to machine learning models, different guide models have embedded prior knowledge of different preset evaluation dimensions, and the guide models determine the evaluation values corresponding to the original texts according to the prior knowledge; A gating unit module is configured to input the original texts into a gating unit to obtain weight values output by the gating unit for the guide models; wherein the gating unit belongs to a machine learning model, and the gating unit determines the weight values according to the original texts and historical performances of previously screened training texts in a model training task; A screening module is configured to perform weighted summation processing on all the evaluation values by using all the weight values to obtain screening values of the original texts, and screen the original texts according to the screening values to obtain training texts for performing the model training task; The guide models sequentially include an encoding layer, a first conversion decoder, a fully connected layer and a first normalization layer according to a data flow direction, the first conversion decoder includes a plurality of conversion decoder units connected in series, and the first conversion decoder has embedded prior knowledge; The guide model module is configured to: input the original texts into the encoding layer for position encoding to obtain text embedding vectors; input the text embedding vectors into the first conversion decoder to enable the first conversion decoder to perform feature extraction on the text embedding vectors according to the prior knowledge to obtain feature extraction vectors; input the feature extraction vectors into the fully connected layer for feature conversion to obtain feature conversion vectors; input the feature conversion vectors into the first normalization layer for normalization processing to obtain the evaluation values.

13. An electronic device, comprising: Comprising: A memory is configured to store a computer program; A processor for implementing the text screening method according to any one of claims 1 to 11 when the computer program is executed.

14. A computer-readable storage medium, characterized in that, A computer readable storage medium having stored computer executable instructions, which when loaded and executed by a processor, implement the text screening method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • 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