Event type analysis method and related equipment

By using the parent-child training set with parent-child labels and Fisher information filtering technology, the event detection model is trained, which solves the classification problem under low resource conditions and achieves efficient model adjustment and performance protection.

CN114881141BActive Publication Date: 2024-09-27NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210487017.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-06
Publication Date
2024-09-27
Estimated Expiration
2042-05-06

AI Technical Summary

Technical Problem

Existing event detection technology is difficult to effectively classify under low resource conditions, especially when model learning and screening require a large amount of manually annotated data, and the generalization ability of meta-learning methods relies on rich data classes, making it difficult to be effective with a small number of samples. promotion.

Method used

By obtaining the parent training set containing the parent tag and the child training set of the child tag, converting it into a prompt format, adjusting the pre-trained language model, using Fisher information to filter demonstration examples, and dynamically selecting the supporting examples with the largest amount of information for training, simulating human beings Course learning process from easy to difficult.

Benefits of technology

In the absence of additional training data, additional supervision signals are provided to alleviate the classification bottleneck caused by insufficient data, reduce the number of demonstration examples, improve the efficiency of model adjustment, and avoid damage to the performance of the original language model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114881141B
    Figure CN114881141B
Patent Text Reader

Abstract

The present application provides an event type analysis method and related equipment. The method includes: obtaining a parent training set including a parent label and a first sub-training set including a sub-label; converting the first input tuple in the parent training set into a first prompt format; adjusting the pre-trained language model based on the first prompt format to obtain a first language model; adding the parent label to the corresponding second input tuple of the first sub-training set to obtain a second sub-training set; converting the second input tuple in the second sub-training set into a second prompt format; adjusting the first language model based on the second prompt format to obtain a second language model; and using the second language model to analyze the event type corresponding to the text to be detected. The embodiment of the present application provides additional supervisory signals when training the model by introducing the concepts of parent-child labels and Fisher information, and can effectively identify the demonstration examples with the largest amount of information for training, and finally realizes the analysis of event types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of event detection, and in particular to an event type analysis method and related equipment. Background Art

[0002] Event detection (ED) aims to assign event labels to unlabeled sentences, which often struggles in real-world applications when only a few labeled samples are available. Existing works mainly focus on using meta-learning to overcome the low-resource problem, but still require labeled data from other tasks for model learning and screening.

[0003] Few-shot learning is one of the most successful techniques in event detection practice. It usually enriches the semantic representation of the input text by increasing the number of parameters, for example, deepening the model or building a more complex attention structure than the existing model. However, as the number of model parameters increases, the training process requires more manually annotated samples, which results in an unbearable time and labor cost. Subsequently, meta-learning has been used for few-shot event detection in many recent studies, with the paradigm of learning meta-knowledge, such as event features, from rich data classes and then generalizing it to new classes with only a small number of examples. However, the generalization ability of meta-learning-based methods mainly relies on rich classes that are not easy to obtain. Summary of the invention

[0004] In view of this, the purpose of this application is to propose an event type analysis method and related equipment.

[0005] Based on the above purpose, the present application provides an event type analysis method, including:

[0006] Obtain a parent training set including a parent label and a first child training set including a child label;

[0007] Converting a first input tuple in the parent training set into a first prompt format;

[0008] Adjusting the pre-trained language model based on the first prompt format to obtain a first language model;

[0009] Adding the parent label to the corresponding second input tuple of the first sub-training set to obtain a second sub-training set;

[0010] converting a second input tuple in the second training subset into a second prompt format;

[0011] Adjusting the first language model based on the second prompt format to obtain a second language model;

[0012] The second language model is used to analyze the event type corresponding to the text to be detected.

[0013] In a possible implementation, converting the first input tuple in the parent training set into a first prompt format includes:

[0014] Converting the label of the first input tuple into a label vector using average vector representation;

[0015] Reconstructing the first input tuple into a sentence prompt format using a reconstruction template;

[0016] The label vector and the sentence prompt format constitute the first prompt format.

[0017] In a possible implementation, the reconstruction template is obtained by:

[0018] For each input tuple in the training set, permuting and combining the three elements in each input tuple to obtain a permutation and combination of the input tuple elements;

[0019] Masks are filled in the permutations and combinations respectively and input into a text-to-text converter, and the reconstruction template is determined using a beam search method.

[0020] In a possible implementation, respectively filling in masks in the permutations and combinations, inputting them into a text-to-text converter, and determining the reconstruction template using a beam search method include:

[0021] Filling masks into the permutations and combinations respectively to obtain masked permutations and combinations;

[0022] Inputting the masked permutations and combinations into the text-to-text converter, and using the text-to-text converter to fill in the mask using natural language;

[0023] The beam search is used to decode the permutations and combinations after filling the mask to obtain a candidate template set, and the reconstructed template is obtained according to the result obtained after filling the mask.

[0024] In a possible implementation, adjusting the pre-trained language model based on the first prompt format to obtain the first language model includes:

[0025] Calculate the similarity between the sentence of the first input tuple and the sentence of the third input tuple in the parent training set;

[0026] Taking the third input tuples corresponding to the first 50% of the similarities as the first support set of the first input tuple;

[0027] converting a third input tuple in the first support set into a third prompt format;

[0028] splicing the first prompt format and the third prompt format to obtain a context;

[0029] Inputting the context into the pre-trained language model to obtain a first training label;

[0030] Calculating Fisher information using the first training label and the label of the first input tuple;

[0031] taking the third input tuple corresponding to the maximum value of the Fisher information as a supporting example;

[0032] The pre-trained language model is adjusted using the supporting examples to obtain a first language model.

[0033] In a possible implementation, the step of calculating the first Fisher information by using the first training label and the label of the first input tuple includes:

[0034] Calculate a label loss using the first training label and the label of the first input tuple;

[0035] Obtaining a parameter gradient of the pre-trained language model using the label loss;

[0036] The Fisher information is obtained by calculating the parameter gradient.

[0037] In a possible implementation, the using the supporting examples to adjust the pre-trained language model to obtain a first language model includes:

[0038] splicing the supporting example with the sentence prompt format and inputting the concatenated result into the pre-trained language model to obtain a second training label;

[0039] Calculating a training loss using the second training label and the label of the first input tuple;

[0040] The pre-trained language model is adjusted using the training loss to obtain a first language model.

[0041] Based on the same inventive concept, one or more embodiments of this specification further provide an event type analysis device, including:

[0042] An acquisition module is configured to acquire a parent training set including a parent label and a first child training set including a child label;

[0043] A conversion module configured to convert a first input tuple in the parent training set into a first prompt format;

[0044] an adjustment module, configured to adjust the pre-trained language model based on the first prompt format to obtain a first language model;

[0045] A data processing module is configured to add the parent label to a corresponding second input tuple of the first sub-training set to obtain a second sub-training set;

[0046] a conversion module configured to convert a second input tuple in the second sub-training set into a second prompt format;

[0047] an adjustment module, configured to adjust the first language model based on the second prompt format to obtain a second language model;

[0048] The prediction module is configured to use the second language model to analyze the event type corresponding to the text to be detected.

[0049] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an event type analysis method as described in any one of the above is implemented.

[0050] Based on the same inventive concept, one or more embodiments of the present specification further provide a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute any of the above-mentioned event type analysis methods.

[0051] From the above description, it can be seen that the event type analysis method and related equipment provided by the present application obtain a parent training set including a parent label and a first sub-training set including a sub-label; convert the first input tuple in the parent training set into a first prompt format; adjust the pre-trained language model based on the first prompt format to obtain a first language model; add the parent label to the corresponding second input tuple of the first sub-training set to obtain a second sub-training set; convert the second input tuple in the second sub-training set into a second prompt format; adjust the first language model based on the second prompt format to obtain a second language model; and use the second language model to analyze the event type corresponding to the text to be detected. For the model, it is trained by the parent-child training set with parent-child labels, and the language model is trained with samples from easy to difficult, which is in line with the human course learning process and effectively alleviates the classification bottleneck caused by insufficient data. In addition, the concept of Fisher information is introduced to filter the demonstration examples, so that the supporting example with the largest amount of information can be dynamically selected for each input tuple to train the model, effectively preventing damage to the performance of the original language model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0053] Figure 1 This is a flow chart of the event type analysis method of an embodiment of the present application;

[0054] Figure 2 This is a structural diagram of an event type analysis device according to an embodiment of the present application;

[0055] Figure 3 This is the electronic device structure of an embodiment of the present application. DETAILED DESCRIPTION

[0056] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0057] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0058] As mentioned in the background technology section, related technologies mainly focus on using meta-learning to overcome the low-resource problem, but labeled data from other tasks is still required for model learning and screening. Therefore, the concept of prompt learning is introduced. However, these methods ignore specific task information and generally use demonstration learning to adjust the model, which makes the model unable to use the most informative examples for training and damages the model performance.

[0059] Based on the above considerations, the present application proposes an event type analysis method and related equipment, which can provide additional supervision signals without additional training data by combining a parent-child training set containing parent-child labels and training a language model with samples from easy to difficult, effectively alleviating the classification bottleneck caused by insufficient data. In addition, Fisher information is used to filter the demonstration examples with the largest amount of information, effectively reducing the number of instances involved in the demonstration, while still maintaining or even improving the efficiency of adjusting the model.

[0060] The technical solution of the present application is described in detail below through specific embodiments.

[0061] refer to Figure 1 The event type analysis method of the embodiment of the present application comprises the following steps:

[0062] Step S101, obtaining a parent training set including a parent label and a first child training set including a child label.

[0063] Step S102: converting the first input tuple in the parent training set into a first prompt format.

[0064] Step S103: adjusting the pre-trained language model based on the first prompt format to obtain a first language model.

[0065] Step S104: adding the parent label to the corresponding second input tuple of the first sub-training set to obtain a second sub-training set.

[0066] Step S105: converting the second input tuple in the second sub-training set into a second prompt format.

[0067] Step S106: adjusting the first language model based on the second prompt format to obtain a second language model

[0068] Step S107: Analyze the event type corresponding to the text to be detected by using the second language model.

[0069] In step S101, during the analysis of event types, each event type consists of a parent tag and a child tag. i =Life.Be-born, for example, "Life" is the event type y i The parent label of is, “Be-born” is its child label, and each event type (i.e., child label) has K examples in the training set. Ideally, each parent label contains N p sub-tags. In this way, the amount of data for each parent tag can reach N p* K. The difference in the amount of labeled data can easily divide event detection into two training stages, namely the easy parent label classification stage and the difficult child label classification stage. Neither additional parameters are introduced nor the computational workload is increased in these two training stages.

[0070] In a possible implementation, converting the first input tuple in the parent training set into a first prompt format includes:

[0071] Converting the label of the first input tuple into a label vector using average vector representation;

[0072] Reconstructing the first input tuple into a sentence prompt format using a reconstruction template;

[0073] The label vector and the sentence prompt format constitute the first prompt format.

[0074] In a possible implementation, the first input tuple includes: a sentence, a tag, and a trigger word.

[0075] In step S102, the event labels do not contain meaningless stop words, such as "of" in "city-of-birth", and some event labels share the same words that are close to the context contained in each category, such as "Org" in "Start-Org", "Merge-Org" and "end-Org", and the typical weighted representation may result in unclear differences between labels, so the average vector method is applied to obtain the label vector. The label vector is calculated by the following formula:

[0076]

[0077] Among them, M(y i ) represents the label vector, y i Indicates the label, l i represents the i-th parameter after label decomposition, C y Represents the set of parameters after all tags are decomposed.

[0078] In a possible implementation, the reconstruction template is obtained by:

[0079] For each input tuple in the training set, permuting and combining the three elements in each input tuple to obtain a permutation and combination of the input tuple elements;

[0080] Masks are filled in the permutations and combinations respectively and input into a text-to-text converter, and the reconstruction template is determined using a beam search method.

[0081] In a possible implementation, respectively filling in masks in the permutations and combinations, inputting them into a text-to-text converter, and determining the reconstruction template using a beam search method include:

[0082] Filling masks into the permutations and combinations respectively to obtain masked permutations and combinations;

[0083] Inputting the masked permutations and combinations into the text-to-text converter, and using the text-to-text converter to fill in the mask using natural language;

[0084] The beam search is used to decode the permutations and combinations after filling the mask to obtain a candidate template set, and the reconstructed template is obtained according to the result obtained after filling the mask.

[0085] In one possible implementation, the original input can be directly used as a predetermined constraint. If the input has f factors, then the input of the text-to-text converter has f! permutations and combinations. In the embodiment of the present application, the input tuple is (x i ,y i ,t i ), event type analysis has only three elements: sentences, trigger words and labels, and function P is used to output all permutations and combinations of these inputs, as shown below:

[0086]

[0087] Fill in the masks in the above permutations and combinations respectively to obtain the masked permutations and combinations as shown below:

[0088]

[0089] Use a text-to-text converter to fill in the placeholders above using natural language" <x> ”、" <y> ”、" <z>For each permutation and combination, beam search is used to decode the padded permutation and combination, and the text-to-text converter can generate a template candidate set accordingly, and the template candidate set is calculated by the following formula:

[0090]

[0091] in, represents the template candidate set, Beam represents beam search, V represents the vocabulary of the pre-trained language model, Represents the jth template in the template candidate set The characters in .

[0092] Each template in the template candidate set is brought into the pre-trained language model, and the final reconstruction template is selected based on the performance of the template in filling the mask in the language model. The reconstruction template is calculated by the following formula:

[0093]

[0094] Among them, [MASK] represents a special placeholder in the template as a mask, P L represents the predicted probability of the pre-trained language model, M(·) represents the label representation equation, Indicates that (x i ,t i ) is rebuilt from a template.

[0095] In a possible implementation, adjusting the pre-trained language model based on the first prompt format to obtain the first language model includes:

[0096] Calculate the similarity between the sentence of the first input tuple and the sentence of the third input tuple in the parent training set;

[0097] Taking the third input tuples corresponding to the first 50% of the similarities as the first support set of the first input tuple;

[0098] converting a third input tuple in the first support set into a third prompt format;

[0099] splicing the first prompt format and the third prompt format to obtain a context;

[0100] Inputting the context into the pre-trained language model to obtain a first training label;

[0101] Calculating Fisher information using the first training label and the label of the first input tuple;

[0102] taking the third input tuple corresponding to the maximum value of the Fisher information as a supporting example;

[0103] The pre-trained language model is adjusted using the supporting examples to obtain a first language model. In a possible implementation, the first Fisher information is calculated using the first training label and the label of the first input tuple, including:

[0104] Calculate a label loss using the first training label and the label of the first input tuple;

[0105] Obtaining a parameter gradient of the pre-trained language model using the label loss;

[0106] The Fisher information is obtained by calculating the parameter gradient.

[0107] In a possible implementation, the using the supporting examples to adjust the pre-trained language model to obtain a first language model includes:

[0108] splicing the supporting example with the sentence prompt format and inputting the concatenated result into the pre-trained language model to obtain a second training label;

[0109] Calculating a training loss using the second training label and the label of the first input tuple;

[0110] The pre-trained language model is adjusted using the training loss to obtain a first language model.

[0111] In step S103, the advantage of learning by demonstration is that it can demonstrate to the language model how to provide answers to the actual input prompts. For example, before providing the query sentence "The capital of China is [MASK]", several examples are given, such as "Great Britain's capital is London. Japan's capital is Tokyo." These demonstration examples enable a powerful language model to learn repeated patterns. Therefore, examples that are semantically close to the query sample in the embedding space can always produce strong performance.

[0112] Therefore, we adopt the pre-trained Sentence-BERT (SBERT) to measure the semantic similarity between examples, which encodes each sentence independently and maps them into a dense vector space. Specifically, SBERT creates Siamese and Triplet networks to update the weights so that the resulting sentence embeddings can be compared using cosine similarity.

[0113] In the embodiment of the present application, SBERT first converts the sentence of the first input tuple and the sentence of the third input tuple in the parent training set into a first input vector and a second input vector respectively, and the similarity is calculated by the following formula:

[0114]

[0115] Wherein, dist(·) represents the calculation of similarity, a represents the first input vector, and b represents the second input vector.

[0116] The cosine similarity between the sentences in the first input tuple and each sentence in the third input tuple in the parent training set is calculated respectively, and after comparison, the third input tuples corresponding to the top 50% of the largest similarities are taken as the first support set.

[0117] Each third input tuple in the first support set is converted by a label representation equation and a text to text converter to obtain a third prompt format.

[0118] The third prompt format is represented by the following formula:

[0119]

[0120] D train represents the training set, T(·) represents the text-to-text converter, M(·) represents the label representation equation, (x i ,y i ,t i ) represents the input tuple.

[0121] In a possible implementation, the context obtained after concatenation is expressed by the following formula:

[0122]

[0123] Among them, c m represents the context, T(·) represents the sentence prompt format obtained after the text-to-text converter converts the sentence of the first input tuple, Indicates the third prompt format, x in Represents the sentence of the third input tuple.

[0124] In one possible implementation, the label loss is calculated by the following formula:

[0125]

[0126] in, represents the label loss, represents the label of the first input tuple, c m represents the context and θ represents the model parameters.

[0127] In a possible implementation, the parameter gradient is calculated by the following formula:

[0128]

[0129] grad(θ i ) represents the gradient of the i-th parameter, represents the label loss.

[0130] In a possible implementation, the Fisher information is calculated by the following formula:

[0131]

[0132] in, represents Fisher information, grad(θ i ) represents the gradient of the i-th parameter, and layers represents each layer in the pre-trained language model.

[0133] In step S103, after obtaining the first language model, the parent label is added to the first sub-training set, and steps S104-106 are performed.

[0134] In the embodiment of the present application, step S104 corresponds to step S101, step S105 corresponds to step S102, and step S106 corresponds to step S103, wherein the difference is that in step S105, when converting the second input tuple in the second sub-training set into the second prompt format, the parent label is introduced, and therefore the parameter of the parent label needs to be considered during the conversion, and the remaining steps are merely simple parameter replacements, which will not be elaborated here.

[0135] After the second language model is obtained in step S106, step S107 is performed to analyze the event type corresponding to the text to be detected using the second language model. In this step, the input of the second language model is the text to be detected, and the output is the event type.

[0136] It can be seen from the above embodiments that the event type analysis method described in the embodiment of the present application is trained by using a parent-child training set with parent-child labels, and the language model is trained with samples from easy to difficult, which is in line with the human course learning process and effectively alleviates the classification bottleneck caused by insufficient data. In addition, the concept of Fisher information is introduced to filter the demonstration examples, so that the supporting examples with the largest amount of information can be dynamically selected for each input tuple to train the model, effectively preventing damage to the performance of the original language model. Compared with the prior art, the present application avoids introducing additional parameters and maintains or even improves the efficiency of adjusting the model while reducing the parameter demonstration examples.

[0137] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.

[0138] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0139] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an event type analysis device.

[0140] refer to Figure 2 , the event type analysis device comprises:

[0141] An acquisition module 21 is configured to acquire a parent training set including a parent label and a first child training set including a child label;

[0142] A conversion module 22, configured to convert the first input tuple in the parent training set into a first prompt format;

[0143] An adjustment module 23 is configured to adjust the pre-trained language model based on the first prompt format to obtain a first language model;

[0144] A data processing module 24 is configured to add the parent label to a corresponding second input tuple of the first sub-training set to obtain a second sub-training set;

[0145] A conversion module 22, configured to convert the second input tuple in the second sub-training set into a second prompt format;

[0146] An adjustment module 23, configured to adjust the first language model based on the second prompt format to obtain a second language model;

[0147] The prediction module 25 is configured to analyze the event type corresponding to the text to be detected by using the second language model.

[0148] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0149] The device of the above embodiment is used to implement the corresponding event type analysis method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0150] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the event type analysis method described in any of the above embodiments is implemented.

