Event extraction method, device, equipment and medium based on large model

Through the combination of dependency syntax analysis and multi-feature extraction models, the problem of neglected event structure in the existing technology is solved, and high-quality event extraction results and model accuracy are achieved.

CN118378700BActive Publication Date: 2024-09-24HAINA CLOUD IOT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822792.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-24
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing event extraction methods usually only consider sentence semantics when processing sentences and ignore event structure, resulting in low-quality examples and affecting the accuracy of the model.

Method used

Obtain triples of event instances through dependency syntax analysis, use multiple feature extraction models to obtain feature vectors, and conduct iterative training through two large models to ensure the accuracy and structural consistency of the extraction results.

Benefits of technology

It improves the quality and accuracy of event extraction results, enhances the model's context learning and reasoning capabilities, and ensures the high quality and structural consistency of the extraction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The present application provides an event extraction method, device, equipment and medium based on a large model, which relates to the field of natural language processing. The method includes: performing dependency syntax analysis on an event instance to obtain a triple of the event instance; according to the event instance and the triple, obtaining a feature vector corresponding to the event instance through an extraction model, and placing the feature vector in a vector database; confirming the input of the first large model according to the event definition, generation rules, the vector database and the event to be extracted of the event instance, and obtaining the extraction result of the event to be extracted through the first large model, wherein the event definition includes an event type, and the generation rules are used to provide rules for the first large model to extract the event to be extracted; updating the generation rules according to the extraction results through the second large model. The method of the present application can achieve high-quality event capture and improve the model learning ability.
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, and in particular to a large model-based event extraction method, device, equipment and medium. Background Art

[0002] Natural language processing involves computer science and artificial intelligence, and is dedicated to enabling computers to understand, generate and interact with human natural language. Natural language processing technology has a wide range of applications in many fields, including text generation, information retrieval, syntactic analysis, and situational understanding.

[0003] Existing event extraction methods usually only consider the semantic relevance of sentences when processing sentences, but lack attention to the specific event structure, which will introduce low-quality examples and affect the accuracy of the model.

[0004] Therefore, this application proposes an event extraction method based on a large model, which can obtain higher quality examples and improve the quality and accuracy of model extraction results. Summary of the invention

[0005] The present application provides a large model-based event extraction method, apparatus, device and medium to solve the problem in the prior art that low-quality examples are introduced, thereby affecting the accuracy of the model.

[0006] In a first aspect, the present application provides an event extraction method based on a large model, comprising:

[0007] Performing dependency syntax analysis on the event instance to obtain triples of the event instance, wherein each triple includes three elements related to the event instance;

[0008] According to the event instance and the triple, a feature vector corresponding to the event instance is obtained by extracting a model, wherein one feature vector is extracted from each event instance by each extraction model, and the feature vector is placed in a vector database;

[0009] Confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rule is used to provide the first large model with a rule for extracting the event to be extracted;

[0010] The generation rules are updated according to the extraction results through the second largest model.

[0011] In a possible implementation, confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database, and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model includes:

[0012] Acquire the event to be extracted from the event instance, and acquire a generation rule according to the event to be extracted and a rule set, wherein the rule set is initialized to be empty;

[0013] Acquire a feature vector corresponding to the event to be extracted from the vector database according to the event to be extracted, and obtain a union of the feature vectors corresponding to the event to be extracted, wherein the number of feature vectors corresponding to each event to be extracted is the same as the number of the extraction models;

[0014] The event definition, generation rules, the union and the event to be extracted of the event instance are input into the first large model, and the extraction result of the event to be extracted is obtained through the first large model.

[0015] In a possible implementation, updating the generation rule according to the extraction result by using the second largest model includes:

[0016] confirming whether the extraction result is consistent with the reference result, and if not, generating a new generation rule through the second large model according to the event to be extracted, the extraction result and the reference result, wherein the reference result is a triple corresponding to the event to be extracted;

[0017] The new generation rule is updated into a rule set, wherein the rule set with updated generation rules can be used to train the first large model.

[0018] In a possible implementation manner, after updating the generation rule, the method further includes:

[0019] Obtaining the accuracy of the extraction result, and confirming whether the accuracy is less than a preset threshold;

