Active learning method and system based on ternary loss language model

By introducing a ternary loss language model into the active learning method, combining language representation and task characteristics, the problem of difficulty in sample selection in relation extraction tasks is solved, and more efficient sample selection and better model performance is achieved.

CN119848486AInactive Publication Date: 2025-04-18GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510024419.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-04-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing active learning methods face problems such as unbalanced distribution of multi-category relationship categories, diverse sentence monetization, limited model judgment ability and difficulty in dealing with negative samples in relation extraction tasks, resulting in difficulty and high cost of sample selection.

Method used

The active learning method based on the ternary loss language model is adopted, and the language representation and task characteristics are obtained by training downstream task models, and the integrated features are scored in combination with the target task loss and the ternary loss. The integrated features that meet the preset filtering conditions are selected as the label data until they meet the preset training requirements.

Benefits of technology

The task-independent active learning method is realized, the quality and diversity of sample selection is improved, the cost of data annotation is reduced, the model performance is improved, and it is suitable for different natural language processing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848486A_ABST
    Figure CN119848486A_ABST
Patent Text Reader

Abstract

The invention provides an active learning method and system based on a ternary loss language model. Comprises: training a downstream task model; wherein the downstream task model at least comprises a language model encoder and a task classifier; then, based on the unlabeled data, obtaining language representations and task features corresponding to the language model encoder and the task classifier, and splicing the language representations and the task features to obtain integrated features; and further scoring the integrated features based on the target task loss and the ternary loss to obtain a plurality of integrated features meeting a preset screening condition, taking the integrated features as annotation data to continue to train a downstream task model, and outputting a final downstream task model until the integrated features meet a preset training requirement. According to the method, better model performance can be obtained by using less annotation data, the labor cost of data annotation is reduced, and an efficient active learning technology is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to an active learning method, and in particular to an active learning method and system based on a ternary loss language model, belonging to the technical field of active learning. Background Art

[0002] In today's era of rapid information dissemination, the news industry is in a stage of rapid development. With the rise of social media, news websites and mobile applications, the way people obtain and share news has changed dramatically. However, with the explosive growth of information, it has become increasingly difficult to accurately extract and understand key information from massive news texts. Especially when faced with a large amount of news content from different sources, languages ​​and formats, how to effectively extract and enhance the relationship between news has become an important challenge.

[0003] If traditional relationship extraction methods are used, a large amount of manually annotated training data is required to learn when extracting relationships from news texts. The cost of annotated data and labor costs will be greatly increased. In fact, in most news text acquisitions, the number of news is huge and there are many important differences in different stylistic features. Many traditional relationship extraction methods extract relationships through rules or feature engineering, which is not easy to migrate to different information sources and the cost is immeasurable. There are some problems with existing active learning methods: 1) The relationship categories of relationship extraction data sets are usually very large and the distribution is unbalanced. This brings difficulties to methods based on uncertainty sampling, which tend to sample data of major categories. 2) Sentences expressing the same relationship are diverse, requiring the model to have strong semantic understanding capabilities. The model's judgment ability is still limited, which brings difficulties to sample selection. 3) Many sentences do not express any relationship between given entity pairs, but it is difficult for the model to judge these "negative samples". Simply relying on model output may ignore these irrelevant sentences, but they also contain information. Summary of the invention

[0004] In view of this, the present application provides an active learning method and system based on a ternary loss language model to solve or alleviate the technical problems existing in the prior art and at least provide a beneficial option.

[0005] The technical solution of the embodiment of the present application is implemented as follows: an active learning method based on a ternary loss language model, comprising the following steps:

[0006] S100: training a downstream task model; wherein the downstream task model includes at least a language model encoder and a task classifier.

[0007] S200: Acquire language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and concatenate the language representation and task features to obtain integrated features.

[0008] S300: Score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to S100 as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

[0009] Further preferably, before executing step S100, the method includes:

[0010] The unlabeled data x=(x1,x2,…,x l ) is input into the pre-trained language model; wherein l is the length of the unlabeled data.

[0011] Further preferably: the step S100 includes:

[0012] Based on the pre-trained language model after inputting unlabeled data x, and based on the labeled data Train the language model encoder and task classifier.

[0013] Further preferably, the acquiring of the language representation in step S200 includes:

[0014] According to the weight parameter θ e Encode the unlabeled data x into the pre-trained language model to obtain the language representation s(x,θ e ).

[0015] Further preferably, the step S200 of acquiring task features includes:

[0016] The probability distribution of the target label is defined based on the language representation s to obtain the task feature f(x,θ c )=softmax(h C ·W C +b C ); wherein the unlabeled data x and weight parameter θ C =(W,b),f(x,θ c ) is the probability vector assigned to the candidate labels, h C It is the hidden state representation of the last layer of the task classifier.

[0017] Further preferably, the step S300 further includes calculating the target task loss, including:

[0018] Obtain the predicted label through the task classifier And according to the predicted label Calculate target task loss

[0019] Further preferably, the step S300 further includes calculating the ternary loss, including:

[0020] Construct a triplet loss language model triplet to obtain a triplet loss based on the triplet loss language model triplet in, is the anchor sample, are positive samples with the same predicted label, are negative samples with different predicted labels, m is a predetermined interval, and D is the Euclidean distance between sample representations.

[0021] Further preferably, the step S300 of obtaining the labeled data includes:

[0022] Based on the target task loss L target and the ternary loss L triplet Get the final loss L final =L target +λL triplet , and the final loss L final Scoring is performed to obtain multiple integrated features that meet the preset screening conditions as labeled data.

[0023] Further preferably: the step S300 further includes:

[0024] The multiple integrated features that meet the preset screening conditions are deleted from the unlabeled data x.

[0025] Furthermore, the present application also provides a system for an active learning method based on a ternary loss language model, comprising:

[0026] A training module is used to train a downstream task model; wherein the downstream task model includes at least a language model encoder and a task classifier.

[0027] The acquisition module is used to acquire the language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and to concatenate the language representation and task features to obtain integrated features.

[0028] The learning module is used to score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to the training module as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

[0029] The embodiment of the present application adopts the above technical solution, which has the following advantages:

[0030] This application implements a task-independent active learning method that can be applied to different natural language processing tasks, improving the applicability and scalability of active learning. By combining the language representation of the pre-trained language model with the task features, the quality of sample selection is improved, avoiding reliance on immature task models. By considering the integrated features using the ternary loss, it is possible to select samples that meet the requirements and improve the diversity of samples. The batch selection method is used to improve the sampling efficiency of active learning, making it more suitable for practical applications.

[0031] In general, this application solution can help obtain better model performance using less labeled data, reduce the labor cost of data labeling, and provide an efficient active learning technology.

[0032] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0034] Figure 1 This is a flowchart of the active learning method based on the ternary loss language model described in this application.

[0035] Figure 2 To adopt Figure 1 System framework diagram of the active learning method based on the ternary loss language model. DETAILED DESCRIPTION

[0036] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0037] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0038] like Figure 1 As shown, the embodiment of the present application provides an active learning method based on a ternary loss language model, comprising the following steps:

[0039] S100: training a downstream task model; wherein the downstream task model includes at least a language model encoder and a task classifier.

[0040] In this embodiment, specifically, before executing step S100, the following steps are included:

[0041] The unlabeled data x=(x1,x2,…,x l ) is input into the pre-trained language model; wherein l is the length of the unlabeled data.

[0042] In this embodiment, specifically: step S100 includes:

[0043] Based on the pre-trained language model after inputting unlabeled data x, and based on the labeled data Train the language model encoder and task classifier.

[0044] S200: Acquire language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and concatenate the language representation and task features to obtain integrated features.

[0045] In this embodiment, specifically: the acquiring language representation in step S200 includes:

[0046] According to the weight parameter θ e Encode the unlabeled data x into the pre-trained language model to obtain the language representation e

[0047] s(x,θ).

[0048] In this embodiment, specifically: the step S200 of acquiring task features includes:

[0049] The probability distribution of the target label is defined based on the language representation s to obtain the task feature f(x,θ c )=softmax(h C ·W C +b C ); wherein the unlabeled data x and weight parameter θ C =(W,b),f(x,θ c ) is the probability vector assigned to the candidate labels, h C It is the hidden state representation of the last layer of the task classifier.

[0050] S300: Score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to S100 as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

[0051] In this embodiment, specifically: step S300 further includes calculating the target task loss, including:

[0052] Obtain the predicted label through the task classifier And according to the predicted label Calculate target task loss

