Construction of event extraction model based on semantic injection enhancement and event extraction method

By building a semantic injection-enhanced event extraction model, the problems of lack of deep semantic optimization and sparse annotated data in existing technologies are solved, the event extraction performance of the model in complex scenarios is improved, and higher accuracy and generalization ability are achieved.

CN120163231BActive Publication Date: 2025-09-19CHINA JILIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510639331.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2025-09-19
Estimated Expiration
2045-05-19

AI Technical Summary

Technical Problem

Existing technologies lack deep semantic optimization, insufficient research on the fusion of labeled data and fine-tuning strategies in event extraction, resulting in insufficient extraction performance of the model in complex scenarios and data sparseness.

Method used

By building a semantic injection-enhanced event extraction model, using semantic enhancement tables and semantic anchor dictionary to optimize the loss function of the large language model, and combining task descriptions and structured output constraints, the model's understanding and extraction accuracy of event text are improved.

Benefits of technology

The accuracy and generalization ability of event extraction are improved, especially in complex scenarios and data sparse conditions, which can better identify and extract relevant events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120163231B_ABST
    Figure CN120163231B_ABST
Patent Text Reader

Abstract

This technical solution provides an event extraction model construction and event extraction method based on semantic injection enhancement. A prompt template is constructed based on the task description, event type, event role table, semantic enhancement table and structured output constraints that define the event extraction task. The event text and the corresponding prompt template are used as a fine-tuning dataset, and the fine-tuning dataset is enhanced. The output content of the large language model is trained using the fine-tuning dataset until the loss function meets the requirements, thereby obtaining an event extraction model based on semantic injection enhancement. The loss function used in the training of the large language model is the combined value of the prototype loss and the cross-entropy loss. The prototype loss, which reflects the prototype structure problem, is calculated by using the predicted event type extracted from the output content of the large language model and the semantic anchor dictionary constructed based on the semantic enhancement table, thereby improving the accuracy and generalization ability of event extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to the construction of an event extraction model based on semantic injection enhancement and an event extraction method. Background Art

[0002] Event extraction (EE) is a critical task for identifying event types and related elements from unstructured text, and has broad application prospects in fields such as information retrieval and knowledge graph construction. Traditional methods rely on static models and large amounts of annotated data, using supervised training through rule matching or feature-based machine learning algorithms, particularly deep learning. Common algorithms include sequence annotation methods based on conditional random fields (CRFs) and pre-trained models such as BERT. These methods often use cross-entropy loss and require intermediate steps such as extracting event trigger words. As a result, traditional methods have relatively simple semantic representations, limited generalization capabilities, and require a large number of intermediate and final annotations. This results in insufficient task performance, especially in complex and changing scenarios and with sparse data.

[0003] In recent years, large language models (LLMs), with their powerful generative capabilities and potential for semantic understanding, have brought new ideas and methods to event extraction. Using pre-trained general language models, a direct prompt input can generate structured output, such as "Attack#we_attacker;." This approach simplifies the event extraction process, avoids complex intermediate steps, and demonstrates significant potential for performance improvements. It holds broad application prospects in areas such as news event monitoring and financial risk analysis.

[0004] However, in practical applications, directly injecting task semantics through prompts and optimizing event extraction performance through efficient fine-tuning on large models still face many challenges:

[0005] 1) Lack of deep semantic optimization: The cross-entropy loss commonly used in large models focuses only on token-level predictions, ignoring the deeper semantics of event types. For example, when extracting events related to "economic crisis," the model may simply match keywords in the text, failing to deeply understand the complex economic phenomena and semantic relationships inherent in the event type "economic crisis," resulting in inaccurate extraction results.

[0006] 2) Sparsity of labeled data: The scarcity of high-quality labeled data severely limits model performance. Acquiring large amounts of high-quality labeled data is costly. In the absence of sufficient data, models struggle to learn comprehensive and accurate event patterns and features, significantly compromising their ability to extract complex events. For example, in some emerging fields or specific scenarios, the lack of sufficient labeled data makes it difficult for models to effectively identify and extract relevant events.

[0007] 3) Limited research on fine-tuning strategy fusion: There is limited research on fine-tuning strategies for large models optimized for specific tasks. Different fine-tuning strategies have their own strengths and weaknesses for different tasks and data, but there is currently a lack of effective methods to organically combine multiple fine-tuning strategies to fully leverage the advantages of large models and improve event extraction performance. Summary of the Invention

