Knowledge acquisition-oriented active learning method

By comprehensively considering the query function of uncertainty, momentum, variance and loss value indicators, the problem of sample selection monotonicity and generalization ability in existing active learning methods is solved, and sample diversity and model generalization ability are realized Improve, improve the performance of knowledge acquisition tasks.

CN119294469APending Publication Date: 2025-01-10INST OF COMPUTING TECH CHINESE ACAD OF SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411219818.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

Existing active learning methods have problems such as monotonicity of sample selection, lack of sample diversity and limited generalization ability when selecting samples. Especially when noisy data or outliers exist, the model may over-focus on samples with high uncertainty. Ignoring valuable samples leads to reduced model generalization capabilities and accuracy.

Method used

Using a query function that comprehensively considers uncertainty, momentum, variance and loss value indicators, the value quantization value of each unlabeled sample is weighted and calculated, and the valuable samples of the model are selected and the samples that are valuable are marked through multiple iterative training. Optimize the sample selection process to ensure sample diversity and model generalization capabilities.

Benefits of technology

Effectively avoid the similarity of sample selection, optimize the sample selection process, improve the generalization ability and accuracy of the model, enhance the training efficiency, ensure that the model pays more attention to valuable representative samples, thereby improving the knowledge acquisition task performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294469A_ABST
    Figure CN119294469A_ABST
Patent Text Reader

Abstract

The invention provides a knowledge acquisition-oriented active learning method, which is used for performing multiple iterative training on a knowledge acquisition model, and each iteration comprises the following steps: acquiring a first training set with a plurality of labeled samples and a candidate data set with a plurality of unlabeled samples, each sample being a piece of text data, and each candidate data set being a candidate data set with a plurality of unlabeled samples; the label is a knowledge category label set for the sample in the knowledge acquisition task; a preset query function is obtained, the function is used for calculating a value quantized value of the sample to the training model, the value quantized value of the sample is a weighted sum of a preset uncertainty index and a plurality of preset indexes, and the plurality of preset indexes comprise any two or three of a momentum index, a variance index and a loss value index; selecting valuable samples according to value quantized values of a plurality of samples which are not labeled with labels and calculated by utilizing a query function, labeling the valuable samples, and adding the labeled samples to the first training set to obtain a second training set; and performing knowledge category prediction according to the text data by using the second training set training model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge acquisition, in particular to the field of active learning of neural network models, and more particularly to an active learning method for knowledge acquisition. Background Art

[0002] Active learning methods play a vital role in the application field of knowledge acquisition. As an important branch in the field of machine learning, active learning aims to optimize the strategy of sample selection during the learning process to reduce the cost of annotation and improve the performance of the model. The performance of active learning plays a vital role in various applications of machine learning, especially in those cases where labeled data is scarce or the cost of annotation is high. By intelligently selecting the most valuable data samples to be labeled, the active learning strategy can significantly improve the learning efficiency and final performance of the model. Moreover, it can also reduce the amount of manual annotation work required. Since the query function in active learning directly determines which data will be selected for annotation, it affects the efficiency and effectiveness of the entire learning process. Therefore, the core component in active learning is the query function.

[0003] At present, the query functions of active learning methods in the field of knowledge acquisition are mainly uncertainty sampling and its variants. Such methods are usually simple, effective and computationally light. The uncertainty sampling strategy is typically represented by the Least Confidence (LC) strategy. When the prior art implements the LC strategy, the model evaluates its level of certainty in sample classification, and usually uses the probability distribution predicted by the model as the basis for quantifying uncertainty. Specifically, for each sample x to be labeled, the model estimates the conditional probability distribution over all possible categories y. The LC strategy selects samples by maximizing the prediction uncertainty of the model. The LC strategy is mathematically expressed as follows:

[0004] ,

[0005] in, represents the maximum value of the predicted probabilities of all possible categories, that is, the predicted probability of the category that the model considers to be the most likely. The value increases, the model is more accurate for samples The higher the forecast uncertainty.

[0006] The core idea of ​​the above strategy is to prioritize the samples whose predictions the model is least confident about, so as to obtain the maximum model performance improvement at the minimum annotation cost. Although this LC strategy enables the model to learn efficiently to a certain extent and is popular because of its intuitiveness and ease of implementation, it also has the following obvious shortcomings:

[0007] 1) Monotonicity of sample selection: The LC strategy tends to select samples that the model is most uncertain about, and these samples may be concentrated in a specific area of ​​the data distribution. This bias may cause the model to ignore other important areas in the data distribution, resulting in the selected samples being unable to fully represent the entire data distribution, which has a negative impact on the generalization ability of the model.

[0008] 2) Lack of sample diversity: LC strategies tend to repeatedly select instances similar to the selected samples, which may cause some categories or features to be over-represented in the training dataset, while other categories or features are ignored. This convergent selection method weakens the diversity of the dataset, which may cause the model to overfit to a specific type of sample and reduce the model's ability to adapt to new samples.