[0020] If the accuracy is less than a preset threshold, confirming to delete the generation rule corresponding to the extraction result from the rule set;

[0021] If there are idle rules in the rule set, confirm to delete the idle rules, wherein the idle rules are generation rules in the rule set that have not been used to obtain the extraction results within a preset time period.

[0022] In a possible implementation, acquiring a feature vector corresponding to the event instance by extracting a model according to the event instance and the triplet includes:

[0023] Combining the triples and the event instances into natural language, and encoding the natural language through a first extraction model to obtain a first feature vector;

[0024] Confirm the start and end points of the event instance, and confirm multiple fragment vectors according to the triples through a second extraction model, and combine the multiple fragment vectors into a second feature vector, wherein the first feature vector and the second feature vector are both feature vectors corresponding to the event instance.

[0025] In a possible implementation, before confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, the method further includes:

[0026] According to the event type and event elements of the event instance in the historical data, confirm multiple information points of the event instance, wherein the information points include the event type and the event elements, and the event elements include the event occurrence location and the event occurrence time;

[0027] Generate a prompt language for the first large model, and define the information point as an event, so that the first large model can output corresponding content according to the information point as an extraction result of the event to be extracted.

[0028] In a possible implementation, obtaining the accuracy of the extraction result includes:

[0029] Obtaining the number of recalls of the generation rule used to obtain the extraction result, and obtaining the number of successful inferences of the generation rule used to obtain the extraction result;

[0030] The accuracy of the extraction result is obtained according to the number of recalls and the number of successful inferences, wherein when it is confirmed that the extraction result is consistent with the reference result, the generation rule used to obtain the extraction result achieves successful inference.

[0031] In a second aspect, the present application provides an event extraction device based on a large model, comprising:

[0032] An acquisition module, configured to perform dependency syntax analysis on an event instance to acquire triples of the event instance, wherein each triple includes three elements related to the event instance;

[0033] A processing module, configured to obtain a feature vector corresponding to the event instance through an extraction model according to the event instance and the triple, wherein one feature vector is extracted from each event instance by each extraction model, and the feature vector is placed in a vector database;

[0034] A first training module, used for confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rule is used for providing the first large model with a rule for extracting the event to be extracted;

[0035] The second training module is used to update the generation rules according to the extraction results through a second large model.

[0036] In a third aspect, the present application provides an event extraction device based on a large model, comprising: at least one processor and a memory;

[0037] The memory stores computer-executable instructions;

[0038] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the event extraction method based on the large model as described above.

[0039] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the large model-based event extraction method as described above.

[0040] The present application provides a large-model-based event extraction method, apparatus, device and medium, which perform dependency syntactic analysis on event instances to obtain triples of the event instances, wherein each triple includes three elements about the event instance; according to the event instance and the triples, a feature vector corresponding to the event instance is obtained through an extraction model, wherein each event instance is extracted with a feature vector by each extraction model, and the feature vector is placed in a vector database; according to the event definition, generation rules, vector database and event to be extracted of the event instance, the input of the first large model is confirmed, and the extraction result of the event to be extracted is obtained through the first large model, wherein the event definition includes an event type, and the generation rules are used to provide rules for the first large model to extract the event to be extracted; according to the extraction result, the generation rules are updated through the second large model.

[0041] In the above method, starting from the structural perspective of event instances, event instances are converted into triples through dependency syntax analysis to more accurately capture event information; multiple feature extraction models are used to allow the extraction model to obtain the feature vector corresponding to the event instance based on the event instance and the triple, thereby obtaining a high-quality demonstration example to ensure that the example and the event to be extracted have similar structure and semantics, wherein the feature vector is stored in a vector database; the event to be extracted is obtained from the event instance, and two large models are set for training. The first large model is used to obtain the extraction result of the event to be extracted based on the event definition, generation rules, vector database and input confirmed by the event to be extracted of the event instance, and the second large model is used to update the generation rules according to the extraction result. The training process of the first large model and the second large model is repeated many times. After the iteration is completed, a model that can complete accurate reasoning is obtained. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 1 A schematic diagram of a scenario of event extraction based on a large model provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 1 ;

