CN115757723A - Text processing method and device - Google Patents

Text processing method and device Download PDF

Info

Publication number
CN115757723A
CN115757723A CN202211415341.6A CN202211415341A CN115757723A CN 115757723 A CN115757723 A CN 115757723A CN 202211415341 A CN202211415341 A CN 202211415341A CN 115757723 A CN115757723 A CN 115757723A
Authority
CN
China
Prior art keywords
text
model
task
pseudo
unlabeled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211415341.6A
Other languages
Chinese (zh)
Inventor
赵英秀
郁博文
余海洋
黄非
李永彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202211415341.6A priority Critical patent/CN115757723A/en
Publication of CN115757723A publication Critical patent/CN115757723A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The embodiment of the specification provides a text processing method and a text processing device, wherein the text processing method comprises the following steps: acquiring a text to be processed, and executing a first task model of a target task; inputting a text to be processed into a first task model, and obtaining a task processing result of the text to be processed for executing a target task, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabelled text, the unlabelled text comprises the unlabelled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks. Because the training data of the first task model comprises the label-free text which is output by the second task model and is related to the target task, the label-free data of the second task model is used for training the first task model, so that better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.

Description

Text processing method and device
Technical Field
The embodiment of the specification relates to the technical field of machine learning, in particular to a text processing method.
Background
The text processing task is based on traditional given knowledge to carry out simple question and answer, and is expanded from the aspects of data sources and application scenes. From a data source, a client desires to utilize the existing data of the client, including dialog logs, knowledge bases, databases, documents, etc., at low cost; in a service scene, more and more scenes need to serve more professional personnel, the traditional system based on manual construction knowledge and providing simple question and answer can not meet the requirements of the existing scene, and a set of integral scheme design aiming at the scene is urgently needed.
Disclosure of Invention
In view of this, the embodiments of the present specification provide a text processing method. One or more embodiments of the present disclosure relate to a machine question and answer method, a data processing method of a task model, a text processing apparatus, a computing device, a computer-readable storage medium, and a computer program, so as to solve technical deficiencies in the prior art.
According to a first aspect of embodiments herein, there is provided a text processing method including:
acquiring a text to be processed and a first task model for executing a target task;
inputting the text to be processed into the first task model, and obtaining a task processing result of executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabelled text, the unlabelled text comprises the unlabelled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks.
According to a second aspect of embodiments herein, there is provided a machine question answering method, comprising:
acquiring a text of a question to be processed and a question and answer task model for executing a question and answer task;
inputting the question text to be processed into the question-answering task model, and obtaining an answer text corresponding to the question text to be processed, wherein the question-answering task model is obtained by performing semi-supervised learning on an initial task model by using a tagged text and an untagged text, the untagged text comprises untagged texts which are output by other task models and are related to the question-answering task, and the other task models and the question-answering task model execute different tasks.
According to a third aspect of the embodiments of the present specification, there is provided a data processing method of a task model, applied to a cloud-side device, including:
acquiring a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts;
inputting the unlabeled texts in the unlabeled sample set into a first sub-model to generate a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively;
training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain model parameters of a trained first task model;
sending model parameters of the first task model to an end-side device.
According to a fourth aspect of embodiments herein, there is provided a text processing apparatus including:
the system comprises a sample acquisition module, a first task model and a second task model, wherein the sample acquisition module is configured to acquire a text to be processed and execute a target task;
the model processing module is configured to input the text to be processed into the first task model, and obtain a task processing result of executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabeled text, the unlabeled text comprises an unlabeled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions and the processor is configured to execute the computer-executable instructions, which when executed by the processor implement the steps of the text processing method described above.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the text processing method described above.
According to a fifth aspect of embodiments herein, there is provided a computer program, wherein the computer program, when executed in a computer, causes the computer to perform the steps of the above-described text processing method.
The embodiment of the specification provides a text processing method and a text processing device, wherein the text processing method comprises the following steps: acquiring a text to be processed and a first task model for executing a target task; inputting the text to be processed into the first task model, and obtaining a task processing result of executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabelled text, the unlabelled text comprises the unlabelled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks. The first task model is obtained by performing semi-supervised learning on the initial task model by using a labeled text and a non-labeled text, the non-labeled text comprises a non-labeled text which is output by the second task model and is related to a target task, and the second task model and the first task model execute different tasks, so that the first task model is trained by using the non-labeled data of the second task model, better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.
Drawings
FIG. 1 is a diagram of a model training framework for a text processing method according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a method for processing text according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a process of a method for machine question answering according to an embodiment of the present disclosure;
FIG. 4 is a flow diagram of a data processing method for a task model provided by one embodiment of the present description;
fig. 5 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present specification;
fig. 6 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be implemented in many ways other than those specifically set forth herein, and those skilled in the art will appreciate that the present description is susceptible to similar generalizations without departing from the scope of the description, and thus is not limited to the specific implementations disclosed below.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if," as used herein, may be interpreted as "at \8230; \8230when" or "when 8230; \823030when" or "in response to a determination," depending on the context.
First, the noun terms to which one or more embodiments of the present specification relate are explained.
When the Life Learning model learns a plurality of tasks serially, the tasks learned before are not forgotten.
Catastrophic learning, catastrophic Forgetting, when a model sequence learns multiple tasks, forgetting the previously learned task results in performance degradation of the previous task.
Backward knowledge transfer: and backward knowledge migration is performed, and the task newly learned by the model is beneficial to improving the performance of the previous and old tasks.
EMA: exponential moving average, exponential moving average. Also called the EXPMA index, which is also a trend-like index, the exponential moving average is a moving average weighted exponentially decreasing.
PPL: perplexityscore, the degree of confusion, is an index used to evaluate the quality of a language model.
Dropout: is a strategy for making the model more robust.
R-drop: the method is a method for enhancing the robustness of the model to Dropout by adding a regular term so as to enable the output of models under different Dropout modes to be basically consistent.
Relative entropy (relative entropy): also known as the Kullback-Leibler divergence, or KL divergence.
The existing continuous learning method only focuses on supervised learning in natural language processing, all data are provided with labels, and in real life, tasks often only have a small amount of labels and a large amount of unlabeled data. Semi-supervised continuous learning methods in the field of computer vision use either confrontational networks or hierarchically structured data sets, and cannot be migrated directly into the field of natural language processing. Thus semi-supervised language continuous learning presents the following two problems: unmarked data cannot be leveraged to facilitate each arriving linguistic task. Newly arriving unlabeled data cannot be exploited to encourage the transfer of knowledge to previous tasks.
Based on this, in the present specification, a text processing method is provided, and the present specification relates to a machine question and answer method, a data processing method of a task model, a text processing apparatus, a computing device, and a computer readable storage medium, which are described in detail one by one in the following embodiments.
Referring to fig. 1, fig. 1 illustrates a model training framework diagram of a text processing method provided in an embodiment of the present specification, wherein the model training framework diagram includes a virtual supervised augmented solver and a backward augmented learner. The virtual supervised enhancement solver uses a teacher-student framework (teacher model-student model) and utilizes unlabeled data. The teacher model generates pseudo labels for the unmarked data as virtual supervision and guides students according to the learning progress of the student model. Students also learn from pseudo-tags by self-learning. The backward reinforcement learner moves knowledge from the current task to a previously learned task. The backward reinforcement learner is used to transfer knowledge back to previously learned tasks by reinforcing the pseudo data generated by each learning task by retrieving semantically similar unlabeled samples from the unlabeled samples in the current task.
Specifically, in the virtual supervision and enhancement solver, a labeled sample set and a non-labeled sample set are obtained, non-labeled texts in the non-labeled sample set are input into a teacher model, a pseudo-labeled sample set is generated, and the teacher model and the student model are trained based on the labeled sample set and the first pseudo-labeled sample set. Further, the specific training mode is to extract a first labeled text from the labeled sample set, and input the first labeled text into the student model to obtain a first prediction result. Calculating a first loss value based on the first prediction result; extracting a first pseudo label text from a first pseudo label exemplar set; inputting the first pseudo label text into a student model, and obtaining a second loss value through self-learning of the student model; and adjusting the model parameters of the student model and the model parameters of the teacher model based on the first loss value and the second loss value, and returning to the step of extracting the first labeled text from the labeled sample set until a preset training stop condition is reached.
In addition, the virtual supervised enhancement solver further comprises: inputting the first labeled text into a teacher model to obtain a second prediction result; and calculating a third loss value based on the second prediction result, and adjusting the model parameters of the teacher model according to the target difference value between the first loss value and the third loss value. And returning to the step of inputting the unlabeled texts in the unlabeled sample set into the teacher model to generate a first pseudo-label sample set. And inputting the unlabeled texts in the unlabeled sample set into the teacher model to generate a plurality of pseudo unlabeled samples.
Further, the virtual supervised enhancement solver further comprises: receiving a plurality of pseudo label-free samples output by the second task model, inputting the plurality of pseudo label-free samples into the teacher model, generating a second pseudo label sample set, extracting a second pseudo label text from the second pseudo label sample set, inputting the second pseudo label text into the student model, and obtaining a fourth loss value through self-learning of the student model; based on the fourth loss value, model parameters of the student model are adjusted, and model parameters of the teacher model are adjusted.
Specifically, in the virtual supervised enhanced solver, the unlabelled texts in the unlabelled sample set are acquired and input into the first submodel, a plurality of pseudo unlabelled samples are generated, and enhancement processing is performed on the data, wherein the enhancement processing can be operations of adding words and deleting words on the unlabelled texts, so as to add more unlabelled samples. And sending the unlabeled samples to a conventional task, and executing a training task in a virtual supervision and enhancement solver.
In the embodiment of the specification, because the first task model is obtained by performing semi-supervised learning on the initial task model by using the tagged text and the non-tagged text, the non-tagged text includes the non-tagged text which is output by the second task model and is related to the target task, and the second task model and the first task model execute different tasks, the non-tagged data of the second task model is used for training the first task model, so that better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.
Referring to fig. 2, fig. 2 is a flowchart illustrating a text processing method according to an embodiment of the present disclosure, which specifically includes the following steps.
Step 202: the method comprises the steps of obtaining a text to be processed and a first task model for executing a target task.
The text to be processed may be a text in the form of a sentence, a word, or the like, for example, the text to be processed is: "what this movie is", and the text to be processed may be text in multiple languages, such as english, chinese, japanese, korean, and the like, and the embodiments of the present specification are not limited thereto. The target task may be a text-based task, such as a task of classifying sentences or answering questions. The first task model may be a model obtained by performing semi-supervised learning, for example, the first task model may be a question-answer type model, an emotion classification model, or a semantic parsing type.
In practical application, in some question and answer scenes, users acquire enterprise website contents in a clicking and browsing mode, the operation is complex, and the users hope to interact with websites more efficiently and directly reach core information. The portal websites of enterprises in various industries such as government affairs, finance and the like, colleges and universities, scientific research units and the like are all unidirectional, the portal websites expect to have bidirectional interaction with users, so that the users can be known better, better services are provided, meanwhile, practitioners in the electric power, medical, education and insurance industries have higher requirements on question and answer types, and the portal websites need to be maintainable, traceable and interpretable. Thus, machine learning may be used to solve the above-described problems.
For example, in the access of a movie page, the user can interact with the user to improve the speed of understanding the movie by the user, and then the target task can be determined to be a question-answer type. The user inputs the question: "what type of movie is it? ", that is, the text to be processed is obtained, and the task model corresponding to the question and answer type is obtained.
The embodiment of the specification obtains the text to be processed and executes the first task model of the target task, so that the result can be predicted through the first task model subsequently.
Step 204: and inputting the text to be processed into the first task model to obtain a task processing result for executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and a non-labeled text, the non-labeled text comprises the non-labeled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks.
The labeled text may be sample text that has been labeled, and the unlabeled text may be sample text that has no label. The unlabelled text includes the unlabelled text output by the second task model and related to the target task, and may be understood as the unlabelled samples including samples that have not been marked but have been processed by the teacher model, and the samples are related to the target task, for example, the target task is a question and answer task, and the unlabelled text includes sentences such as "how to look like in the weather today" and "how to look like in this movie". The second task model may be a model obtained by performing semi-supervised learning, and it may be understood that the second task model and the first task model execute different tasks, that is, the output of the second task model to the same text is inconsistent with the output of the first task model, that is, the second task model and the first task model are applied in different scenes, for example, the first task model is an emotion classification model, and the second task model is a question and answer model.
In practical application, after the model corresponding to the target task is determined, the text to be processed can be input into the model to obtain a corresponding result.
Along with the above example, in the access of a movie page, the user can interact with the user to improve the speed of understanding the movie by the user, and then the target task can be determined to be a question and answer type. The user inputs the question: "what type of movie is it? ", that is, the text to be processed is obtained, and the task model corresponding to the question and answer type is obtained. After the task model corresponding to the question-answer type processes the text to be processed, the output answer is that the movie is of a comedy type.
In the embodiment of the specification, because the first task model is obtained by performing semi-supervised learning on the initial task model by using the tagged text and the non-tagged text, the non-tagged text includes the non-tagged text which is output by the second task model and is related to the target task, and the second task model and the first task model execute different tasks, the non-tagged data of the second task model is used for training the first task model, so that better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.
Before the first task model is used, the first task model needs to be trained, and a specific implementation of the training of the first task model is as follows.
In an implementable manner, the initial task model comprises a first submodel and a second submodel;
before the inputting the text to be processed into the first task model and obtaining a task processing result of executing the target task on the text to be processed, the method further includes:
acquiring a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts;
inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively;
and training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain a trained first task model.
The first sub-model can be a teacher model, and the second sub-model can be a student model. Correspondingly, the pseudo label sample set refers to a sample set obtained by marking unlabeled samples through a teacher model.
In practical applications, the initial task model is a model based on a teacher-student framework, and may include the virtual supervised enhancement solver in the above embodiments, where the teacher model and the student model are trained in the virtual supervised enhancement solver based on the labeled sample set and the unlabeled sample set.
For example, a labeled sample set a and an unlabeled sample set B are obtained, the labeled sample set a includes 100 labeled samples, the unlabeled sample set B includes 1000 unlabeled samples, the 1000 unlabeled samples are input to a teacher model, so that the teacher model marks the 1000 unlabeled samples, and 1000 pseudo-labeled samples can be obtained and input to a student model for training. And, 100 labeled samples are input into the student model for training. Furthermore, parameters of the student model after training can influence parameters of the teacher model, so that the effect of training the teacher model at the same time is achieved.
In the embodiment of the specification, the teacher model in the teacher-student framework generates the pseudo label for the unmarked data to be used as virtual supervision, so that the student model is trained, and the parameter optimization capability of the student model is improved.
Specifically, the training of the first submodel and the second submodel is performed through a loss function, which is implemented as follows.
In an implementation manner, the training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain a trained first task model includes:
extracting a first labeled text from the labeled sample set, wherein the first labeled text is any one of the plurality of labeled texts;
inputting the first labeled text into the second submodel to obtain a first prediction result;
calculating a first loss value based on the first prediction result;
extracting a first pseudo label text from the first pseudo label sample set, wherein the first pseudo label text is any one of a plurality of pseudo label texts;
inputting the first pseudo label text into the second sub-model, and obtaining a second loss value through self-learning of the second sub-model;
and adjusting the model parameters of the second submodel and the first submodel based on the first loss value and the second loss value, and returning to execute the step of extracting the first labeled text from the labeled sample set until a preset training stopping condition is reached to obtain a trained first task model.
The first prediction result may be a prediction result based on a target task, for example, a user input question: "what type of movie is it? ", the predicted result is" comedy ". The self-learning can be a consistency regularization method based on R-drop, and information in the unlabeled data is learned by carrying out certain disturbance on the model based on Dropot to enhance the predicted consistency of the model under different disturbances.
In practical application, the student models can be trained based on the labeled data, the student models can also be trained based on the pseudo-label data generated by the teacher model on the unlabeled data, and the parameters of the teacher model can be updated in an EMA mode based on the parameter adjustment of the student models.
Specifically, the optimization goal of the labeled data in the student model is as follows, namely the calculation of the first loss value:
Figure BDA0003939745060000061
where X, Y are input and output of samples of labeled data, S θ Representing a student model. D s t A tagged data set representing the t-th task.
Further, for unlabeled data, the optimization objectives of the teacher model and the student model are as follows, i.e. the calculation of the second loss value:
Figure BDA0003939745060000071
wherein, A (X) u ) Representing data enhancement of a non-standard data sample, PPL representing an ambiguity, tau representing a confidence threshold, D u t For the unlabeled dataset of the t-th task,
Figure BDA0003939745060000072
pseudo label data representing the teacher model.
Further, the optimization objective learned by the student model is as follows, that is, the calculation of the second loss value may also be:
Figure BDA0003939745060000073
Figure BDA0003939745060000074
where KL represents the KL divergence between the two data distributions.
Further, parameter update of the teacher model is obtained through the parameter EMA of the student model, as follows:
φ p =αφ p-1 +(1-α)θ p
(4)
wherein alpha represents EMA decay rate, phi represents parameters of a teacher model, theta represents parameters of a student model, and p represents the number of iterative training.
Along the use example, a labeled sample set A and an unlabeled sample set B are obtained, the labeled sample set A comprises 100 labeled texts, the unlabeled sample set B comprises 1000 unlabeled texts, the 1000 unlabeled texts are input into a teacher model, the teacher model marks the 1000 unlabeled texts, 1000 pseudo-labeled texts can be obtained, the 1000 pseudo-labeled texts are input into a student model for training, the student model learns by self based on the 1000 pseudo-labeled texts, a prediction result can be generated for each pseudo-labeled text, a loss value can be obtained for each prediction result based on a loss function, and parameters of the student model can be adjusted according to the loss values. And, 100 pieces of labeled text are input into the student model for training. And generating a prediction result for each tagged text, obtaining a loss value for each prediction result based on a loss function, and adjusting parameters of the student model according to the loss values.
The embodiment of the specification adjusts the model parameters of the second sub-model and adjusts the model parameters of the first sub-model based on the first loss value and the second loss value, so that the student model is trained, and the parameter optimization capability of the student model is improved. And parameters of the student model can be transmitted to the teacher model, so that the parameter optimization capability of the teacher model is improved.
The teacher model can be further subjected to parameter adjustment through the loss values of the labeled data based on the teacher model and the student model respectively, and the specific implementation mode is as follows.
Specifically, after the extracting the first labeled text from the labeled sample set, the method further includes:
inputting the first labeled text into the first submodel to obtain a second prediction result;
calculating a third loss value based on the second prediction result;
the adjusting the model parameters of the first submodel includes:
and adjusting the model parameters of the first sub-model according to the target difference value between the first loss value and the third loss value, and returning to execute the step of inputting the unlabeled texts in the unlabeled sample set into the first sub-model to generate a first pseudo-labeled sample set.
In practical applications, the teacher model can predict the labeled data to calculate a loss value through a loss function, the student model can predict the labeled data to calculate a loss value through the loss function, and the progress of the student model is determined according to a difference value between the two loss values, that is, after the difference value between the two loss values is smaller than a certain threshold value, it can be determined that the student is well-learned, and in the case that the difference value between the two loss values is larger than the certain threshold value, the parameters of the student model and the parameters of the teacher model are continuously updated and adjusted. Based on this, the third loss value can also be calculated by equation (1).
For example, the labeled sample set a includes 100 pieces of labeled text, and the 100 pieces of labeled text are input to the teacher model for training. And generating a prediction result for each labeled text, obtaining a loss value for each prediction result based on a loss function, and adjusting parameters of the student model according to the loss values. And 100 pieces of labeled text were entered into the student model for training. And generating a prediction result for each labeled text, obtaining a loss value for each prediction result based on a loss function, and determining a target difference value according to the loss value of the teacher model corresponding to the labeled text 1 and the loss value of the student model corresponding to the labeled text 1. And under the condition that the target difference value does not meet the set threshold value, adjusting the parameters of the student model and the parameters of the teacher model.
It should be noted that, after the parameter adjustment is performed on the student model each time, the parameters of the teacher model can be updated in the EMA manner.
According to the embodiment of the specification, the model parameters of the first sub-model are adjusted according to the target difference value between the first loss value and the third loss value, namely, the student model is guided according to the learning progress of the student model, so that the training degree of the model can be accurately controlled, and the prediction capability of the model is improved.
Further, a pseudo label-free sample may be generated by using the teacher model in the task, and the pseudo label-free sample may be input into a preceding task, which may be referred to as backward knowledge migration, and a specific embodiment is described below.
In an implementable manner, after the obtaining the set of tagged exemplars and the set of unlabeled exemplars, further comprising:
and inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a plurality of pseudo unlabeled samples, wherein the pseudo unlabeled samples are used for training other task models, and the other task models and the first task model execute different tasks.
The pseudo label-free sample can be understood as data which is not marked after passing through the teacher model, for example, the label-free text is 'i watch a movie', and after the label-free text is input into the teacher model, the teacher model outputs 'i watch a movie today'. The other task model may be the same as the architecture of the first task model, e.g., the other task model may include the virtual supervised augmentation solver of the above embodiments.
In practical application, the pseudo label data of the task can be input into the teacher model to obtain data output by the teacher model, which is not marked yet, so that the generated pseudo label-free sample can be transferred from the current task to a previously learned task. It should be noted that the pseudo unlabeled exemplar may be transferred from the current task to the preceding task, or may be transferred to a subsequent task, and the embodiments of the present specification are not limited.
For example, the label sample set B includes 100 unlabeled texts, 1000 unlabeled texts are input into the teacher model, so that the teacher model generates 1000 corresponding pseudo unlabeled samples, and the 1000 pseudo unlabeled samples are used as the unlabeled samples of other task models for training.
To ensure the ability of the teacher model to generate the pseudo unlabeled exemplars, language model optimization objectives of labeled data and unlabeled data need to be performed, as follows:
Figure BDA0003939745060000091
wherein, G t A prompt, which may be referred to as a token, is generated for the t-th task.
Based on the optimization objectives described above, a total optimization objective for the current task can be determined:
Figure BDA0003939745060000092
in the embodiment of the specification, the teacher model in the task generates the pseudo label-free sample, and the pseudo label-free sample can be input into the preorded task, so that the prediction capability of other task models is improved, and the problem of catastrophic forgetting is solved.
Correspondingly, the first task model may also be trained by using a pseudo unlabeled sample generated by the teacher model in other task models, and the specific embodiment is as follows.
In an implementable manner, after the training the first submodel and the second submodel based on the labeled sample set and the first pseudo-labeled sample set and obtaining a trained first task model, the method further includes:
receiving a plurality of pseudo label-free samples output by the second task model, inputting the pseudo label-free samples into the first submodel, and generating a second pseudo label sample set, wherein the second pseudo label sample set comprises pseudo label texts corresponding to the pseudo label-free texts respectively;
extracting a second pseudo label text from the second pseudo label sample set, wherein the second pseudo label text is any one of a plurality of pseudo label texts;
inputting the second pseudo label text into the second submodel, and obtaining a fourth loss value through self-learning of the second submodel;
adjusting model parameters of the second submodel, and adjusting model parameters of the first submodel, based on the fourth loss value.
In practical application, the pseudo label data output by other task models can be acquired, so that the pseudo label-free samples generated by other task models can be transferred from other tasks to the currently learned task.
Further, the backward knowledge migration also has an optimization objective, as follows:
Figure BDA0003939745060000093
wherein D is Mix k And the data of the pseudo unlabeled sample after the backward enhancement of the k-th old task.
For example, the pseudo label-free sample set B obtained from other task models includes 1000 pseudo label-free texts, the 1000 pseudo label-free texts are input into the teacher model, so that the teacher model marks the 1000 pseudo label-free texts, and can obtain 1000 pseudo label texts, and the 1000 pseudo label texts are input into the student model for training, so that the student model self-learns based on the 1000 pseudo label texts, a prediction result is generated for each pseudo label text, a loss value can be obtained for each prediction result based on a loss function, and parameters of the student model can be adjusted according to the loss values. Parameters of the student model can be adjusted according to the loss value.
The pseudo label-free samples generated by the teacher model in other tasks can be input into the task, so that the prediction capability of the current task model is improved, and the problem of catastrophic forgetting is solved.
Further, in order to increase the number of samples, enhancement processing may be performed on the samples, and a specific implementation manner is as follows.
Specifically, before the step of inputting the unlabeled text in the unlabeled sample set into the first submodel and generating a first pseudo-labeled sample set, the method further includes:
modifying the text of the non-label text to generate an enhanced non-label text;
and adding the enhanced unlabeled text to the unlabeled sample set to obtain a supplemented unlabeled text.
The text modification may be modification such as adding or deleting a text, for example, the unlabeled text is "no meal today", and text modification on the unlabeled text results in "no meal today".
In practical application, the number of samples can be increased by modifying the words of the unlabeled text by adding, deleting and the like to obtain sentences similar to the unlabeled text.
For example, the unlabeled sample set B includes 1000 unlabeled texts, text modification is performed on each unlabeled text once to obtain 2000 unlabeled texts, the 2000 unlabeled texts are input to the teacher model, so that the teacher model marks the 2000 unlabeled texts to obtain 2000 pseudo-labeled texts, the 2000 pseudo-labeled texts are input to the student model for training, so that the student model self-learns based on the 2000 pseudo-labeled texts, a prediction result is generated for each pseudo-labeled text, a loss value can be obtained for each prediction result based on a loss function, and parameters of the student model can be adjusted according to the loss value.
The embodiment of the specification enhances the number of samples by enhancing the samples, so that the training is more sufficient, and the parameter optimization effect of the model is improved.
In order to ensure that the pseudo-label-free data generated by the task is beneficial to other task models when training other task models, namely, to ensure that parameters of other task models are better, the pseudo-label-free data generated by the task needs to be screened to obtain the pseudo-label-free data related to the tasks of other task models.
Specifically, after the unlabeled texts in the unlabeled exemplar set are input into the first submodel to generate a plurality of pseudo unlabeled exemplars, the method further includes:
determining text identifications of the plurality of pseudo label-free texts, and matching preset text identifications with the text identifications of the plurality of pseudo label-free texts to obtain matching results, wherein the preset text identifications are the text identifications of the label-free texts in a label-free sample set for training the second task model;
and screening a target pseudo-label-free text matched with the preset text identifier from the plurality of pseudo-label-free texts according to the matching result, wherein the target pseudo-label-free text is used for fine adjustment of the second task model.
The text identifier may be an identifier generated based on a task type corresponding to the text, for example, an identifier for adding a question to "do it watch a movie today".
In practical application, the pseudo label-free data is screened by comparing the identifiers, so that the pseudo label-free data which ensures better parameters of other task models can be obtained. It should be noted that the pseudo unlabeled text may be screened in an identification manner, and the pseudo unlabeled data may be generated by other models based on the pseudo unlabeled data and related to the tasks of other task models. The embodiments of the present specification do not limit the manner in which pseudo-unlabeled data related to tasks of other task models is obtained.
For example, if the number of obtained pseudo non-tag data is 1000, and the task to be performed is a question and answer type, 500 pieces of pseudo non-tag data that are the same are selected from the 1000 pieces of pseudo non-tag data based on comparison between the identifiers of the question and answer type and the identifiers of the 1000 pieces of pseudo non-tag data.
The embodiment of the specification screens the pseudo-label-free data generated by the task to obtain the pseudo-label-free data related to the tasks of other task models, and ensures that the parameter adjustment of other task models is a better direction when the pseudo-label-free data generated by the task is used for training other task models, thereby improving the parameter optimization effect of the models.
Further, in order to ensure that sample data is sufficient, enhancement processing may be performed on the pseudo unlabeled data, and this process may be referred to as backward enhancement, and a specific implementation manner is described below.
In an implementation manner, after the selecting, according to the matching result, a target pseudo unlabeled text that matches the preset text identifier from the plurality of pseudo unlabeled texts, the method further includes:
determining a similar text of the target pseudo-unlabeled text through semantic analysis based on the target pseudo-unlabeled text;
and combining the similar text and the target pseudo label-free text to obtain a combined target pseudo label-free text.
Wherein the similar text may be a text semantically similar to the pseudo-unlabeled text, for example, the unlabeled text is "not wanted to eat today", and the similar text may be "not eaten today".
In actual practice, the pseudo-unlabeled data generated by each learning task is enhanced by retrieving semantically similar unlabeled exemplars from the current task. It should be noted that not only semantically similar unlabeled samples can be retrieved from the current task, but also similar unlabeled samples can be added in a specified manner. The examples in this specification do not limit this.
For example, the pseudo-unlabeled sample set C includes 1000 pseudo-unlabeled samples, each pseudo-unlabeled sample is subjected to one-time retrieval of semantically similar unlabeled samples, 2000 pseudo-unlabeled samples can be obtained, 2000 pseudo-unlabeled samples are input to a teacher model in other task models, so that the teacher model marks the 2000 pseudo-unlabeled samples, 2000 pseudo-labeled texts can be obtained, the 2000 pseudo-labeled texts are input to a student model for training, the student model learns by itself based on the 2000 pseudo-labeled texts, a prediction result is generated for each pseudo-labeled text, a loss value can be obtained for each prediction result based on a loss function, and parameters of the student model can be adjusted according to the loss values.
It should be noted that the initial task models corresponding to different task models have the same model parameters. That is, for different tasks, not only can the same architecture as the first task model be used for training, but also the same initial parameters can be used for training. The first task model in the embodiments of the present disclosure may be used as a module model (adapter model) to be integrated into other models, for example, the first task model may be used in combination with a T5 (Transfer Text-to-Text Transformer) model. The examples in this specification do not limit this. Based on this, parameters specific to the setting of the respective task (adapter model) mitigate the catastrophic forgetting problem in enhanced lifetime learning based on unmarked data. Specifically, the parameters of the base model T5 may be fixed, and only the parameters of the corresponding adapter model are updated when each task is optimized.
The embodiment of the specification provides a text processing method and a text processing device, wherein the text processing method comprises the following steps: acquiring a text to be processed and a first task model for executing a target task; and inputting the text to be processed into the first task model to obtain a task processing result for executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and a non-labeled text, the non-labeled text comprises the non-labeled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks. The first task model is obtained by performing semi-supervised learning on the initial task model by using the labeled text and the unlabelled text, the unlabelled text comprises the unlabelled text which is output by the second task model and is related to the target task, and the second task model and the first task model execute different tasks, so that the first task model is trained by using the unlabelled data of the second task model, better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.
The following will further describe the text processing method by taking the application of the text processing method provided in this specification to a machine question and answer as an example with reference to fig. 3. Fig. 3 is a flowchart illustrating a processing procedure of a machine question answering method according to an embodiment of the present specification, and specifically includes the following steps.
Step 302: and acquiring a question text to be processed and executing a question-answering task model of a question-answering task.
Where the question text to be processed is a question type statement, for example, "is it today read? ". The question-and-answer task may be a task for generating an answer text based on a to-be-processed question text, for example, a to-be-processed question text of "is it today read? ". The answer text is "i don't see book".
For example, in the access of a movie page, the user can interact with the user to improve the speed of understanding the movie by the user, and then the target task can be determined to be a question-answer type. The user inputs the question: "what type of movie is it? ", namely, the question text to be processed is obtained, and the question-answer task model corresponding to the question-answer type is obtained.
Step 304: inputting the question text to be processed into the question-answering task model, and obtaining an answer text corresponding to the question text to be processed, wherein the question-answering task model is obtained by performing semi-supervised learning on an initial task model by using a tagged text and an untagged text, the untagged text comprises untagged texts which are output by other task models and are related to the question-answering task, and the other task models and the question-answering task model execute different tasks.
The labeled text may be sample text that has been labeled, and the unlabeled text may be sample text that has no label. The unlabeled text includes the unlabeled text output by the second task model and related to the question and answer task, and may be understood as that the unlabeled samples include samples which are processed by the teacher model but not marked yet, and the samples are related to the question and answer task, for example, the unlabeled text includes sentences such as "how to look like in the weather today" and "how to look like in the movie". The second task model may be a model obtained by performing semi-supervised learning, and the second task model and the question-answering task model execute different tasks, which may be understood as that the output of the same text by the second task model and the output of the same text by the question-answering task model are inconsistent, that is, the second task model and the question-answering task model are applied in different scenes, for example, the second task model is an emotion classification model.
Following the above example, the user enters the question: "what type of movie is it? ", namely, the text of the question to be processed is obtained, and the task model corresponding to the question and answer type is obtained. After the question-answer task model processes the question text to be processed, the output answer text is 'the movie is of comedy type'.
In the machine question-answering method of the embodiment of the specification, the question-answering task model is obtained by performing semi-supervised learning on the initial task model by using the tagged text and the untagged text, the untagged text comprises the untagged text which is output by the second task model and is related to the question-answering task, and the second task model and the question-answering task model execute different tasks, so that the question-answering task model is trained by using the untagged data of the second task model, better model parameters can be obtained, and more accurate answer text can be obtained under the condition that the question-answering task is executed on the question text to be processed by using the question-answering task model.
An embodiment of the present specification further provides a data processing method of a task model, which is applied to a cloud-side device, and referring to fig. 4, fig. 4 shows a flowchart of the data processing method of the task model provided in an embodiment of the present specification, and specifically includes the following steps.
Step 402: the method comprises the steps of obtaining a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts.
Step 404: inputting the unlabeled texts in the unlabeled sample set into a first sub-model, and generating a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively.
Step 406: and training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain model parameters of the trained first task model.
Step 408: and sending the model parameters of the first task model to a terminal side device.
In one implementation, the training task for the model may be handed over to the cloud device. For example, if a user needs to obtain a question-answer model, a model structure and initial parameters are set in the cloud, and a tag sample set and a non-tag sample set are set. Based on the method, the cloud side equipment acquires a labeled sample set and an unlabeled sample set, inputs unlabeled texts in the unlabeled sample set into the teacher model, generates a pseudo-labeled sample set, and trains the teacher model and the student model based on the labeled sample set and the first pseudo-labeled sample set. Furthermore, the specific training mode is to extract a first labeled text from the labeled sample set, and input the first labeled text into the student model to obtain a first prediction result. Calculating a first loss value based on the first prediction result; extracting a first pseudo label text from a first pseudo label exemplar set; inputting the first pseudo label text into a student model, and obtaining a second loss value through self-learning of the student model; and adjusting the model parameters of the student model and the model parameters of the teacher model based on the first loss value and the second loss value, and returning to the step of extracting the first labeled text from the labeled sample set until a preset training stop condition is reached.
In addition, the cloud equipment inputs the first labeled text into the teacher model to obtain a second prediction result; and calculating a third loss value based on the second prediction result, and adjusting the model parameters of the teacher model according to the target difference value between the first loss value and the third loss value. And returning to the step of inputting the unlabeled texts in the unlabeled sample set into the teacher model to generate a first pseudo-label sample set. And inputting the unlabeled texts in the unlabeled sample set into the teacher model to generate a plurality of pseudo-unlabeled samples.
Further, the cloud device receives a plurality of pseudo label-free samples output by the second task model, inputs the plurality of pseudo label-free samples into the teacher model, generates a second pseudo label sample set, extracts a second pseudo label text from the second pseudo label sample set, inputs the second pseudo label text into the student model, and obtains a fourth loss value through self-learning of the student model; based on the fourth loss value, model parameters of the student model are adjusted, and model parameters of the teacher model are adjusted.
Based on this, after a certain training process is completed, the cloud device can send the parameters of the model to the end-side device, so that the end-side device uses the trained model parameters. In addition, the cloud device can also acquire unlabeled texts in the unlabeled sample set, input the first submodel, generate a plurality of pseudo unlabeled samples, and perform enhancement processing on the data, where the enhancement processing can be operations of adding words and deleting words on the unlabeled texts, so as to add more unlabeled samples. And then the unlabelled samples are sent to the past tasks, and corresponding training tasks are executed.
In the data processing method of the task model in the embodiment of the specification, the training task is processed by the cloud, so that the processing capacity of the cloud-side equipment can be utilized to accelerate the training process, and the training efficiency is improved.
It should be noted that the text to be processed (including but not limited to user device information, user personal information, etc.) and training data (including but not limited to tagged text, untagged text, data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the relevant data need to comply with relevant laws and regulations and standards of relevant countries and regions, and provide corresponding operation entrances for the user to choose to authorize or reject.
Corresponding to the above method embodiment, this specification further provides a text processing apparatus embodiment, and fig. 5 shows a schematic structural diagram of a text processing apparatus provided in an embodiment of this specification. As shown in fig. 5, the apparatus includes:
a sample obtaining module 502 configured to obtain a text to be processed and a first task model for executing a target task;
a model processing module 504 configured to input the text to be processed into the first task model, and obtain a task processing result for executing the target task on the text to be processed, where the first task model is obtained by performing semi-supervised learning on an initial task model using a labeled text and an unlabeled text, the unlabeled text includes an unlabeled text output by a second task model and related to the target task, and the second task model and the first task model execute different tasks.
In one implementation, the model processing module 504 is further configured to:
the initial task model comprises a first submodel and a second submodel;
before the inputting the text to be processed into the first task model and obtaining a task processing result of executing the target task on the text to be processed, the method further includes:
acquiring a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts;
inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively;
and training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain a trained first task model.
In one implementation, the model processing module 504 is further configured to:
extracting a first labeled text from the labeled sample set, wherein the first labeled text is any one of the plurality of labeled texts;
inputting the first labeled text into the second submodel to obtain a first prediction result;
calculating a first loss value based on the first prediction result;
extracting a first pseudo label text from the first pseudo label sample set, wherein the first pseudo label text is any one of a plurality of pseudo label texts;
inputting the first pseudo label text into the second sub-model, and obtaining a second loss value through self-learning of the second sub-model;
and adjusting the model parameters of the second submodel and the first submodel based on the first loss value and the second loss value, and returning to execute the step of extracting the first labeled text from the labeled sample set until a preset training stopping condition is reached to obtain a trained first task model.
In one implementation, the model processing module 504 is further configured to:
inputting the first labeled text into the first submodel to obtain a second prediction result;
calculating a third loss value based on the second prediction result;
the adjusting the model parameters of the first submodel includes:
and adjusting the model parameters of the first submodel according to the target difference value between the first loss value and the third loss value, and returning to execute the step of inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a first pseudo-labeled sample set.
In one implementation, the model processing module 504 is further configured to:
and inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a plurality of pseudo unlabeled samples, wherein the pseudo unlabeled samples are used for training other task models, and the other task models and the first task model execute different tasks.
In one implementation, the model processing module 504 is further configured to:
receiving a plurality of pseudo label-free samples output by the second task model, inputting the pseudo label-free samples into the first submodel, and generating a second pseudo label sample set, wherein the second pseudo label sample set comprises pseudo label texts corresponding to the pseudo label-free texts respectively;
extracting a second pseudo label text from the second pseudo label sample set, wherein the second pseudo label text is any one of a plurality of pseudo label texts;
inputting the second pseudo label text into the second sub-model, and obtaining a fourth loss value through self-learning of the second sub-model;
adjusting model parameters of the second submodel, and adjusting model parameters of the first submodel, based on the fourth loss value.
In one implementation, the model processing module 504 is further configured to:
modifying the text of the non-label text to generate an enhanced non-label text;
and adding the enhanced unlabeled text to the unlabeled sample set to obtain a supplemented unlabeled text.
In one implementation, the model processing module 504 is further configured to:
determining text identifications of the plurality of pseudo label-free texts, and matching preset text identifications with the text identifications of the plurality of pseudo label-free texts to obtain matching results, wherein the preset text identifications are the text identifications of the label-free texts in a label-free sample set for training the second task model;
and screening a target pseudo-label-free text matched with the preset text identifier from the plurality of pseudo-label-free texts according to the matching result, wherein the target pseudo-label-free text is used for fine adjustment of the second task model.
In one implementation, the model processing module 504 is further configured to:
determining a similar text of the target pseudo-unlabeled text through semantic analysis based on the target pseudo-unlabeled text;
and combining the similar text and the target pseudo-no-label text to obtain a combined target pseudo-no-label text.
The embodiment of the specification provides a text processing method and a text processing device, wherein the text processing device comprises: acquiring a text to be processed and a first task model for executing a target task; inputting the text to be processed into the first task model, and obtaining a task processing result of executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabelled text, the unlabelled text comprises the unlabelled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks. The first task model is obtained by performing semi-supervised learning on the initial task model by using a labeled text and a non-labeled text, the non-labeled text comprises a non-labeled text which is output by the second task model and is related to a target task, and the second task model and the first task model execute different tasks, so that the first task model is trained by using the non-labeled data of the second task model, better model parameters can be obtained, and more accurate results can be obtained under the condition that the target task is executed on the text to be processed by using the first task model.
The above is a schematic scheme of a text processing apparatus of the present embodiment. It should be noted that the technical solution of the text processing apparatus and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the text processing apparatus can be referred to the description of the technical solution of the text processing method.
FIG. 6 illustrates a block diagram of a computing device 600 provided in accordance with one embodiment of the present description. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is coupled to the memory 610 via a bus 630 and a database 650 is used to store data.
Computing device 600 also includes access device 640, access device 640 enabling computing device 600 to communicate via one or more networks 660. Examples of such networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The Access device 640 may include one or more of any type of Network interface (e.g., a Network interface controller) that may be wired or Wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) Wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular Network interface, a bluetooth interface, near Field Communication (NFC), or any other type of Network interface card, for example.
In one embodiment of the present description, the above-described components of computing device 600, as well as other components not shown in FIG. 6, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 6 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 600 may be any type of stationary or mobile computing device, including a mobile Computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop Computer or Personal Computer (PC). Computing device 600 may also be a mobile or stationary server.
Wherein the processor 620 is configured to execute computer-executable instructions that, when executed by the processor, implement the steps of the data processing method described above. The foregoing is a schematic diagram of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the text processing method.
An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which when executed by a processor implement the steps of the above-mentioned text processing method.
The above is an illustrative scheme of a computer-readable storage medium of the embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the text processing method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the text processing method.
An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the text processing method.
The above is an illustrative scheme of a computer program of the present embodiment. It should be noted that the technical solution of the computer program and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the computer program can be referred to the description of the technical solution of the text processing method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for an embodiment of the specification.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.

