Continuous small sample event detection method and device

By memory and contrast enhancement of event pairs of historical tasks and current tasks, combined with multi-objective loss functions and knowledge distillation, a target model is constructed, which solves the problem of poor learning results in tasks with fewer samples in continuous small sample event detection, and improves Monitor performance and optimize resource usage.

CN118606835APending Publication Date: 2024-09-06INST OF AUTOMATION CHINESE ACAD OF SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410656752.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In the existing technology, continuous small sample event detection has poor learning effect on historical task events and current task events with small samples, and it is difficult to maintain the performance of old task detection and learning new tasks.

Method used

Through memory enhancement of event pairs in historical tasks and contrast enhancement of event pairs in the current task, combined with multi-objective loss function and knowledge distillation, a target model is constructed for detection, and a pre-trained language model is used to encode the current task text to construct a second Memory set and select target event pairs.

Benefits of technology

It significantly improves the learning effect of tasks with fewer samples, improves the performance of continuous small sample event detection tasks, uses resources efficiently, and reduces the consumption of computing and storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606835A
    Figure CN118606835A
Patent Text Reader

Abstract

The invention provides a continuous small sample event detection method and device, and relates to the technical field of natural language processing. The method comprises the steps of performing memory enhancement on event pairs representing samples in a first memory set based on historical tasks to obtain first event pairs; performing comparison enhancement based on the category of the event pair in the second memory set of the current task to obtain a second event pair; determining a target model based on the first event pair and the second event pair; and detecting the continuous small sample event of the current task through the target model. According to the continuous small sample event detection method and device provided by the invention, the performance of a continuous small sample event detection task can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a method and device for detecting continuous small sample events. Background Art

[0002] With the rapid development of the Internet, massive amounts of unstructured texts have emerged, which contain a large amount of high-value information. However, due to its unstructured nature, it is difficult for computers to directly calculate and utilize this information. In this context, information extraction technology has emerged. As an important part of information extraction technology, the event detection task aims to extract structured event knowledge from unstructured text. The extracted structured event knowledge plays an important supporting role in understanding the text content. For example, for the text "'Melony Marshall was married, just a month before she left for Iraq", an ideal event detection model should be able to predict the "marriage" event triggered by "married" and the "transportation" event triggered by "left". The mainstream event detection method is mainly based on manually annotated data sets, through supervised learning, to train the model to identify fixed categories of events. However, due to the openness, scalability and flexibility of the Internet, new types of events are constantly emerging, and the training data for these events is usually very limited. Therefore, the event detection model is required to maintain the detection performance of old tasks while learning new tasks (for example, the old task model only learns the "marriage" event, while the current task needs to learn the "transportation" event).

[0003] Continuous Few-shot Event Detection technology is a powerful way to solve this problem. The goal of continuous few-shot event detection is to enable the model to maintain event detection performance for old and current tasks by learning a small number of samples (for example, only 5 training samples are available) in continuous event detection tasks. This brings two challenges to the model: the model needs to remember the event types of old tasks with very few representative samples, and can only learn the event types of the current task through a small number of samples. Summary of the invention

[0004] The present application provides a method and device for continuous small sample event detection, which are used to solve the defect of the prior art that continuous small sample event detection has poor learning effect on historical task events and current task events with fewer samples.

[0005] In a first aspect, the present application provides a method for detecting continuous small sample events, comprising:

[0006] Perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain the first event pairs;

[0007] Perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs;

[0008] Determining a target model based on the first event pair and the second event pair;

[0009] The target model is used to detect continuous small sample events of the current task.

[0010] Optionally, the memory enhancement of the event pairs representing the samples in the first memory set based on the historical task to obtain the first event pairs includes:

[0011] The first event pairs are obtained by performing feature enhancement on the event pairs representing the samples in the first memory set based on a deviation noise method under Gaussian distribution.

[0012] Optionally, performing contrast enhancement on the categories of the event pairs in the second memory set based on the current task to obtain the second event pairs includes:

[0013] Performing data enhancement on the event pairs in the second memory set based on the token to obtain enhanced event pairs;