[0009] 3) Limited generalization ability: Since the LC strategy is mainly based on the current uncertainty of the model, it may repeatedly select samples that the model considers difficult, and these samples may be noise data or outliers. Excessive attention to these samples may cause the model to predict extremely unconfidently, and will ignore those typical samples that contribute more to model improvement, thereby limiting the breadth and depth of knowledge learned by the model and affecting the model's generalization ability on a wider range of data.

[0010] Therefore, the problems with existing active learning methods include: 1. The multiple samples actively selected for learning are similar, resulting in a lack of diversity in the training data set, thereby reducing the generalization ability of the model; 2. When there are abnormal samples with noise data or outliers, the quantitative index of their uncertainty will usually be higher, causing the model to focus too much on learning abnormal samples and ignore samples that contribute more to the training model, further reducing the generalization ability of the model and reducing the accuracy of the model.

[0011] It should be noted that this background technology is only used to introduce the relevant information of the present invention to help understand the technical solution of the present invention, but it does not mean that the relevant information is necessarily the prior art. If there is no evidence that the relevant information has been disclosed before the application date of the present invention, the relevant information shall not be regarded as the prior art. Summary of the invention

[0012] Therefore, the purpose of the present invention is to overcome the defects of the prior art and provide an active learning method for knowledge acquisition.

[0013] The objective of the present invention is achieved through the following technical solutions:

[0014] According to a first aspect of the present invention, there is provided an active learning method for knowledge acquisition, which is used to perform one or more rounds of training on a knowledge acquisition model, wherein each round performs multiple iterative training, and each iterative training is performed in the following manner:

[0015] A first training set and a candidate data set are obtained, wherein the first training set includes a plurality of labeled samples, and the candidate data set includes a plurality of unlabeled samples, each sample being a piece of text data, and the label being a knowledge category label set for the text data in the knowledge acquisition task; a preset query function is obtained, wherein the query function is used to calculate the quantitative value of the value of each unlabeled sample to the training model, wherein the quantitative value of the value of each unlabeled sample is a weighted sum of a preset uncertainty index of the sample and a plurality of preset indicators, and the plurality of preset indicators include any two or three of a preset momentum index, a preset variance index, and a preset loss value index; according to the respective quantitative values ​​of the plurality of unlabeled samples calculated using the query function, unlabeled samples valuable to the model are selected and labeled to obtain labeled samples, and the samples and their labels are added to the first training set to obtain a second training set; and the model is trained using the second training set to perform knowledge category prediction related to the knowledge acquisition task based on the text data.

[0016] In some embodiments of the present invention, the query function is a weighted sum of a combination of a preset momentum function, a preset variance function, and a preset uncertainty function and a preset loss learning function; wherein the uncertainty function is used to calculate the uncertainty index, the momentum function is used to calculate the momentum index, the variance function is used to calculate the variance index, and the loss learning function is used to calculate the loss value index.

[0017] In some embodiments of the present invention, the uncertainty index is calculated as follows:

[0018] ,

[0019] in, Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates the current iteration number, Represents a sample, represents the least trusted function, , Indicates The model before iterations, Indicates The model parameters before the iteration, Indicates that the model predicts that the sample belongs to the knowledge category is the maximum probability value, Represents the probability value of the model predicting that the sample belongs to each knowledge category, Indicates The maximum probability value predicted by the model before the iteration corresponds to the preset category weight of the knowledge category. Indicates The knowledge category corresponding to the maximum probability value predicted by the model before the iteration , the preset category weights of the corresponding knowledge categories are updated before each iteration, wherein the preset category weights of each knowledge category of the multiple knowledge categories related to the knowledge acquisition task are determined according to the ratio of the number of samples of the knowledge category to the total number of samples in the first training set of each iteration and the performance index of the model before each iteration.

[0020] In some embodiments of the present invention, the preset category weight of each knowledge category is determined as follows:

[0021] ,

[0022] in, Representing knowledge categories The preset category weights of Represents the knowledge category, represents the weight parameter, represents the weight parameter, Represents the knowledge category in the first training set The ratio of the number of samples to the total number of samples, represents the curve control parameter, Indicates the weight parameter corresponding to the F1 score, Represents the knowledge category before each iteration The F1 score of the model before each iteration includes the F1 scores of multiple knowledge categories. Indicates the curve control parameters.

[0023] In some embodiments of the present invention, the momentum indicator is calculated as follows:

[0024] ,

[0025] in, represents the preset momentum function, Indicates the current iteration number, Represents a sample, Indicates Sample before iteration The corresponding momentum indicator, It means to find the absolute value. represents the attenuation factor, Indicates Sample before iteration The corresponding momentum indicator, Indicates The uncertainty function preset before the iteration, Indicates The uncertainty function that is preset before the iteration.

[0026] In some embodiments of the present invention, the variance index is calculated as follows:

[0027] ,