Claims (14)

1. A method of text processing, comprising:
acquiring a text to be processed and a first task model for executing a target task;
inputting the text to be processed into the first task model, and obtaining a task processing result of executing the target task on the text to be processed, wherein the first task model is obtained by performing semi-supervised learning on an initial task model by using a labeled text and an unlabelled text, the unlabelled text comprises the unlabelled text which is output by a second task model and is related to the target task, and the second task model and the first task model execute different tasks.
2. The method of claim 1, the initial task model comprising a first sub-model and a second sub-model;
before the text to be processed is input into the first task model and a task processing result of the target task executed on the text to be processed is obtained, the method further includes:
acquiring a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts;
inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively;
and training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain a trained first task model.
3. The method of claim 2, the training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain a trained first task model, comprising:
extracting a first labeled text from the labeled exemplar set, wherein the first labeled text is any one of the plurality of labeled texts;
inputting the first labeled text into the second submodel to obtain a first prediction result;
calculating a first loss value based on the first prediction result;
extracting a first pseudo label text from the first pseudo label sample set, wherein the first pseudo label text is any one of a plurality of pseudo label texts;
inputting the first pseudo label text into the second sub-model, and obtaining a second loss value through self-learning of the second sub-model;
and adjusting the model parameters of the second submodel and the first submodel based on the first loss value and the second loss value, and returning to execute the step of extracting the first labeled text from the labeled sample set until a preset training stopping condition is reached to obtain a trained first task model.
4. The method of claim 3, further comprising, after said extracting first tagged text from said set of tagged exemplar text:
inputting the first labeled text into the first submodel to obtain a second prediction result;
calculating a third loss value based on the second prediction result;
the adjusting the model parameters of the first submodel includes:
and adjusting the model parameters of the first submodel according to the target difference value between the first loss value and the third loss value, and returning to execute the step of inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a first pseudo-labeled sample set.
5. The method of claim 2, further comprising, after said obtaining a set of labeled exemplars and a set of unlabeled exemplars:
and inputting the unlabeled texts in the unlabeled sample set into the first submodel to generate a plurality of pseudo unlabeled samples, wherein the pseudo unlabeled samples are used for training other task models, and the other task models and the first task model execute different tasks.
6. The method of claim 2, further comprising, after said training the first submodel and the second submodel based on the set of labeled samples and the first set of pseudo-labeled samples to obtain a trained first task model:
receiving a plurality of pseudo label-free samples output by the second task model, inputting the pseudo label-free samples into the first submodel, and generating a second pseudo label sample set, wherein the second pseudo label sample set comprises pseudo label texts corresponding to the pseudo label-free texts respectively;
extracting a second pseudo label text from the second pseudo label sample set, wherein the second pseudo label text is any one of a plurality of pseudo label texts;
inputting the second pseudo label text into the second sub-model, and obtaining a fourth loss value through self-learning of the second sub-model;
adjusting model parameters of the second submodel, and adjusting model parameters of the first submodel, based on the fourth loss value.
7. The method of any of claims 2 to 6, further comprising, prior to said entering unlabeled text in the unlabeled exemplar set into the first submodel, generating a first pseudo-labeled exemplar set:
modifying the text of the non-label text to generate an enhanced non-label text;
and adding the enhanced unlabeled text to the unlabeled sample set to obtain a supplemented unlabeled text.
8. The method of claim 5 or 6, further comprising, after said entering unlabeled text in the set of unlabeled exemplars into the first submodel, generating a plurality of pseudo unlabeled exemplars:
determining text identifications of the plurality of pseudo label-free texts, and matching preset text identifications with the text identifications of the plurality of pseudo label-free texts to obtain a matching result, wherein the preset text identifications are the text identifications of the label-free texts in the label-free sample set for training the second task model;
and screening a target pseudo-label-free text matched with the preset text identifier from the plurality of pseudo-label-free texts according to the matching result, wherein the target pseudo-label-free text is used for fine adjustment of the second task model.
9. The method according to claim 8, further comprising, after the target pseudo unlabeled text matching the preset text identifier is obtained by filtering from the plurality of pseudo unlabeled texts according to the matching result, the method further comprising:
determining a similar text of the target pseudo-unlabeled text through semantic analysis based on the target pseudo-unlabeled text;
and combining the similar text and the target pseudo label-free text to obtain a combined target pseudo label-free text.
10. A method according to any one of claims 2 to 6, wherein the initial task models for different task models have the same model parameters.
11. A machine question-answering method, comprising:
acquiring a text of a question to be processed and a question and answer task model for executing a question and answer task;
inputting the question text to be processed into the question-answering task model, and obtaining an answer text corresponding to the question text to be processed, wherein the question-answering task model is obtained by performing semi-supervised learning on an initial task model by using a tagged text and an untagged text, the untagged text comprises untagged texts which are output by other task models and are related to the question-answering task, and the other task models and the question-answering task model execute different tasks.
12. A data processing method of a task model is applied to cloud-side equipment and comprises the following steps:
acquiring a labeled sample set and an unlabeled sample set, wherein the labeled sample set comprises a plurality of labeled texts, and the unlabeled sample set comprises a plurality of unlabeled texts;
inputting the unlabeled texts in the unlabeled sample set into a first sub-model, and generating a first pseudo-labeled sample set, wherein the first pseudo-labeled sample set comprises pseudo-labeled texts corresponding to the plurality of unlabeled texts respectively;
training the first sub-model and the second sub-model based on the labeled sample set and the first pseudo-labeled sample set to obtain model parameters of a first trained task model;
sending model parameters of the first task model to an end-side device.
13. A computing device, comprising:
a memory and a processor;
the memory is for storing computer-executable instructions, and the processor is for executing the computer-executable instructions, which when executed by the processor, implement the steps of the method of any one of claims 1 to 12.
14. A computer-readable storage medium storing computer-executable instructions which, when executed by a processor, implement the steps of the method of any one of claims 1 to 12.
CN202211415341.6A 2022-11-11 2022-11-11 Text processing method and device Pending CN115757723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211415341.6A CN115757723A (en) 2022-11-11 2022-11-11 Text processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211415341.6A CN115757723A (en) 2022-11-11 2022-11-11 Text processing method and device