[0014] Based on the category of the enhancement event, constructing a contrast loss function;

[0015] The features of the enhanced event pair are learned through the contrast loss function to obtain the second event pair.

[0016] Optionally, determining a target model based on the first event pair and the second event pair includes:

[0017] The first event pair and the second event pair are jointly learned based on a multi-objective loss function, and knowledge distillation is used to strengthen the learning of historical tasks to obtain the target model.

[0018] Optionally, the method further comprises:

[0019] Encode the current task text through the pre-trained language model to obtain the feature representation of the current task event pair;

[0020] The second memory set is constructed based on the feature representation of the current task-event pair.

[0021] Optionally, the method further comprises:

[0022] Select a target event pair from the event pairs of the current task;

[0023] Determining a target sample based on the category of the target event pair;

[0024] Based on the target sample, a third memory set is determined.

[0025] In a second aspect, the present application further provides a continuous small sample event detection device, comprising:

[0026] A memory enhancement module, used for performing memory enhancement on event pairs representing samples in a first memory set based on historical tasks to obtain first event pairs;

[0027] A contrast enhancement module, used for performing contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain a second event pair;

[0028] A model building module, configured to determine a target model based on the first event pair and the second event pair;

[0029] The detection module is used to detect the continuous small sample events of the current task through the target model.

[0030] In a third aspect, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0031] In a fourth aspect, the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0032] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.

[0033] The method and device for detecting continuous small sample events provided in the present application detect continuous small sample events by performing memory enhancement on event pairs in historical tasks and contrast enhancement on event pairs in current tasks, so that the model can not only preserve the knowledge in old tasks, but also make full use of the knowledge in memory enhancement and contrast enhancement, continuously accumulate and learn the characteristics and patterns of these events, improve the learning effect of tasks with fewer samples, enhance the performance of continuous small sample event detection tasks, use resources efficiently, and significantly reduce the consumption of computing resources and storage resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0035] Figure 1 It is a flowchart of the continuous small sample event detection method provided by this application;

[0036] Figure 2 This is one of the principle schematic diagrams of the continuous small sample event detection method provided by this application;

[0037] Figure 3 This is the second principle schematic diagram of the continuous small sample event detection method provided by this application;

[0038] Figure 4 It is a structural schematic diagram of a continuous small sample event detection device provided by the present application;

[0039] Figure 5 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0040] For memorizing old tasks, in the setting of continuous small sample event detection tasks, only one representative sample of each type can be saved in the memory set, which makes it difficult for the model to recall all the knowledge of old tasks from the memory set. This requires the model to generate more generalized representative samples from the representative samples of the memory set; when learning the current task, since only limited samples can be used, simple supervision methods are often difficult to generalize well, resulting in serious overfitting. It is necessary to mine event information from a small number of samples to help the model learn the knowledge of new events. Therefore, when using the memory set to learn old knowledge and using small samples to learn the knowledge of the current task, the above problems need to be solved.

[0041] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0042] Figure 1 is a flow chart of a method for detecting continuous small sample events provided in an embodiment of the present application. Figure 1The embodiment of the present application provides a method for detecting a continuous small sample event, the execution subject of which may be an electronic device, for example, a controller, and the method may include:

[0043] Step 110, performing memory enhancement on event pairs representing samples in a first memory set based on historical tasks to obtain first event pairs;

[0044] Step 120, performing contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain a second event pair;

[0045] Step 130: Determine a target model based on the first event pair and the second event pair;

[0046] Step 140: Detect continuous small sample events of the current task through the target model.

[0047] In step 110, the controller may obtain representative samples from the first memory set of the historical task, perform memory enhancement based on these samples, and obtain the first event pair. Since the memory set directly stores the encoded event pair representation, the event pair representation of the representative sample of the old task can be directly obtained.

[0048] In step 120, the controller may first perform data enhancement including token shuffling and random token replacement on the representation of event pairs in the second memory set of the current task, and secondly, regard event pairs of the same type as positive classes; and event pairs of different types as negative classes, and construct a contrast loss function based on the positive and negative classes to perform feature learning to obtain the second event pairs.