[0045] Figure 3 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 2 ;

[0046] Figure 4 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 3 ;

[0047] Figure 5 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 4 ;

[0048] Figure 6 A diagram of an event extraction device based on a large model provided by an embodiment of the present invention;

[0049] Figure 7 A hardware schematic diagram of a large model-based event extraction device provided in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0051] Existing event extraction methods based on contextual learning have some limitations in recalling examples, mainly because they ignore event structure information; for example, traditional methods usually only consider the semantic relevance of sentences and lack attention to the specific event structure, which may lead to the introduction of a large number of low-quality examples, thus affecting the accuracy of the model.

[0052] In addition, existing contextual learning methods usually do not explicitly model hard samples, which limits the model's ability to learn from negative samples.

[0053] In summary, the present invention improves and optimizes the event extraction method based on context learning by starting from the two aspects of event structure information and hard-to-distinguish samples, thereby improving the accuracy and generalization ability of the model.

[0054] Therefore, this application proposes an event extraction method based on a large model. This application analyzes event instances from the perspective of event structure information to more accurately capture event information; and adopts different feature extraction methods to obtain high-quality demonstration examples; this process takes into account the semantic relevance of sentences, and at the same time, from the perspective of event structure, ensures that the recalled examples have similar structures and semantics to the events to be extracted, effectively improving the quality of the extraction results;

[0055] In addition, in order to enhance the model's reasoning ability, for difficult-to-classify samples, the model is allowed to summarize rules from erroneous examples so that the model can better understand and handle complex scenarios, thereby improving the contextual learning ability of large models.

[0056] The implementation process of an event extraction method based on a large model proposed in this application is described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0057] Figure 1 A schematic diagram of a scenario of event extraction based on a large model provided in an embodiment of the present application. Figure 1 As shown, the system includes: an extraction model, a vector database, a first large model and a second large model;

[0058] Perform dependency syntax analysis on the event instance, and obtain triples of the event instance while considering the event structure. Each triple includes three elements about the event instance. According to the information of the three elements in the triple, the event content can be basically illustrated. If the event instance is a complete sentence, the three elements in the triple are three main information words.

[0059] In order to obtain high-quality examples, different extraction models are used to obtain the feature vectors corresponding to event instances based on event instances and triples. Each event instance is extracted with a feature vector by each extraction model. The number of feature vectors corresponding to an event instance is determined by the number of extraction models used. The feature vectors obtained by all extraction models are put into the vector database.

[0060] In order for the large model to automatically learn from error cases, two large models can be set up for model training, including the first large model and the second large model; in the process of training the model, the first large model is responsible for extracting event instances and obtaining extraction results, and the second large model is responsible for adjusting and updating the generation rules according to the extraction results until multiple iterative calculations are completed to obtain a model with good reasoning ability; wherein, the input of the first large model is based on the event definition, generation rules, vector database and event confirmation to be extracted of the event instance; the event definition includes the event type, and the generation rules are used to provide rules for the first large model to extract the events to be extracted.

[0061] Figure 2 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 1 .like Figure 2 As shown, the method includes:

[0062] S201. Perform dependency syntactic analysis on an event instance to obtain triples of the event instance, wherein each triple includes three elements related to the event instance.

[0063] In Natural Language Processing (NLP), event instances refer to specific types of events and their related information that are identified and extracted in text; these events can be any activities or situations with specific time, place, participants, and actions; in the emergency field, extracting emergency events including fire events can help to accurately obtain and extract disaster situations;

[0064] Dependency syntactic analysis is a text analysis method that can analyze a sentence into a dependency syntactic tree to describe the dependency relationship between each word. Dependency syntactic analysis of event instances can obtain triples of event instances. Each triple includes three elements about the event instance, that is, the complete sentence is divided into three keywords. If the event instance is a simple sentence, then there may be one triple corresponding to the event instance. If the event instance is a complex sentence, then there may be multiple triples corresponding to the event instance.

[0065] For example, the sentence "A fire broke out in City A" can extract the triple (City A, fire broke out); the tool for dependency parsing can be an NLP open source toolkit.