[0008] The purpose of the present invention is to provide a construction of an event extraction model based on semantic injection enhancement and an event extraction method, which improves the event extraction capability of a large language model by introducing semantic injection enhancement.

[0009] To achieve the above objectives, the present technical solution provides a method for constructing an event extraction model based on semantic injection enhancement, comprising the following steps:

[0010] S1: Obtain at least one event text and determine the event type and event role table of the event text;

[0011] S2: Construct a semantic enhancement table based on dataset samples of different event types;

[0012] S3: Construct a prompt template based on the task description, event type, event role table, semantic enhancement table, and structured output constraints that define the event extraction task. The event text and the corresponding prompt template are used as the fine-tuning dataset. The structured output constraints specify the output content and output format of the event extraction task.

[0013] S4: Perform enhancement processing on the fine-tuning dataset;

[0014] S5: Use the fine-tuning dataset to train the output content of the large language model until the loss function meets the requirements. The loss function used in the large language model training is the combined value of the prototype loss and the cross-entropy loss. The prototype loss, which reflects the prototype structure problem, is calculated by extracting the predicted event type from the output content of the large language model and the semantic anchor dictionary constructed based on the semantic enhancement table.

[0015] This technical solution provides an event extraction method based on semantic injection enhancement, which inputs the event text that needs to be extracted into the event extraction model based on semantic injection enhancement constructed by the method for constructing the event extraction model based on semantic injection enhancement to obtain the event extraction result.

[0016] The technical solution of this scheme also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method for constructing an event extraction model based on semantic injection enhancement or the event extraction method based on semantic injection enhancement.

[0017] Compared with the existing technology, this technical solution has the following characteristics and beneficial effects:

[0018] 1. A semantic injection enhancement method is proposed: For event extraction tasks, on the one hand, the key semantics of related event types are obtained from event knowledge prototypes. For example, the core semantics of events such as "contract disputes" are extracted from event knowledge prototypes in the legal field. On the other hand, semantic features such as vocabulary and sentence structure-related features are extracted from event texts with the help of small models such as BERT. These rich semantics are directly integrated into the task prompt template as semantic enhancement tables, improving the model's understanding of event texts and improving the accuracy of event extraction.

[0019] 2. Design a loss optimization strategy that incorporates semantic anchors: This strategy transforms event extraction into a question-answer format, aligning with the generative capabilities of large language models. A semantic anchor dictionary is constructed, for example, identifying semantic anchors such as "earthquake magnitude" for the "natural disaster" event type. During large language model training, the loss function consists of a weighted cross-entropy loss based on token-level predictions and a prototype loss calculated based on the output predicted event type and the semantic anchor dictionary. This balances the contributions of these two factors, optimizes model training, and improves event extraction performance.

[0020] 3. Build a complete event extraction framework: By performing semantic injection enhancement and synonym replacement on the event type of the event text, the data is expanded, and prompt templates are carefully constructed based on the task description, event type, event role table, semantic enhancement table, and structured output constraints. This can effectively improve the generalization of the model and complete accurate event extraction in complex scenarios, such as when processing text with overlapping domain knowledge. For example, in news monitoring, news releases can be analyzed in real time to extract event structured information and help understand news trends. In the field of financial risk analysis, financial-related texts are mined to extract structured content of risk events to provide support for financial decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a flowchart of the method for constructing an event extraction model based on semantic injection enhancement proposed in this solution.

[0022] Figure 2 This is a schematic diagram of the data map of this solution.

[0023] Figure 3This is a logical diagram of the method for constructing an event extraction model based on semantic injection enhancement proposed in this solution.

[0024] Figure 4 It is a framework diagram of an electronic device for implementing this solution. DETAILED DESCRIPTION

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention are within the scope of protection of the present invention.

[0026] It should be understood by those skilled in the art that, in the disclosure of the present invention, the terms "longitudinal", "transverse", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the above terms should not be understood as limiting the present invention.

[0027] Example 1

[0028] like Figure 1 As shown in the figure, this scheme proposes a method for constructing an event extraction model based on semantic injection enhancement, which includes the following steps:

[0029] S1: Obtain at least one event text and determine the event type and event role table of the event text;

[0030] S2: Construct a semantic enhancement table based on dataset samples of different event types;

[0031] S3: Construct a prompt template based on the task description, event type, event role table, semantic enhancement table, and structured output constraints that define the event extraction task. The event text and the corresponding prompt template are used as the fine-tuning dataset. The structured output constraints specify the output content and output format of the event extraction task.