[0053] Among them, it should be noted that the target task loss L target It refers to the error made by the task classifier when predicting the true label of the labeled data; for example, in a sentence classification task, the target task loss can be the cross entropy loss, which reflects the degree of difference between the model's predicted probability distribution of the sample category and the actual category label.

[0054] In this embodiment, specifically: step S300 further includes calculating the ternary loss, including:

[0055] Construct a triplet loss language model triplet to obtain a triplet loss based on the triplet loss language model triplet in, is the anchor sample, are positive samples with the same predicted label, are negative samples with different predicted labels, m is a predetermined interval, and D is the Euclidean distance between sample representations.

[0056] Among them, in the task-independent triplet loss active learning method based on the pre-trained language model, in addition to the target task loss, the triplet loss is introduced to improve the deficiencies of sample selection and batch diversity. The triplet loss is a structured loss function that optimizes the learning of the model by comparing the relative distances of three samples (an anchor sample, a positive sample, and a negative sample) in the feature space. In the unlabeled data pool, the constructed triplet should satisfy the following constraint: the distance between the anchor sample and the positive sample with the same label should be smaller than the distance between the anchor sample and the negative sample with a different label. The formula is expressed as in is the anchor sample, is a positive sample with the same label, are negative samples with different labels, and m is a predetermined interval.

[0057] In this embodiment, specifically: the step S300 of obtaining the labeled data includes:

[0058] Based on the target task loss L target and the ternary loss L triplet Get the final loss L final =L target +λL triplet, and the final loss L final Scoring is performed to obtain multiple integrated features that meet the preset screening conditions as labeled data.

[0059] Among them, a task-independent triplet loss method is proposed. It does not rely solely on the final loss value, but uses triplet constraints to select difficult samples with similar features but difficult to determine labels, thereby enhancing the diversity of batch samples while ensuring the amount of information. Under the triplet loss framework, sample selection is based on the principle that the distance between the anchor sample and the same category sample (positive sample) should be smaller than the distance between the anchor sample and the different category sample (negative sample). According to the final loss L of the sample final Select k sample batches with the largest amount of information and obvious distinction from each other:

[0060] After constructing the final loss, according to L of all unlabeled samples final Scoring, select the k samples with the highest scores (i.e., the integrated features) to form a batch; considering L triplet , the selected batch of samples are clearly distinguished from each other in the feature space, have a large amount of information, and avoid selecting redundant samples.

[0061] In this embodiment, specifically: the step S300 further includes:

[0062] The multiple integrated features that meet the preset screening conditions are deleted from the unlabeled data x.

[0063] Among them, query the true label of the selected sample batch, and let this batch of newly labeled samples represent the dataset D l , from the unlabeled dataset D u Delete the batch of samples from . Fine-tune the language model encoder and task classifier using the newly annotated data, and repeat the above steps until the label budget is exhausted (optionally, the label budget is set to 10 times).

[0064] The unlabeled data set includes a set of multiple unlabeled data x.

[0065] In summary, after multiple rounds of sample selection, labeling, and model updating, this application has constructed a labeled data set with larger information content and wider distribution from an initial small amount of labeled data; the downstream task model trained on this labeled data set can achieve better performance than the model trained using only an initial small amount of labeled data; experiments on the relationship extraction task of news text show that the model trained by this method can achieve higher accuracy or F1 value than the model trained by only selecting samples using random sampling or other active learning methods.

[0066] Further, such as Figure 2As shown, the present application also provides a system for an active learning method based on a ternary loss language model, comprising:

[0067] A training module is used to train a downstream task model; wherein the downstream task model includes at least a language model encoder and a task classifier.

[0068] In some embodiments, it is necessary to first convert the unlabeled data x=(x1, x2, …, x l ) is input into the pre-trained language model; wherein l is the length of the unlabeled data.

[0069] Furthermore, based on the pre-trained language model after inputting the unlabeled data x, and according to the labeled data D l 0Train the language model encoder and task classifier.

[0070] The acquisition module is used to acquire the language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and to concatenate the language representation and task features to obtain integrated features.

[0071] In some embodiments, according to the weight parameter θ e Encode the unlabeled data x into the pre-trained language model to obtain the language representation s(x,θ e ).