[0066] S202. According to the event instance and the triplet, a feature vector corresponding to the event instance is obtained by extracting a model, wherein one feature vector is extracted from each event instance by each extraction model, and the feature vector is placed in a vector database.

[0067] In the example recall process, this embodiment uses multiple extraction models to extract features from event instances and obtain corresponding feature vectors, that is, to obtain high-quality demonstration examples; one extraction model can extract a corresponding feature vector for one event instance, and feature vectors extracted by multiple extraction models can be placed in the same vector database;

[0068] The process of selecting two extraction models for extraction:

[0069] For example, the triples and the event instances are combined into natural language, and the natural language is encoded by a first extraction model to obtain a first feature vector;

[0070] Confirm the start and end points of the event instance, and confirm multiple fragment vectors according to the triples through a second extraction model, and combine the multiple fragment vectors into a second feature vector, wherein the first feature vector and the second feature vector are both feature vectors corresponding to the event instance.

[0071] The two extraction models are the first extraction model and the second extraction model. When using the first extraction model, the triples obtained by dependency syntactic analysis and the event instance are first combined into natural language, and the first extraction model is used to encode the natural language, thereby obtaining a single first feature vector extracted by the first extraction model for the event instance. The first extraction model is the SimCSE model, which is used to generate sentence embeddings, so that similar sentences are closer in the embedding space, while dissimilar sentences are farther away.

[0072] The input of the first extraction model is, for example, "a fire occurred in City A. The event elements are City A, occurred, fire"; where "a fire occurred in City A" is an event instance, and "City A, occurred, fire" is triple information; the first extraction model is responsible for encoding the entire input;

[0073] When using the second extraction model, the start and end points of the event instance are first confirmed, and multiple fragment vectors are extracted from the event instance based on the triple confirmation, and the multiple fragment vectors are combined into a single second feature vector through the maximum pooling operation; the second extraction model is a fine-tuned SpanBERT model, which is an improved BERT (Bidirectional Encoder Representations from Transformers) model used to better model span information;

[0074] The input of the second extraction model is, for example: "[CLS] A fire occurred in City A [SEP]", [CLS] is the starting point marker, [SEP] is the end point marker, and the SpanBERT model is responsible for extracting the three segment vectors of "City A, occurred, fire" from the triples, and then combining them into a single second feature vector using the maximum pooling operation; the second feature vector It can be expressed as:

[0075]

[0076] in, is the maximum pooling operator; , , are three fragment vectors respectively;

[0077] The sentences are converted into multiple triplets, so that the recalled examples can more accurately reflect the true semantics and structure of the events to be extracted; this refined recall process can not only ensure the high quality of the recall results, but also provide more accurate and rich context examples for the large model, thereby significantly enhancing the context learning ability of the large model.

[0078] S203. Confirm the input of the first large model according to the event definition of the event instance, the generation rules, the vector database and the event to be extracted, and obtain the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rules are used to provide rules for the first large model to extract the event to be extracted.

[0079] The input of the first large model requires four parts, including event definition, rules recalled from the rule set, demonstration examples recalled from the vector database, and text fragments to be extracted; among them, the event definition is to define the key content in the event, so that the model can understand and extract the specific information in the definition. The event definition includes the event type. For example, after defining the event type, the model can extract the event type as fire; the demonstration example recalled from the vector database is the feature vector obtained from the vector database, the event to be extracted is an instance obtained from the event instance, and the generation rule is the rule of how the first large model treats the extracted event. After receiving the input, the first large model can obtain the extraction result of the event to be extracted, for example, allowing the first large model to extract fire from the event instance.

[0080] S204: Update the generation rules according to the extraction results through the second largest model.

[0081] After the first model completes the extraction of an event to be extracted based on the input, the second model is used to update the rules. When the second model confirms that the extraction result obtained by the first model is wrong, it can generate new generation rules and put them into the rule set, so that the first model can have more rule choices when processing the event to be extracted next time. The first model and the second model are continuously trained to eventually obtain a model with good reasoning ability.