[0028] in, represents the preset variance function, Representation sample The corresponding variance indicator, Represents a sample, represents the number of historical iterations, The sequence number indicating the number of iterations, Indicates the current iteration number, Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates Before the iteration The samples calculated in the iterations using the uncertainty function preset before each iteration The corresponding uncertainty indicators are averaged.

[0029] In some embodiments of the present invention, the preset loss learning function is constructed based on a trained loss learner, the model includes a multi-layer neural network, and the loss value indicator is calculated as follows:

[0030] ,

[0031] in, represents the preset loss learning function, Represents samples calculated using the preset loss learning function The corresponding loss value indicator is, Represents a sample, represents the trained loss learner, represents the fusion feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, represents the parameters of the loss learner.

[0032] In some embodiments of the present invention, the loss learner includes multiple learnable linear layers, and the training process of the loss learner includes: obtaining a third training set, including multiple input data and loss labels corresponding to each of the multiple input data, wherein each input data is a fused feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, and the loss label is a true loss value calculated based on the prediction result of the sample by the model and the sample label; using the third training set to train the loss learner to predict the loss value index between the prediction result of the sample by the input data prediction model and the sample label, and updating the parameters of the loss learner with the goal of minimizing the difference between the predicted loss value index and the true loss value to obtain a trained loss learner.

[0033] According to a second aspect of the present invention, there is provided an electronic device comprising: one or more processors; and a memory, wherein the memory is used to store executable instructions; the one or more processors are configured to implement the steps of any one of the methods described in the first aspect of the present invention by executing the executable instructions.

[0034] Compared with the prior art, the advantages of the present invention are:

[0035] The value quantification value calculated by the query function of the present invention not only considers the uncertainty index of the sample, but also comprehensively considers multiple other indicators, namely momentum index, variance index and loss value index, so that the present invention can avoid the similarity of multiple samples actively selected, optimize the sample selection process, ensure the diversity of samples in the active learning process, and improve the generalization ability of the model. In addition, the present invention selects unlabeled samples that are valuable to the model to train the model according to the value quantification value of each sample, so that the model of the present invention pays more attention to learning valuable representative samples, thereby achieving the use of a small number of labeled samples to effectively enhance the generalization ability and accuracy of the model, greatly improving the efficiency of model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The embodiments of the present invention are further described below with reference to the accompanying drawings, in which:

[0037] Figure 1 A schematic diagram of a method flow chart for each iterative training according to an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of the principle of building a preset query function by combining multiple sample screening strategies according to an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0040] As mentioned in the background technology section, the problems with existing active learning methods include: 1. The multiple samples actively selected for learning are similar, resulting in a lack of diversity in the training data set, thereby reducing the generalization ability of the model; 2. When there are abnormal samples with noise data or outliers, the quantitative index of their uncertainty will usually be higher, causing the model to focus too much on learning abnormal samples and ignore samples that contribute more to the training model, further reducing the generalization ability of the model and reducing the accuracy of the model.

[0041] Based on the above problems, according to one embodiment of the present invention, the inventor proposes an active learning method for knowledge acquisition, which is used to perform one or more rounds of training on the knowledge acquisition model, and each round performs multiple iterative training. In each iterative training process of the method of the present invention, on the first aspect, the present invention uses a preset query function to calculate the value quantification value of each unlabeled sample in the candidate data set for the training model, and the value quantification value is the weighted sum of the preset uncertainty index of the sample and multiple preset indicators. Therefore, the value quantification value calculated by the query function of the present invention not only considers the uncertainty index of the sample, but also comprehensively considers multiple other indicators, namely the momentum index, the variance index and the loss value index, so that the present invention can avoid the similarity of multiple samples actively selected, optimize the sample selection process, ensure the sample diversity in the active learning process, and improve the generalization ability of the model. Secondly, the present invention selects unlabeled samples that are valuable to the model based on the quantitative value of each sample, and labels them with knowledge category labels according to the knowledge acquisition task, and uses the labeled samples to train the model, so that the present invention avoids the model from paying too much attention to learning abnormal samples, and allows the model to pay more attention to learning valuable representative samples, thereby achieving the use of a small number of labeled samples to effectively enhance the generalization ability and accuracy of the model and greatly improve the efficiency of model training.

[0042] According to one embodiment of the present invention, the knowledge acquisition model is a pre-trained language (Bidirectional Encoder Representations from Transformers, BERT for short) model, a hidden Markov model (HMM for short) or other natural language processing models, which is not limited in the present invention.

[0043] According to one embodiment of the present invention, the method of the present invention performs multiple iterations of training on the model until the model converges or reaches a preset number of iterations, then stops the iteration training to obtain a trained model. Figure 1 , which is a schematic diagram of the method flow of each iterative training in the method of the present invention, and each iterative training includes the following steps S1, S2, S3 and S4. In order to better understand the present invention, each step is described in detail below in conjunction with specific embodiments.

[0044] Step S1, obtaining a first training set and a candidate data set, the first training set includes a plurality of labeled samples, the candidate data set includes a plurality of unlabeled samples, each sample is a piece of text data, and the label is a knowledge category label set for the text data in the knowledge acquisition task.