[0072] Furthermore, the probability distribution of the target label is defined based on the language representation s to obtain the task feature f(x,θ c )=softmax(h C ·W C +b C ); wherein the unlabeled data x and weight parameter θ C =(W,b),f(x,θ c ) is the probability vector assigned to the candidate labels, h C It is the hidden state representation of the last layer of the task classifier.

[0073] The learning module is used to score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to the training module as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

[0074] In some embodiments, the predicted label is obtained by the task classifier And according to the predicted label Calculate target task loss

[0075] Further, a triplet loss language model triplet is constructed to obtain a triplet loss based on the triplet loss language model triplet. in, is the anchor sample, are positive samples with the same predicted label, are negative samples with different predicted labels, m is a predetermined interval, and D is the Euclidean distance between sample representations.

[0076] Furthermore, based on the target task loss L target and the ternary loss L triplet Get the final loss L final =L target +λL triplet , and the final loss L final Scoring is performed to obtain multiple integrated features that meet the preset screening conditions as labeled data.

[0077] Furthermore, the plurality of integrated features satisfying the preset screening conditions are deleted from the unlabeled data x.

[0078] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An active learning method based on a ternary loss language model, characterized in that: The following steps are involved: S100: training a downstream task model; wherein the downstream task model at least includes a language model encoder and a task classifier; S200: Acquire language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and concatenate the language representation and task features to obtain integrated features; S300: Score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to S100 as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

2. The active learning method based on the ternary loss language model according to claim 1, characterized in that: Before executing step S100, the process includes: The unlabeled data x=(x1,x2,…,x l ) is input into the pre-trained language model; wherein l is the length of the unlabeled data.

3. The active learning method based on the ternary loss language model according to claim 2, characterized in that: The step S100 includes: Based on the pre-trained language model after inputting unlabeled data x, and based on the labeled data D l 0Train the language model encoder and task classifier.

4. The active learning method based on the ternary loss language model according to claim 3, characterized in that: The acquiring of the language representation in step S200 includes: According to the weight parameter θ e Encode the unlabeled data x into the pre-trained language model to obtain the language representation e s(x,θ).

5. The active learning method based on the ternary loss language model according to claim 4, characterized in that: The step S200 of acquiring task features includes: The probability distribution of the target label is defined based on the language representation s to obtain the task feature f(x,θ c )=softmax(h C ·W C +b C ); wherein the unlabeled data x and weight parameter θ C =(W,b),f(x,θ c ) is the probability vector assigned to the candidate labels, h C It is the hidden state representation of the last layer of the task classifier.

6. The active learning method based on the ternary loss language model according to claim 5, characterized in that: The step S300 also includes calculating the target task loss, including: Obtain the predicted label through the task classifier And according to the predicted label Calculate target task loss 7. The active learning method based on the ternary loss language model according to claim 6, characterized in that: The step S300 also includes calculating the ternary loss, including: Construct a triplet loss language model triplet to obtain a triplet loss based on the triplet loss language model triplet in, is the anchor sample, are positive samples with the same predicted label, are negative samples with different predicted labels, m is a predetermined interval, and D is the Euclidean distance between sample representations.

8. The active learning method based on the ternary loss language model according to claim 7, characterized in that: The step S300 of obtaining the labeled data includes: Based on the target task loss L target and the ternary loss L triplet Get the final loss L final =L target +λL triplet , and the final loss L final Scoring is performed to obtain multiple integrated features that meet the preset screening conditions as labeled data.

9. The active learning method based on the ternary loss language model according to claim 8, characterized in that: The step S300 further includes: The multiple integrated features that meet the preset screening conditions are deleted from the unlabeled data x.

10. A system using the active learning method based on the ternary loss language model as described in any one of claims 1 to 9, characterized in that: include: A training module, used for training a downstream task model; wherein the downstream task model comprises at least a language model encoder and a task classifier; An acquisition module, used for acquiring language representation and task features corresponding to the language model encoder and the task classifier based on unlabeled data, and concatenating the language representation and task features to obtain integrated features; The learning module is used to score the integrated features based on the target task loss and the ternary loss to obtain multiple integrated features that meet the preset screening conditions, and return them to the training module as labeled data until the integrated features meet the preset training requirements, and then output the final downstream task model.

Citation Information

Patent Citations

  • Robust multi-mode active learning method based on pre-training language model

    CN115221947A

  • Domain-invariant feature-based meta-knowledge fine-tuning method and platform

    WO2022151553A1