[0049] In step 130 , the controller may determine a target model by jointly learning the first event pair and the second event pair.

[0050] In step 140 , the controller may use the trained target model to detect continuous small sample events of the current task and obtain detection results.

[0051] The continuous small sample event detection method provided in the embodiment of the present application detects continuous small sample events by performing memory enhancement on event pairs in historical tasks and contrast enhancement on event pairs in current tasks, so that the model can not only preserve the knowledge in old tasks, but also make full use of the knowledge in memory enhancement and contrast enhancement, continuously accumulate and learn the characteristics and patterns of these events, improve the learning effect of tasks with fewer samples, enhance the performance of continuous small sample event detection tasks, efficiently use resources, and significantly reduce the consumption of computing resources and storage resources.

[0052] Figure 2 , 3 It is a schematic diagram of the principle of the method provided by this application, which can be referred to in accordance with the context.

[0053] In one embodiment, memory enhancement is performed on event pairs representing samples in a first memory set based on historical tasks to obtain first event pairs, including:

[0054] Based on the deviation noise method under Gaussian distribution, feature enhancement is performed on the event pairs representing the samples in the first memory set to obtain the first event pairs.

[0055] Specifically, in order to utilize the representative samples of the first memory set in the old task (historical task), the controller can obtain the pre-trained language model (BERT) representation of the representative of the old task belonging to class j Assuming that the feature space follows a Gaussian distribution, given that the representative is usually considered to be the most representative sample, this sample can be regarded as the mean of the distribution. The variance of the distribution is calculated during the representative selection process, and the controller can calculate the mean square error of all samples belonging to the same category:

[0056]

[0057] in, is the mean square error of all samples of the same category, is a set of representative sample representations obtained by training the language model, is the representation of a single representative sample of the jth class, μ j is the mean of all samples of the same category.

[0058] First Memory Set M t-1 has been reformulated as Among them, i is the number of memory sets, is the representative sample of the jth class in the kth memory set, is its corresponding label, is the mean square error of the class obtained by the previous formula, and m is the number of categories.

[0059] The controller can define the mean square error of all representatives as the variance of the Gaussian distribution. When replaying a representative, given its The expression is The controller can then sample from the distribution multiple times to construct synthetic features that can represent the feature space of its category as part of the training samples and together as the first event pair for recall of old tasks.

[0060] The continuous small sample event detection method provided in the embodiment of the present application performs feature enhancement on the event pairs of representative samples in the first memory set by means of deviation noise under Gaussian distribution to obtain the first event pairs. More generalized representative samples can be generated from the representative samples in the memory set, thereby improving the learning effect of tasks with fewer samples and enhancing the performance of continuous small sample event detection tasks.

[0061] In one embodiment, contrast enhancement is performed based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs, including:

[0062] Performing data enhancement on event pairs in the second memory set based on the tokens to obtain enhanced event pairs;

[0063] Based on the category of enhancement events, a contrast loss function is constructed;

[0064] The features of the enhanced event pairs are learned through the contrast loss function to obtain the second event pairs.

[0065] In order to utilize the knowledge in the small sample data text of the current task, the controller can first construct positive token pairs and negative token pairs from the batch data. Specifically, given a batch (x i ,y i ) are the sentences, n is the number of sentences, and the original sentence is The enhanced sentence is where m is a hyperparameter, which refers to the number of times contrast enhancement is performed. Therefore, sentences with the same source can be described as Based on these pairings, the controller can perform contrastive learning between sentence representation and trigger word representation.

[0066] The controller can cls Using contrastive sentence representation learning. Among them, h cls is the feature representation of the classification token [CLS] obtained by BERT. Representations from the same sentence are considered as positive token pairs, and representations from different sentences are considered as negative token pairs. The controller can aggregate the sentence feature representation information after contrast enhancement. The contrast loss function is calculated as follows:

[0067]

[0068] Among them, L cls is the contrast loss function, n is the batch size, B is the set of all samples in the batch, m is the number of times contrast enhancement is performed, k is the index of an enhancement other than j, O is all samples in the batch after enhancement, l is the index of a sample in the batch other than p, S is the similarity function (here we use cosine similarity), is the feature representation of the [CLS] token encoded by BERT after the i-th augmentation for the j-th sample in the batch, is the feature representation of the [CLS] token obtained by BERT encoding after the qth augmentation of the pth sample, τ is the temperature coefficient, which is set to 2 here, is the i-th sample after the k-th enhancement.

[0069] Meanwhile, considering the trigger word representation, when the trigger words in B belong to the same event type, a positive token pair is formed, and when they belong to different types or are marked as NA (Not Any), a negative token pair is formed. The supervised contrast loss in the trigger word representation is:

[0070]

[0071] Among them, L trig is the supervised contrast loss function in the trigger word representation, n is the batch size, l is the index of a sample other than i in the batch, B is the set of all samples in the batch, m is the number of times the trigger word is enhanced, k is the index of a sample other than j in the batch, O is all samples in the batch after a sample is enhanced, is the label of the i-th sample after the j-th enhancement, is the label of the lth sample after the kth enhancement, i is the index of a sample in the batch, is the label of the p-th sample after the q-th enhancement, S is the similarity function (here we use cosine similarity), is the BERT representation of the sentence of the i-th sample after the j-th enhancement, is the BERT representation of the sentence of the p-th sample after the q-th enhancement, τ is the temperature coefficient, which is set to 2 here, is the BERT representation of the sentence of the lth sample after the kth augmentation.

[0072] The continuous small sample event detection method provided in the embodiment of the present application performs data enhancement through token shuffling and random token replacement, and then constructs a contrast loss function based on positive and negative classes to learn event pair features. It can mine event information in small samples and help the model learn knowledge of new events, thereby improving the learning effect of tasks with fewer samples and improving the performance of continuous small sample event detection tasks.

[0073] In one embodiment, determining a target model based on the first event pair and the second event pair includes:

[0074] The first event pair and the second event pair are jointly learned based on the multi-objective loss function, and knowledge distillation is used to strengthen the learning of historical tasks to obtain the target model.

[0075] After obtaining the memory-enhanced representation and the contrast-enhanced representation, the controller jointly learns the two representations through a multi-objective loss function, and uses knowledge distillation to strengthen the learning of the old task. Based on the learned model, it detects the continuous small sample events of the current task. The loss function of knowledge distillation is as follows:

[0076]

[0077]

[0078] Among them, L fd is the loss function of feature layer knowledge distillation, (X, Y) are all input samples and their corresponding labels, T t is the data set of the t-th learning stage, S is the similarity function (here we use cosine similarity), is the BERT representation of the sample sentence in stage t-1, h is the BERT representation of the sample sentence in the current stage, L pd is the loss function of the prediction layer knowledge distillation, is the predicted distribution of sample sentences in stage t-1, and p is the predicted distribution of sample sentences in the current stage.

[0079] The optimization objective function of the overall model is the sum of each loss function.

[0080] The continuous small sample event detection method provided in the embodiment of the present application determines the target model through joint learning and knowledge distillation, detects continuous small sample events, and can improve the performance of the continuous small sample event detection task.

[0081] In one embodiment, the continuous small sample event detection method further includes:

[0082] Encode the current task text through the pre-trained language model to obtain the feature representation of the current task event pair;

[0083] Based on the feature representation of the current task-event pair, a second memory set is constructed.

[0084] In order to obtain the event pair representation, the input text can be encoded. Since the pre-trained language model (BERT) is the best encoder for the event detection task, this application uses the pre-trained language model for encoding. The training data is processed and converted into the input form of the pre-trained language model (BERT), and then the event pair representation is obtained.

[0085] Given an input text S = {x1,x2,...,[e s ,...,e e ],...,x n}, which contains the trigger word E = [e s ,...,e e ], through forward propagation, the hidden representation can be obtained The controller obtains the hidden state H by simply concatenating the start and end representations of the trigger word e Event Type i ∈T t At stage t, p(y i |h e) is obtained by the following formula:

[0086]

[0087] Among them, p(y i |h e ) is the event type y i The probability distribution at stage t, Lt is the set of all label categories at stage t, is the weight matrix of the softmax function, h e is the BERT representation of the sentence, b j is the bias matrix of softmax, is the weight matrix of softmax.

[0088] The method for detecting continuous small sample events provided in the embodiment of the present application obtains a second memory set by extracting features through a pre-trained language model, provides data preparation for continuous small sample event detection, and improves the performance of the continuous small sample event detection task.

[0089] In one embodiment, the continuous small sample event detection method further includes:

[0090] Select a target event pair from the event pairs of the current task;

[0091] Based on the category of the target event pair, determine the target sample;

[0092] Based on the target sample, a third memory set is determined.

[0093] Based on the event pairs of the current task, the event pair representation closest to the class center in the representation space is selected, and representative samples are selected for each category to form a memory set under the current task for memory enhancement of the next task. The controller first creates a prototype for each event type by averaging the encoded representations. Then, the closest sample measured by distance (such as L2 distance or cosine distance) is selected as the representative. The memory set is represented as follows:

[0094]

[0095] Among them, M t It is the third memory set. is the representative sample of the jth class in the tth memory set, is its corresponding label, m is the number of categories, t is the index of the memory set, M t-1 It is the old task memory set.

[0096] The continuous small sample event detection method provided in the embodiment of the present application selects the event pair representation closest to the class center in the representation space by the class nearest neighbor method, selects representative samples for each category, and constitutes a third memory set for memory enhancement of the next task, so that the model can not only preserve the knowledge in the old tasks, but also make full use of the knowledge in memory enhancement and contrast enhancement, continuously accumulate and learn the characteristics and patterns of these events, improve the learning effect of tasks with fewer samples, and improve the performance of continuous small sample event detection tasks.

[0097] This application uses the MAVEN dataset and the ACE 2005 dataset as training and test corpora. The original MAVEN contains 168 event types and is a large general-domain event detection dataset. The ACE 2005 dataset includes 33 event types. For the division of incremental tasks, the most frequent event categories can be selected to construct 5 incremental continuous small sample event detection tasks, where each category of the first task contains 100 samples, and each category of the remaining tasks contains only 5 samples. The effectiveness of this method is illustrated by comparing the effects of existing methods with this method. The comparison results on the MAVEN dataset and the ACE 2005 dataset are shown in the following table:

[0098]

[0099]

[0100]

[0101] From the experimental results in the above table, it can be seen that the method for continuous small sample event detection provided by this application outperforms the existing methods on the MAVEN dataset and the ACE 2005 dataset, which shows that this application can effectively use memory enhancement and contrast enhancement to improve the performance of continuous small sample event detection.

[0102] The continuous small sample event detection device provided in the present application is described below. The continuous small sample event detection device described below and the continuous small sample event detection method described above can refer to each other.

[0103] Figure 4 Schematic diagram of the structure of the continuous small sample event detection device provided in the embodiment of the present application. Figure 4 The continuous small sample event detection device provided in the embodiment of the present application may include:

[0104] A memory enhancement module 410 is used to perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain a first event pair;

[0105] A contrast enhancement module 420, configured to perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain a second event pair;

[0106] A model building module 430, configured to determine a target model based on the first event pair and the second event pair;

[0107] The detection module 440 is used to detect the continuous small sample events of the current task through the target model.

[0108] The continuous small sample event detection device provided in the embodiment of the present application detects continuous small sample events by performing memory enhancement on event pairs in historical tasks and contrast enhancement on event pairs in current tasks, so that the model can not only preserve the knowledge in old tasks, but also make full use of the knowledge in memory enhancement and contrast enhancement, continuously accumulate and learn the characteristics and patterns of these events, improve the learning effect of tasks with fewer samples, enhance the performance of continuous small sample event detection tasks, efficiently use resources, and significantly reduce the consumption of computing resources and storage resources.

[0109] Specifically, the above-mentioned continuous small sample event detection device provided in the embodiment of the present application can implement all the method steps implemented by the method embodiment in which the execution subject is the controller, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.

[0110] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the continuous small sample event detection method, for example, including:

[0111] Perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain the first event pairs;

[0112] Perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs;

[0113] Determining a target model based on the first event pair and the second event pair;

[0114] The target model is used to detect continuous small sample events of the current task.

[0115] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0116] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the steps of the continuous small sample event detection method provided by the above methods, for example, including:

[0117] Perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain the first event pairs;

[0118] Perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs;

[0119] Determining a target model based on the first event pair and the second event pair;

[0120] The target model is used to detect continuous small sample events of the current task.

[0121] In another aspect, the present application further provides a computer program product, the computer program product comprising a computer program, the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the steps of the continuous small sample event detection method provided by the above methods, for example, including:

[0122] Perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain the first event pairs;

[0123] Perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs;

[0124] Determining a target model based on the first event pair and the second event pair;

[0125] The target model is used to detect continuous small sample events of the current task.

[0126] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0127] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0128] It should also be noted that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.

[0129] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0130] "Determine B based on A" in the embodiments of the present application means that the factor A should be considered when determining B. It is not limited to "B can be determined based on A alone", but should also include: "Determine B based on A and C", "Determine B based on A, C and E", "Determine C based on A, and further determine B based on C", etc. In addition, it can also include taking A as a condition for determining B, for example, "When A meets the first condition, use the first method to determine B"; for another example, "When A meets the second condition, determine B", etc.; for another example, "When A meets the third condition, determine B based on the first parameter", etc. Of course, it can also be a condition that takes A as a factor for determining B, for example, "When A meets the first condition, use the first method to determine C, and further determine B based on C", etc.

[0131] In the embodiments of the present application, the term "plurality" refers to two or more than two, and other quantifiers are similar.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting persistent small sample events, It is characterized in that include: Perform memory enhancement on the event pairs representing the samples in the first memory set of the historical task to obtain the first event pairs; Perform contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain the second event pairs; Determining a target model based on the first event pair and the second event pair; The target model is used to detect continuous small sample events of the current task.

2. The method for detecting persistent small sample events according to claim 1, It is characterized in that The memory enhancement of the event pairs representing the samples in the first memory set based on the historical task to obtain the first event pairs includes: The first event pairs are obtained by performing feature enhancement on the event pairs representing the samples in the first memory set based on a deviation noise method under Gaussian distribution.

3. The method for detecting persistent small sample events according to claim 1, It is characterized in that The process of contrasting and enhancing the categories of the event pairs in the second memory set based on the current task to obtain the second event pairs includes: Performing data enhancement on the event pairs in the second memory set based on the token to obtain enhanced event pairs; Based on the category of the enhancement event, constructing a contrast loss function; The features of the enhanced event pair are learned through the contrast loss function to obtain the second event pair.

4. The method for detecting persistent small sample events according to claim 1, It is characterized in that The determining of the target model based on the first event pair and the second event pair includes: The first event pair and the second event pair are jointly learned based on a multi-objective loss function, and knowledge distillation is used to strengthen the learning of historical tasks to obtain the target model.

5. The method for detecting persistent small sample events according to any one of claims 1 to 4, It is characterized in that The method further comprises: Encode the current task text through the pre-trained language model to obtain the feature representation of the current task event pair; The second memory set is constructed based on the feature representation of the current task-event pair.

6. The method for detecting persistent small sample events according to any one of claims 1 to 4, It is characterized in that The method further comprises: Select a target event pair from the event pairs of the current task; Determining a target sample based on the category of the target event pair; Based on the target sample, a third memory set is determined.

7. A continuous small sample event detection device, It is characterized in that include: A memory enhancement module, used for performing memory enhancement on event pairs representing samples in a first memory set based on historical tasks to obtain first event pairs; A contrast enhancement module, used for performing contrast enhancement based on the categories of the event pairs in the second memory set of the current task to obtain a second event pair; A model building module, configured to determine a target model based on the first event pair and the second event pair; The detection module is used to detect the continuous small sample events of the current task through the target model.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the continuous small sample event detection method as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for detecting continuous small sample events according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method for detecting continuous small sample events according to any one of claims 1 to 6 is implemented.