[0045] According to one embodiment of the present invention, the knowledge acquisition task is an entity recognition task, a relationship extraction task, or an event extraction task, etc., and corresponding knowledge category labels can be set for samples according to the actual knowledge acquisition task. Schematically, in the entity recognition task, the knowledge category label set is the category of the entity in the text data, such as a name, place, organization, or time category, and in the relationship extraction task, the knowledge category label set is the relationship category between two words in the text data, such as a causal relationship, a social relationship, a time sequence relationship, an attribute relationship, or a kinship relationship category.

[0046] Step S2, obtaining a preset query function, wherein the query function is used to calculate the quantitative value of the value of each unlabeled sample to the training model, wherein the quantitative value of the value of each unlabeled sample is a weighted sum of a preset uncertainty index of the sample and multiple preset indicators, and the multiple preset indicators include any two or three of a preset momentum index, a preset variance index, and a preset loss value index.

[0047] According to one embodiment of the present invention, the query function is a weighted sum of a combination of a preset momentum function, a preset variance function and a preset uncertainty function and a preset loss learning function; wherein the uncertainty function is used to calculate the uncertainty index, the momentum function is used to calculate the momentum index, the variance function is used to calculate the variance index, and the loss learning function is used to calculate the loss value index. The technical solution of this embodiment can at least achieve the following beneficial technical effects: in the continuous active learning process, the predicted values ​​of some samples change significantly, which indicates that they may have an important impact on the improvement and adaptability of the model. The present invention combines the two indicators of momentum and variance, that is, by capturing the changing trend of sample predictions through momentum, and by measuring the instability of predictions through variance, it can more effectively select samples with the most potential value for long-term training and generalization ability of the model. And the loss value indicator that comprehensively measures the optimization ability of the sample to the model, gives priority to labeling those sample data that are expected to improve the model performance the most, and significantly improves the model performance.

[0048] According to one embodiment of the present invention, the query function is shown in the following formula (1):

[0049] , (1)

[0050] in, represents the query function, Representation sample Quantify the value of the trained model, Represents a sample, represents the preset loss learning function, represents the weight parameter, Represents samples calculated using the preset loss learning function The corresponding loss value indicator is, represents a combination of a preset momentum function, a preset variance function, and a preset uncertainty function, , Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is represents the preset variance function, Representation sample The corresponding variance indicator, represents the preset momentum function, Indicates Sample before iteration The corresponding momentum indicator, , Both represent weight parameters, , Used to balance the relative importance of variance and momentum, .For example, The value is 0.4. The value is 0.6.

[0051] According to an embodiment of the present invention, the query function may also be expressed as follows:

[0052] , (2)

[0053] in, represents the query function, , , and denotes weight parameters, and .

[0054] According to an embodiment of the present invention, the query function may also be shown as the following formula (3):

[0055] , (3)

[0056] in, represents the query function, , and denotes weight parameters, and It should be understood that the query functions obtained by weighting the preset functions in the above-mentioned embodiments are only for illustration, and each embodiment can set the size of each weight parameter for weighting according to actual needs. The present invention does not limit how to combine the preset uncertainty function, the preset momentum function, the preset variance function and the preset loss learning function and how to weight them to obtain the query function.

[0057] The preset uncertainty function, preset momentum function, preset variance function and preset loss learning function in the query function are explained below respectively.

[0058] ①Preset uncertainty function

[0059] According to one embodiment of the present invention, in order to solve the problem of uneven sample distribution and lack of sample diversity in the training set due to the imbalanced sample selection in active learning, a strategy for adjusting the uncertainty function based on preset category weights is proposed before constructing the preset uncertainty function. The strategy comprehensively considers the frequency of the category and the performance indicators of the model, calculates the corresponding preset category weights for multiple knowledge categories related to the knowledge acquisition task, and adjusts the uncertainty function through the preset category weights to adjust the sample selection probability, thereby achieving sample diversity and sample distribution balance in the active learning process, and improving the generalization ability of the model. In addition, with the iterative training of the model and the addition of new samples, the preset category weights corresponding to each knowledge category must be recalculated before each iteration to ensure that the active learning process can adapt to changes in model performance and data distribution, so as to select samples more targeted and improve model training efficiency.

[0060] According to one embodiment of the present invention, the preset category weights of each of the multiple knowledge categories related to the knowledge acquisition task are updated before each iteration, wherein the preset category weight of each knowledge category is determined based on the ratio of the number of samples of the knowledge category to the total number of samples in the first training set of each iteration and the performance indicators of the model before each iteration. The performance indicators of the model before each iteration include the F1 scores of the multiple knowledge categories. Among them, the F1 score (F1 Score) aims to balance the differences between categories by adjusting the sample selection probability and improve the performance of the model on imbalance. The F1 score is an indicator used to evaluate the performance of a classification model. It combines precision and recall to provide a balanced evaluation indicator for the model.

[0061] According to one embodiment of the present invention, before each iteration, the preset category weight of each knowledge category is determined as follows:

[0062] , (4)

[0063] in, Representing knowledge categories The preset category weights of Represents the knowledge category, represents the weight parameter, represents the weight parameter, Represents the knowledge category in the first training set The ratio of the number of samples to the total number of samples (also called the frequency of the category), represents the curve control parameter, Indicates the weight parameter corresponding to the F1 score, Represents the knowledge category before each iteration The F1 score, Indicates the curve control parameter. Among them, the parameters in the embodiment of the present invention are and They are used to control the frequency of the category and the influence of the linear part of the F1 score. and Both are used to control the steepness of the curve. The value range is between 0 and 1. Used to balance the relative importance of class frequency and F1 score.

[0064] According to one embodiment of the present invention, the preset category weights of the multiple knowledge categories updated before each iteration are obtained, and a preset uncertainty function is constructed based on the preset category weights. The preset uncertainty index of the sample is calculated by the preset uncertainty function. Among them, the preset uncertainty function is used to calculate the uncertainty index corresponding to the sample before the iteration according to the maximum probability value predicted by the model for the sample before each iteration and the preset category weight of the category corresponding to the maximum probability value. The calculation method of the preset uncertainty index is as follows:

[0065] , (5)

[0066] in, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates the current iteration number, Represents a sample, Represents the least credible Localized Competition Query (LC query) function, , Indicates The model before iterations, Indicates The model parameters before the iteration, Indicates that the model predicts that the sample belongs to the knowledge category is the maximum probability value, Represents the probability value of the model predicting that the sample belongs to each knowledge category, Indicates The maximum probability value predicted by the model before the iteration corresponds to the preset category weight of the knowledge category. Indicates The knowledge category corresponding to the maximum probability value predicted by the model before the iteration . The technical solution of this embodiment can at least achieve the following beneficial technical effects: as the model is updated and new samples are added, the frequency and performance indicators of the knowledge categories are recalculated before each iteration to update the category weights to ensure that the active learning process can adapt to changes in model performance and data distribution. Multiply the category weight by the least credible function. For example, if the model predicts a sample as category R, ​​then it is weighted according to the preset category weight of category R, ​​and then the largest sample is sorted. If the preset category weight is high, then the sample will be selected first, so that the sample can be selected more specifically.

[0067] It should be noted that the above embodiment is based on the preset category weight multiplied by the LC query function to construct the preset uncertainty function is only for illustration, and the preset category weight can also be multiplied by other uncertainty query functions to construct the preset uncertainty function, and the present invention is not limited to this. For example, the preset category weight is multiplied by the probability query function to obtain the preset uncertainty function, thereby realizing the category weighting transformation.

[0068] ②Preset momentum function

[0069] According to one embodiment of the present invention, during the continuous learning process, when the prediction results of the model for certain samples change significantly after different iterations, this indicates that these samples may have an important impact on the improvement and adaptability of the model. Therefore, a preset momentum indicator is calculated by a preset momentum function, and the momentum indicator is used to capture the changing trend of sample prediction. Among them, the preset momentum function is used to calculate the momentum indicator corresponding to the sample before the current iteration based on the uncertainty indicator of the corresponding sample before each iteration, the uncertainty indicator of the corresponding sample before the previous iteration, and the momentum indicator before the previous iteration. The calculation method of the momentum indicator is as follows:

[0070] , (6)

[0071] in, Indicates Sample before iteration The corresponding momentum indicator, It means to find the absolute value. represents the attenuation factor (usually less than 1), Used to control the influence of past momentum on current momentum. Indicates Sample before iteration The corresponding momentum indicator, Indicates The uncertainty function preset before the iteration, Indicates The uncertainty function preset before the iteration. The larger the momentum index of the sample calculated in the present invention is, the greater the probability of selecting the sample is, ensuring the value of the selected sample to the training model.

[0072] ③Preset variance function

[0073] According to one embodiment of the present invention, during the active learning process, when the prediction results of certain samples change significantly, it indicates that these samples may have an important impact on the improvement and adaptability of the model. By calculating the variance of the sample prediction, the stability of the model prediction can be evaluated, thereby identifying those samples whose predictions fluctuate greatly in different iterations. The instability of the prediction is measured by variance. Among them, the preset variance function is used to calculate the variance index corresponding to the sample before the current iteration based on the uncertainty index of the corresponding sample before each iteration in the historical multiple iterations. The calculation method of the variance index is as follows:

[0074] , (7)

[0075] in, Representation sample The corresponding variance indicator, represents the number of historical iterations, The sequence number indicating the number of iterations, Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates Before the iteration The samples calculated in the iterations using the uncertainty function preset before each iteration The corresponding uncertainty index is averaged. The larger the variance index of the sample calculated in the present invention is, the greater the probability of selecting the sample is, ensuring the value of the selected sample to the training model.

[0076] ④Preset loss learning function