[0032] S4: Perform enhancement processing on the fine-tuning dataset;

[0033] S5: Use the fine-tuning dataset to train the output content of the large language model until the loss function meets the requirements, and obtain an event extraction model based on semantic injection enhancement. The loss function used in the training of the large language model is the combined value of the prototype loss and the cross-entropy loss. The prototype loss, which reflects the prototype structure problem, is calculated by extracting the predicted event type from the output content of the large language model and the semantic anchor dictionary constructed based on the semantic enhancement table.

[0034] This solution uses semantic injection enhancement to construct a semantic enhancement table for event text that requires event extraction. Based on the semantic enhancement table, rich semantics are directly injected into the prompt template. This solution, combined with the prompt template, converts the event extraction task into a question-answer pair for a large language model, thereby leveraging the generative capabilities of the large language model to improve the event extraction accuracy of the event extraction model. In this way, the event extraction model optimized by this solution can better understand the semantic information of event text, accurately identify event types and event roles, and thus improve event extraction performance.

[0035] Specifically, in step S1:

[0036] This solution can directly obtain the event text of the known event type and event role table, or manually define the event type and event role table after obtaining the event text.

[0037] Event text: The text description of the event that needs to be extracted. Event text comes from a wide range of sources, including news reports, social media posts, legal documents, and medical records. Event text can be collected from major news websites and social media platforms using web crawlers. Alternatively, text from specific fields can be obtained from specialized databases. After acquisition, event text is preprocessed, including removing special characters and HTML tags, unifying capitalization, and performing word segmentation and part-of-speech tagging.

[0038] Event Type: Defines the type of event. For legal-related events, the event type can be anything like "declaration of bankruptcy, transfer of ownership, transfer of funds, marriage, transportation, death, arrest and imprisonment, conviction, or prosecution." The event type can be adjusted based on the specific scenario.

[0039] Event Role Table: Defines the roles involved in the current event text. Similarly, when the event text is related to the legal field, the event role table can be any of the following: beneficiary, prosecutor, plaintiff, seller, victim, buyer, agent, destination, organization, recipient, and location.

[0040] In step S2:

[0041] The semantic enhancement table records the semantic enhancement words and / or semantic features corresponding to the current event type, where the semantic enhancement words are words with similar semantic expression meanings to the current event type, and the semantic features are features that represent the semantic enhancement information of the current event type.

[0042] In some embodiments, semantic enhancement words for the current event type are manually defined, and corresponding semantic enhancement words are expanded based on the event type. In this case, a semantic enhancement database with semantic enhancement words corresponding to different event types can be preset, and semantic enhancement words related to the current event type can be filtered from the semantic enhancement database to construct a semantic enhancement table. These semantic enhancement words can more comprehensively and accurately describe the semantic information of the event type. For example, for the event type of "fire", the semantic enhancement vocabulary may include "fire starting point", "fire spread", "fire rescue", etc.; for the event type of "attack", the semantic enhancement words may include "bombing, assault, raid, invade", etc.

[0043] In some embodiments, the event text is input into a trained event type extraction model to output semantic features related to the event type. In this case, the event type extraction model is trained to extract semantic features from the event text. The event type extraction model is a small model similar to BERT, GRU, or LSTM.

[0044] Preferably, the semantic enhancement table records the semantic enhancement words and semantic features corresponding to the current event type, that is, the semantic enhancement words and semantic features are combined to form the semantic enhancement table corresponding to the current event type.

[0045] In step S3:

[0046] The prompt template is the key to guiding the large language model to extract events. This solution combines the task description, event type, event role table, semantic enhancement table and structured output constraints to design a reasonable prompt template. The prompt template and the event text that needs to be extracted are used as the fine-tuning dataset after structured processing. The fine-tuning dataset can then be used to fine-tune the large language model.

[0047] Tips template for this program:

[0048] Task description: used to define tasks that require event extraction from the current event text, such as "extracting event information from a given event text."

[0049] Structured output constraints: used to define the output content and output format of the event extraction task. In some embodiments, the output format is a structured key-value pair, and the output content is the event extraction result.

[0050] It should be noted that the purpose of this solution is to enable a large language model to extract structured event information from unstructured event text. Therefore, the structuring of event information can be achieved through structured output constraints to facilitate subsequent data analysis of the extracted results.