[0082] In an embodiment of the present application, starting from the structural perspective of event instances, event instances are converted into triples through dependency syntax analysis to more accurately capture event information; multiple feature extraction models are used to allow the extraction model to obtain feature vectors corresponding to event instances based on event instances and triples, thereby obtaining high-quality demonstration examples and ensuring that the examples and events to be extracted have similar structures and semantics, wherein the feature vectors are stored in a vector database; events to be extracted are obtained from event instances, and two large models are set for training, wherein the first large model is used to obtain extraction results of events to be extracted based on event definitions, generation rules, a vector database, and inputs confirmed by events to be extracted of the event instances, and the second large model is used to update generation rules based on the extraction results, and the training process of the first large model and the second large model is repeated multiple times. After the iteration is completed, a model that can complete accurate reasoning is obtained.

[0083] Figure 3 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 2 .like Figure 3 As shown, the method includes:

[0084] S301. Acquire the event to be extracted from the event instance, and acquire a generation rule according to the event to be extracted and a rule set, wherein the rule set is initialized to be empty.

[0085] During the training process, the event instances used are obtained from the training set, and the events to be extracted are obtained from the event instances. Based on the events to be extracted and the rule set, the generation rules applicable to the events to be extracted can be selected. The generation rules are one of the inputs of the first largest model. In the first iteration of training the first largest model, the rule set is initialized to empty, and the generation rules can be added or deleted to the rule set subsequently through the second largest model.

[0086] S302. Acquire a feature vector corresponding to the event to be extracted from the vector database according to the event to be extracted, and obtain a union of the feature vectors corresponding to the event to be extracted, wherein the number of feature vectors corresponding to each event to be extracted is the same as the number of extraction models.

[0087] There is a corresponding relationship between event instances and their feature vectors, so there is also a corresponding relationship between the event to be extracted and its feature vector; an event instance corresponds to multiple feature vectors according to multiple extraction models, so an event to be extracted also corresponds to multiple feature vectors; according to the event to be extracted, the corresponding feature vector can be obtained from the vector database, including feature vectors extracted by different extraction models, and the feature vectors obtained from different extraction models can be unioned, and the union is one of the inputs of the first largest model.

[0088] S303: Input the event definition, generation rules, the union and the event to be extracted of the event instance into the first large model, and obtain the extraction result of the event to be extracted through the first large model.

[0089] The event definition of the event instance is one of the inputs of the first large model. The first large model can make corresponding outputs according to the event definition:

[0090] For example, according to the event type and event elements of the event instance in the historical data, multiple information points of the event instance are confirmed, wherein the information points include the event type and the event elements, and the event elements include the event location and the event time;

[0091] Generate a prompt language for the first large model, and define the information point as an event, so that the first large model can output corresponding content according to the information point as an extraction result of the event to be extracted.

[0092] According to the event instances in the historical data or the empirical data, the event type and event elements of the event instance are confirmed. The event type is an important information point representing the event, and the event element is other important information points representing the event, including the location and time of the event. In a fire event, the event elements may include the location, time and number of casualties. The above information points constitute the event definition.

[0093] Generate a prompt language of the first large model, and input the event definition into the first large model, so that the first large model can output corresponding content as the extraction result of the event to be extracted according to the information point;

[0094] After confirming the inputs of the first large model, you can use the first large model for extraction training. During each iterative training process, the first large model needs to traverse the entire training set;

[0095] The prompt language set in this embodiment is: Please determine the event type of the following event and extract the corresponding event element. The event type and event element are selected from the following definitions:

[0096] Type of incident, location of incident, time of incident, number of casualties.

[0097] The output of the first large model, that is, the extraction result is:

[0098] Event type: fire, event location: City A, event time: X hours, number of casualties: Y people.

[0099] In the embodiment of the present application, each input of the first large model is confirmed, and the model is trained based on high-quality inputs to facilitate obtaining a good model.

[0100] Figure 4 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 3 .like Figure 4 As shown, the method includes:

[0101] S401. Confirm whether the extraction result is consistent with the reference result. If not, generate a new generation rule through the second large model according to the event to be extracted, the extraction result and the reference result, wherein the reference result is the triple corresponding to the event to be extracted.