[0077] According to an embodiment of the present invention, for the knowledge acquisition task, a preset loss learning function is constructed based on a trained loss learner, and the knowledge acquisition model includes a multi-layer neural network. Among them, using the preset loss learning function, the fusion feature obtained by fusion of the multi-layer feature representation of the sample according to the model before each iteration is used to calculate the loss value index corresponding to the sample before the iteration. The calculation method of the loss value index is as follows:

[0078] , (8)

[0079] in, Represents samples calculated using the preset loss learning function The corresponding loss value indicator is, represents the trained loss learner, represents the fusion feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, Represents the parameters of the loss learner. The technical solution of this embodiment can at least achieve the following beneficial technical effects: since the loss learning function is used to predict the loss value (i.e., loss value index) that may be generated by each unlabeled sample, it can be directly related to the improvement of model performance. That is, if samples with higher predicted loss values ​​are selected, the improvement in model performance will be the most significant. Therefore, the present invention uses a preset loss learning function to predict the loss value index of a sample, so that the model can give priority to labeling those samples that are expected to have the greatest improvement in model performance, thereby quickly improving model performance.

[0080] According to one embodiment of the present invention, taking the BERT model as an example, the feature representation of samples by different layers of neural networks of the BERT model is considered. For example, the feature representation of samples by the 0th layer (i.e., the embedding layer), the 4th layer of neural network, the 8th layer of neural network, and the last layer of neural network of the BERT model are comprehensively considered, and the multi-layer feature representation of the four-layer neural network is recorded as , , and .in, It represents the feature representation of the sample after being processed by the 0th layer (i.e., the embedding layer) of the model. It represents the feature representation of the output of the sample after being processed by the first 0 to 4 layers of neural network of the model. It represents the feature representation of the output after the first 0 to 8 layers of neural network processing of the sample model. Indicates that the sample passes through the first 0 to the last layer of the model The feature representation of the output after neural network processing, Indicates the number of the last layer of the neural network of the model. The fusion feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model , It should be understood that this is only for illustration, and the feature representation of the sample by the 0th layer (i.e., embedding layer), the 3rd layer neural network, the 6th layer neural network, and the last layer neural network of the BERT model can also be considered comprehensively, and the fusion feature is ,in, It represents the feature representation of the output of the sample after being processed by the first 0 to 3 layers of neural network of the model. It represents the feature representation of the output of the sample after being processed by the first 0 to 6 layers of neural network of the model.

[0081] According to an embodiment of the present invention, the loss learner includes a plurality of learnable linear layers. Schematically, the loss learner includes five learnable linear layers, and four learnable linear layers are used to process the fused features. , four linear layers on the input features Projection processing is performed separately, and the results of the four projection processing are concatenated and processed through the fifth learnable linear layer to obtain the preset loss value indicator of the sample.

[0082] According to one embodiment of the present invention, the trained loss learner The training process includes the following steps a1 and a2:

[0083] In step a1, a third training set is obtained, including multiple input data and loss labels corresponding to each of the multiple input data, wherein each input data is a fused feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, and the loss label is a true loss value calculated based on the prediction result of the model for the sample and the sample label.

[0084] According to one embodiment of the present invention, each input data is generated as follows:

[0085] For the named entity recognition task, a sample (a piece of text data) is passed through the BERT model from 1 to The feature representation of the output after the layer neural network processing is recorded as . It represents the feature representation of the output of the sample after being processed by the first 0 to 1 layers of the neural network of the model. It represents the feature representation of the output after the first 0 to 2 layers of neural network processing of the sample model. Indicates that the sample passes through the first 0 to the last layer of the model The feature representation of the output after neural network processing. In particular, the present invention adopts a strategy of comprehensive multi-layer representation, which comprehensively considers the feature representation of the 0th layer (i.e., the embedding layer), the feature representation of the 4th layer, the feature representation of the 8th layer, and the feature representation of the last layer of the BERT model, and then splices the 4-layer feature representation to obtain the fusion feature. , the fused feature is an input data.

[0086] For the relationship extraction task, the strategy of comprehensive multi-layer representation is also adopted. First, a sample (a piece of text data, which only includes two entities) is passed through the embedding layer of the BERT model to obtain , the present invention considers the overall representation , where the definition , ,and are the representations of the [CLS] tag, the first entity, and the second entity, respectively. Then, the embedding layer Through the BERT model from 1 to The feature representation of the output after the layer neural network processing is recorded as . It represents the feature representation of the sample after it is processed by the first 0 to 1 layers of the neural network of the model (for the relationship extraction task, the feature representation is the relationship feature representation between two entities). It represents the feature representation of the output after the first 0 to 2 layers of neural network processing of the sample model. Indicates that the sample passes through the first 0 to the last layer of the model The feature representation of the output after neural network processing. In particular, the present invention adopts a strategy of comprehensive multi-layer representation, which comprehensively considers the feature representation of the 0th layer (i.e., the embedding layer), the feature representation of the 4th layer, the feature representation of the 8th layer, and the feature representation of the last layer of the BERT model, and then splices the 4-layer feature representation to obtain the fusion feature. The technical solution of this embodiment can at least achieve the following beneficial technical effects: the present invention adopts a strategy of comprehensive multi-layer feature representation to capture language features from different abstraction levels, thereby providing a rich feature set for downstream tasks and ensuring the accuracy of the predicted loss value.