[0051] For example, if the task description is "Extract event information from a given text," the event type is "traffic accident," the event role table includes "driver," "passenger," and "vehicle," the semantic enhancement table includes information such as "collision location" and "accident cause," and the structured output constraint specifies the output format as JSON. The prompt template could be designed as: "Please extract traffic accident-related information from the following text, output in JSON format, including information such as event type, driver, passenger, vehicle, collision location, and accident cause: [event text]."

[0052] Of course, before inputting the fine-tuning dataset into the large language model for fine-tuning training, the data in the fine-tuning dataset should be normalized. For example, the time and date in the fine-tuning dataset can be normalized to prevent training errors in the large language model caused by non-standard data in the fine-tuning dataset.

[0053] In step S4:

[0054] This solution leverages the excellent generation and semantic understanding capabilities of the large language model to complete the event extraction task. At the same time, it introduces semantic injection enhancement technology to solve many problems that arise in traditional large language models in event extraction tasks.

[0055] Specifically, to prevent abnormal samples in the fine-tuning dataset from interfering with the fine-tuning training process of the large language model, that is, to ensure that the samples in the fine-tuning dataset conform to the original data distribution characteristics, this solution further includes the following steps:

[0056] During fine-tuning training, the samples in the fine-tuning dataset are input into the large language model in batches and the loss value of each sample during multiple rounds of training is recorded. A data map of each sample is constructed based on the loss value. Abnormal samples in the fine-tuning dataset are located and removed from the data map to construct a new fine-tuning dataset.

[0057] Furthermore, the standard deviation of each sample in multiple rounds of training is used as the horizontal coordinate of the data map, and the mean of each sample in multiple rounds of training is used as the vertical coordinate of the data map, and data that deviates from normal samples on the data map are eliminated.

[0058] like Figure 2 As shown, Figure 2 This is an example of the data map given by this solution. The data that deviates from the normal sample refers to the data with larger horizontal and vertical coordinate values ​​in the data map. Figure 2The red points are abnormal samples, and the blue and yellow points are normal samples.

[0059] The formula for calculating the mean of each sample in multiple rounds of training is as follows:

[0060] ;

[0061] The formula for calculating the standard deviation of each sample within multiple rounds of training is as follows:

[0062] ;

[0063] Where E represents the total number of training rounds, S represents the number of epochs to start counting, Represents the loss value of the i-th sample in the e-th epoch, is the mean of the i-th sample, is the standard deviation of the ith sample.

[0064] It should be noted that when the sample size of the fine-tuning dataset is large, the large language model may have good performance on some samples in the first few rounds, which may cause certain unfairness. Therefore, this solution does not record the loss value of the sample from the beginning, thereby alleviating the impact of this problem.

[0065] In some embodiments, abnormal samples include samples with incorrect labels and samples that do not conform to the data distribution, wherein the semantic information of the samples that do not conform to the data distribution is significantly different from that of most samples in the fine-tuning sample set.

[0066] In step S5:

[0067] In some embodiments, when fine-tuning a large language model using a fine-tuning dataset, a plug-and-play event semantic injection enhancement component is inserted into the output layer of the large language model, where the event semantic injection enhancement component can decompose the event type from the output content and use the prototype loss function to optimize the loss function of the large language model.

[0068] The loss function of the large language model in this solution is the weighted sum of cross entropy loss and prototype loss, where cross entropy loss is the token-level prediction of the large language model. The loss function of the large language model is expressed as follows:

[0069] ;

[0070] in is the cross entropy loss, is the prototype loss, is a hyperparameter used to balance the contribution of prototype loss and cross entropy loss to ensure the coordinated expression of the core semantics of the event and the context.

[0071] Furthermore, the prototype loss is the cosine distance between the predicted event type extracted from the output of the large language model and the semantic anchor corresponding to the current event type in the semantic anchor dictionary. The calculation formula is as follows:

[0072]

[0073] ;

[0074] ;

[0075] Where h is the mean of the predicted event type extracted from the hidden state of the large language model, p is the semantic anchor point of the corresponding event type, and h i Refers to the predicted event type of the i-th hidden state, n represents the number of hidden states; e i It refers to the word embedding vector of the i-th semantic enhancer or semantic feature corresponding to the current event type, and m represents the number of semantic enhancers or semantic features corresponding to the current event type.

[0076] The method for obtaining the semantic anchor dictionary is as follows:

[0077] The semantic enhancement words or semantic features in the semantic enhancement table are encoded into a token sequence using a word segmenter, and the token sequence is converted into a word embedding vector through a word embedding layer. The mean of the word embedding vectors of the semantic enhancement words or semantic features is taken as the semantic anchor point. The semantic anchor point is used as the value and the event type as the key to construct a key-value pair. The key-value pairs of different event types are stored to obtain a semantic anchor dictionary.

[0078] In some embodiments, the word segmenter of ChatGLM3-6B can be used to encode the semantic enhancement words or semantic features in the semantic enhancement table into a token sequence.

[0079] In some embodiments, the predicted event type is located and extracted from the output layer of the large language model, for example, invalid tokens may be skipped and the start and end positions of the event type (marked by "#") may be found.

[0080] Figure 3This is a logical diagram of the method for constructing an event extraction model based on semantic injection enhancement provided by this solution. First, a semantic enhancement table is constructed based on the event type of the event text by manually defining semantic enhancement words and extracting semantic features by the model. Then, an instruction template is constructed based on the semantic enhancement table. A fine-tuning dataset is constructed by combining the instruction template and the event text, and the fine-tuning dataset is input into the large language model for fine-tuning. At the same time, a word segmenter is used to extract word embedding vectors from the semantic enhancement table and construct a semantic anchor dictionary corresponding to different event types. A prototype loss is constructed based on the predicted event type and the semantic anchor dictionary in the model prediction results of the large language model, and the cross-entropy loss and prototype loss of the large language model are combined as the loss function of the large language model.

[0081] Example 2

[0082] This solution proposes an event extraction model based on semantic injection enhancement, which is constructed according to the event extraction method based on semantic injection enhancement mentioned in the above embodiment 1.

[0083] Furthermore, this solution provides an event extraction method based on semantic injection enhancement, which includes the following steps:

[0084] The event text that needs to be extracted is input into the semantic injection-enhanced event extraction model trained in Example 1, and the event extraction result is output.

[0085] The contents of the second embodiment that are the same as those of the first embodiment will not be described in detail here.

[0086] Example 3

[0087] This embodiment also provides an electronic device, referring to Figure 4 , including a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps in any of the above-mentioned embodiments of the method for constructing an event extraction model based on semantic injection enhancement.

[0088] Specifically, the processor 402 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the present invention. The memory 404 may include a large-capacity memory 404 for data or instructions.

[0089] The processor 402 reads and executes the computer program instructions stored in the memory 404 to implement any one of the methods for constructing an event extraction model based on semantic injection enhancement in the above embodiments.

[0090] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input / output device 408 is connected to the processor 402 .

[0091] Transmission device 406 can be used to receive or transmit data via a network. Specific examples of such networks may include wired or wireless networks provided by the electronic device's communications provider. In one embodiment, the transmission device includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0092] The input and output device 408 is used to input or output information. In this embodiment, the input information can be event text, etc., and the output information can be event extraction results, etc.

[0093] Optionally, in this embodiment, the processor 402 may be configured to execute the following steps through a computer program:

[0094] S1: Obtain at least one event text and determine the event type and event role table of the event text;

[0095] S2: Construct a semantic enhancement table based on dataset samples of different event types;

[0096] S3: Construct a prompt template based on the task description, event type, event role table, semantic enhancement table, and structured output constraints that define the event extraction task. The event text and the corresponding prompt template are used as the fine-tuning dataset. The structured output constraints specify the output content and output format of the event extraction task.

[0097] S4: Perform enhancement processing on the fine-tuning dataset;

[0098] S5: Use the fine-tuning dataset to train the output content of the large language model until the loss function meets the requirements, and obtain an event extraction model based on semantic injection enhancement. The loss function used in the training of the large language model is the combined value of the prototype loss and the cross-entropy loss. The prototype loss, which reflects the prototype structure problem, is calculated by extracting the predicted event type from the output content of the large language model and the semantic anchor dictionary constructed based on the semantic enhancement table.

[0099] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.

[0100] In general, various embodiments may be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the blocks, devices, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or a controller or other computing device, or some combination thereof.

[0101] Embodiments of the present invention can be implemented by computer software, which is executable by the data processor of the mobile device, such as in the processor entity, or is implemented by hardware, or is implemented by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product can include one or more computer executable components configured to perform the embodiment when the program is running. One or more computer executable components can be at least one software code or a part thereof. In addition, at this point, it should be noted that any box of the logic flow in the figure can represent a program step, or interconnected logical circuits, boxes and functions, or a combination of program steps and logical circuits, boxes and functions. The software can be stored in physical media such as memory chips or storage blocks implemented in the processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and their data variants, CDs. Physical media is non-transient media.