Publications (1)

Publication Number Publication Date
CN115757723A true CN115757723A (en) 2023-03-07

Family

ID=85369948

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211415341.6A Pending CN115757723A (en) 2022-11-11 2022-11-11 Text processing method and device

Country Status (1)

Country Link
CN (1) CN115757723A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431316A (en) * 2023-06-06 2023-07-14 阿里巴巴(中国)有限公司 Task processing method, system, platform and automatic question-answering method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431316A (en) * 2023-06-06 2023-07-14 阿里巴巴(中国)有限公司 Task processing method, system, platform and automatic question-answering method
CN116431316B (en) * 2023-06-06 2023-11-14 阿里巴巴(中国)有限公司 Task processing method, system, platform and automatic question-answering method

Similar Documents

Publication Publication Date Title
CN110795552B (en) Training sample generation method and device, electronic equipment and storage medium
CN113127624B (en) Question-answer model training method and device
CN113254599A (en) Multi-label microblog text classification method based on semi-supervised learning
CN110633730A (en) Deep learning machine reading understanding training method based on course learning
CN110457585B (en) Negative text pushing method, device and system and computer equipment
CN113536801A (en) Reading understanding model training method and device and reading understanding method and device
CN113159187B (en) Classification model training method and device and target text determining method and device
CN114090776A (en) Document analysis method, system and device
CN116050405A (en) Text processing, question-answer text processing and text processing model training method
CN114297399A (en) Knowledge graph generation method, knowledge graph generation system, storage medium and electronic equipment
CN110852071B (en) Knowledge point detection method, device, equipment and readable storage medium
CN116595026A (en) Information inquiry method
CN115757723A (en) Text processing method and device
CN114120342A (en) Resume document identification method and device, computing device and storage medium
CN113961686A (en) Question-answer model training method and device, question-answer method and device
CN112015903B (en) Question duplication judging method and device, storage medium and computer equipment
CN114077655A (en) Method and device for training answer extraction model
CN111897955A (en) Comment generation method, device and equipment based on coding and decoding and storage medium
CN115730607A (en) Dialogue detection model training method and device
CN115617959A (en) Question answering method and device
CN114003706A (en) Keyword combination generation model training method and device
CN113535946A (en) Text identification method, device and equipment based on deep learning and storage medium
CN113536808A (en) Reading understanding test question difficulty automatic prediction method introducing multiple text relations
CN113792120A (en) Graph network construction method and device and reading understanding method and device
CN115617961A (en) Question answering method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination