Method and device for processing event extraction task based on model cascading mode
By adopting the model cascade method in the event extraction task, and utilizing the cascade processing of large language models and lightweight event extraction models, we solve the problems of poor generalization and hallucination in the existing technology, and achieve higher prediction accuracy and Cross-domain performance.
Patent Information
- Application Number
- CN202411485500.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art has problems in the event extraction task that are not ideal generalization and poor accuracy in the recognition of event types that are not trained in sufficiently trained, and end-to-end models are prone to hallucinations when they lack high-quality prompt contexts.
The event extraction task is processed based on model cascade, using a large language model that has been pre-trained and a lightweight event extraction model for cascade processing. First, the lightweight model performs a first-level extraction on the event text input by the user, then uses the result as a prompt text and inputs the original text into the large language model for a second-level extraction, and finally fuses the two-level results to obtain the final event information.
The output of lightweight models as a high -quality reminder context of large language models reduces the incorrect probability of an illusion of large language models, improves the accuracy of model prediction, and improves the cross -domain prediction performance of event extraction tasks.
Smart Images

Figure CN119337869A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for processing event extraction tasks based on a model cascade mode. Background Art
[0002] Common large language models (LLMs) include BERT series models, BART series models, GPT series models, T5 series models, Wenxin series models, etc. These large language models are widely used in a variety of natural language processing (NLP) tasks, and event extraction (EE) tasks are one of the typical tasks. The essence of the EE task is to extract event elements from unstructured text; the event elements mentioned here include event types, trigger words, and event element (also known as argument) sets, where the event element set consists of multiple event elements, each of which consists of a corresponding element type and element text (or role text), and the element types contained in the event element set corresponding to each type of event are also different.
[0003] Currently, there are many conventional ways to process event extraction tasks based on large language models, such as: using event extraction models implemented by BERT+CRF to process EE tasks, using event extraction models implemented by BiLSTM+CRF to process EE tasks, using event extraction models implemented by ALBERT+BiLSTM+CRF to process EE tasks, and using text-to-text end-to-end models such as GPT / T5 / Wenxin series models to process EE tasks. However, through practical applications, we found that the above conventional methods have their own limitations: 1) The event extraction model implemented by BERT+CRF / BiLSTM+CRF / ALBERT+BiLSTM+CRF essentially uses the sequence labeling capability of the conditional random field (CRF) model to identify event elements, but the feature function of the CRF model mainly relies on manually designed rules or features. This easily leads to the generalization of these types of models is not ideal and the accuracy of element recognition for event types that are not fully trained is poor; 2) When using end-to-end models such as GPT / T5 / Wenxin series models to handle EE tasks, although the model generalization is good, it is prone to illusion problems when there is no high-quality prompt context. Summary of the invention
[0004] The purpose of the present invention is to address the defects of the prior art and provide a method, device, electronic device and computer-readable storage medium for processing event extraction tasks based on a model cascade approach. The present invention uses a pre-trained large language model as the corresponding first model (such as a GPT series model, a T5 series model, a Wenxin series model, etc.); and uses a lightweight event extraction model as the corresponding second model (such as an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, an event extraction model based on ALBERT+BiLSTM+CRF, etc.); and combines multiple event extraction data sets to train the first model; and trains the second model based on an event extraction data set in a specific field; and after the training of the first and second models is completed, the event extraction task is processed by the cascade mode of the first and second models, specifically: firstly, the event text input by the user is processed based on the lightweight second model for primary event extraction processing, and then the event extraction result of the second model is sent to the first model as a prompt text together with the event text input by the user for secondary event extraction processing, and then the two-level event extraction results are fused to obtain the final event information to feed back to the user. The present invention uses the output of a lightweight event extraction model as a high-quality prompt context for a large language model to reduce the error probability of hallucinations in the large language model and improve the model prediction accuracy, and improves the cross-domain prediction performance of event extraction tasks based on the good generalization of the large language model; by processing event extraction tasks based on the model cascade method provided by the present invention, both the cross-domain performance of task processing and the prediction accuracy of task processing can be improved.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a method for processing an event extraction task based on a model cascade method, the method comprising:
[0006] Merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set; the first data set at least includes the ACE2005 data set released by the Language Data Alliance, the event extraction data set released by the Chinese Language Resource Alliance, the event extraction data set provided by the Kaggle / Google / GitHub / HDX / FiveThirtyEight platform, and multiple types of event extraction data sets in specific fields; the specific fields at least include biochemistry, energy materials, medical care, finance, law, and social news;
[0007] A large language model that has been pre-trained is used as the corresponding first model; a lightweight event extraction model is used as the corresponding second model; the first model is trained based on the first data set; and the second model is trained based on the second data set; the first model includes at least a GPT series model, a T5 series model, and a Wenxin series model; the second model includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+BiLSTM+CRF;
[0008] After the first and second model training is completed, the user input text is received and recorded as the corresponding current event text;
[0009] Input the current event text into the second model to perform event extraction processing to obtain corresponding first event information;
[0010] The first event information is used as the corresponding current prompt text; the current prompt text and the current event text are brought into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and the current instruction text is input into the first model to perform event extraction processing to obtain the corresponding second event information;
[0011] The first and second event information are fused to obtain corresponding third event information and fed back to the user.
[0012] Preferably, the first model is used to perform event extraction processing according to the event extraction instruction text input by the model and output corresponding formatted event extraction information; the formatted event extraction information is composed of event type information, trigger word text information and event element set information; the event element set information is composed of multiple event element information; the event element information is composed of element type information and element text information;
[0013] The second model is used to perform event extraction processing on the model input text and output the corresponding formatted event extraction information;
[0014] The event extraction instruction template corresponding to the first model includes the first event extraction instruction template and the second event extraction instruction template;
[0015] The first event extraction instruction template is a formatting template; the first event extraction instruction template is used to use the input prompt text and event text as the corresponding current prompt text and current event text, and inform the first model through a narrative text to perform event information extraction processing on the current event text with the current prompt text as the prompt context, and perform corresponding event information text generation processing according to the extracted event type, event trigger word and event element set in the formatted text output format of the formatted event extraction information;
[0016] The second event extraction instruction template is a formatting template; the second event extraction instruction template is used to use the input event text as the corresponding current event text, and inform the first model through a narrative text to perform event information extraction processing on the current event text, and perform corresponding event information text generation processing according to the extracted event type, event trigger words and event element set according to the formatted text output format of the formatted event extraction information;
[0017] The first data set includes a plurality of first data records; the first data record includes a first event text and a first event label; the first event label includes a first label event type, a first label trigger word text and a first label event element set; the first label event element set includes a plurality of first label event elements; the first label event element includes a first label element type and a first label element text;
[0018] The second data set includes a plurality of second data records; the second data record includes a second event text and a second event label; the second event label includes a second label event type, a second label trigger word text and a second label event element set; the second label event element set includes a plurality of second label event elements; the second label event element includes a second label element type and a second label element text;
[0019] The first event information includes a first event type, a first trigger word text and a first event element set; the first event element set includes a plurality of first event elements; the first event element includes a first element type and a first element text;
[0020] The second event information includes a second event type, a second trigger word text, and a second event element set; the second event element set includes a plurality of second event elements; the second event element includes a second element type and a second element text;
[0021] The third event information includes a third event type, a third trigger word text and a third event element set; the third event element set includes multiple third event elements; and the third event element includes a third element type and a third element text.
[0022] Preferably, the training of the first model based on the first data set specifically includes:
[0023] Recording the parameter set of all model components related to the event extraction task in the full model parameter set of the first model as the corresponding first parameter set; and performing one-stage training modulation on the first parameter set of the first model based on the first data set and the second event extraction instruction template;
[0024] The parameter set of the decoding and text generation components related to the event extraction task in the full model parameter set is recorded as the corresponding second parameter set; and the second parameter set of the first model is subjected to two-stage training modulation based on the first data set and the first event extraction instruction template.
[0025] Furthermore, the first parameter set of the first model is subjected to one-stage training modulation based on the first data set and the second event extraction instruction template, specifically comprising:
[0026] Step 41, based on a preset first segmentation ratio, the first data set is divided into two sub-data sets which are recorded as a corresponding first training set and a first evaluation set;
[0027] Wherein, both the first training set and the first evaluation set include a plurality of the first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio;
[0028] Step 42, extracting the first first data record of the first training set as the corresponding current training record;
[0029] Step 43, bringing the first event text of the current training record into the second event extraction instruction template to perform instruction text assembly processing to obtain the corresponding first training instruction text;
[0030] Step 44, inputting the first training instruction text into the first model for event extraction processing and using the generated text output by the model as the corresponding first predicted event information;
[0031] The first predicted event information includes a first predicted event type, a first predicted trigger word text, and a first predicted event element set; the first predicted event element set includes a plurality of first predicted event elements; the first predicted event element includes a first predicted element type and a first predicted element text;
[0032] Step 45: Substitute the first predicted event information and the first event label of the current training record into a preset first model loss function L M1; and based on the preset first model optimizer, move towards making the first model loss function L M1 Performing a round of optimization on the first parameter set of the first model in a direction of reaching a minimum value;
[0033] Among them, the first model loss function L M1 for:
[0034]
[0035] x pre is the N-gram encoding vector of the predicted trigger word text of the predicted event information. If the predicted trigger word text is empty, the corresponding encoding vector x pre is set to an all-zero vector; x tag is the N-gram encoding vector of the tag trigger word text of the event tag. If the tag trigger word text is empty, the corresponding encoding vector x tag is set to an all-zero vector; the encoding vector x pre 、x tag The vector length should be consistent. If the text lengths of the predicted trigger word text and the tag trigger word text are inconsistent, the encoding vector x is padded with zeros to make the encoding vector x pre 、x tag The vector length of is consistent;
[0036] y pre The event type one-hot encoding vector of the predicted event type for the predicted event information; y tag The event type one-hot encoding vector of the event type of the event label; the one-hot encoding vector y pre ,y tag The vector lengths of y are consistent, and are composed of multiple event type one-hot encodings. Each event type one-hot encoding corresponds to a class of event types, and the total number of event type one-hot encodings is consistent with the preset total number of event types. The one-hot encoding vector y pre In the one-hot encoding vector y, only the event type corresponding to the current predicted event type is one-hot encoded as 1, and all other event types are one-hot encoded as 0; tag Only the event type corresponding to the current label event type is one-hot encoded as 1, and all other event types are one-hot encoded as 0;
[0037] N is the total number of types of the statistical type set G, and the total number of types of statistics N is a positive integer; the statistical type set G is the statistical result obtained by performing type statistics on the element types of all event elements in the predicted event information and event tags, and the statistical type set G consists of N types of statistical types g i Composition, 1≤type index i≤N, each of the statistic types gi The element type corresponding to a class of event elements;
[0038] z pre,i The predicted event element type in the predicted event element set for the predicted event information and the statistical type g of the i-th category i The N-gram encoding vector of the predicted element text of the matched predicted event element. If there is no statistical type g in the predicted event element set that matches the statistical type g of the i-th category, i The matching predicted element type corresponds to the encoding vector z pre,i is set to an all-zero vector;
[0039] z tag,i The label element type in the label event element set of the event label and the statistical type g of the i-th category i The N-gram encoding vector of the tag element text of the matching tag event element. If there is no statistical type g in the tag event element set that matches the i-th category, i The matching tag element type corresponds to the encoding vector z tag,i is set to an all-zero vector;
[0040] The encoding vector z pre,i 、z tag,i The vector length should be consistent. If the predicted event information and event label contain the same statistical type g as the i-th category i If the lengths of the corresponding prediction element text and label element text are inconsistent, the encoding vector z is padded with zeros to make the encoding vector z shorter. pre,i 、z tag,i The vector length of is consistent;
[0041] The first model optimizer includes at least an SGD optimizer and an ADAM optimizer;
[0042] Step 46, identifying whether the current training record is the last first data record of the first training set; if so, going to step 47; if not, extracting the next first data record of the first training set as the new current training record and returning to step 43;
[0043] Step 47, perform a round of traversal on all the first data records of the first evaluation set; and in this round of traversal, use the first data record currently traversed as the corresponding current evaluation record; and bring the first event text of the current evaluation record into the second event extraction instruction template for instruction text assembly processing to obtain the corresponding second training instruction text; and input the second training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding second predicted event information; and form a corresponding first prediction-label pair with the second predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function F A Performing an evaluation value calculation to obtain a corresponding first evaluation value;
[0044] The second predicted event information includes a second predicted event type, a second predicted trigger word text, and a second predicted event element set; the second predicted event element set includes a plurality of second predicted event elements; the second predicted event element includes a second predicted element type and a second predicted element text;
[0045] The first model evaluation function F A for:
[0046]
[0047] M is the total number of the first prediction-label pairs, 1≤indexj≤M;
[0048] f er () is MAE error function or MSE error function;
[0049] x pre,j is the N-gram encoding vector corresponding to the predicted trigger word text of the predicted event information of the j-th prediction-label pair; tag,j is the N-gram encoding vector of the label trigger word text of the event label of the jth prediction-label pair; each prediction-label pair corresponds to a pair of encoding vectors x pre,j 、x tag,j The vector lengths of should be consistent. If a pair of encoding vectors x pre,j 、x tag,j If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent;
[0050] y pre,j is the event type one-hot encoding vector of the predicted event type of the predicted event information of the j-th prediction-label pair; y tag,jis the event type one-hot encoding vector of the label event type of the event label of the jth prediction-label pair; a pair of one-hot encoding vectors y corresponding to each prediction-label pair pre,j ,y tag,j The vector lengths of are consistent;
[0051] N j is the statistical type set G corresponding to the j-th prediction-label pair j The total number of species statistics, the total number of species statistics N j is a positive integer; the statistical type set G j The statistical result obtained by performing type statistics on the element types of all event elements in the predicted event information and event labels of the jth prediction-label pair. The statistical type set G j By N j Class statistic type g j,k Composition, each of the statistical types g j,k The element type corresponding to a class of event elements; in each of the statistical type sets G j , 1≤type index k≤N j ;
[0052] z pre,j,k The predicted element type in the predicted event element set of the predicted event information of the j-th prediction-label pair and the corresponding statistical type set G j The statistical type g in the kth category j,k The N-gram encoding vector of the predicted element text of the matched predicted event element; z tag,j,k The label element type in the label event element set of the event label of the j-th prediction-label pair and the corresponding statistical type set G j The statistical type g in the kth category j,k The N-gram encoding vector of the tag element text of the matching tag event element; each pair of encoding vectors z corresponding to each prediction-label pair tag,j,k 、z tag,j,k The vector lengths should be consistent. If a pair of the encoding vector z tag,j,k 、z tag,j,k If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent;
[0053] Step 48, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 42 to continue training; if satisfied, stopping training and confirming the end of one stage of training.
[0054] Furthermore, the performing two-stage training modulation on the second parameter set of the first model based on the first data set and the first event extraction instruction template specifically includes:
[0055] Step 51, based on a preset second segmentation ratio, the first data set is divided into two sub-data sets recorded as corresponding second training sets and second evaluation sets;
[0056] Wherein, both the second training set and the second evaluation set include a plurality of the first data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio;
[0057] Step 52, extracting the first of the first data records in the second training set as the corresponding current training record;
[0058] Step 53, extract the first event text and the first event label of the current training record as the corresponding current event text and current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set completed into the first event extraction instruction template for instruction text assembly processing to obtain the corresponding third training instruction text;
[0059] Step 54, inputting the third training instruction text into the first model for event extraction processing and using the generated text output by the model as the corresponding third predicted event information;
[0060] The third predicted event information includes a third predicted event type, a third predicted trigger word text and a third predicted event element set; the third predicted event element set includes a plurality of third predicted event elements; the third predicted event element includes a third predicted element type and a third predicted element text;
[0061] Step 55: bring the third predicted event information and the first event label of the current training record into the first model loss function L M1 ; and based on the preset second model optimizer, move towards making the first model loss function L M1 Performing a round of fine-tuning on the second parameter set of the first model in the direction of reaching the minimum value;
[0062] The second model optimizer includes at least an SGD optimizer and an ADAM optimizer;
[0063] Step 56, identifying whether the current training record is the last of the first data record in the second training set; if so, going to step 57; if not, extracting the next first data record in the second training set as the new current training record and returning to step 53;
[0064] Step 57, perform a round of traversal on all the first data records of the second evaluation set; and in this round of traversal, take the first data record currently traversed as the corresponding current evaluation record; and extract the first event text and the first event label of the current evaluation record as the corresponding current event text and current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set completed into the first event extraction instruction template for instruction text assembly processing to obtain the corresponding fourth training instruction text; and input the fourth training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding fourth predicted event information; and form a corresponding second prediction-label pair with the fourth predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding second evaluation value;
[0065] The fourth predicted event information includes a fourth predicted event type, a fourth predicted trigger word text, and a fourth predicted event element set; the fourth predicted event element set includes a plurality of fourth predicted event elements; the fourth predicted event element includes a fourth predicted element type and a fourth predicted element text;
[0066] Step 58, identifying whether the second evaluation value meets the preset second evaluation value range; if not, returning to step 52 to continue training; if satisfied, stopping training and confirming the end of the second stage training.
[0067] Preferably, the training of the second model based on the second data set specifically includes:
[0068] Step 61, based on a preset third segmentation ratio, the second data set is divided into two sub-data sets, which are recorded as a corresponding third training set and a third evaluation set;
[0069] Wherein, the third training set and the third evaluation set both include a plurality of the second data records; the ratio of the total number of records in the third training set to the total number of records in the third evaluation set satisfies the third segmentation ratio;
[0070] Step 62, extracting the first second data record of the third training set as the corresponding current training record;
[0071] Step 63, inputting the second event text of the current training record into the second model for event extraction processing and using the formatted event extraction information output by the model as the corresponding fifth predicted event information;
[0072] The fifth predicted event information includes a fifth predicted event type, a fifth predicted trigger word text, and a fifth predicted event element set; the fifth predicted event element set includes a plurality of fifth predicted event elements; the fifth predicted event element includes a fifth predicted element type and a fifth predicted element text;
[0073] Step 64: bring the fifth predicted event information and the second event label of the current training record into the first model loss function L M1 ; and based on a preset third model optimizer, move toward making the first model loss function L M1 Performing a round of optimization on the model parameters of the second model in the direction of reaching the minimum value;
[0074] Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer;
[0075] Step 65, identifying whether the current training record is the last second data record of the third training set; if so, going to step 66; if not, extracting the next second data record of the third training set as the new current training record and returning to step 63;
[0076] Step 66, perform a round of traversal on all the second data records of the third evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second event text of the current evaluation record into the second model for event extraction processing and use the formatted event extraction information output by the model as the corresponding sixth predicted event information; and form a corresponding third prediction-label pair from the sixth predicted event information and the second event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding third evaluation value;
[0077] The sixth predicted event information includes a sixth predicted event type, a sixth predicted trigger word text, and a sixth predicted event element set; the sixth predicted event element set includes a plurality of sixth predicted event elements; the sixth predicted event element includes a sixth predicted element type and a sixth predicted element text;
[0078] Step 67, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 62 to continue training; if satisfied, stopping training and confirming the completion of the second model training.
[0079] Preferably, performing information fusion processing on the first and second event information to obtain corresponding third event information and feeding back to the user specifically includes:
[0080] Step 71, identifying whether the second event type of the second event information is empty; if the second event type is empty, taking the first event type of the first event information as the corresponding third event type; if the second event type is not empty, taking the second event type as the corresponding third event type;
[0081] Step 72, identifying whether the second trigger word text of the second event information is empty; if the second trigger word text is empty, using the first trigger word text of the first event information as the corresponding third trigger word text; if the second trigger word text is not empty, using the second trigger word text as the corresponding third trigger word text;
[0082] Step 73, merging the first and second event element sets of the first and second event information to obtain a corresponding first merged element set; and clustering the first merged elements of the same first merged element type in the first merged element set to obtain a plurality of corresponding first-category element subsets;
[0083] The first merged element set includes a plurality of the first merged elements, each of which corresponds to one of the first event elements or one of the second event elements; the first merged element includes the first merged element type and the first merged element text; each of the first-type element subsets consists of one or two of the first merged elements, and the first merged element type of all the first merged elements in each of the first-type element subsets is the same;
[0084] Step 74, taking each of the first-category element subsets as the corresponding current subset; and identifying the total number of merged elements in the current subset; if the total number of merged elements is 1, taking the only first merged element in the current subset as the corresponding third event element; if the total number of merged elements is 2, taking the first merged element in the current subset corresponding to one of the second event elements as the corresponding third event element; and forming the corresponding third event element set from all the obtained third event elements;
[0085] Step 75, the third event information corresponding to the third event type, the third trigger word text and the third event element set is fed back to the user.
[0086] A second aspect of an embodiment of the present invention provides a device for implementing the method for processing event extraction tasks based on a model cascade method as described in the first aspect, the device comprising: a data set preparation module, a model training module, a data receiving module, a primary model processing module, a secondary model processing module and a two-level information fusion module;
[0087] The data set preparation module is used to merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set; the first data set at least includes the ACE2005 data set released by the Language Data Alliance, the event extraction data set provided by the Kaggle / Google / GitHub / HDX / FiveThirtyEight platform, the event extraction data set released by the Chinese Language Resource Alliance, and multiple types of event extraction data sets in specific fields; the specific fields at least include biochemistry, energy materials, medical care, finance, law, and social news;
[0088] The model training module is used to use a pre-trained large language model as the corresponding first model; and a lightweight event extraction model as the corresponding second model; and train the first model based on the first data set; and train the second model based on the second data set; the first model includes at least a GPT series model, a T5 series model, and a Wenxin series model; the second model includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+BiLSTM+CRF;
[0089] The data receiving module is used to receive user input text as the corresponding current event text after the first and second model training are completed;
[0090] The primary model processing module is used to input the current event text into the second model for event extraction processing to obtain corresponding first event information;
[0091] The secondary model processing module is used to use the first event information as the corresponding current prompt text; and bring the current prompt text and the current event text into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and input the current instruction text into the first model to perform event extraction processing to obtain the corresponding second event information;
[0092] The two-level information fusion module is used to perform information fusion processing on the first and second event information to obtain corresponding third event information and feed it back to the user.
[0093] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;
[0094] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;
[0095] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
[0096] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.
[0097] The embodiments of the present invention provide a method, an apparatus, an electronic device and a computer-readable storage medium for processing an event extraction task based on a model cascade method. It can be seen from the above content that the embodiment of the present invention uses a large language model that has been pre-trained as the corresponding first model (such as a GPT series model, a T5 series model, a Wenxin series model, etc.); and uses a lightweight event extraction model as the corresponding second model (such as an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, an event extraction model based on ALBERT+BiLSTM+CRF, etc.); and merges multiple types of event extraction data sets to train the first model; and trains the second model based on an event extraction data set in a specific field; and after the training of the first and second models is completed, the event extraction task is processed by the cascade method of the first and second models, specifically: first, the event text input by the user is subjected to a first-level event extraction process based on the lightweight second model, and then the event extraction result of the second model is sent to the first model as a prompt text together with the event text input by the user for a second-level event extraction process, and then the two-level event extraction results are fused to obtain the final event information to feedback to the user. The embodiment of the present invention uses the output of a lightweight event extraction model as a high-quality prompt context for a large language model, which can reduce the error probability of hallucinations in the large language model and improve the prediction accuracy of the model; the embodiment of the present invention improves the cross-domain prediction performance of event extraction tasks through the good generalization of the large language model; and the event extraction task is processed based on the model cascade method provided by the embodiment of the present invention, which not only improves the cross-domain performance of task processing, but also reduces the model error probability and improves the prediction accuracy of task processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] Figure 1 A schematic diagram of a method for processing event extraction tasks based on a model cascade method provided in Embodiment 1 of the present invention;
[0099] Figure 2 A module structure diagram of a device for processing event extraction tasks based on a model cascade method provided in Embodiment 2 of the present invention;
[0100] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0101] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all 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.
[0102] Embodiment 1 of the present invention provides a method for processing event extraction tasks based on a model cascade method, such as Figure 1 As shown in the schematic diagram of a method for processing event extraction tasks based on a model cascade method provided in the first embodiment of the present invention, the method mainly includes the following steps:
[0103] Step 1: merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set.
[0104] Here, the multiple event extraction datasets merged by the first dataset in the embodiment of the present invention at least include the ACE2005 dataset released by the Linguistic Data Consortium (LDC), the event extraction dataset released by the Chinese Linguistic Data Consortium (CLDC), the event extraction dataset provided by platforms such as Kaggle / Google / GitHub / HDX / FiveThirtyEight, and multiple event extraction datasets in specific fields; in addition, the multiple event extraction datasets merged by the first dataset may also include event extraction datasets collected and sorted by manual or machine data collection methods; the specific fields referred to here should at least include computer fields, biochemistry fields, energy materials fields, medical fields, financial fields, legal fields, social news fields, etc., and can also be expanded to other fields based on application requirements.
[0105] The data formats of the first and second data sets in the embodiment of the present invention are similar, as shown below:
[0106] The first data set includes a plurality of first data records; the first data record includes a first event text and a first event tag; the first event tag includes a first tag event type, a first tag trigger word text and a first tag event element set; the first tag event element set includes a plurality of first tag event elements; the first tag event element includes a first tag element type and a first tag element text;
[0107] The second data set includes multiple second data records; the second data record includes a second event text and a second event label; the second event label includes a second label event type, a second label trigger word text and a second label event element set; the second label event element set includes multiple second label event elements; the second label event element includes a second label element type and a second label element text.
[0108] Step 2: using a pre-trained large language model as the corresponding first model; using a lightweight event extraction model as the corresponding second model; training the first model based on the first data set; and training the second model based on the second data set;
[0109] Specifically, it includes: step 21, taking a large language model that has completed pre-training as the corresponding first model;
[0110] Here, the first model of the embodiment of the present invention includes at least a GPT series model, a T5 series model, and a Wenxin series model. In addition, other types of large language models can be selected as the first model based on application requirements;
[0111] The first model of the embodiment of the present invention is used to perform event extraction processing according to the event extraction instruction text input by the model and output corresponding formatted event extraction information; the formatted event extraction information is composed of event type information, trigger word text information and event element set information; the event element set information is composed of multiple event element information; the event element information is composed of element type information and element text information;
[0112] It should be noted that, from the conventional use of the large language model, it can be known that: the instruction templates of various NLP tasks can be customized in advance for it; when executing a certain type of specific NLP task (such as the event extraction task in the embodiment of the present invention), the corresponding NLP task instruction template is used as a reference, and the relevant parameters are substituted into the template to perform the corresponding instruction text assembly processing to obtain the corresponding instruction text, and then the instruction text is input into the large language model to execute the corresponding NLP task; this processing method of constructing the instruction text based on the instruction template and prompting the large language model to execute the NLP task based on the instruction text can make full use of the powerful natural language understanding ability of the large language model to reduce the complexity of task processing and improve the efficiency of task processing;
[0113] The instruction templates customized for the first model and used for processing event extraction tasks in the embodiment of the present invention include at least two categories: a first event extraction instruction template and a second event extraction instruction template;
[0114] The first and second event extraction instruction templates are each a formatting template; wherein the first event extraction instruction template is used to output an event information extraction instruction text with a prompt text and an event text; the second event extraction instruction template is used to output an event information extraction instruction text with only an event text; the specific descriptions of the first and second event extraction instruction templates are as follows;
[0115] The first event extraction instruction template is used to use the input prompt text and event text as the corresponding current prompt text and current event text, and inform the first model through a narrative text to perform event information extraction processing on the current event text with the current prompt text as the prompt context, and perform corresponding event information text generation processing according to the extracted event type, event trigger words and event element set in the formatted text output format of the formatted event extraction information;
[0116] The second event extraction instruction template is used to use the input event text as the corresponding event text, and inform the first model through a narrative text to perform event information extraction processing on the event text, and perform corresponding event information text generation processing according to the extracted event type, event trigger words and event element set in the formatted text output format of the formatted event extraction information;
[0117] Step 22, and using a lightweight event extraction model as the corresponding second model;
[0118] Here, the second model of the embodiment of the present invention includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+BiLSTM+CRF. In addition, other types of lightweight event extraction models can be selected as the second model based on application requirements.
[0119] The second model of the embodiment of the present invention is used to perform event extraction processing on the model input text and output corresponding formatted event extraction information;
[0120] It should be noted that the model parameters and model structure complexity of the second model of the embodiment of the present invention are smaller than or even much smaller than those of the first model, so it is called a lightweight event extraction model; and the three types of event extraction models, namely, the event extraction model based on BERT+CRF, the event extraction model based on BiLSTM+CRF, and the event extraction model based on ALBERT+BiLSTM+CRF, are all public and commonly used event extraction models. The specific model structures corresponding to each of these three types of models and the specific processing methods of each component in the model can be queried in public technical documents, so these types of models will not be further elaborated here;
[0121] Step 23, training the first model based on the first data set;
[0122] Specifically, it includes: step 231, recording the parameter set of all model components related to the event extraction task in the full model parameter set of the first model as the corresponding first parameter set;
[0123] Step 232, performing a first-stage training modulation on the first parameter set of the first model based on the first data set and the second event extraction instruction template;
[0124] Specifically, it includes: step 2321, dividing the first data set into two sub-data sets based on a preset first division ratio and recording them as a corresponding first training set and a first evaluation set;
[0125] The first segmentation ratio is a preset ratio parameter, such as 8:2; the first training set and the first evaluation set both include a plurality of first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio;
[0126] Step 2322, extracting the first first data record of the first training set as the corresponding current training record;
[0127] Step 2323, bringing the first event text of the current training record into the second event extraction instruction template to perform instruction text assembly processing to obtain the corresponding first training instruction text;
[0128] Step 2324, input the first training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding first predicted event information;
[0129] The first predicted event information includes a first predicted event type, a first predicted trigger word text, and a first predicted event element set; the first predicted event element set includes a plurality of first predicted event elements; the first predicted event element includes a first predicted element type and a first predicted element text;
[0130] Step 2325: bring the first predicted event information and the first event label of the current training record into the preset first model loss function L M1 ; and based on the preset first model optimizer, move towards making the first model loss function L M1 Perform a round of optimization on the first parameter set of the first model in the direction of reaching the minimum value;
[0131] Here, the first model optimizer of the embodiment of the present invention includes at least an SGD optimizer and an ADAM optimizer;
[0132] The first model loss function L of the embodiment of the present invention M1 for:
[0133]
[0134] in,
[0135] x pre is the N-gram encoding vector of the predicted trigger word text of the predicted event information. If the predicted trigger word text is empty, the corresponding encoding vector x pre is set to an all-zero vector; x tag is the N-gram encoding vector of the tag trigger word text of the event tag. If the tag trigger word text is empty, the corresponding encoding vector x tag is set to an all-zero vector; the encoding vector x pre 、x tag The vector length should be consistent. If the text lengths of the predicted trigger word text and the label trigger word text are inconsistent, the encoding vector x is padded with zeros to make it consistent. pre 、x tag The vector length of is consistent;
[0136] y pre The event type one-hot encoding vector of the predicted event type for the predicted event information; y tag The event type one-hot encoding vector of the event type of the event label; the one-hot encoding vector y pre ,y tag The vector length of y is consistent, and they are composed of multiple event type one-hot encodings. Each event type one-hot encoding corresponds to a class of event types, and the total number of event type one-hot encodings is consistent with the preset total number of event types; the one-hot encoding vector y pre In the one-hot encoding vector y, only the event type corresponding to the current predicted event type is encoded as 1, and all other event types are encoded as 0. tag Only the event type corresponding to the current label event type is one-hot encoded as 1, and all other event types are one-hot encoded as 0;
[0137] N is the total number of statistical types in the statistical type set G, and the total number of statistical types N is a positive integer; the statistical type set G is the statistical result obtained by performing type statistics on the element types of all event elements in the predicted event information and event tags. The statistical type set G consists of N statistical types g i Composition, 1≤type index i≤N, each statistic type g i The element type corresponding to a class of event elements;
[0138] z pre,i The predicted event element type and the i-th statistical type g are concentrated in the predicted event element of the predicted event information i The N-gram encoding vector of the predicted element text of the matched predicted event element. If there is no N-gram encoding vector of the predicted event element text that matches the statistical type g of the i-th category, i The matching predicted element type corresponds to the encoding vector z pre,i is set to an all-zero vector;
[0139] z tag,i The label element type of the label event element set and the i-th category statistical type g i The N-gram encoding vector of the tag element text of the matching tag event element. If there is no tag event element set that matches the i-th statistical type g i The matching tag element type corresponds to the encoding vector z tag,i is set to an all-zero vector;
[0140] Encoded vector z pre,i 、z tag,i The vector length should be consistent. If the predicted event information and event label have the same statistical type g as the i-th category i If the lengths of the corresponding prediction element text and label element text are inconsistent, the encoding vector z is padded with zeros to make the encoding vector z pre,i 、z tag,i The vector length of is consistent;
[0141] Step 2326, identifying whether the current training record is the last first data record of the first training set; if so, going to step 2327; if not, extracting the next first data record of the first training set as the new current training record and returning to step 2323;
[0142] Step 2327, perform a round of traversal on all first data records of the first evaluation set; and in this round of traversal, use the currently traversed first data record as the corresponding current evaluation record; and bring the first event text of the current evaluation record into the second event extraction instruction template for instruction text assembly processing to obtain the corresponding second training instruction text; and input the second training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding second predicted event information; and form a corresponding first prediction-label pair from the second predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function F A Performing an evaluation value calculation to obtain a corresponding first evaluation value;
[0143] Here, the second predicted event information of the embodiment of the present invention includes a second predicted event type, a second predicted trigger word text, and a second predicted event element set; the second predicted event element set includes a plurality of second predicted event elements; the second predicted event element includes a second predicted element type and a second predicted element text;
[0144] The first model evaluation function F of the embodiment of the present invention A for:
[0145]
[0146] in,
[0147] M is the total number of first prediction-label pairs, 1≤indexj≤M;
[0148] f er () is MAE error function or MSE error function;
[0149] x pre,j is the N-gram encoding vector corresponding to the predicted trigger word text of the predicted event information of the j-th prediction-label pair; tag,j is the N-gram encoding vector of the label trigger word text of the event label of the jth prediction-label pair; each prediction-label pair corresponds to a pair of encoding vectors x pre,j 、x tag,j The vector lengths of should be consistent. If a pair of encoding vectors x pre,j 、x tag,j If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent;
[0150] y pre,j is the event type one-hot encoding vector of the predicted event type of the predicted event information of the j-th prediction-label pair; y tag,jis the event type one-hot encoding vector of the label event type of the event label of the jth prediction-label pair; a pair of one-hot encoding vectors y corresponding to each prediction-label pair pre,j ,y tag,j The vector lengths of are consistent;
[0151] N j is the statistical type set G corresponding to the j-th prediction-label pair j The total number of species statistics, the total number of species statistics N j is a positive integer; statistical type set G j The statistical result of the type statistics of the element types of all event elements in the predicted event information and event labels of the jth prediction-label pair is obtained. The statistical type set G j By N j Class statistic type g j,k Composition, each statistic type g j,k The element type corresponding to a class of event elements; in each statistical type set G j , 1≤type index k≤N j ;
[0152] z pre,j,k The predicted element type and the corresponding statistical type set G in the predicted event element set of the predicted event information of the j-th prediction-label pair j The kth statistical type g in j,k The N-gram encoding vector of the predicted element text of the matched predicted event element; z tag,j,k The label element type and corresponding statistical type set G in the label event element set of the event label of the j-th prediction-label pair j The kth statistical type g in j,k The N-gram encoding vector of the tag element text of the matching tag event element; each pair of encoding vectors z corresponding to each prediction-label pair tag,j,k 、z tag,j,k The vector lengths of should be consistent. If a pair of encoding vectors z tag,j,k 、z tag,j,k If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent;
[0153] Step 2328, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 2322 to continue training; if satisfied, stopping training and confirming the end of the first stage of training;
[0154] Here, the first evaluation value range is a preset evaluation value range;
[0155] Step 233, recording the parameter set of the decoding and text generation components related to the event extraction task in the full model parameter set of the first model as the corresponding second parameter set;
[0156] Step 234, performing two-stage training modulation on the second parameter set of the first model based on the first data set and the first event extraction instruction template;
[0157] Specifically, it includes: step 2341, dividing the first data set into two sub-data sets based on a preset second division ratio and recording them as corresponding second training sets and second evaluation sets;
[0158] The second segmentation ratio is a preset ratio parameter, such as 8:2; the second training set and the second evaluation set both include a plurality of first data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio;
[0159] Step 2342, extracting the first first data record of the second training set as the corresponding current training record;
[0160] Step 2343, extract the first event text and the first event label of the current training record as the corresponding current event text and current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set to the first event extraction instruction template for instruction text assembly processing to obtain the corresponding third training instruction text;
[0161] Step 2344, input the third training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding third predicted event information;
[0162] The third predicted event information includes a third predicted event type, a third predicted trigger word text, and a third predicted event element set; the third predicted event element set includes a plurality of third predicted event elements; the third predicted event element includes a third predicted element type and a third predicted element text;
[0163] Step 2345: bring the third predicted event information and the first event label of the current training record into the first model loss function L M1 ; and based on the preset second model optimizer, move towards making the first model loss function L M1 A round of fine-tuning of the second parameter set of the first model is performed in the direction of reaching the minimum value;
[0164] Wherein, the second model optimizer includes at least an SGD optimizer and an ADAM optimizer;
[0165] Step 2346, identifying whether the current training record is the last first data record of the second training set; if so, going to step 2347; if not, extracting the next first data record of the second training set as the new current training record and returning to step 2343;
[0166] Step 2347, perform a round of traversal on all the first data records of the second evaluation set; and in this round of traversal, use the currently traversed first data record as the corresponding current evaluation record; and extract the first event text and the first event label of the current evaluation record as the corresponding current event text and the current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set completed into the first event extraction instruction template for instruction text assembly processing to obtain the corresponding fourth training instruction text; and input the fourth training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding fourth predicted event information; and form a corresponding second prediction-label pair with the fourth predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding second evaluation value;
[0167] The fourth predicted event information includes a fourth predicted event type, a fourth predicted trigger word text, and a fourth predicted event element set; the fourth predicted event element set includes a plurality of fourth predicted event elements; the fourth predicted event element includes a fourth predicted element type and a fourth predicted element text;
[0168] Step 2348, identifying whether the second evaluation value meets the preset second evaluation value range; if not, returning to step 2342 to continue training; if satisfied, stopping training and confirming the end of the second stage training;
[0169] Here, the second evaluation value range is a preset evaluation value range;
[0170] Step 24, training the second model based on the second data set;
[0171] Specifically, it includes: step 241, dividing the second data set into two sub-data sets based on a preset third division ratio and recording them as a corresponding third training set and a third evaluation set;
[0172] The third segmentation ratio is a preset ratio parameter, such as 8:2; the third training set and the third evaluation set both include a plurality of second data records; the ratio of the total number of records in the third training set to the total number of records in the third evaluation set satisfies the third segmentation ratio;
[0173] Step 242, extracting the first second data record of the third training set as the corresponding current training record;
[0174] Step 243, inputting the second event text of the current training record into the second model for event extraction processing and using the formatted event extraction information output by the model as the corresponding fifth predicted event information;
[0175] The fifth predicted event information includes a fifth predicted event type, a fifth predicted trigger word text, and a fifth predicted event element set; the fifth predicted event element set includes a plurality of fifth predicted event elements; the fifth predicted event element includes a fifth predicted element type and a fifth predicted element text;
[0176] Step 244: bring the fifth predicted event information and the second event label of the current training record into the first model loss function L M1 ; and based on the preset third model optimizer, move towards making the first model loss function L M1 Perform a round of optimization on the model parameters of the second model in the direction of reaching the minimum value;
[0177] Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer;
[0178] Step 245, identifying whether the current training record is the last second data record of the third training set; if so, going to step 246; if not, extracting the next second data record of the third training set as the new current training record and returning to step 243;
[0179] Step 246, perform a round of traversal on all second data records of the third evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second event text of the current evaluation record into the second model for event extraction processing and use the formatted event extraction information output by the model as the corresponding sixth predicted event information; and form a corresponding third prediction-label pair from the sixth predicted event information and the second event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding third evaluation value;
[0180] The sixth predicted event information includes a sixth predicted event type, a sixth predicted trigger word text, and a sixth predicted event element set; the sixth predicted event element set includes a plurality of sixth predicted event elements; the sixth predicted event element includes a sixth predicted element type and a sixth predicted element text;
[0181] Step 247, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 242 to continue training; if satisfied, stopping training and confirming the completion of the second model training.
[0182] Here, the third evaluation value range is a preset evaluation value range.
[0183] Step 3: After the first and second model training is completed, the user input text is received and recorded as the corresponding current event text.
[0184] Step 4, input the current event text into the second model for event extraction to obtain the corresponding first event information;
[0185] Among them, the first event information includes a first event type, a first trigger word text and a first event element set; the first event element set includes multiple first event elements; and the first event element includes a first element type and a first element text.
[0186] Step 5, taking the first event information as the corresponding current prompt text; bringing the current prompt text and the current event text into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and inputting the current instruction text into the first model to perform event extraction processing to obtain the corresponding second event information;
[0187] Among them, the second event information includes a second event type, a second trigger word text and a second event element set; the second event element set includes multiple second event elements; and the second event element includes a second element type and a second element text.
[0188] Step 6: Perform information fusion processing on the first and second event information to obtain corresponding third event information and feed it back to the user;
[0189] Specifically comprising: step 61, identifying whether the second event type of the second event information is empty; if the second event type is empty, taking the first event type of the first event information as the corresponding third event type; if the second event type is not empty, taking the second event type as the corresponding third event type;
[0190] Step 62, identifying whether the second trigger word text of the second event information is empty; if the second trigger word text is empty, using the first trigger word text of the first event information as the corresponding third trigger word text; if the second trigger word text is not empty, using the second trigger word text as the corresponding third trigger word text;
[0191] Step 63, merging the first and second event element sets of the first and second event information to obtain a corresponding first merged element set; and clustering the first merged elements of the same first merged element type in the first merged element set to obtain a plurality of corresponding first-category element subsets;
[0192] The first merged element set includes a plurality of first merged elements, each of which corresponds to a first event element or a second event element; the first merged element includes a first merged element type and a first merged element text; each first-category element subset consists of one or two first merged elements, and the first merged element type of all first merged elements in each first-category element subset is the same;
[0193] Step 64, taking each first-category element subset as the corresponding current subset; and identifying the total number of merged elements in the current subset; if the total number of merged elements is 1, taking the only first merged element in the current subset as a corresponding third event element; if the total number of merged elements is 2, taking the first merged element in the current subset corresponding to a second event element as a corresponding third event element; and forming a corresponding third event element set from all the obtained third event elements;
[0194] Step 65, the third event type, the third trigger word text and the third event element set are used to form corresponding third event information and feedback it to the user;
[0195] Here, the third event information obtained by the embodiment of the present invention includes a third event type, a third trigger word text and a third event element set; the third event element set includes multiple third event elements; and the third event element includes a third element type and a third element text.
[0196] Figure 2 The module structure diagram of a device for processing event extraction tasks based on a model cascade method provided in the second embodiment of the present invention, the device is a terminal device or server that implements the aforementioned method embodiment, and can also be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment, for example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 2 As shown, the device includes: a data set preparation module 201, a model training module 202, a data receiving module 203, a primary model processing module 204, a secondary model processing module 205 and a two-level information fusion module 206.
[0197] The data set preparation module 201 is used to merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set; the first data set at least includes the ACE2005 data set released by the Language Data Alliance, the event extraction data set released by the Chinese Language Resource Alliance, the event extraction data set provided by the Kaggle / Google / GitHub / HDX / FiveThirtyEight platform, and multiple types of event extraction data sets in specific fields; the specific fields at least include biochemistry, energy materials, medical care, finance, law, and social news.
[0198] The model training module 202 is used to use a large language model that has completed pre-training as the corresponding first model; and a lightweight event extraction model as the corresponding second model; and train the first model based on the first data set; and train the second model based on the second data set; the first model includes at least a GPT series model, a T5 series model, and a Wenxin series model; the second model includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+BiLSTM+CRF.
[0199] The data receiving module 203 is used to receive user input text as the corresponding current event text after the first and second model training are completed.
[0200] The primary model processing module 204 is used to input the current event text into the second model for event extraction processing to obtain the corresponding first event information.
[0201] The secondary model processing module 205 is used to use the first event information as the corresponding current prompt text; and bring the current prompt text and the current event text into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and input the current instruction text into the first model for event extraction processing to obtain the corresponding second event information.
[0202] The two-level information fusion module 206 is used to perform information fusion processing on the first and second event information to obtain corresponding third event information and feed it back to the user.
[0203] An embodiment of the present invention provides a device for processing event extraction tasks based on a model cascade method, which can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0204] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the data set preparation module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-mentioned module is determined. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0205] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0206] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0207] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 3 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.
[0208] exist Figure 3The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.
[0209] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0210] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.
[0211] The embodiments of the present invention provide a method, an apparatus, an electronic device and a computer-readable storage medium for processing an event extraction task based on a model cascade method. It can be seen from the above content that the embodiment of the present invention uses a large language model that has been pre-trained as the corresponding first model (such as a GPT series model, a T5 series model, a Wenxin series model, etc.); and uses a lightweight event extraction model as the corresponding second model (such as an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, an event extraction model based on ALBERT+BiLSTM+CRF, etc.); and merges multiple types of event extraction data sets to train the first model; and trains the second model based on an event extraction data set in a specific field; and after the training of the first and second models is completed, the event extraction task is processed by the cascade method of the first and second models, specifically: first, the event text input by the user is subjected to a first-level event extraction process based on the lightweight second model, and then the event extraction result of the second model is sent to the first model as a prompt text together with the event text input by the user for a second-level event extraction process, and then the two-level event extraction results are fused to obtain the final event information to feedback to the user. The embodiment of the present invention uses the output of a lightweight event extraction model as a high-quality prompt context for a large language model, which can reduce the error probability of hallucinations in the large language model and improve the prediction accuracy of the model; the embodiment of the present invention improves the cross-domain prediction performance of event extraction tasks through the good generalization of the large language model; and the event extraction task is processed based on the model cascade method provided by the embodiment of the present invention, which not only improves the cross-domain performance of task processing, but also reduces the model error probability and improves the prediction accuracy of task processing.
[0212] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0213] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for processing event extraction tasks based on model cascade, characterized in that: The method comprises: Merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set; the first data set at least includes the ACE2005 data set released by the Language Data Alliance, the event extraction data set released by the Chinese Language Resource Alliance, the event extraction data set provided by the Kaggle / Google / GitHub / HDX / FiveThirtyEight platform, and multiple types of event extraction data sets in specific fields; the specific fields at least include biochemistry, energy materials, medical care, finance, law, and social news; A large language model that has been pre-trained is used as the corresponding first model; a lightweight event extraction model is used as the corresponding second model; the first model is trained based on the first data set; and the second model is trained based on the second data set; the first model includes at least a GPT series model, a T5 series model, and a Wenxin series model; the second model includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+Bi LSTM+CRF; After the first and second model training is completed, the user input text is received and recorded as the corresponding current event text; Input the current event text into the second model to perform event extraction processing to obtain corresponding first event information; The first event information is used as the corresponding current prompt text; the current prompt text and the current event text are brought into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and the current instruction text is input into the first model to perform event extraction processing to obtain the corresponding second event information; The first and second event information are fused to obtain corresponding third event information and fed back to the user.
2. The method for processing event extraction tasks based on model cascade according to claim 1 is characterized in that: The first model is used to perform event extraction processing according to the event extraction instruction text input by the model and output corresponding formatted event extraction information; the formatted event extraction information is composed of event type information, trigger word text information and event element set information; the event element set information is composed of multiple event element information; the event element information is composed of element type information and element text information; The second model is used to perform event extraction processing on the model input text and output the corresponding formatted event extraction information; The event extraction instruction template corresponding to the first model includes the first event extraction instruction template and the second event extraction instruction template; The first event extraction instruction template is a formatting template; The first event extraction instruction template is used to use the input prompt text and event text as the corresponding current prompt text and current event text, and inform the first model through a narrative text to perform event information extraction processing on the current event text with the current prompt text as the prompt context, and perform corresponding event information text generation processing according to the extracted event type, event trigger word and event element set in the formatted text output format of the formatted event extraction information; The second event extraction instruction template is a formatting template; The second event extraction instruction template is used to use the input event text as the corresponding current event text, and inform the first model through a narrative text to perform event information extraction processing on the current event text, and perform corresponding event information text generation processing according to the extracted event type, event trigger words and event element set in the formatted text output format of the formatted event extraction information; The first data set includes a plurality of first data records; the first data record includes a first event text and a first event label; the first event label includes a first label event type, a first label trigger word text and a first label event element set; the first label event element set includes a plurality of first label event elements; the first label event element includes a first label element type and a first label element text; The second data set includes a plurality of second data records; the second data record includes a second event text and a second event label; the second event label includes a second label event type, a second label trigger word text and a second label event element set; the second label event element set includes a plurality of second label event elements; the second label event element includes a second label element type and a second label element text; The first event information includes a first event type, a first trigger word text and a first event element set; the first event element set includes a plurality of first event elements; the first event element includes a first element type and a first element text; The second event information includes a second event type, a second trigger word text, and a second event element set; the second event element set includes a plurality of second event elements; the second event element includes a second element type and a second element text; The third event information includes a third event type, a third trigger word text and a third event element set; the third event element set includes multiple third event elements; and the third event element includes a third element type and a third element text.
3. The method for processing event extraction tasks based on model cascade according to claim 2 is characterized in that: The training of the first model based on the first data set specifically includes: Recording the parameter set of all model components related to the event extraction task in the full model parameter set of the first model as the corresponding first parameter set; and performing one-stage training modulation on the first parameter set of the first model based on the first data set and the second event extraction instruction template; The parameter set of the decoding and text generation components related to the event extraction task in the full model parameter set is recorded as the corresponding second parameter set; and the second parameter set of the first model is subjected to two-stage training modulation based on the first data set and the first event extraction instruction template.
4. The method for processing event extraction tasks based on model cascade according to claim 3 is characterized in that: The performing one-stage training modulation on the first parameter set of the first model based on the first data set and the second event extraction instruction template specifically includes: Step 41, based on a preset first segmentation ratio, the first data set is divided into two sub-data sets which are recorded as a corresponding first training set and a first evaluation set; Wherein, both the first training set and the first evaluation set include a plurality of the first data records; the ratio of the total number of records in the first training set to the total number of records in the first evaluation set satisfies the first segmentation ratio; Step 42, extracting the first first data record of the first training set as the corresponding current training record; Step 43, bringing the first event text of the current training record into the second event extraction instruction template to perform instruction text assembly processing to obtain the corresponding first training instruction text; Step 44, inputting the first training instruction text into the first model for event extraction processing and using the generated text output by the model as the corresponding first predicted event information; The first predicted event information includes a first predicted event type, a first predicted trigger word text, and a first predicted event element set; the first predicted event element set includes a plurality of first predicted event elements; the first predicted event element includes a first predicted element type and a first predicted element text; Step 45: Substitute the first predicted event information and the first event label of the current training record into a preset first model loss function L M1 ; and based on the preset first model optimizer, move towards making the first model loss function L M1 Performing a round of optimization on the first parameter set of the first model in a direction of reaching a minimum value; Among them, the first model loss function L M1 for: x pre is the N-gram encoding vector of the predicted trigger word text of the predicted event information. If the predicted trigger word text is empty, the corresponding encoding vector x pre is set to an all-zero vector; x tag is the N-gram encoding vector of the tag trigger word text of the event tag. If the tag trigger word text is empty, the corresponding encoding vector x tag is set to an all-zero vector; the encoding vector x pre 、x tag The vector length should be consistent. If the text lengths of the predicted trigger word text and the tag trigger word text are inconsistent, the encoding vector x is padded with zeros to make the encoding vector x pre 、x tag The vector length of is consistent; y pre The event type one-hot encoding vector of the predicted event type for the predicted event information; y tag The event type one-hot encoding vector of the event type of the event label; the one-hot encoding vector y pre ,y tag The vector lengths of y are consistent, and are composed of multiple event type one-hot encodings. Each event type one-hot encoding corresponds to a class of event types, and the total number of event type one-hot encodings is consistent with the preset total number of event types. The one-hot encoding vector y pre In the one-hot encoding vector y, only the event type corresponding to the current predicted event type is one-hot encoded as 1, and all other event types are one-hot encoded as 0; tag Only the event type corresponding to the current label event type is one-hot encoded as 1, and all other event types are one-hot encoded as 0; N is the total number of types of the statistical type set G, and the total number of types of statistics N is a positive integer; the statistical type set G is the statistical result obtained by performing type statistics on the element types of all event elements in the predicted event information and event tags, and the statistical type set G consists of N types of statistical types g i Composition, 1≤type index i≤N, each of the statistic types g i The element type corresponding to a class of event elements; z pre,i The predicted event element type in the predicted event element set for the predicted event information and the statistical type g of the i-th category i The N-gram encoding vector of the predicted element text of the matched predicted event element. If there is no statistical type g in the predicted event element set that matches the statistical type g of the i-th category, i The matching predicted element type corresponds to the encoding vector z pre,i is set to an all-zero vector; z tag,i The label element type in the label event element set of the event label and the statistical type g of the i-th category i The N-gram encoding vector of the tag element text of the matching tag event element. If there is no statistical type g in the tag event element set that matches the i-th category, i The matching tag element type corresponds to the encoding vector z tag,i is set to an all-zero vector; The encoding vector z pre,i 、z tag,i The vector length should be consistent. If the predicted event information and event label contain the same statistical type g as the i-th category i If the lengths of the corresponding prediction element text and label element text are inconsistent, the encoding vector z is padded with zeros to make the encoding vector z shorter. pre,i 、z tag,i The vector length of is consistent; The first model optimizer includes at least an SGD optimizer and an ADAM optimizer; Step 46, identifying whether the current training record is the last first data record of the first training set; if so, going to step 47; if not, extracting the next first data record of the first training set as the new current training record and returning to step 43; Step 47, perform a round of traversal on all the first data records of the first evaluation set; and in this round of traversal, use the first data record currently traversed as the corresponding current evaluation record; and bring the first event text of the current evaluation record into the second event extraction instruction template for instruction text assembly processing to obtain the corresponding second training instruction text; and input the second training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding second predicted event information; and form a corresponding first prediction-label pair with the second predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained first prediction-label pairs into the preset first model evaluation function F A Performing an evaluation value calculation to obtain a corresponding first evaluation value; The second predicted event information includes a second predicted event type, a second predicted trigger word text, and a second predicted event element set; the second predicted event element set includes a plurality of second predicted event elements; the second predicted event element includes a second predicted element type and a second predicted element text; The first model evaluation function F A for: M is the total number of the first prediction-label pairs, 1≤indexj≤M; f er () is MAE error function or MSE error function; x pre,j is the N-gram encoding vector corresponding to the predicted trigger word text of the predicted event information of the j-th prediction-label pair; tag,j is the N-gram encoding vector of the label trigger word text of the event label of the jth prediction-label pair; each prediction-label pair corresponds to a pair of encoding vectors x pre,j 、x tag,j The vector lengths of should be consistent. If a pair of encoding vectors x pre,j 、x tag,j If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent; y pre,j is the event type one-hot encoding vector of the predicted event type of the predicted event information of the j-th prediction-label pair; y tag,j is the event type one-hot encoding vector of the label event type of the event label of the jth prediction-label pair; a pair of one-hot encoding vectors y corresponding to each prediction-label pair pre,j ,y tag,j The vector lengths of are consistent; N j is the statistical type set G corresponding to the j-th prediction-label pair j The total number of species statistics, the total number of species statistics N j is a positive integer; the statistical type set G j The statistical result obtained by performing type statistics on the element types of all event elements in the predicted event information and event labels of the jth prediction-label pair. The statistical type set G j By N j Class statistic type g j,k Composition, each of the statistical types g j,k The element type corresponding to a class of event elements; in each of the statistical type sets G j , 1≤type index k≤N j ; z pre,j,k The predicted element type in the predicted event element set of the predicted event information of the j-th prediction-label pair and the corresponding statistical type set G j The statistical type g in the kth category j,k The N-gram encoding vector of the predicted element text of the matched predicted event element; z tag,j,k The label element type in the label event element set of the event label of the j-th prediction-label pair and the corresponding statistical type set G j The statistical type g in the kth category j,k The N-gram encoding vector of the tag element text of the matching tag event element; each pair of encoding vectors z corresponding to each prediction-label pair tag,j,k 、z tag,j,k The vector lengths should be consistent. If a pair of the encoding vector z tag,j,k 、z tag,j,k If the lengths of the vectors are inconsistent, the shorter encoding vector is padded with zeros to make the lengths of the two vectors consistent; Step 48, identifying whether the first evaluation value meets the preset first evaluation value range; if not, returning to step 42 to continue training; if satisfied, stopping training and confirming the end of one stage of training.
5. The method for processing event extraction tasks based on model cascade according to claim 4 is characterized in that: The performing two-stage training modulation on the second parameter set of the first model based on the first data set and the first event extraction instruction template specifically includes: Step 51, based on a preset second segmentation ratio, the first data set is divided into two sub-data sets recorded as corresponding second training sets and second evaluation sets; Wherein, both the second training set and the second evaluation set include a plurality of the first data records; the ratio of the total number of records in the second training set to the total number of records in the second evaluation set satisfies the second segmentation ratio; Step 52, extracting the first of the first data records in the second training set as the corresponding current training record; Step 53, extract the first event text and the first event label of the current training record as the corresponding current event text and current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set completed into the first event extraction instruction template for instruction text assembly processing to obtain the corresponding third training instruction text; Step 54, inputting the third training instruction text into the first model for event extraction processing and using the generated text output by the model as the corresponding third predicted event information; The third predicted event information includes a third predicted event type, a third predicted trigger word text and a third predicted event element set; the third predicted event element set includes a plurality of third predicted event elements; the third predicted event element includes a third predicted element type and a third predicted element text; Step 55: bring the third predicted event information and the first event label of the current training record into the first model loss function L M1 ; and based on the preset second model optimizer, move towards making the first model loss function L M1 Performing a round of fine-tuning on the second parameter set of the first model in the direction of reaching the minimum value; The second model optimizer includes at least an SGD optimizer and an ADAM optimizer; Step 56, identifying whether the current training record is the last of the first data record in the second training set; if so, going to step 57; if not, extracting the next first data record in the second training set as the new current training record and returning to step 53; Step 57, perform a round of traversal on all the first data records of the second evaluation set; and in this round of traversal, take the first data record currently traversed as the corresponding current evaluation record; and extract the first event text and the first event label of the current evaluation record as the corresponding current event text and current prompt text; and randomly select one item from the first label event type, the first label trigger word text and all the first label event elements of the current prompt text as the corresponding current mask item; and set the current mask item to empty; and bring the current prompt text and the current event text with the mask item set completed into the first event extraction instruction template for instruction text assembly processing to obtain the corresponding fourth training instruction text; and input the fourth training instruction text into the first model for event extraction processing and use the generated text output by the model as the corresponding fourth predicted event information; and form a corresponding second prediction-label pair with the fourth predicted event information and the first event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained second prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding second evaluation value; The fourth predicted event information includes a fourth predicted event type, a fourth predicted trigger word text, and a fourth predicted event element set; the fourth predicted event element set includes a plurality of fourth predicted event elements; the fourth predicted event element includes a fourth predicted element type and a fourth predicted element text; Step 58, identifying whether the second evaluation value meets the preset second evaluation value range; if not, returning to step 52 to continue training; if satisfied, stopping training and confirming the end of the second stage training.
6. The method for processing event extraction tasks based on model cascade according to claim 4 is characterized in that: The training of the second model based on the second data set specifically includes: Step 61, based on a preset third segmentation ratio, the second data set is divided into two sub-data sets, which are recorded as a corresponding third training set and a third evaluation set; Wherein, the third training set and the third evaluation set both include a plurality of the second data records; the ratio of the total number of records in the third training set to the total number of records in the third evaluation set satisfies the third segmentation ratio; Step 62, extracting the first second data record of the third training set as the corresponding current training record; Step 63, inputting the second event text of the current training record into the second model for event extraction processing and using the formatted event extraction information output by the model as the corresponding fifth predicted event information; The fifth predicted event information includes a fifth predicted event type, a fifth predicted trigger word text, and a fifth predicted event element set; the fifth predicted event element set includes a plurality of fifth predicted event elements; the fifth predicted event element includes a fifth predicted element type and a fifth predicted element text; Step 64: bring the fifth predicted event information and the second event label of the current training record into the first model loss function L M1 ; and based on a preset third model optimizer, move toward making the first model loss function L M1 Performing a round of optimization on the model parameters of the second model in the direction of reaching the minimum value; Wherein, the third model optimizer includes at least an SGD optimizer and an ADAM optimizer; Step 65, identifying whether the current training record is the last second data record of the third training set; if so, going to step 66; if not, extracting the next second data record of the third training set as the new current training record and returning to step 63; Step 66, perform a round of traversal on all the second data records of the third evaluation set; and in this round of traversal, use the second data record currently traversed as the corresponding current evaluation record; and input the second event text of the current evaluation record into the second model for event extraction processing and use the formatted event extraction information output by the model as the corresponding sixth predicted event information; and form a corresponding third prediction-label pair from the sixth predicted event information and the second event label of the current evaluation record; and at the end of this round of traversal, bring all the obtained third prediction-label pairs into the first model evaluation function F A Performing evaluation value calculation to obtain a corresponding third evaluation value; The sixth predicted event information includes a sixth predicted event type, a sixth predicted trigger word text, and a sixth predicted event element set; the sixth predicted event element set includes a plurality of sixth predicted event elements; the sixth predicted event element includes a sixth predicted element type and a sixth predicted element text; Step 67, identifying whether the third evaluation value meets the preset third evaluation value range; if not, returning to step 62 to continue training; if satisfied, stopping training and confirming the completion of the second model training.
7. The method for processing event extraction tasks based on model cascade according to claim 2 is characterized in that: The performing information fusion processing on the first and second event information to obtain corresponding third event information and feeding back the corresponding third event information to the user specifically includes: Step 71, identifying whether the second event type of the second event information is empty; if the second event type is empty, taking the first event type of the first event information as the corresponding third event type; if the second event type is not empty, taking the second event type as the corresponding third event type; Step 72, identifying whether the second trigger word text of the second event information is empty; if the second trigger word text is empty, using the first trigger word text of the first event information as the corresponding third trigger word text; if the second trigger word text is not empty, using the second trigger word text as the corresponding third trigger word text; Step 73, merging the first and second event element sets of the first and second event information to obtain a corresponding first merged element set; and clustering the first merged elements of the same first merged element type in the first merged element set to obtain a plurality of corresponding first-category element subsets; The first merged element set includes a plurality of the first merged elements, each of which corresponds to one of the first event elements or one of the second event elements; the first merged element includes the first merged element type and the first merged element text; each of the first-type element subsets consists of one or two of the first merged elements, and the first merged element type of all the first merged elements in each of the first-type element subsets is the same; Step 74, taking each of the first-category element subsets as the corresponding current subset; and identifying the total number of merged elements in the current subset; if the total number of merged elements is 1, taking the only first merged element in the current subset as the corresponding third event element; if the total number of merged elements is 2, taking the first merged element in the current subset corresponding to one of the second event elements as the corresponding third event element; and forming the corresponding third event element set from all the obtained third event elements; Step 75, the third event information corresponding to the third event type, the third trigger word text and the third event element set is fed back to the user.
8. A device for executing the method for processing event extraction tasks based on model cascade as described in any one of claims 1 to 7, characterized in that: The device comprises: a data set preparation module, a model training module, a data receiving module, a primary model processing module, a secondary model processing module and a two-level information fusion module; The data set preparation module is used to merge multiple types of event extraction data sets to form a corresponding first data set; and use a type of event extraction data set in a specific field as the corresponding second data set; the first data set at least includes the ACE2005 data set released by the Language Data Alliance, the event extraction data set provided by the Kaggle / Google / GitHub / HDX / FiveThirtyEi ght platform, the event extraction data set released by the Chinese Language Resource Alliance, and multiple types of event extraction data sets in specific fields; the specific fields at least include biochemistry, energy materials, medical care, finance, law, and social news; The model training module is used to use a pre-trained large language model as the corresponding first model; and a lightweight event extraction model as the corresponding second model; and train the first model based on the first data set; and train the second model based on the second data set; the first model includes at least a GPT series model, a T5 series model, and a Wenxin series model; the second model includes at least an event extraction model based on BERT+CRF, an event extraction model based on BiLSTM+CRF, and an event extraction model based on ALBERT+BiLSTM+CRF; The data receiving module is used to receive user input text as the corresponding current event text after the first and second model training are completed; The primary model processing module is used to input the current event text into the second model for event extraction processing to obtain corresponding first event information; The secondary model processing module is used to use the first event information as the corresponding current prompt text; and bring the current prompt text and the current event text into the first event extraction instruction template corresponding to the first model to perform instruction text assembly processing to obtain the corresponding current instruction text; and input the current instruction text into the first model to perform event extraction processing to obtain the corresponding second event information; The two-level information fusion module is used to perform information fusion processing on the first and second event information to obtain corresponding third event information and feed it back to the user.
9. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 7; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Processing method and device for health plan prediction based on large medical model
CN120413081A