[0102] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0103] The above embodiments merely illustrate several embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for constructing an event extraction model based on semantic injection enhancement, characterized in that: The following steps are involved: S1: Obtain at least one event text and determine the event type and event role table of the event text; S2: Construct a corresponding semantic enhancement table based on dataset samples of different event types, where the semantic enhancement table records the semantic enhancement words and / or semantic features corresponding to the current event type. Semantic enhancement words are words with similar semantic expression meanings to the current event type, and semantic features are features that represent the semantic enhancement information of the current event type. S3: Construct a prompt template based on the task description, event type, event role table, semantic enhancement table, and structured output constraints that define the event extraction task. The event text and the corresponding prompt template are used as the fine-tuning dataset. The structured output constraints specify the output content and output format of the event extraction task. S4: Perform enhancement processing on the fine-tuning dataset; S5: Use the fine-tuning dataset to train the output of the large language model until the loss function meets the requirements. The loss function used in the large language model training is the combined value of the prototype loss and the cross-entropy loss. The prototype loss, which reflects the prototype structure problem, is calculated by combining the predicted event type extracted from the output of the large language model with the semantic anchor dictionary constructed based on the semantic enhancement table. The prototype loss is the cosine distance between the predicted event type extracted from the output of the large language model and the semantic anchor corresponding to the current event type in the semantic anchor dictionary. The calculation formula is as follows: ; ; Where h is the mean of the predicted event type extracted from the hidden state of the large language model, p is the semantic anchor point of the corresponding event type, and h i Refers to the predicted event type of the i-th hidden state, n represents the number of hidden states; e i Refers to the word embedding vector of the i-th semantic enhancement word or semantic feature corresponding to the current event type, and m represents the number of semantic enhancement words or semantic features corresponding to the current event type; The method for obtaining the semantic anchor dictionary is as follows: The semantic enhancement words or semantic features in the semantic enhancement table are encoded into a token sequence using a word segmenter, and the token sequence is converted into a word embedding vector through a word embedding layer. The mean of the word embedding vectors of the semantic enhancement words or semantic features is taken as the semantic anchor point. The semantic anchor point is used as the value and the event type as the key to construct a key-value pair. The key-value pairs of different event types are stored to obtain a semantic anchor dictionary.

2. The method for constructing an event extraction model based on semantic injection enhancement according to claim 1, characterized in that: Artificially define the semantic enhancer of the current event type, and expand the corresponding semantic enhancer based on the event type; Input the event text into the trained event type extraction model to output semantic features related to the event type.

3. The method for constructing an event extraction model based on semantic injection enhancement according to claim 1, characterized in that: The task description in the prompt template is used to define the task of event extraction from the current event text, and the structured output constraint is used to define the output content and output format of the event extraction task.

4. The method for constructing an event extraction model based on semantic injection enhancement according to claim 1, characterized in that: During fine-tuning training, the samples in the fine-tuning dataset are input into the large language model in batches and the loss value of each sample during multiple rounds of training is recorded. A data map of each sample is constructed based on the loss value. Abnormal samples in the fine-tuning dataset are located and removed from the data map to construct a new fine-tuning dataset.

5. The method for constructing an event extraction model based on semantic injection enhancement according to claim 4, characterized in that: The standard deviation of each sample in multiple rounds of training is used as the horizontal coordinate of the data map, and the mean of each sample in multiple rounds of training is used as the vertical coordinate of the data map. Data that deviates from normal samples on the data map are eliminated.

6. The method for constructing an event extraction model based on semantic injection enhancement according to claim 1, characterized in that: The loss function of the large language model is expressed as follows: ; in is the cross entropy loss, is the prototype loss, is a hyperparameter used to balance the contribution of prototype loss and cross entropy loss.

7. An event extraction method based on semantic injection enhancement, characterized in that: The event text that needs to be extracted is input into the semantic injection enhanced event extraction model constructed according to the method for constructing the semantic injection enhanced event extraction model according to any one of claims 1 to 6 to obtain the event extraction result.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for constructing an event extraction model based on semantic injection enhancement as described in any one of claims 1 to 6 or the event extraction method based on semantic injection enhancement as described in claim 7.

Citation Information

Patent Citations

  • Event parameter extraction method and system based on abstract semantic graph

    CN117874254A

  • Event detection method and system capable of efficiently utilizing limited annotation data

    CN119884379A