[0151] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.

[0152] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0153] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.

[0154] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0155] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0156] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).

[0157] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0158] The electronic device of the above embodiment is used to implement the corresponding event type analysis method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0159] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the event type analysis method described in any of the above embodiments.

[0160] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0161] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the event type analysis method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0162] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0163] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0164] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0165] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.< / z> < / y> < / x>

Claims

1. A method for analyzing event types, It is characterized in that include: Obtain a parent training set including a parent label and a first child training set including a child label; Converting the first input tuple in the parent training set into a first prompt format, comprising: converting the label of the first input tuple into a label vector using an average vector representation method; reconstructing the first input tuple into a sentence prompt format using a reconstruction template; the label vector and the sentence prompt format constitute the first prompt format; The pre-trained language model is adjusted based on the first prompt format to obtain a first language model, including: calculating the similarity between the sentence of the first input tuple and the sentence of the third input tuple in the parent training set; taking the third input tuple corresponding to the first 50% of the similarity as the first support set of the first input tuple; converting the third input tuple in the first support set into a third prompt format; concatenating the first prompt format with the third prompt format to obtain a context; inputting the context into the pre-trained language model to obtain a first training label; using the first training label and the label of the first input tuple to calculate the Fisher information; taking the third input tuple corresponding to the maximum value of the Fisher information as a support example; adjusting the pre-trained language model using the support example to obtain the first language model; Adding the parent label to the corresponding second input tuple of the first sub-training set to obtain a second sub-training set; converting a second input tuple in the second training subset into a second prompt format; Adjusting the first language model based on the second prompt format to obtain a second language model; The second language model is used to analyze the event type corresponding to the text to be detected.

2. The method according to claim 1, It is characterized in that The reconstruction template is obtained by the following method: For each input tuple in the training set, permuting and combining the three elements in each input tuple to obtain a permutation and combination of the input tuple elements; Masks are filled in the permutations and combinations respectively and input into a text-to-text converter, and the reconstruction template is determined using a beam search method.

3. The method according to claim 2, It is characterized in that The steps of filling masks in the permutations and combinations respectively, inputting the masks into a text-to-text converter, and determining the reconstruction template using a beam search method include: Filling masks into the permutations and combinations respectively to obtain masked permutations and combinations; Inputting the masked permutations and combinations into the text-to-text converter, and using the text-to-text converter to fill in the mask using natural language; The beam search is used to decode the permutations and combinations after filling the mask to obtain a candidate template set, and the reconstructed template is obtained according to the result obtained after filling the mask.

4. The method according to claim 1, It is characterized in that The step of calculating the first Fisher information by using the first training label and the label of the first input tuple includes: Calculate a label loss using the first training label and the label of the first input tuple; Obtaining a parameter gradient of the pre-trained language model using the label loss; The Fisher information is obtained by calculating the parameter gradient.

5. The method according to claim 1, It is characterized in that The step of adjusting the pre-trained language model by using the supporting examples to obtain a first language model includes: splicing the supporting example with the sentence prompt format and inputting the concatenated result into the pre-trained language model to obtain a second training label; Calculating a training loss using the second training label and the label of the first input tuple; The pre-trained language model is adjusted using the training loss to obtain a first language model.

6. An event detection device, the device being used to implement the method of claim 1, It is characterized in that include: An acquisition module is configured to acquire a parent training set including a parent label and a first child training set including a child label; A conversion module configured to convert a first input tuple in the parent training set into a first prompt format; an adjustment module, configured to adjust the pre-trained language model based on the first prompt format to obtain a first language model; A data processing module is configured to add the parent label to a corresponding second input tuple of the first sub-training set to obtain a second sub-training set; a conversion module configured to convert a second input tuple in the second sub-training set into a second prompt format; an adjustment module, configured to adjust the first language model based on the second prompt format to obtain a second language model; The prediction module is configured to use the second language model to analyze the event type corresponding to the text to be detected.

7. 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 method according to any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium storing computer instructions, It is characterized in that The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 5.