[0102] During the training process, the second largest model is responsible for processing the generation rules; after the first largest model completes an extraction training and obtains the extraction result, it is necessary to confirm whether the extraction result is consistent with the reference result. If they are consistent, it means that the first largest model is extracted correctly, and the generation rules used to obtain the extraction result can continue to be included; if the extraction result is inconsistent with the reference result, it means that the first largest model is extracted incorrectly, and the second largest model is required to generate new generation rules based on the event to be extracted, the extraction result and the reference result; among which, the reference result is the actual content of the triple corresponding to the event to be extracted, and the extraction result is the predicted content;

[0103] The extraction result is inconsistent with the reference result. For example, the extraction result of the first model is: occurrence, fire, but the reference result is: beware, fire.

[0104] S402: Update the new generation rule into a rule set, wherein the rule set of updated generation rules can be used to train the first large model.

[0105] The second largest model places the new generation rules in the rule set, so that the first largest model can have new generation rules to choose from during the next iteration, thereby generating more accurate extraction results.

[0106] In the embodiment of the present application, when training the second largest model to generate new generation rules, the error of the extraction results is taken into consideration, so that the model can change the rules when an error occurs, thereby improving the learning effect of the model and enhancing the model's reasoning ability.

[0107] Figure 5 A schematic diagram of a process of event extraction method based on a large model provided in an embodiment of the present application Figure 4 .like Figure 5 As shown, the method includes:

[0108] S501: Obtain the accuracy of the extraction result, and confirm whether the accuracy is less than a preset threshold.

[0109] In addition to updating the generation rules based on the extraction results of the first model, the second model can also manage the generation rules in the rule set; after each iteration, the accuracy of the extraction results is calculated, and it is determined whether the accuracy is less than a preset threshold;

[0110] The process of calculating accuracy:

[0111] For example, obtaining the number of recalls of the generation rule used to obtain the extraction result, and obtaining the number of successful inferences of the generation rule used to obtain the extraction result;

[0112] The accuracy of the extraction result is obtained according to the number of recalls and the number of successful inferences, wherein when it is confirmed that the extraction result is consistent with the reference result, the generation rule used to obtain the extraction result achieves successful inference.

[0113] Get the recall times, that is, the usage times, of the generation rules used to obtain the extraction results; and get the successful inference times of the generation rules used to obtain the extraction results. If the extraction results are exactly the same as the reference results, then; get the ratio of the successful inference times to the recall times, and you can get the accuracy of the extraction results.

[0114] S502: If the accuracy rate is less than a preset threshold, confirm that a generation rule corresponding to the extraction result is deleted from the rule set.

[0115] According to the training requirements, a preset threshold is set for the accuracy. If the accuracy is less than the preset threshold, it is confirmed that the quality of the generation rules used to obtain the extraction results is poor, and the generation rules with poor quality can be deleted from the rule set; if the accuracy is greater than or equal to the preset threshold, it means that the quality of the generation rules used to obtain the extraction results is good and is usable, and can continue to be retained in the rule set.

[0116] S503: If there are idle rules in the rule set, confirm to delete the idle rules, wherein the idle rules are generation rules in the rule set that have not been used to obtain the extraction results within a preset time period.

[0117] If there are generation rules in the rule set that have not been used for a long time, the generation rules are idle rules. Confirm to delete the idle rules to avoid the accumulation of inapplicable rules in the rule set. The way to confirm whether it is an idle rule is to set a preset time or number of iterations, which is less than the total number of iterations for training the two large models. Within the preset time or number of iterations, if one or some generation rules are not selected by the first large model for extraction, then that or those generation rules can be deleted.

[0118] The large model training process can be written as:

[0119]

[0120]

[0121]

[0122] in, Indicated in e In iterations; D is the training set, which can be expressed as , For the p event instances, For the p triples; Indicates selecting event instances and corresponding triples in the training set; G To generate rules; is the recall function; R is a set of rules; , are different eigenvectors; is the feature vector matching function; v is a vector database; , Demonstrate examples for different matches; is the input paradigm of the first large model, is a combination function; For the first large model processing; This is the extraction result of the first largest model; Indicates the condition. If the extraction result is not equal to the reference result, the following process will start; For the new generation rules; For the treatment of the second largest model; Generate a rule deletion function to delete rules with low accuracy and that have not been used for a long time;

