Text pre-training model generation method, text prediction method, and related device
By performing data augmentation and contrastive learning on the original sample text, a pre-trained text model is generated, which solves the problem of low accuracy of the pre-trained model and improves the accuracy of the model.
Patent Information
- Application Number
- CN202310457723.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-04-25
AI Technical Summary
Existing pre-trained models have low accuracy due to the small amount of original sample data.
By performing data augmentation on the original sample text, augmented sample text is generated. The initial model is then subjected to contrastive learning and contrastive loss function evaluation to adjust the initial model and generate a pre-trained text model.
The sample size was increased, which improved the training effect of the model, and the recognition accuracy of the model was improved through contrastive learning and loss function evaluation.
Smart Images

Figure CN117493866B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a method for generating a text pre-trained model, a text prediction method, and related equipment. Background Technology
[0002] In recent years, pre-trained models have been widely used in the field of natural language processing. These models are first trained on a large number of unlabeled samples using a self-supervised approach to learn general text representations. Then, for application, only fine-tuning is needed on specific tasks. Compared to training from scratch, fine-tuning based on a pre-trained model requires fewer samples and has stronger generalization ability. A pre-trained model refers to: first, training an initial model on a large unlabeled corpus, and then fine-tuning the model using labeled samples on the target task, thereby improving the efficiency of the target task.
[0003] In related technologies, pre-trained models can only be trained based on existing original sample sets. Since the amount of data in the original sample sets is small, the accuracy of the pre-trained models is not high. Summary of the Invention
[0004] This application provides a method for generating a text pre-trained model, a text prediction method, and related equipment to improve the accuracy of the text pre-trained model.
[0005] Firstly, this application provides a method for generating a text pre-trained model, comprising:
[0006] Perform data augmentation on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text, and generate positive sample pairs based on the original sample text and the augmented sample text;
[0007] The initial model is used to perform contrastive learning on the positive sample pairs, and the contrastive loss function value of the initial model is calculated based on the contrastive learning results and the contrastive loss function; wherein, the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs;
[0008] The initial model is adjusted based on the contrastive loss function value to obtain a text pre-trained model; wherein the text pre-trained model is used to perform text prediction tasks.
[0009] Secondly, this application provides a text prediction method, including:
[0010] Obtain the predicted text;
[0011] The predicted text is input into a text prediction model to obtain the prediction result corresponding to the predicted text; wherein, the prediction result is used to characterize the text category and / or text intent label to which the predicted text belongs;
[0012] The text prediction model is obtained by: acquiring a set of labeled prediction sample texts; wherein the set of prediction sample texts contains multiple prediction sample texts carrying prediction labels; and training the text pre-training model using the set of prediction sample texts to obtain the text prediction model.
[0013] Thirdly, this application provides a device for generating a text pre-trained model, comprising:
[0014] An augmentation module is adapted to perform data augmentation operations on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text, and to generate positive sample pairs based on the original sample text and the augmented sample text;
[0015] The contrastive learning module is adapted to perform contrastive learning on the positive sample pairs using an initial model, and to calculate the contrastive loss function value of the initial model based on the contrastive learning results and the contrastive loss function; wherein the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs;
[0016] The adjustment module is adapted to adjust the initial model according to the contrastive loss function value to obtain a text pre-trained model; wherein the text pre-trained model is used to perform a text prediction task.
[0017] Fourthly, this application provides a text prediction device, comprising:
[0018] The acquisition module is suitable for acquiring predicted text.
[0019] The prediction module is adapted to input the predicted text into a text prediction model to obtain the prediction result corresponding to the predicted text; wherein the prediction result is used to characterize the text category and / or text intent tag to which the predicted text belongs;
[0020] The text prediction model is obtained by: acquiring a set of labeled prediction sample texts; wherein the set of prediction sample texts contains multiple prediction sample texts carrying prediction labels; and training the text pre-training model using the set of prediction sample texts to obtain the text prediction model.
[0021] Fifthly, this application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the above-described method.
[0022] Sixthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-described method when executed by a processor / processor core.
[0023] In the embodiments provided in this application, firstly, data augmentation is performed on the original sample texts in the original sample text set to obtain augmented sample texts corresponding to the original sample texts. Positive sample pairs are then generated based on the original sample texts and their corresponding augmented sample texts. Next, contrastive learning is performed on the positive sample pairs using an initial model. The contrastive loss function value of the initial model is calculated based on the contrastive learning results and the contrastive loss function, and the initial model is adjusted according to the contrastive loss function value to obtain a pre-trained text model for performing text prediction tasks. Therefore, this method, by performing data augmentation on the original sample texts, expands the number of original sample texts, which is beneficial for improving the training effect of the model. Furthermore, based on the data augmentation operation, it is convenient to construct positive sample pairs based on the augmentation results, perform contrastive learning using these positive sample pairs, and evaluate the predictive ability of the initial model for positive samples using the contrastive loss function, which helps the model learn the features between similar samples. Specifically, the initial model learns from a set of positive sample pairs to determine the similar features between the positive sample pairs. The learning results are then used to predict the text prediction tasks encountered, gradually improving the prediction ability of the initial model and thus enhancing the accuracy of the text pre-trained model.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0025] The accompanying drawings are provided to further illustrate the present application and form part of the specification. They are used together with the embodiments of the present application to explain the application and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed example embodiments described with reference to the accompanying drawings, in which:
[0026] Figure 1A flowchart illustrating a method for generating a text pre-trained model according to one embodiment of this application;
[0027] Figure 2 A flowchart illustrating a text prediction method according to another embodiment of the present invention is shown;
[0028] Figure 3 A block diagram of a text pre-trained model generation device provided in an embodiment of this application;
[0029] Figure 4 A block diagram of a text prediction device provided in an embodiment of this application;
[0030] Figure 5 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0031] To enable those skilled in the art to better understand the technical solutions of this application, exemplary embodiments of this application are described below in conjunction with the accompanying drawings, including various details of the embodiments of this application to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0032] Where there is no conflict, the various embodiments of this application and the features thereof may be combined with each other.
[0033] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0034] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0035] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0036] The text pre-training model generation method according to embodiments of this application can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Specifically, the method can be implemented by a processor calling a computer program stored in memory.
[0037] In related technologies, pre-trained models can only be trained based on existing original sample sets. Due to the limited amount of data in the original sample sets, the accuracy of the pre-trained models is not high. To address this issue, this application proposes a method for generating text pre-trained models. In this method, by performing data augmentation on the original samples, the number of original samples is increased, which is beneficial to improving the training effect of the model. Furthermore, by using positive sample pairs for comparative learning and optimizing the pre-trained model through a comparative loss function, the learning ability of the model is further enhanced.
[0038] Figure 1 This is a flowchart illustrating a method for generating a text pre-trained model, as provided in one embodiment of this application. The text pre-trained model is used to perform text prediction tasks, such as text classification, intent prediction, and other similar tasks. (Refer to...) Figure 1 The method specifically includes the following steps:
[0039] Step S110: Perform data augmentation on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text, and generate positive sample pairs based on the original sample text and the augmented sample text.
[0040] The original sample text set stores multiple original sample texts. In this embodiment, the original sample texts are text-based data, such as text paragraphs or text sentences. Data augmentation is used to increase the number of samples and improve the training effect of the model.
[0041] In one optional implementation, when performing data augmentation operations on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text, this is achieved as follows: First, at least one augmentation operation type is selected as the target augmentation operation type from a set of preset augmentation operation types. The multiple augmentation operation types include at least one of the following: synonym replacement, random insertion, random swapping, and random deletion. Then, the data augmentation operation is performed on the original sample text using the target augmentation operation type to obtain the augmented sample text corresponding to the original sample text.
[0042] For example, in a specific example, data augmentation is mainly performed using the EDA (easy data augmentation) method, which involves randomly performing operations such as synonym replacement, random word insertion, random word swapping, and random word deletion on parts of the text. Suppose the original sentence before augmentation is "The quota is too low, isn't it?" After performing synonym replacement augmentation, the augmented sentence is "The quota is too small, isn't it?"; after performing random word insertion augmentation, the augmented sentence is "The quota is really too low, isn't it?"; after performing random word swapping augmentation, the augmented sentence is "The quota is too low, isn't it?"; and after performing random word deletion augmentation, the augmented sentence is "The quota is too low, isn't it?".
[0043] Therefore, the original sample text and the augmented sample text are semantically close. Thus, the original sample text and its corresponding augmented sample text constitute a positive sample pair. A positive sample pair typically refers to a set of two samples that are semantically close to each other. One original sample text can be augmented into multiple augmented sample texts through various augmentation operations. Correspondingly, the original sample text can form a positive sample pair with each augmented sample text. For example, assuming one original sample text corresponds to four augmented sample texts, then the original sample text forms four positive sample pairs with each augmented sample text. Therefore, after augmentation operations, the number of samples is increased by N times, where N is the number of augmentation operation types. For example, if the number of original samples is m and the number of augmentation operation types is 4, the final number of positive sample pairs is 4m.
[0044] Step S120: Perform contrastive learning on positive sample pairs using the initial model, and calculate the contrastive loss function value of the initial model based on the contrastive learning results and the contrastive loss function; wherein, the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs.
[0045] The initial model can be of various types. For example, in this embodiment, the initial model is a BERT model, which consists of multiple Transformer encoders. A Transformer is a network structure in deep learning. The full name of the BERT model is Bidirectional Encoder Representation from Transformers, a pre-trained language representation model that primarily uses a Transformer encoder structure.
[0046] The BERT model performs contrastive learning on positive sample pairs. Contrastive learning is a self-supervised learning method used to learn general features of a dataset by teaching the model which data points are similar or different, even without labels. Since a positive sample pair contains a highly similar set of samples, performing contrastive learning on the positive sample pairs with the initial model helps the model learn the features between similar samples. Specifically, the initial model learns from a set of positive sample pairs to determine the similar features between them, and uses the learning results to make predictions for encountered text prediction tasks.
[0047] Optionally, in this step, negative sample pairs can be further constructed to enable the initial model to perform comparative learning based on a combination of positive and negative sample pairs. For example, the initial model learns from a set of negative sample pairs to determine the dissimilarity features between these pairs. These negative sample pairs can be constructed as follows: for any original sample in the original sample set, select another sample from the original sample set (excluding that original sample), and pair that original sample with that other sample to form a negative sample pair. In summary, comparative learning can improve the model's recognition ability.
[0048] After comparative learning, the initial model can identify both positive and negative samples. Ideally, the initial pre-trained model should calculate a 100% similarity between two positive samples. However, in reality, the recognition accuracy of the initial pre-trained model cannot reach the ideal state. Therefore, in order to improve the recognition accuracy of the initial pre-trained model, this embodiment uses a contrastive loss function to evaluate the recognition accuracy of the initial pre-trained model for positive sample pairs. Based on the evaluation results, the initial pre-trained model can be corrected to improve its recognition accuracy.
[0049] For example, after the initial model has undergone a period of contrastive learning, a set of sample pairs is input, and the initial model is asked to predict whether the set of sample pairs belongs to positive or negative sample pairs. The probability prediction results are then evaluated using a contrastive loss function to assess the predictive ability of the initial model.
[0050] The contrastive loss function is used to evaluate the accuracy of the initial pre-trained model in recognizing positive sample pairs. The higher the accuracy of the initial pre-trained model in recognizing positive sample pairs, the lower the value of the contrastive loss function; conversely, the lower the accuracy of the initial pre-trained model in recognizing positive sample pairs, the higher the value of the contrastive loss function.
[0051] In a specific example, the contrastive loss function is shown in the following formula (1):
[0052]
[0053] Where τ is the temperature hyperparameter, used to adjust the degree of attention given to difficult samples; a smaller temperature hyperparameter indicates a greater focus on separating the current sample from the most similar samples. N is the number of sentences contained in a sample set; h i This represents the feature vector of the original sentence; This is the feature vector representation of the positive pair corresponding to the original sentence, i.e., the sample after augmentation; The feature vector representation of the negative pair corresponding to the original sentence, i.e., other samples in the same sample set; Used to calculate the cosine similarity between two feature vectors.
[0054] Therefore, the contrastive loss function is used to calculate the ratio between the first similarity between any original sample and its corresponding positive sample, and the second similarity between the original sample and its corresponding negative sample. The contrastive loss function value characterizes the accuracy of the initial model in identifying positive sample pairs.
[0055] Step S130: Adjust the initial model based on the contrastive loss function value to obtain the text pre-trained model; wherein, the text pre-trained model is used to perform the text prediction task.
[0056] Since the comparison loss function value can characterize the recognition accuracy of the initial model for positive sample pairs, gradient backpropagation of the loss function value can be used to correct the model parameters based on the gradient backpropagation results, thereby obtaining the text pre-trained model and improving the recognition accuracy of the corrected text pre-trained model.
[0057] Therefore, in the embodiments provided in this application, firstly, data augmentation is performed on the original sample texts in the original sample text set to obtain augmented sample texts corresponding to the original sample texts. Positive sample pairs are then generated based on the original sample texts and their corresponding augmented sample texts. Next, contrastive learning is performed on the positive sample pairs using the initial model. The contrastive loss function value of the initial model is calculated based on the contrastive learning results and the contrastive loss function, and the initial model is adjusted according to the contrastive loss function value to obtain a pre-trained text model for performing text prediction tasks. Thus, this method, by performing data augmentation on the original sample texts, expands the number of original sample texts, which is beneficial for improving the training effect of the model. Furthermore, based on the data augmentation operation, it facilitates the construction of positive sample pairs based on the augmentation results, enabling contrastive learning using these positive sample pairs. The contrastive loss function is then used to evaluate the predictive ability of the initial model for positive samples, helping the model learn the features between similar samples. Specifically, the initial model learns from a set of positive sample pairs to determine the similar features between the positive sample pairs. The learning results are then used to predict the text prediction tasks encountered, gradually improving the prediction ability of the initial model and thus enhancing the accuracy of the text pre-trained model.
[0058] In addition, those skilled in the art can make various modifications and variations to the above embodiments.
[0059] In one optional implementation, in addition to calculating the loss using a contrastive loss function, a discriminative loss function is further incorporated to determine the accuracy of the initial model in recognizing augmentation operation types. Specifically, the inventors discovered during the implementation of this invention that, in the aforementioned contrastive learning process, sample augmentation is used to obtain positive samples. However, sample augmentation often causes a shift in the distribution of augmented samples relative to the original samples. Once the distribution of augmented samples shifts relative to the original samples, it may affect the recognition ability of the initial model. Therefore, it is necessary for the initial model to accurately identify the augmentation operation type of the augmented samples. Thus, in this embodiment, a discriminative loss function is further introduced, which characterizes the accuracy of the initial pre-trained model in recognizing augmentation operation types. If the initial pre-trained model can accurately identify the specific operation type of the augmentation operation, the smaller the discriminative loss function value; conversely, the larger the discriminative loss function value, the less accurate the recognition.
[0060] In a specific example, after selecting at least one augmentation operation type as the target augmentation operation type from a variety of preset augmentation operation types, the initial model is further adjusted using a discriminative loss function: First, the initial model predicts the target augmentation operation type that matches the positive sample pair among the preset augmentation operations. For example, after the initial model has identified the positive sample pair, it can further predict the target augmentation operation type that matches the positive sample pair based on the identification results. Then, the discriminative loss function value of the initial model is calculated. The discriminative loss function value characterizes the prediction accuracy of the initial model for the augmented sample text of the target augmentation operation type. For example, the higher the prediction accuracy of the initial model for the augmented sample text of the target augmentation operation type, the smaller the discriminative loss function value; the lower the prediction accuracy of the initial model for the augmented sample text of the target augmentation operation type, the larger the discriminative loss function value.
[0061] Accordingly, in step S130, when adjusting the initial model based on the contrastive loss function value, this can be achieved as follows: A first target loss function value is obtained based on the contrastive loss function value and the discriminative loss function value; the initial model is then adjusted based on the first target loss function value. Therefore, when a discriminative loss function is set, the first target loss function value needs to be calculated based on both the contrastive and discriminative loss function values, and adjustments are then made based on this first target loss function value. Because the first target loss function value integrates the results of both the contrastive and discriminative loss function values, the adjustment is more comprehensive and accurate.
[0062] Therefore, in the above method, the first target loss function value (also called the actual loss function value) is calculated based on the contrastive loss function value and the discriminative loss function value, thus making the final actual loss function value more accurate. For example, the sum of the contrastive loss function value and the discriminative loss function value can be used as the actual loss function value.
[0063] For example, in a specific example, the discriminator loss function value is calculated using the following formula (2):
[0064]
[0065] Where K is the number of augmentation operation types (e.g., a value of 4), and a sample can be augmented by multiple methods simultaneously. p(y i Let be the probability that the model predicts augmentation type i. Therefore, the discriminative loss function is used to calculate the probability that the model predicts the correct augmentation operation type. By using the discriminative loss function, the model's accuracy in recognizing augmentation operation types can be effectively improved.
[0066] In another alternative implementation, the initial model is further used to perform a masked language modeling (MLM) task, and the performance of the masked language modeling task is evaluated using the modeling loss function value, thereby refining the initial pre-trained model. Accordingly, before adjusting the initial model based on the contrastive loss function value to obtain the text pre-trained model, the masking loss function value is calculated as follows: First, target text words are selected from the original sample text in the original sample text set, and a masked language modeling task is performed on the target text words to obtain predicted text words corresponding to the target text words. The masked language modeling task is used to mask the selected target text words and predict the masked target text words using the initial model, obtaining predicted text words corresponding to the target text words. Then, a set of synonyms for the target text words is obtained from a pre-defined thesaurus, and the matching score between the predicted text words and the set of synonyms for the target text words is calculated. Based on the matching score and the masked language modeling loss function corresponding to the masked language modeling task, the masking loss function value is obtained; the masking loss function value characterizes the prediction accuracy of the initial model for the masked target text words.
[0067] In this process, the target text words selected from the original sample text set can be words, phrases, etc. Masking is performed on the words or phrases corresponding to the target text words, and prediction is made for the words or phrases at the masked positions to obtain the predicted text words. For example, during data processing, the input data can be masked (MASK processing) according to a fixed ratio. For example, assuming the original sentence is "The quota is too low," the masked sentence becomes "The quota is also [MASK] low." Therefore, when performing the masking language modeling task on the target text words to obtain the predicted text words, the main focus is on predicting what the original word should be at the masked position. If the predicted text word is exactly the same as the masked target text word, the accuracy of the initial model is high; conversely, if the predicted text word differs significantly from the masked target text word, the accuracy of the initial model is low. The modeling loss function value is used to characterize the accuracy of the initial model in performing the masking language modeling task. The pre-defined thesaurus can be constructed as follows: For any target text word in the original sample text of the original sample text set, calculate the target word vector corresponding to the target text word; calculate the similarity between the candidate word vectors corresponding to multiple candidate text words and the target word vector; based on the similarity calculation results, select candidate text words that match the target text word and add them to the pre-defined thesaurus. For example, the pre-defined thesaurus can contain a set of synonyms corresponding to each target text word. For example, when constructing the thesaurus, it can be expanded based on an open-source thesaurus. The expansion method is mainly to obtain similar words of a given word through word2vec, thereby obtaining a set of synonyms for the target text word. For example, three synonyms can be pre-selected for each target text word and added to the set of synonyms for that target text word.
[0068] Compared to traditional masked language modeling tasks, the core improvement of this embodiment lies in the construction of a thesaurus and the calculation of the modeling loss function value of the predicted text word relative to the set of synonyms of the target text word (rather than the target text word itself) using a modeling loss function. In traditional modeling loss function calculations, the modeling loss function value of the predicted text word is usually calculated relative to the target text word itself, which can lead to error propagation even if the predicted text word is an approximation of the target text word. To address this issue, in this embodiment, the modeling loss function is used to calculate the modeling loss function value of the predicted text word relative to the set of synonyms of the target text word. If the predicted text word matches any synonym in the set of synonyms of the target text word, error propagation will not occur.
[0069] In a specific example, the masked language modeling loss function (MLM Loss) is shown in the following formula (3):
[0070]
[0071] Wherein, P(x m ): The word that was masked m The predicted probability;
[0072] M represents the number of words masked in a sentence;
[0073] N is the number of sentences in a sample set.
[0074] In summary, in this embodiment, each time the loss function value is calculated, the set of synonyms of the model's predicted text words and the target text words is matched first. If a match is found, the loss is set to 0 and gradient backpropagation is not performed. This method solves the problem of insufficient robustness of the MLM loss function.
[0075] Accordingly, when adjusting the initial model based on the contrastive loss function value, a second target loss function value is obtained specifically based on the contrastive loss function value, the discrimination loss function value, and the modeling loss function value; and the initial model is adjusted based on the second target loss function value. For example, in one optional implementation, the sum of the contrastive loss function value, the discrimination loss function value, and the modeling loss function value is calculated to obtain the second target loss function value; the second target loss function value is then used for gradient backpropagation so that the initial model can be corrected based on the gradient backpropagation result.
[0076] For example, in a specific example, the final loss function is: L Final =L MLM +L CL +L DL Therefore, it can be seen that when a discriminative loss function and a modeling loss function are set, the actual loss function value of the model is obtained by the sum of the results of formulas (1), (2) and (3).
[0077] Among them, L MLM To model the loss function value, L CL To compare the loss function values, L DL To identify the loss function value. Therefore, in this embodiment, the sum of the results of the three loss functions is used to characterize the accuracy loss of the pre-trained model, thereby helping to improve the training accuracy of the model.
[0078] Another embodiment of the present invention provides a text prediction method, which includes the following operations: First, acquiring the predicted text; then, inputting the predicted text into a text prediction model to obtain the prediction result corresponding to the predicted text; wherein the prediction result is used to characterize the text category and / or text intent label to which the predicted text belongs. The text prediction model is obtained by: acquiring a set of labeled prediction sample texts; wherein the set of prediction sample texts contains multiple prediction sample texts carrying prediction labels; and training the text pre-training model obtained in the above embodiment using the set of prediction sample texts to obtain the text prediction model.
[0079] For example, Figure 2 The flowchart of this text prediction method is shown, as follows: Figure 2 As shown, the text prediction method includes:
[0080] Step S201: Obtain the labeled prediction sample text set; wherein, the prediction sample text set contains multiple sample texts carrying prediction labels.
[0081] The labeled predicted sample text set can also be called the prediction task dataset, which can be specifically defined according to the actual business scenario. For example, in intent recognition scenarios, the labeled predicted sample text set is a dataset carrying intent labels (i.e., prediction labels). Each sample text (also called sample task data) represents a type of task, and the prediction label of the sample text represents the corresponding task intent.
[0082] Step S202: Train the text pre-training model using the predicted sample text set to obtain the text prediction model.
[0083] The text pre-training model used in this step is based on Figure 1 The method shown generates the model. Since the text pre-trained model has been pre-trained using the original sample text set and has been fine-tuned according to various loss functions, it already possesses a certain level of prediction accuracy.
[0084] In this step, the text pre-trained model is further trained using the labeled prediction task dataset. Since the prediction task dataset is a dataset in a specified business scenario, the model can learn the expressive features in the specified business scenario, thereby improving the prediction ability of the specified business scenario.
[0085] Therefore, unlike text pre-trained models that lack scenario-specific features, the text prediction model obtained in this step is adapted to the specified business scenario and has the prediction capability for the specified business scenario.
[0086] Step S203: Input the predicted text into the text prediction model to obtain the prediction result corresponding to the predicted text; wherein, the prediction result is used to characterize the text category and / or text intent label to which the predicted text belongs.
[0087] In this context, "predicted text" refers to the text whose category or intent label is to be predicted. Since the sample task data in the prediction task dataset carries prediction labels, the text prediction model can learn the correspondence between the prediction labels and the data. Accordingly, based on this correspondence, it can obtain the prediction result corresponding to the predicted text, which is used to characterize the text category and / or text intent label to which the predicted text belongs.
[0088] Therefore, it can be seen that by using the labeled prediction sample text set, the text pre-trained model can learn the features of a specified business scenario, thereby obtaining a text prediction model adapted to the specified business scenario, and thus achieving accurate prediction for the specified business scenario.
[0089] To facilitate understanding, a specific example will be used below to detail the implementation of the text pre-trained model generation method in this application.
[0090] In recent years, pre-trained models have been widely used in the field of natural language processing. These models are first trained on a large number of unlabeled samples using a self-supervised approach to learn general text representations. Then, when applying the model, only fine-tuning is needed for specific tasks. Compared to training from scratch, fine-tuning based on a pre-trained model requires fewer samples and has stronger generalization ability. Currently, most mainstream pre-trained models include the MLM task, which involves randomly selecting a subset of words, masking them, and then having the model restore them.
[0091] For example, in an MLM task, a data processing procedure is first performed to mask the input data at a fixed ratio. Then, the model predicts the masked portion. In related techniques, during the pre-training process, the model's accuracy is evaluated using both MLM and NSP loss functions.
[0092] The MLM loss function stands for Masked Language Model (multi-classification task), which involves masking parts of the input sentence and then having the model make predictions. The specific MLM loss function is shown in formula (4) below:
[0093]
[0094] Where M is the number of words masked, P(x m ) for word x m The predicted probability.
[0095] Furthermore, the full name of the NSP loss function is Next Sentence Prediction (a binary classification task), which determines whether sentence A is the next sentence of sentence B. The specific NSP loss function is shown in the following formula (5):
[0096] L nsp =-logP(t|x,y) Formula (5)
[0097] If x and y are two consecutive sentences in the original corpus, then t = 1; otherwise, t = 0.
[0098] The final loss function is Final Loss = MLM Loss + NSP Loss.
[0099] Therefore, in related technologies, the above two loss functions are usually used to evaluate model performance. However, in the process of implementing this invention, the inventors discovered that the above methods have at least the following problems: First, in the MLM task, the positive samples predicted by the model must be exactly the same as the original word. Even if the content predicted by the model is a similar word to the original word, it is still considered a negative sample (which will cause backpropagation of errors), thus reducing the robustness of the pre-trained model. Second, the NSP task is not very necessary for text prediction. Therefore, this example proposes a new model generation method to solve the above problems. In this example, on the one hand, the calculation logic of the MLM loss function is improved by pre-constructing a synonym set, so that the content predicted by the model only needs to match the synonym set of the original word, without needing to match the original word exactly, thereby improving the robustness of the model. On the other hand, the NSP task is abandoned, and the number of positive sample pairs is further expanded through data augmentation operations. Then, the accuracy of the model is comprehensively evaluated by using the contrastive loss function and the discriminative loss function values, thereby further improving the accuracy of the model.
[0100] In this example, the following data preparation operations need to be performed: First, data preparation is carried out. High-quality text data is collected, specifically including various scenarios (such as finance, e-commerce, medical insurance, etc.) and open-source datasets (including wikis, Baidu Encyclopedia, news, etc.). After data cleaning (including special symbol filtering, sensitive information desensitization, duplicate data filtering, and removal of texts with excessively short lengths), a total of nearly 100GB of datasets is collected. Then, a thesaurus is organized. Specifically, it is expanded based on the open-source thesaurus. The expansion method mainly obtains similar words for a given word through word vectors. Finally, nearly 50,000 words are organized, with an average of 3 synonyms per word. In addition, augmented data needs to be constructed. Data augmentation is mainly carried out through EDA methods, which involves four operations: randomly replacing some words in the text with synonyms, randomly inserting words, randomly swapping some words, and randomly deleting words, to obtain augmented samples of the original sample.
[0101] After the data preparation is complete, the model training process is executed. The model structure can employ a 12-layer transformer encoder. Furthermore, regarding the loss function, the NSP Loss function from related techniques is replaced with two parts: a discriminator loss function and a contrastive loss function.
[0102] In addition, the MLM Loss loss function is adjusted as shown in the following formula (6):
[0103]
[0104] Wherein, P(x m ): Blocked word x m The predicted probability;
[0105] M represents the number of blocked words in a sentence;
[0106] N is the number of sentences in a batch.
[0107] The core difference between this loss function and related techniques is that each time the loss is calculated, the predicted word obtained by the model is first matched with the synonym library of the target word (i.e., the original word). If a match is found, the loss is set to 0 and gradient backpropagation is not performed. This method solves the problem of insufficient robustness of the MLM loss function.
[0108] In addition, the contrastive loss function is shown in the following formula (7):
[0109]
[0110] Where τ is the temperature hyperparameter, which is used to adjust the degree of attention given to difficult samples. The smaller the temperature hyperparameter, the more attention is paid to separating the current sample from the other most similar samples.
[0111] N is the number of sentences in a batch;
[0112] h i This represents the feature vector of the original sentence;
[0113] This is the feature vector representation of the positive sample pair corresponding to the original sentence, i.e., the sample after augmentation;
[0114] This is the feature vector representation of the negative sample pair corresponding to the original sentence, i.e., other samples in the same batch;
[0115] Used to calculate the cosine similarity between two feature vectors.
[0116] In the Contrastive Loss above, sample augmentation is used to obtain positive sample pairs. However, sample augmentation often results in a drift between the augmented sample and the original sample distribution. To address this issue, a Discriminator Loss function is proposed to alleviate the problem. The Discriminator Loss function is shown in the following formula (8):
[0117]
[0118] Where K is the number of augmentation operation types, and a sample can be augmented by multiple methods at the same time;
[0119] p(y i ) represents the probability that the model predicts augmentation method i;
[0120] The final loss function is the sum of the values of the three loss functions mentioned above, that is: L Final =L MLM +L CL +L DL .
[0121] This example can be applied to intent recognition scenarios in intelligent customer service systems. In this scenario, the model is first fine-tuned: on a labeled task dataset, the input is...<text,label> Fine-tuning is performed by first using the pre-trained model of this invention to extract features from the text, then using the cross-entropy loss function to calculate the error between the model's prediction and the human-standard result, and continuously iterating and optimizing. After the model is optimized, an intent recognition operation is performed: the input is unlabeled text content, which is predicted by the trained model, and the prediction result is taken as the final intent.
[0122] In summary, in this example, the robustness of the model was improved during the pre-training phase by optimizing the MLM loss function. Furthermore, the NSP task was replaced with Discriminator Loss and Contrastive Loss during pre-training, enhancing the model's representational capabilities. Moreover, fine-tuning the model using the target task dataset based on the pre-trained model allows for more efficient utilization of the prior knowledge provided by the pre-trained model compared to direct training.
[0123] It is understood that the various method embodiments mentioned above in this application can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this application will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0124] In addition, this application also provides a text pre-trained model generation device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any of the text pre-trained model generation methods provided in this application. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section and will not be repeated here.
[0125] Figure 3 This is a block diagram of a text pre-trained model generation device provided in an embodiment of this application.
[0126] Reference Figure 3 This application provides a text pre-trained model generation device 30, which includes:
[0127] Augmentation module 31 is adapted to perform data augmentation operation on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text, and generate positive sample pairs based on the original sample text and the augmented sample text;
[0128] The contrastive learning module 32 is adapted to perform contrastive learning on the positive sample pairs using an initial model, and to calculate the contrastive loss function value of the initial model based on the contrastive learning results and the contrastive loss function; wherein the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs;
[0129] The adjustment module 33 is adapted to adjust the initial model according to the contrast loss function value to obtain a text pre-trained model; wherein the text pre-trained model is used to perform a text prediction task.
[0130] In one alternative implementation, the augmentation module 31 is specifically adapted to:
[0131] Select at least one augmentation operation type from a variety of preset augmentation operation types as the target augmentation operation type;
[0132] Perform a data augmentation operation on the original sample text using the target augmentation operation type to obtain augmented sample text corresponding to the original sample text;
[0133] The various augmentation operation types include at least one of the following: synonym replacement type, random insertion type, random swap type, and random deletion type.
[0134] In one alternative implementation, the augmentation module 31 is further adapted to:
[0135] The initial model predicts the target augmentation operation type that matches the positive sample pair among the preset multiple augmentation operations.
[0136] The discriminant loss function value of the initial model is calculated using the discriminant loss function; wherein the discriminant loss function value is used to characterize the prediction accuracy of the initial model for augmented sample text of the target augmentation operation type;
[0137] The adjustment module is specifically adapted to:
[0138] Based on the comparison loss function value and the discrimination loss function value, the first target loss function value is obtained;
[0139] The initial model is adjusted based on the first target loss function value.
[0140] In one alternative implementation, the apparatus further includes:
[0141] The masking language modeling module is adapted to select target text words from the original sample text in the original sample text set, perform a masking language modeling task on the target text words, and obtain predicted text words corresponding to the target text words; wherein, the masking language modeling task is used to perform masking processing on the selected target text words, and predict the masked target text words through the initial model to obtain predicted text words corresponding to the target text words.
[0142] Obtain the set of synonyms for the target text word from a preset thesaurus, and calculate the matching score between the predicted text word and the set of synonyms for the target text word;
[0143] Based on the matching score and the masked language modeling loss function corresponding to the masked language modeling task, a masking loss function value is obtained; wherein, the masking loss function value is used to characterize the prediction accuracy of the initial model for the masked target text words;
[0144] The adjustment module is specifically suitable for:
[0145] The second target loss function value is obtained based on the comparison loss function value, the discrimination loss function value, and the modeling loss function value;
[0146] The initial model is adjusted based on the value of the second objective loss function.
[0147] In one alternative implementation, the adjustment module 31 is specifically adapted to:
[0148] The sum of the contrast loss function value, the discrimination loss function value, and the masking loss function value is calculated to obtain the second target loss function value;
[0149] The second objective loss function value is backpropagated using gradients, so that the initial model is corrected based on the gradient backpropagation results, thus obtaining the text pre-trained model.
[0150] In one optional implementation, the preset thesaurus is constructed in the following manner:
[0151] For any target text word in the original sample text of the original sample text set, calculate the target word vector corresponding to the target text word;
[0152] Calculate the similarity between the candidate word vectors corresponding to multiple candidate text words and the target word vector. Based on the similarity calculation results, select the candidate text words that match the target text word and add them to the preset thesaurus.
[0153] Figure 4 This is a block diagram of a text prediction device provided in an embodiment of this application.
[0154] Reference Figure 4 This application provides a text prediction device 40, which includes:
[0155] Module 41 is used to acquire the predicted text;
[0156] The prediction module 42 is adapted to input the predicted text into the text prediction model to obtain the prediction result corresponding to the predicted text; wherein the prediction result is used to characterize the text category and / or text intent label to which the predicted text belongs;
[0157] The text prediction model is obtained by: acquiring a set of labeled prediction sample texts; wherein the set of prediction sample texts contains multiple prediction sample texts carrying prediction labels; and training the text pre-training model using the set of prediction sample texts to obtain the text prediction model.
[0158] Figure 5 This is a block diagram of an electronic device provided in an embodiment of this application.
[0159] Reference Figure 5This application provides an electronic device, which includes: at least one processor 501; at least one memory 502; and one or more I / O interfaces 503 connected between the processor 501 and the memory 502; wherein the memory 502 stores one or more computer programs that can be executed by the at least one processor 501, and the one or more computer programs are executed by the at least one processor 501 to generate the above-described text pre-trained model.
[0160] This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the above-described method for generating a text pre-trained model. The computer-readable storage medium may be volatile or non-volatile.
[0161] This application also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described method for generating a text pre-trained model.
[0162] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0163] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0164] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0165] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from the computer-readable program instructions. These electronic circuits can execute the computer-readable program instructions to implement various aspects of this application.
[0166] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0167] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0168] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0169] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0171] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for general illustrative purposes only and should not be construed as limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this application as set forth by the appended claims.
Claims
1. A method for generating a text pre-trained model, characterized in that, include: Select at least one augmentation operation type from a variety of preset augmentation operation types as the target augmentation operation type; By performing data augmentation operations on the original sample text in the original sample text set according to the target augmentation operation type, augmented sample text corresponding to the original sample text is obtained, and positive sample pairs are generated based on the original sample text and the augmented sample text. The target augmentation operation type that matches the positive sample pair is predicted from among a variety of preset augmentation operation types using an initial model; The discriminant loss function value of the initial model is calculated using the discriminant loss function; wherein the discriminant loss function value is used to characterize the prediction accuracy of the initial model for augmented sample text of the target augmentation operation type; The initial model is used to perform contrastive learning on the positive sample pairs, and the contrastive loss function value of the initial model is calculated based on the contrastive learning results and the contrastive loss function; wherein, the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs; Based on the comparison loss function value and the discrimination loss function value, the first target loss function value is obtained; Based on the first target loss function value, the initial model is adjusted to obtain a text pre-trained model; wherein, the text pre-trained model is used to perform a text prediction task.
2. The method according to claim 1, characterized in that, The various augmentation operation types include at least one of the following: synonym replacement type, random insertion type, random swap type, and random deletion type.
3. The method according to claim 1, characterized in that, Before adjusting the initial model based on the first target loss function value to obtain the text pre-trained model, the method further includes: Select target text words from the original sample text in the original sample text set, perform a masking language modeling task on the target text words to obtain predicted text words corresponding to the target text words; wherein, the masking language modeling task is used to mask the selected target text words, and predict the masked target text words through the initial model to obtain predicted text words corresponding to the target text words. Obtain the set of synonyms for the target text word from a preset thesaurus, and calculate the matching score between the predicted text word and the set of synonyms for the target text word; Based on the matching score and the masked language modeling loss function corresponding to the masked language modeling task, a masking loss function value is obtained; wherein, the masking loss function value is used to characterize the prediction accuracy of the initial model for the masked target text words; The step of adjusting the initial model based on the first target loss function value includes: The second target loss function value is obtained based on the comparison loss function value, the discrimination loss function value, and the modeling loss function value; The initial model is adjusted based on the value of the second objective loss function.
4. The method according to claim 3, characterized in that, The step of obtaining the second target loss function value based on the contrast loss function value, the discrimination loss function value, and the modeling loss function value includes: The sum of the contrast loss function value, the discrimination loss function value, and the masking loss function value is calculated to obtain the second target loss function value; The step of adjusting the initial model based on the second objective loss function value includes: The second objective loss function value is backpropagated using gradients, so that the initial model is corrected based on the gradient backpropagation results, thus obtaining the text pre-trained model.
5. The method according to claim 3, characterized in that, The preset thesaurus is constructed in the following way: For any target text word in the original sample text of the original sample text set, calculate the target word vector corresponding to the target text word; Calculate the similarity between the candidate word vectors corresponding to multiple candidate text words and the target word vector. Based on the similarity calculation results, select the candidate text words that match the target text word and add them to the preset thesaurus.
6. A text prediction method, characterized in that, include: Obtain the predicted text; The predicted text is input into a text prediction model to obtain the prediction result corresponding to the predicted text; wherein, the prediction result is used to characterize the text category and / or text intent label to which the predicted text belongs; The text prediction model is obtained by: acquiring a set of labeled prediction sample texts; wherein the set of prediction sample texts contains multiple prediction sample texts carrying prediction labels; and training the text pre-training model according to any one of claims 1-5 using the set of prediction sample texts to obtain the text prediction model.
7. A device for generating a text pre-trained model, characterized in that, include: An augmentation module is adapted to select at least one augmentation operation type as the target augmentation operation type from a variety of preset augmentation operation types; The target augmentation operation type is used to perform data augmentation operations on the original sample text in the original sample text set to obtain augmented sample text corresponding to the original sample text. Positive sample pairs are generated based on the original sample text and the augmented sample text. The target augmentation operation type that matches the positive sample pair is predicted by an initial model from a variety of preset augmentation operation types. The discriminative loss function value of the initial model is calculated using a discriminative loss function. The discriminative loss function value is used to characterize the prediction accuracy of the initial model for the augmented sample text of the target augmentation operation type. The contrastive learning module is adapted to perform contrastive learning on the positive sample pairs using an initial model, and to calculate the contrastive loss function value of the initial model based on the contrastive learning results and the contrastive loss function; wherein the contrastive loss function value is used to characterize the recognition accuracy of the initial model for positive sample pairs; The adjustment module is adapted to obtain a first target loss function value based on the contrast loss function value and the discrimination loss function value; and to adjust the initial model based on the first target loss function value to obtain a text pre-trained model; wherein the text pre-trained model is used to perform a text prediction task.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Comparative pre-training of language tasks
CN114514540A
Small sample learning robustness improvement method based on comparative learning
CN114781651A