[0087] According to one embodiment of the present invention, the loss label corresponding to each input data is set as follows:

[0088] First, for a given model’s input sample And the knowledge category label corresponding to the sample , calculate the true loss value based on the model's knowledge category prediction results for the sample and its knowledge category label. The true loss value is calculated as follows:

[0089] , (9)

[0090] in, represents the true loss value, represents the loss function related to the knowledge acquisition task, Represents the model for the sample The predicted value of Represents the model, represents the model parameters, Representation sample Knowledge category label.

[0091] Finally, the true loss value predicted by the model is used as the loss label of the input data.

[0092] In step a2, the loss learner is trained using the third training set to update the parameters of the loss learner based on the loss value index between the prediction results of the sample and the sample label of the input data prediction model with the goal of minimizing the difference between the predicted loss value index and the true loss value, thereby obtaining a trained loss learner.

[0093] According to one embodiment of the present invention, the input data (fusion features) The input loss learner is processed as shown in the following formula (9):

[0094] , (10)

[0095] in, Represents the loss value indicator predicted by the loss learner. By minimizing the predicted loss value indicator The difference between the predicted loss value and the actual loss value, that is, to make the predicted loss value indicator as close to the actual loss value as possible The loss learner parameters are updated as the target. The difference between the predicted loss value indicator and the true loss value is calculated as follows:

[0096] , (11)

[0097] in, Represents the difference between the predicted loss value indicator and the actual loss value, The loss function represents the difference between the predicted loss value indicator and the true loss value. The present invention can train the loss learner to estimate the potential of each unlabeled sample to improve the model, so that the model can preferentially select those samples that are expected to improve the model performance the most for training.

[0098] In general, see Figure 2, which is a schematic diagram of the principle of the present invention combining multiple sample screening strategies to construct a preset query function. Due to the defects of the existing uncertainty screening strategy (i.e., uncertainty sampling function): defect 1, ignoring the long-term variability of sample prediction, defect 2, ignoring the potential characteristics of the sample itself, and defect 3, ignoring the balance of sample distribution. The solution to defect 1 of the present invention is: to integrate the variance index and the momentum index to improve the long-term variability of the prediction of the model-focused learning sample. Among them, by combining the two indicators of momentum and variance, samples that are not only unstable in prediction (high variance) but also show significant prediction changes (high momentum) can be selected to more comprehensively improve the effect of active learning. The solution to defect 2 is: based on the loss learning function, the loss value that may be generated for each sample without a label is predicted, and the predicted value is used for screening to ensure that valuable representative samples are screened. The solution to defect 3 is: to adjust the query function in combination with the preset category weight, so that the sample data of each batch of screening is as balanced as possible, and the diversity of the samples is ensured. Finally, all the above multiple strategies are coupled to obtain the value quantification value corresponding to each sample. The technical solution of this embodiment can at least achieve the following beneficial technical effects: the value quantification value The comprehensive sample indicators not only select valuable samples, but also improve the diversity of samples, thereby enhancing the generalization ability and accuracy of the model.

[0099] Step S3: According to the respective quantitative values ​​of the multiple unlabeled samples calculated by the query function, select the unlabeled samples that are valuable to the model and label them to obtain labeled samples, add the samples and their labels to the first training set, and obtain the second training set.

[0100] According to one embodiment of the present invention, a query function is used to calculate the value quantification value of each of a plurality of unlabeled samples, and samples whose value quantification value is within a preset threshold range are selected and labeled with knowledge category labels, so as to select the most valuable samples to train the model, significantly improve the learning efficiency and performance of the model, and at the same time, reduce the workload of manual labeling required.

[0101] Step S4: Use the second training set to train the model to predict knowledge categories related to the knowledge acquisition task based on the text data.

[0102] According to one embodiment of the present invention, taking the entity recognition task as an example, the knowledge category label is set as the category of the entity in the text data, the text data in the second training set is input into the model, and the model predicts based on the text data to obtain the predicted entity category. At this time, the loss function related to the entity recognition task is used again to calculate the loss based on the predicted entity category and the real entity category (i.e., the knowledge category label), and the parameters of the model are updated inversely based on the loss.

[0103] It should be noted that although the above describes the various steps in a specific order, it does not mean that the various steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order as long as the required functions can be achieved.

[0104] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.

[0105] A computer-readable storage medium may be a tangible device that holds and stores instructions used by an instruction execution device. Computer-readable storage media may include, for example, but are not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a protruding structure in a groove on which instructions are stored, and any suitable combination thereof.