[0123] When the first model recalls from the rule set and vector database, the nearest neighbor (k-NearestNeighbor, KNN) algorithm can be used; after the second model completes the rule organization, it can continue to the next iteration and let the first model perform the next extraction; the model testing process is similar to the training process, except that the event instances in the test set need to be reprocessed to obtain the corresponding feature vectors.

[0124] In an embodiment of the present application, in one iterative training, after the first large model completes the extraction, the second large model performs a rule deletion process on the rule set to ensure timely adjustment of the generation rules in the rule set so that the finally trained large model has a good learning effect; the accumulation and application of these rules enable the model to make decisions more confidently and accurately during the reasoning process, thereby improving the overall reasoning efficiency and accuracy.

[0125] Figure 6 A diagram of an event extraction device based on a large model provided by an embodiment of the present invention, such as Figure 6 As shown, the device includes: an acquisition module 601, a processing module 602, a first training module 603, and a second training module 604;

[0126] The acquisition module 601 is used to perform dependency syntax analysis on the event instance to obtain triples of the event instance, wherein each triple includes three elements related to the event instance.

[0127] Processing module 602 is used to obtain the feature vector corresponding to the event instance through the extraction model according to the event instance and the triplet, wherein each event instance is extracted with a feature vector by each extraction model, and the feature vector is placed in a vector database.

[0128] The processing module 602 is further used to combine the triples and the event instances into natural language, and encode the natural language through a first extraction model to obtain a first feature vector;

[0129] Confirm the start and end points of the event instance, and confirm multiple fragment vectors according to the triples through a second extraction model, and combine the multiple fragment vectors into a second feature vector, wherein the first feature vector and the second feature vector are both feature vectors corresponding to the event instance.

[0130] The first training module 603 is used to confirm the input of the first large model according to the event definition of the event instance, the generation rules, the vector database and the event to be extracted, and obtain the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rules are used to provide rules for the first large model to extract the event to be extracted.

[0131] The first training module 603 is further used to obtain the event to be extracted from the event instance, and obtain a generation rule according to the event to be extracted and a rule set, wherein the rule set is initialized to be empty;

[0132] Acquire a feature vector corresponding to the event to be extracted from the vector database according to the event to be extracted, and obtain a union of the feature vectors corresponding to the event to be extracted, wherein the number of feature vectors corresponding to each event to be extracted is the same as the number of the extraction models;

[0133] The event definition, generation rules, the union and the event to be extracted of the event instance are input into the first large model, and the extraction result of the event to be extracted is obtained through the first large model.

[0134] The second training module 604 is used to update the generation rules according to the extraction results through the second large model.

[0135] The second training module 604 is also used to confirm whether the extraction result and the reference result are consistent. If not, a new generation rule is generated by the second large model according to the event to be extracted, the extraction result and the reference result, wherein the reference result is a triple corresponding to the event to be extracted;

[0136] The new generation rule is updated into a rule set, wherein the rule set with updated generation rules can be used to train the first large model.

[0137] The present application also provides an event extraction device based on a large model, comprising: at least one processor and a memory;

[0138] The memory stores computer-executable instructions;

[0139] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs an event extraction method based on a large model.

[0140] Figure 7 The hardware diagram of the event extraction device based on the large model provided by the embodiment of the present invention is shown in FIG. Figure 7 As shown, the event extraction device 70 based on the large model provided in this embodiment includes: at least one processor 701 and a memory 702. The device 70 also includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.

[0141] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.

[0142] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0143] In the above Figure 7 In the illustrated embodiment, the processor may be a central processing unit (CPU) or other general-purpose processors. The memory may include a high-speed memory (Random Access Memory, RAM), a non-volatile memory (NVM), etc. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc.

[0144] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described above is implemented.

[0145] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, and can be any available medium that can be accessed by a general or special-purpose computer. All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. An event extraction method based on a large model, characterized in that: include: Performing dependency syntax analysis on the event instance to obtain triples of the event instance, wherein each triple includes three elements related to the event instance; According to the event instance and the triple, a feature vector corresponding to the event instance is obtained by extracting a model, wherein one feature vector is extracted from each event instance by each extraction model, and the feature vector is placed in a vector database; Confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rule is used to provide the first large model with a rule for extracting the event to be extracted; The generation rules are updated according to the extraction results through the second largest model.

2. The event extraction method based on a large model according to claim 1, characterized in that: The step of confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model includes: Acquire the event to be extracted from the event instance, and acquire a generation rule according to the event to be extracted and a rule set, wherein the rule set is initialized to be empty; Acquire a feature vector corresponding to the event to be extracted from the vector database according to the event to be extracted, and obtain a union of the feature vectors corresponding to the event to be extracted, wherein the number of feature vectors corresponding to each event to be extracted is the same as the number of the extraction models; The event definition, generation rules, the union and the event to be extracted of the event instance are input into the first large model, and the extraction result of the event to be extracted is obtained through the first large model.

3. The event extraction method based on a large model according to claim 1, characterized in that: The updating of the generation rules according to the extraction result by the second largest model includes: confirming whether the extraction result is consistent with the reference result, and if not, generating a new generation rule through the second large model according to the event to be extracted, the extraction result and the reference result, wherein the reference result is a triple corresponding to the event to be extracted; The new generation rule is updated into a rule set, wherein the rule set with updated generation rules can be used to train the first large model.

4. The event extraction method based on a large model according to claim 1, characterized in that: After updating the generation rule, the method further includes: Obtaining the accuracy of the extraction result, and confirming whether the accuracy is less than a preset threshold; If the accuracy is less than a preset threshold, confirming to delete the generation rule corresponding to the extraction result from the rule set; If there are idle rules in the rule set, confirm to delete the idle rules, wherein the idle rules are generation rules in the rule set that have not been used to obtain the extraction results within a preset time period.

5. The event extraction method based on a large model according to claim 1, characterized in that: The step of obtaining a feature vector corresponding to the event instance by extracting a model according to the event instance and the triplet includes: Combining the triples and the event instances into natural language, and encoding the natural language through a first extraction model to obtain a first feature vector; Confirm the start and end points of the event instance, and confirm multiple fragment vectors according to the triples through a second extraction model, and combine the multiple fragment vectors into a second feature vector, wherein the first feature vector and the second feature vector are both feature vectors corresponding to the event instance.

6. The event extraction method based on a large model according to claim 1, characterized in that: Before confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, the method further includes: According to the event type and event elements of the event instance in the historical data, confirm multiple information points of the event instance, wherein the information points include the event type and the event elements, and the event elements include the event occurrence location and the event occurrence time; Generate a prompt language for the first large model, and define the information point as an event, so that the first large model can output corresponding content according to the information point as an extraction result of the event to be extracted.

7. The event extraction method based on a large model according to claim 4 is characterized in that: The obtaining of the accuracy of the extraction result comprises: Obtaining the number of recalls of the generation rule used to obtain the extraction result, and obtaining the number of successful inferences of the generation rule used to obtain the extraction result; The accuracy of the extraction result is obtained according to the number of recalls and the number of successful inferences, wherein when it is confirmed that the extraction result is consistent with the reference result, the generation rule used to obtain the extraction result achieves successful inference.

8. An event extraction device based on a large model, characterized in that: include: An acquisition module, configured to perform dependency syntax analysis on an event instance to acquire triples of the event instance, wherein each triple includes three elements related to the event instance; A processing module, configured to obtain a feature vector corresponding to the event instance through an extraction model according to the event instance and the triple, wherein one feature vector is extracted from each event instance by each extraction model, and the feature vector is placed in a vector database; A first training module, used for confirming the input of the first large model according to the event definition of the event instance, the generation rule, the vector database and the event to be extracted, and obtaining the extraction result of the event to be extracted through the first large model, wherein the event definition includes the event type, and the generation rule is used for providing the first large model with a rule for extracting the event to be extracted; The second training module is used to update the generation rules according to the extraction results through a second large model.

9. An event extraction device based on a large model, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the large model-based event extraction method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the event extraction method based on a large model as described in any one of claims 1 to 7 are implemented.