[0106] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. An active learning method for knowledge acquisition, which is used to perform one or more rounds of training on the knowledge acquisition model, with multiple iterative training in each round, and each iterative training is performed in the following manner: Obtain a first training set and a candidate data set, wherein the first training set includes a plurality of labeled samples, and the candidate data set includes a plurality of unlabeled samples, each sample is a piece of text data, and the label is a knowledge category label set for the text data in the knowledge acquisition task; Obtain a preset query function, which is used to calculate the quantitative value of each unlabeled sample to the training model, where: The quantitative value of each unlabeled sample is a weighted sum of a preset uncertainty indicator of the sample and a plurality of preset indicators, wherein the plurality of preset indicators include any two or three of a preset momentum indicator, a preset variance indicator, and a preset loss value indicator; According to the respective quantitative values ​​of the multiple unlabeled samples calculated by the query function, select the unlabeled samples valuable to the model and label them to obtain labeled samples, and add the samples and their labels to the first training set to obtain the second training set; The model is trained using the second training set to predict knowledge categories related to the knowledge acquisition task based on text data.

2. The method according to claim 1, characterized in that The query function is a weighted sum of a combination of a preset momentum function, a preset variance function, a preset uncertainty function, and a preset loss learning function; Among them, the uncertainty function is used to calculate the uncertainty index, the momentum function is used to calculate the momentum index, the variance function is used to calculate the variance index, and the loss learning function is used to calculate the loss value index.

3. The method according to claim 2, characterized in that The uncertainty index is calculated as follows: , in, Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates the current iteration number, Represents a sample, represents the least trusted function, , Indicates The model before iterations, Indicates The model parameters before the iteration, Indicates that the model predicts that the sample belongs to the knowledge category is the maximum probability value, Represents the probability value of the model predicting that the sample belongs to each knowledge category, Indicates The maximum probability value predicted by the model before the iteration corresponds to the preset category weight of the knowledge category. Indicates The knowledge category corresponding to the maximum probability value predicted by the model before the iteration , the preset category weights of the corresponding knowledge categories are updated before each iteration, wherein the preset category weights of each knowledge category of the multiple knowledge categories related to the knowledge acquisition task are determined according to the ratio of the number of samples of the knowledge category to the total number of samples in the first training set of each iteration and the performance index of the model before each iteration.

4. The method according to claim 3, characterized in that: The preset category weight of each knowledge category is determined as follows: , in, Representing knowledge categories The preset category weights of Represents the knowledge category, represents the weight parameter, represents the weight parameter, Represents the knowledge category in the first training set The ratio of the number of samples to the total number of samples, represents the curve control parameter, Indicates the weight parameter corresponding to the F1 score, Represents the knowledge category before each iteration The F1 score of the model before each iteration includes the F1 scores of multiple knowledge categories. Indicates the curve control parameters.

5. The method according to claim 2, characterized in that: The momentum indicator is calculated as follows: , in, represents the preset momentum function, Indicates the current iteration number, Represents a sample, Indicates Sample before iteration The corresponding momentum indicator, It means to find the absolute value. represents the attenuation factor, Indicates Sample before iteration The corresponding momentum indicator, Indicates The uncertainty function preset before the iteration, Indicates The uncertainty function preset before the iteration.

6. The method according to claim 2, characterized in that The variance indicator is calculated as follows: , in, represents the preset variance function, Representation sample The corresponding variance indicator is, Represents a sample, represents the number of historical iterations, The sequence number indicating the number of iterations, Indicates the current iteration number, Indicates The uncertainty function preset before the iteration, Indicates Samples calculated using the uncertainty function before the iteration The corresponding uncertainty index is Indicates Before the iteration The samples calculated in the iterations using the uncertainty function preset before each iteration The corresponding uncertainty indicators are averaged.

7. The method according to claim 2, characterized in that: The preset loss learning function is constructed based on a trained loss learner, and the model includes a multi-layer neural network, wherein the loss value indicator is calculated as follows: , in, represents the preset loss learning function, Represents samples calculated using the preset loss learning function The corresponding loss value indicator is, Represents a sample, represents the trained loss learner, represents the fusion feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, represents the parameters of the loss learner.

8. The method according to claim 7, characterized in that The loss learner includes a plurality of learnable linear layers, and the training process of the loss learner includes: Obtain a third training set, including multiple input data and loss labels corresponding to each of the multiple input data, wherein each input data is a fused feature obtained by fusing the multi-layer feature representation of the sample by the multi-layer neural network of the model, and the loss label is a true loss value calculated according to the prediction result of the model for the sample and the sample label; The loss learner is trained using the third training set to update the parameters of the loss learner based on the loss value index between the sample prediction result and the sample label of the input data prediction model with the goal of minimizing the difference between the predicted loss value index and the true loss value, thereby obtaining a trained loss learner.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program can be executed by a processor to implement the steps of the method according to any one of claims 1 to 8.

10. An electronic device, characterized in that: include: one or more processors; as well as A memory, wherein the memory is used to store executable instructions; The one or more processors are configured to implement the steps of the method of any one of claims 1 to 8 by executing the executable instructions.