Event causal relationship identification method and system based on theme awareness context learning

Through the method based on topic-aware context learning, the problem of complex design of prompt templates in the prior art is solved and the inability to utilize topic-related information is achieved, and high-accurate event causality recognition is achieved without the need for complex prompt templates and answer space.

CN119721006APending Publication Date: 2025-03-28HUAZHONG NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411702305.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art requires the design of complex prompt templates in event causal recognition, and the subject correlation information cannot be fully utilized, resulting in limited recognition accuracy and stability.

Method used

Using a method based on topic-aware context learning, a training sample set is formed by extracting event pairs from the text dataset and selecting a causal demonstration sample based on the topic similarity search strategy. Then the training sample set is templated, and the pre-trained language model is input for training and bias calibration, and a context learning model based on bias calibration is obtained to identify event causality.

Benefits of technology

Without the need to construct complex prompt templates and answer spaces, the prediction bias brought by the demonstration samples can be corrected, significantly improving the accuracy of event causality recognition and the generalization ability of contextual learning models based on bias calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119721006A_ABST
    Figure CN119721006A_ABST
Patent Text Reader

Abstract

The invention provides an event causal relationship identification method and system based on theme awareness context learning, and belongs to the field of natural language processing, and the method comprises the steps: S1, extracting event pairs to generate a to-be-identified query instance, and selecting the event pairs with a causal relationship as demonstration samples based on a theme similarity retrieval strategy, combining the query instance and the demonstration sample to form a training sample set; s2, performing templating processing on sentences in the training sample set to generate a template containing query instance sentences and demonstration sample sentences, and setting placeholders for predicting a causal relationship in the template; s3, inputting the templated training sample set into a pre-training language model for training and deviation calibration to obtain a context learning model based on deviation calibration, and outputting a prediction result after deviation calibration; and S4, determining a causal relationship between the event pairs according to a prediction result. According to the method, a complex prompt template and answer space do not need to be constructed, and prediction deviation caused by the demonstration sample can be corrected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a method and system for identifying event causal relationships based on topic-aware context learning. Background Art

[0002] Event Causality Identification (ECI) aims to detect whether there is a causal relationship between two events mentioned in a document, which is very important for many natural language processing (NLP) applications, such as question answering, information extraction, event-centric knowledge graph construction, etc. It also has many applications in real-world scenarios, such as event prediction, policy optimization, etc. The ECI task is usually regarded as a graph-based node classification or edge prediction problem. Some studies have designed graph neural networks to learn the semantic representation of each event for relationship classification, such as Rich Graph Convolutional Network (RichGCN), Event Relation Graph Transformer (ERGO), and graph-based event structure induction model.

[0003] Some studies have attempted to discover causal patterns from external knowledge bases to achieve causal reasoning of knowledge events, aiming to improve the performance of models in complex reasoning tasks by integrating rich structured information. Traditional solutions usually directly use this knowledge for data expansion and enhancement to increase the diversity and depth of training data. For example, event agnosticism and specific context patterns are mined from ConceptNet to improve the model's ability to handle unseen situations, focusing on the explicit expression of causal relationships and diversity in different contexts. In addition, there are studies that encode graph structure knowledge, including descriptive knowledge edges and relationship paths, to enhance the effect of event causal reasoning. These methods enable models to more effectively capture and utilize information in graphs, thereby achieving higher accuracy and robustness in the reasoning process.

[0004] Traditional studies use masked language models as the main prompt to predict the causal relationship between event pairs, and further design two derived prompt tasks to utilize the latent causal knowledge in the pre-trained model to perform explicit causal relationship identification based on the detection of causal clue words. Traditional studies require complex prompt template design and construction of a dedicated answer space, and do not fully utilize topic relevance information, which can easily affect prediction accuracy and stability.

[0005] Therefore, finding a method that can avoid complex prompt template design and make full use of pre-trained model knowledge to improve recognition accuracy is a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0006] The present invention provides an event causal relationship recognition method and system based on topic-aware context learning, which is used to solve the defects in the prior art that complex prompt templates need to be designed and topic relevance information cannot be fully utilized. It does not need to construct complex prompt templates and answer spaces, and can correct the prediction bias caused by demonstration samples, thereby significantly improving the accuracy of event causal relationship recognition.

[0007] The present invention provides an event causal relationship recognition method based on topic-aware context learning, comprising the following steps:

[0008] S1, extracting event pairs from a text data set to generate query instances to be identified, and selecting event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combining the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether the event pairs have a causal relationship;

[0009] S2, performing template processing on the sentences in the training sample set to generate a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template;

[0010] S3, inputting the templated training sample set into the pre-trained language model for training and deviation calibration, obtaining a contextual learning model based on deviation calibration, and outputting the prediction result after deviation calibration;

[0011] S4. Determine the causal relationship between event pairs based on the prediction results after deviation calibration.

[0012] According to a method for identifying event causal relationships based on topic-aware context learning provided by the present invention, the topic similarity retrieval strategy includes:

[0013] Set topic similarity threshold;

[0014] The cosine similarity between all event pairs is calculated based on the word vector representation, and the topic similarity of the event pairs is determined based on the cosine similarity and the topic similarity threshold:

[0015] If the cosine similarity is greater than the topic similarity threshold, the event pair is the same topic;

[0016] If the cosine similarity is less than the topic similarity threshold, the event pair is of different topics.

[0017] According to an event causal relationship recognition method based on topic-aware context learning provided by the present invention, the training sample set includes positive samples and negative samples, wherein:

[0018] Positive samples are event pairs with causal relationships in documents of different topics;

[0019] Negative samples are event pairs that have no causal relationship in documents of the same topic.

[0020] According to a method for identifying event causal relationships based on topic-aware context learning provided by the present invention, the template includes:

[0021] Use the [CLS] tag as a sentence start marker and the [SEP] tag as a sentence end marker;

[0022] Use the [SEP] tag to separate query instance sentences and demonstration sample sentences.

[0023] According to an event causal relationship recognition method based on topic-aware context learning provided by the present invention, the process of training and deviation calibration is as follows:

[0024] Input each templated training sample into the pre-trained language model for semantic learning, obtain the hidden state vector of each training sample at the placeholder position and its label prediction probability, and build a calibration sample library;

[0025] A set of samples closest to the query instance to be identified is retrieved from the calibration sample library, and a prediction result after deviation calibration is obtained based on a nearest neighbor deviation calibration strategy; wherein the nearest neighbor deviation calibration strategy is used to reduce the deviation between demonstration samples.

[0026] According to a method for identifying event causal relationships based on topic-aware contextual learning provided by the present invention, the nearest neighbor deviation calibration strategy includes:

[0027] Calculate the Euclidean distance between the sample to be predicted and the sample in the calibration sample library in the hidden state vector space;

[0028] Select K samples with the smallest Euclidean distance as the nearest neighbor sample set;

[0029] Calculate the weight coefficient of each neighbor sample according to the Euclidean distance;

[0030] The predicted distribution of neighboring samples is weighted and fused with the current prediction result according to the weight coefficient to obtain the prediction result after deviation calibration.

[0031] According to the event causal relationship identification method based on topic-aware context learning provided by the present invention, step S4 specifically includes:

[0032] Obtain the probability value of the existence of causal relationship in the prediction results after bias correction;

[0033] Compare the probability value with the preset decision threshold:

[0034] When the probability value is greater than the determination threshold, it is determined that there is a causal relationship between the event pair;

[0035] When the probability value is less than or equal to the determination threshold, it is determined that there is no causal relationship between the event pair. The present invention also provides an event causal relationship recognition system based on topic-aware context learning, which adopts the event causal relationship recognition method as described above, including:

[0036] A training set construction module is used to extract event pairs from a text data set to generate query instances to be identified, and select event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combine the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship;

[0037] A template processing module, used for performing template processing on the sentences in the training sample set, generating a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template;

[0038] The model training and deviation calibration module is used to input the templated training sample set into the pre-trained language model for training and deviation calibration, obtain a contextual learning model based on deviation calibration, and output the prediction result after deviation calibration;

[0039] The relationship identification module is used to determine the causal relationship between event pairs based on the prediction results after deviation calibration.

[0040] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the event causal relationship identification method described in any one of the above is implemented.

[0041] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the event causal relationship identification methods described above.

[0042] The present invention provides an event causal relationship recognition method and system based on topic-aware contextual learning. By introducing a topic-aware demonstration sample retrieval strategy and a nearest neighbor deviation calibration strategy, the present invention effectively solves the problems of complex prompt template design and contextual deviation in traditional methods. There is no need to construct complex prompt templates and answer spaces, and at the same time, it can correct the prediction deviation caused by demonstration samples, thereby significantly improving the accuracy of event causal relationship recognition and the generalization ability of the contextual learning model based on deviation calibration. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0044] Figure 1 is a flow chart of the event causal relationship identification method provided by the present invention;

[0045] Figure 2 It is an event causal relationship annotation diagram of the event causal relationship identification method provided by the present invention;

[0046] Figure 3 It is a framework diagram of a contextual learning model based on deviation calibration of the event causal relationship identification method provided by the present invention;

[0047] Figure 4 1 is a performance effect diagram of different numbers of positive and negative demonstration samples of the event causal relationship identification method provided by the present invention; wherein (a) is a diagram showing the influence of different numbers and proportions of demonstration samples on the F1 score, and (b) is a probability distribution diagram of the model predicting causal relationships under different combinations of positive and negative sample ratios;

[0048] Figure 5 It is a visualization diagram of the predicted probabilities of 20 randomly selected test instances of different ablation models and demonstration retrieval strategies of the event causal relationship identification method provided by the present invention;

[0049] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

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

[0051] like Figure 1 As shown, an embodiment of the present invention provides an event causal relationship identification method based on topic-aware context learning, comprising the following steps:

[0052] S1. Extract event pairs from the text data set to generate query instances to be identified, and select event pairs with causal relationships as demonstration samples based on the topic similarity retrieval strategy, and combine the query instances and demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship; wherein the query instances to be identified are obtained by combining different events in the text data set in pairs, and the event causal relationships of event topic documents in the event causal recognition corpus are as follows: Figure 2 shown.

[0053] Figure 2 In the figure, “Document” represents the document, “Event Mention” represents the event mention, “Causal Relation (Intra-Sentence)” represents the intra-sentence causal relationship, and “Causal Relation (Cross-Sentence)” represents the inter-sentence causal relationship.

[0054] Furthermore, the training sample set includes positive samples and negative samples, wherein:

[0055] Positive samples are event pairs with causal relationships in documents of different topics;

[0056] Negative samples are event pairs that have no causal relationship in documents of the same topic.

[0057] In the embodiment of the present invention, the positive samples and negative samples in the training sample set are arranged according to a preset ratio, wherein the preset ratio can be set according to actual use requirements, and the present invention does not impose any specific limitation on this.

[0058] In one embodiment of the present invention, the topic similarity search strategy includes:

[0059] Set topic similarity threshold;

[0060] The cosine similarity between all event pairs is calculated based on the word vector representation, and the topic similarity of the event pairs is determined based on the cosine similarity and the topic similarity threshold:

[0061] If the cosine similarity is greater than the topic similarity threshold, the event pair is the same topic;

[0062] If the cosine similarity is less than the topic similarity threshold, the event pair is of different topics.

[0063] The topic similarity threshold can be set according to actual usage requirements, and the present invention does not impose any specific limitation on this.

[0064] In an optional embodiment of the present invention, an experiment is conducted based on EventStoryLine V0.9 and Causal-TimeBank, wherein:

[0065] EventStoryLine V0.9 contains 22 topics and 258 documents. Due to the limitation of the input length of the pre-trained language model, it needs to be converted into a suitable input form. According to statistics, the dataset has 1657 different events, 5334 event mentions, and 5625 event pairs with causal relationships, of which 1770 are intra-sentence causal relationships and 3855 are inter-sentence causal relationships. The original documents are processed into the data required for the cost experiment: Document sentence division: With events as the core, all event pair combinations are obtained through exhaustive methods.

[0066] Causal-TimeBank contains 184 English news article documents and 7608 annotated event pairs. A total of 318 event pairs are annotated with causal relationships, of which 300 event pairs have intra-sentence causal relationships and only 18 event pairs have inter-sentence causal relationships. Since the number of event pairs with inter-sentence causal relationships is small, the present invention only conducts intra-sentence causal relationship recognition experiments on them.

[0067] The contextual input prompt contains a query instance for answer prediction and some demonstration samples for contextual analogies. The query instance q is an event pair, i.e., q = (Evt i ,Evt j ), where Evt i is the first event to be determined for causal relationship, Evt j The second event whose causal relationship is to be determined. For q, retrieve some demonstration samples d from the training dataset with annotated labels y∈{causal,none} k =(Evt i ,Evt j ,y), where causal means there is a causal relationship, and none means there is no causal relationship.

[0068] Negative Demonstration Sample is defined as an event pair with the label “none” extracted from annotated documents with the same topic as the query instance. Defined as event pairs with a "causal" label, which are extracted from documents with different topics from the query instance. By using positive and negative demonstration samples, the IncBC (In-Context Learning with Bias Calibration) model can be trained to distinguish non-causal relationships in the same topic and identify causal relationships in different topics. Since it is impossible to predict which one is more effective, the same number of positive and negative demonstration samples will be retrieved, and the number of demonstration samples will be tested experimentally later.

[0069] S2. Performing template processing on the sentences in the training sample set to generate a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template.

[0070] It can be understood that the template H includes the corresponding query instance sentence and the demonstration sentence. The placeholder inserted in the template H represents the causal relationship to be predicted, and the placeholder of the demonstration sample sentence is replaced with a more explicit identifier. <causal>and <none>, used to indicate whether there is a causal relationship between events; among them, <causal>Placeholders for causal relationships. <none>A placeholder for a non-causal relationship.

[0071] Furthermore, the demonstration sample sentence includes a description part and a relationship identification part of the event pair, wherein:

[0072] The description part is used to describe the specific content of the event pair;

[0073] The relationship identification part is used to identify the causal relationship between the event pair, and the relationship identification part includes an identifier that characterizes whether the causal relationship exists or not.

[0074] In one embodiment of the present invention, the query instance q and the demonstration sample d k Expressed as prompt templates H(q) and T(d k ), that is, T(q)=Evt i [MASK]Evt j , where [MASK] is a placeholder. In the query instance, two events mention Evt i and Evt j PLM-specific placeholders [MASK] are inserted between them for relationship prediction.

[0075] For the demonstration sample, use the same template as the query instance, but replace each positive sample in the template H Replace [MASK] with <causal>, each negative sample Replace [MASK] with <none>, representing the existence or non-existence of causal relationship:

[0076]

[0077] Among them, H(d k ) represents the expression of the demonstration sample, Evt m Indicates the first event mention in the demo sample, Evt n Indicates the second event mention in the demo sample, <causal>Placeholders for causal relationships. <none>Placeholder for no causal relationship, d k Indicates a demo sample, represents a positive sample, Represents negative samples.

[0078] In one embodiment of the present invention, the template includes:

[0079] Use the [CLS] tag as a sentence start marker and the [SEP] tag as a sentence end marker;

[0080] Use the [SEP] tag to separate query instance sentences and demonstration sample sentences.

[0081] It can be understood that the use of [CLS] and [SEP] special markers to mark the beginning and end of the input, and the use of [SEP] as a separator between the query instance and the demonstration sample makes the template input structure contain not only the query instance, but also the contextual information of multiple positive and negative samples, thereby enhancing the causal relationship recognition capability.

[0082] In one embodiment of the present invention, using <e1> 、< / e1> , <e2> 、< / e2> , <h> and< / h> , to mark the start and end of the event. Finally, the query prompt template and the retrieved demonstration prompt template are connected as the input of PLM. <e1> Indicates the start marker of the first event.< / e1> Indicates the end marker of the first event, <e2> Indicates the start marker of the second event,< / e2> Indicates the end marker of the second event, <h> Indicates the start tag of template H.< / h> Indicates the end marker of template H.

[0083] The present invention uses a special event marker ( <e1> 、< / e1> , <e2> 、< / e2> ) identifies event mentions and aggregates the relevant semantics of event mentions by clearly marking the boundaries of events, which simplifies the construction of the answer space and improves prediction efficiency.

[0084] S3. Input the templated training sample set into the pre-trained language model for training and deviation calibration to obtain a contextual learning model based on deviation calibration, and output the prediction result after deviation calibration.

[0085] Among them, the pre-trained language model can be a masked language model based on BERT, a masked language model based on DeBERTa, a masked language model based on RoBERTa, etc., and the present invention does not make specific limitations here.

[0086] In a preferred embodiment of the present invention, the pre-trained language model adopts a masked language model based on RoBERTa.

[0087] like Figure 3 As shown, the specific training and bias calibration process is as follows:

[0088] Input each templated training sample into the pre-trained language model for semantic learning, obtain the hidden state vector of each training sample at the placeholder position and its label prediction probability, and build a calibration sample library;

[0089] A set of samples closest to the query instance to be identified is retrieved from the calibration sample library, and a prediction result after deviation calibration is obtained based on a nearest neighbor deviation calibration strategy; wherein the nearest neighbor deviation calibration strategy is used to reduce the deviation between demonstration samples.

[0090] Furthermore, the nearest neighbor deviation calibration strategy includes:

[0091] Calculate the Euclidean distance between the sample to be predicted and the sample in the calibration sample library in the hidden state vector space;

[0092] Select K samples with the smallest Euclidean distance as the nearest neighbor sample set;

[0093] Calculate the weight coefficient of each neighbor sample according to the Euclidean distance;

[0094] The predicted distribution of neighboring samples is weighted and fused with the current prediction result according to the weight coefficient to obtain the prediction result after deviation calibration.

[0095] Among them, K can be specifically set according to actual usage, and the present invention does not make any specific limitation to this.

[0096] The present invention constructs a calibration sample library, retrieves the nearest neighbor samples according to the Euclidean distance, and weightedly fuses the retrieval results with the predictions of the language model, thereby effectively reducing the prediction deviation of the context learning model based on deviation calibration and improving the reliability of the prediction results.

[0097] Figure 3 In the example, "In-context Prompt Templatize" means context prompt template processing, "Positive demo samples (Different topic decuments in training date)" means positive demo samples (documents from different topics in training data), "Negative demo samples (Same topic decuments in training date)" means negative demo samples (documents from the same topic in training data), "Retrieved from Training data" means retrieval from training sample set, "Answer Prediction (Training phase)" means answer prediction (training phase), "Bias Calibration (Testing phase)" means bias calibration (testing phase), and "Fine-tuned "PLM" represents the fine-tuned pre-trained language model, "Key" represents the key, "Value" represents the value, "Nearest" represents the nearest, "Neighbour" represents the similar sample, "Distance" represents the similarity measure between samples, "Relation" represents the causal relationship type, "Temperature" represents the temperature, "Normalization" represents the normalization process, "Calibration value" represents the calibration value, "Prediction value" represents the prediction value, "Loss" represents the loss function, "Training" represents the training process, "causal relation classifier" represents the causal relationship classifier, and "Query Instance (training or testing)" represents the query instance (training or testing sample). Figure 3 The processing flow is as follows:

[0098] Input layer processing stage: Receive query instances (event pairs to be identified) as input and retrieve relevant demonstration samples from the training data; negative demonstration samples retrieve event pairs that do not have a causal relationship from documents with the same topic as the query instance, while positive demonstration samples retrieve event pairs that have a causal relationship from documents with different topics. This ensures that the model can learn causal relationship features in different scenarios.

[0099] Template conversion phase: Convert the query instance and the retrieved demonstration sample into a unified template format, using special markers ( <e1> 、< / e1> , <e2> 、< / e2> ) identifies the location of the event mention and inserts the [MASK] tag in the query instance as the causal relationship location to be predicted, while in the demonstration sample, <causal>or <none>Marking to indicate known cause-effect relationships;

[0100] Pre-trained language model processing stage: The templated input sequence is sent to the pre-trained language model for processing. The model generates a hidden state vector at the [MASK] position and calculates the predicted distribution through the softmax layer to obtain the predicted probability distribution p based on the context. l ;

[0101] Bias calibration processing stage: The calibration sample library stores the hidden state vectors and corresponding label information of the training sample set. During prediction, the most similar samples are retrieved by calculating the Euclidean distance between the hidden state of the query instance and the samples in the calibration repository, and the temperature coefficient T (preferably 3) is used to weight the distance to generate the calibrated prediction distribution p c ;

[0102] Result fusion stage: context prediction distribution p l and the calibration score distribution p c The final predicted probability distribution is obtained by weighted fusion using the weight coefficient λ (preferred value is 0.5). <causal>The probability is greater than <none>When , it is determined that there is a causal relationship between the event pair; otherwise, it is determined that there is no causal relationship.

[0103] In one embodiment of the present invention, each templated template H is input into a pre-trained language model for semantic learning to obtain the predicted probability distribution of the placeholder in the template H. The pre-trained language model is trained by minimizing the difference between the event mention prediction result at each placeholder and the true result determined based on the corresponding label. After PLM encoding, the hidden state h of the input [MASK] tag for causal prediction is obtained. q , with dimension s.

[0104] Based on this, the Masked Language Model (MLM) classifier determines the most likely word by calculating the probability distribution of each word marked by [MASK]. The expression is:

[0105] P([MASK]=v∈V|H(s))

[0106] Among them, P represents the probability distribution, H(s) represents the text sequence input into the pre-trained language model, that is, the concatenated sequence of query instances and demonstration samples, V is the PLM vocabulary, and v represents the vocabulary in the PLM vocabulary.

[0107] The pre-trained language model introduces two virtual words in the PLM vocabulary: <causal>"and" <none>”. Then, the prediction scores of the two words are normalized using the softmax layer to obtain the probability distribution:

[0108]

[0109] Among them, P l (v i ∈V a |H(s)) means that given the input sequence H(s), the vocabulary v i Belongs to vocabulary subset V a The probability distribution of v i represents the virtual word to be predicted, j represents the index of the summation item, n represents the total number of virtual words, v j A virtual word in the summation process. Indicates virtual word v i The exponential form of the prediction score, Indicates virtual word v j The exponential form of the prediction score, V a Represents the set of virtual words, V a ={ <causal> , <none>}.

[0110] It can be understood that by comparing the possible probabilities of two words, it is possible to determine whether there is a causal relationship between the event pairs in the query instance. <causal>The probability is higher than <none>When , it is determined that there is a causal relationship between the two event pairs; otherwise, it is determined that there is no causal relationship between the two event pairs.

[0111] During the pre-trained language model training phase, the goal of the pre-trained language model is to minimize the prediction error of the language model at the [MASK] position. The pre-trained language model continuously adjusts the parameters of the pre-trained language model based on the true label of the event pair (whether there is a causal relationship), so that the pre-trained language model can more accurately predict the causal relationship given the contextual prompts. The pre-trained language model uses the cross entropy loss function for optimization:

[0112]

[0113] Where J(θ) represents the loss function, t represents the index of the sample, K is the number of samples, and y (t) is the true label of the t-th query instance, is the predicted label, τ represents the hyperparameter controlling the regularization strength, and θ represents the parameters of the pre-trained language model.

[0114] The present invention optimizes the pre-trained language model by using a cross entropy loss function to prevent the pre-trained language model from overfitting.

[0115] In a preferred embodiment of the present invention, the pre-trained language model uses an AdamW optimizer with L2 regularization to update parameters. AdamW is an Adam optimizer with weight decay, which can better prevent excessive updating of the pre-trained language model parameters, thereby improving the convergence speed and reducing overfitting.

[0116] In an optional embodiment of the present invention, after training is completed, the contextual learning model based on deviation calibration generates a hidden state vector h according to the position of [MASK] in each training instance. c , and these hidden states and their corresponding causal labels y c Stored in the calibration store S (calibration store). The calibration store contains multiple "key-value" pairs, each key is the hidden state h of [MASK] c , the value is the corresponding label y c :

[0117]

[0118] Where D train is the training data set, x c Denotes the training data set D train A training sample in .

[0119] It can be understood that in the test phase, for each event pair to be recognized, the pre-trained language model first uses the Euclidean distance d(h c ,y c ) retrieves the hidden state vector h of the nearest neighbor in the calibration sample library c These nearest neighbor samples are most similar to the [MASK] position of the test instance and can therefore be used as a reference for bias calibration.

[0120] In one embodiment of the present invention, since the nearest neighbor samples retrieved from the calibration sample library may have different distances, a temperature coefficient T (greater than 1) is used to smooth the distance distribution. When the temperature coefficient is higher, the distribution can be made smoother, thereby reducing excessive dependence on samples that are too close, and avoiding the context learning model based on bias calibration from overfitting specific samples. When the temperature is lower, the prediction accuracy of the context learning model based on bias calibration can be improved, but the risk of overfitting may be increased.

[0121] Through the retrieved nearest neighbor samples, the bias-calibrated contextual learning model calculates a calibrated score distribution:

[0122]

[0123] Among them, P C (y|h q ) indicates that in the test sample hidden state h q Under the condition, the calibrated probability distribution of the predicted label y, y represents the label predicted by the contextual learning model based on bias calibration, v a Indicates two virtual words, h q is the hidden state of the test sample, h c is the hidden state of the sample in the calibration sample library, y c represents the causal relationship label corresponding to the sample in the calibration sample library, softmax(·) represents the normalization function, N t is the nearest neighbor sample set of the test sample, d(h q ,h c ) is h q and h c The Euclidean distance is , T is the temperature coefficient, and the preferred value of T is 3.

[0124] The present invention introduces a temperature coefficient to weight the distance of retrieval samples, thereby achieving precise control of the degree of dependence on samples of different distances. While maintaining the prediction accuracy of the contextual learning model based on deviation calibration, the overfitting problem is effectively prevented, and the robustness of the contextual learning model based on deviation calibration is enhanced.

[0125] S4. Determine the causal relationship between event pairs based on the prediction results after deviation calibration.

[0126] Specifically, step S4 specifically includes:

[0127] Obtain the probability value of the existence of causal relationship in the prediction results after bias correction;

[0128] Compare the probability value with the preset decision threshold:

[0129] When the probability value is greater than the determination threshold, it is determined that there is a causal relationship between the event pair;

[0130] When the probability value is less than or equal to the determination threshold, it is determined that there is no causal relationship between the event pair.

[0131] The present invention combines the context learning results and the deviation calibration results to make a comprehensive judgment. <causal>and <none>The causal relationship is determined by the predicted probability of the prediction. This discriminant method is simple and effective, avoiding complex post-processing and improving the practicality of the contextual learning model based on bias calibration.

[0132] In one embodiment of the present invention, a recognition model is constructed, wherein the recognition model is used to make a judgment based on the event mention prediction result at the placeholder in the template H to obtain the causal relationship between the events in the template H.

[0133] Event causal relationship prediction is based on the context prediction distribution p l and the calibration score distribution p c It is obtained through comprehensive calculation. The calculation formula is:

[0134] p(y|x)=(1-λ)·p l +λ·p c

[0135] Among them, p(y|x) represents the probability of predicting label y under the condition of input x, λ∈[0,1] is the weight coefficient, which is used to balance the importance of contextual cue prediction and bias calibration. The larger the λ value, the higher the p l The smaller the influence of , the better the value of λ is 0.5.

[0136] When p(causal)>p(none), there is a causal relationship between the two event pairs of the task template H; otherwise, there is no causal relationship between the two event pairs of the task template H.

[0137] The present invention effectively solves the problem of complex prompt template design and contextual bias in traditional methods by introducing a topic-aware demonstration sample retrieval strategy and a nearest neighbor deviation calibration strategy. This method does not require the construction of complex prompt templates and answer spaces, and can correct the prediction bias caused by demonstration samples, significantly improving the accuracy of event causal relationship recognition and the generalization ability of the contextual learning model based on deviation calibration.

[0138] In one embodiment of the present invention, the EventStoryLine 0.9Corpus (ESCv0.9) and Causal-TimeBank (CTB) datasets widely used in ECI tasks are taken as examples to demonstrate the performance effect of the method for identifying event causal relationships based on the contextual learning model of deviation calibration proposed in the present invention. The ECS dataset is collected from different news websites, containing 22 topics, 258 documents, and a total of 5334 event mentions. A total of 5625 pairs of events are marked as having causal relationships, of which 1770 pairs are intra-sentence causal relationships and 3855 pairs are inter-sentence causal relationships. Similar to the standard data division, the last two topics are used as the validation set, and the remaining 20 topics are subjected to 5-fold cross validation. The average results of precision (P), recall (R) and F1 value are used as performance indicators.

[0139] The CTB dataset contains 184 English news article documents and 7608 annotated event pairs. A total of 318 event pairs are annotated with causal relationships, of which 300 are intra-sentence causal relationships and 18 are inter-sentence causal relationships. The same as the standard data division, 10-fold cross validation is performed, and precision (P), recall (R) and F1 value are used as performance indicators. Due to the small number of event pairs with inter-sentence causal relationships, only intra-sentence causal relationship recognition experiments are performed on CTB.

[0140] The 768-dimensional pre-trained RoBERTa model provided by HuggingFace transformers was used and the PyTorch framework with CUDA was run on NVIDIA GTX 3090 GPUs. The learning rate of the experiment was set to 1e-5, the batch_size was set to 16, and all trainable parameters were randomly initialized from a normal distribution. The number of demonstration samples was set to 4 in random order, of which 2 were positive samples and 2 were negative samples. Since the positive and negative demonstration samples were unbalanced in the training dataset, 10 3 positive training samples and 10 3 Negative training samples are used to calibrate the construction of the repository. The first 10 nearest neighbors are retrieved for bias calibration, and T is set to 3 and λ is set to 0.5.

[0141] Further, Tables 1 and 2 compare the overall performance of IncBC of the present invention and competitors on the ESC corpus and CTB corpus. Table 1 shows all intra-sentence, inter-sentence and overall results of competitors on the ESC dataset, and Table 2 shows the intra-sentence results of competitors on the ESC dataset and CTB dataset, and '-' indicates unpublished data.

[0142] Table 1 All intra-sentence, inter-sentence and overall results on the ESC dataset

[0143]

[0144]

[0145] Table 2 In-sentence results on the ESC dataset and the CTB dataset

[0146]

[0147] From Table 2, DPJL with derived cue learning significantly outperforms other competitors in intra-sentence causal relationship identification. The outstanding performance can be attributed to its applied cue learning paradigm, which transforms the ECI task into directly predicting PLM vocabulary instead of fine-tuning downstream task-specific neural models on PLM. While other competitors use some kind of additional knowledge from large-scale external knowledge bases, such as lexical knowledge and relational knowledge, the cue learning model can better utilize the encyclopedic language knowledge embedded in PLM during model training. However, DPJL uses a causal cue word for event causality identification, which does not exist in cross-sentence event pairs. Therefore, it cannot be applied to cross-sentence situations.

[0148] It can be observed from Table 1 that on the ESC dataset, RichGCN, GESI, and ERGO significantly outperform ILP in F1 scores for all intra-sentence, cross-sentence, and overall event causal relationship recognition. This may be attributed to the use of some graph-based neural networks, which operate on document-level graph structures with large-scale trainable parameters to enhance event representation learning. In fact, graph-based neural networks have been shown to be effective for many NLP tasks. In addition, on the ESC and CTB datasets, the improvement in intra-sentence causal relationship recognition is more significant than that in inter-sentence causal relationship recognition. This may be due to the use of a pre-trained language model for event node encoding, which can capture the semantic interaction between two events in a sentence.

[0149] Finally, on the ESC and CTB datasets, IncBC of the present invention achieves higher F1 scores than all competitors in all intra-sentence, inter-sentence, and overall event causal relationship recognition, thus achieving significant performance improvement. Its outstanding performance is attributed to incorporating some demonstration samples into prompt learning and calibrating demonstration bias to achieve topic-oriented context learning. In this way, IncBC can not only better utilize some contextual information, but also mitigate the bias introduced by this information.

[0150] In order to verify the effectiveness of the present invention and its superiority over traditional prompt learning, the present invention conducted an ablation experiment to test the impact of different modules on the experimental results, which are:

[0151] (1) Prompt: Only prompts are given to the learning model, without contextual demonstration samples, so there is no bias calibration.

[0152] (2) In-context (Rand): Some randomly selected demonstration samples are added to the input prompt, but no bias calibration is performed.

[0153] (3) In-context (Topic): retrieved topic-oriented demonstration samples are added to the input prompts, but no bias calibration is performed.

[0154] (4) IncBC(Rand): Some randomly selected demonstration samples are added to the input prompts and bias calibration is used.

[0155] (5) IncBC(Topic): The complete IncBC model, including retrieved topic-oriented demonstration samples and bias calibration.

[0156] (6) IncBC(T): Performance results of the complete IncBC model under different temperature coefficient T values ​​on the ESC dataset.

[0157] (7) IncBC(lam): Performance results of the complete IncBC model on the ESC dataset under different λ values.

[0158] Table 3 Causal relationship identification performance

[0159]

[0160] Table 4 Performance results of IncBC model under different temperature coefficient T values ​​and different λ values

[0161]

[0162]

[0163] Table 3 shows the causal relationship recognition performance of schemes (1)-(5). The following shows the results of ablation experiments from three aspects: context learning, bias calibration, and effectiveness of demonstration samples.

[0164] Contextual learning: The first observation is that the performance of the Prompt model is not as good as In-context(Topic) and In-context(Rand). This shows the effectiveness of contextual learning for demonstration samples that are rich in contextual analogies, even if these demonstration samples are randomly selected. In addition, it is observed that In-context(Rand) is not as good as In-context(Topic), which retrieves topic-oriented demonstration samples rather than randomly selected. This verifies one of the design goals of the present invention, which is to enhance the encoding ability of PLM through positive and negative demonstration samples. Positive samples can help PLM understand the causal relationship of other event types in different topic documents; negative samples can help PLM distinguish similar but non-causal events in the same topic documents.

[0165] Bias Calibration: The second observation is that IncBC(Rand) and IncBC(Topic) with bias calibration can further improve the performance of In-context(Rand) and In-context(Topic). This shows that the present invention can effectively mitigate the impact of demonstration sample bias. Similarly, it can be observed that IncBC(Rand) is inferior to IncBC(Topic), which further verifies the design goal of the present invention on topic-oriented demonstration sample retrieval to enhance contextual learning.

[0166] Effectiveness of Demonstration Samples: To further explore the effect of demonstration samples on contextual learning, the performance using different numbers of retrieved demonstration samples is compared. Figure 4 The experimental results are shown, where the X-axis represents the number of demonstration samples, the Y-axis represents the performance index (F1 score), "Positive / Negative" represents the positive / negative sample ratio, "Predictionnumber" represents the number of event pairs predicted to have a causal relationship, "False Positive" represents the number of event pairs incorrectly predicted to have a causal relationship, "True Positive" represents the number of event pairs correctly predicted to have a causal relationship, "False Negative" represents the number of event pairs incorrectly predicted to have no causal relationship, "True Negative" represents the number of event pairs correctly predicted to have no causal relationship, "F1 score" represents (F1 score), and different curves represent different proportions of positive and negative sample combinations. It can be observed that the performance is best when the number of positive and negative samples is equal. This is not surprising. The contextual analogy of the IncBC model needs to strike a balance between causal and non-causal relationships to avoid bias towards a specific type, especially when there is no prior knowledge and it is uncertain which type is more favorable.

[0167] Furthermore, Table 4 shows the performance results of the complete IncBC model of schemes (6) and (7) under different temperature coefficient T values ​​and different λ values. The temperature coefficient can control the smoothness of the probability distribution. A higher temperature coefficient can reduce the overfitting of the model to the training data and improve the generalization ability; a lower temperature coefficient can improve the prediction accuracy of the model, but may increase the risk of overfitting. λ is a weight coefficient used to balance the importance of the context prediction distribution and the calibration score distribution. A suitable λ value can enable the model to have a certain generalization ability while ensuring the prediction accuracy.

[0168] In fact, the analysis also obtained Figure 4 . It can be observed that the IncBC model with only positive samples (the cases of 4 / 0 and 2 / 0 in the figure) predicts more causal relationships than other cases. This also verifies the idea of ​​contextual learning, that is, the contextual analogies provided by the demonstration samples can guide the performance of the model. In the case of only positive samples, the trained IncBC model may predict more causal relationships, however, it actually contains many false positives. The increase in false positives due to only positive samples is obviously not conducive to the event causal relationship identification task, because false positives will also affect the overall F1 performance. Similar results can also be observed in the IncBC model with only negative samples.

[0169] In the test dataset, 10 positive samples (each sample has a causal relationship) and 10 negative samples (each sample has no causal relationship) are randomly selected. Figure 5 The visualization results of the predicted probabilities (after softmax) of these 20 samples when using different ablation experimental models are shown. The IncBC model applies a reverse retrieval strategy to retrieve positive samples from documents with the same topic and negative samples from documents with different topics. , where Figure 5 In the figure, "Prompt" represents the basic prompt learning model, "In-context (Random)" represents the contextual learning model using randomly selected demonstration samples, "In-context (Topic-aware)" represents the contextual learning model using topic-aware demonstration samples, "IncBC (Random)" represents the bias calibration model using random demonstration samples, "IncBC (Topic-aware)" represents the bias calibration model using topic-aware demonstration samples, and "IncBC (Reverse)" represents the bias calibration model using the reverse topic retrieval strategy. Numbers 1-10 are positive samples, that is, they have causal relationships (blue circles), and numbers 11-20 are negative samples, that is, they do not have causal relationships (yellow circles). The closer the predicted probability is to 1.0, the more the model tends to judge that there is a causal relationship. The closer the predicted probability is to 0.0, the more the model tends to judge that there is no causal relationship. The distribution position of the samples on the horizontal axis can intuitively show the prediction effects of different models. Ideally, blue circles (positive samples) should be distributed on the right side (high probability area), and yellow circles (negative samples) should be distributed on the left side (low probability area).

[0170] Both the In-context (Topic-aware) model and the IncBC (Topic-aware) model of the present invention corrected many incorrect predictions of the Prompt model, including positive samples 1, 3, 7 and negative sample 12. This once again verifies the goal of adopting the contextual learning paradigm based on bias calibration in the present invention.

[0171] The second observation is that different demonstration sample retrieval strategies have a significant impact on the predictions of contextual learning. For example, the topic-aware retrieval strategy corrects the prediction of negative sample 12, while the random and reverse topic-aware strategies fail to correct it. In addition, random retrieval and reverse topic-aware retrieval incorrectly change the predictions of samples 9, 13, 18, etc., while topic-aware retrieval does not. This may be attributed to the topic-aware retrieval strategy of the present invention, which enhances the ability of the context model to identify causal relationships from documents of different topics and distinguish non-causal relationships in the same topic.

[0172] It can also be observed that the bias-calibrated context model can correct most of the wrong predictions, such as 9 positive samples in the random strategy and 18 negative samples in the reverse topic-aware retrieval. In addition, bias calibration also enhances the probability of correctly predicted samples, such as the probability of positive sample 7 is increased from 0.6+ to 0.7+. This shows the effectiveness of the bias calibration of the present invention.

[0173] In summary, the present invention first extracts query instances from a pre-collected text data set as event pairs to be predicted; then, based on cosine similarity, a topic similarity retrieval strategy is adopted to select several context samples from the training sample set to enhance the semantics of the query instance; then, a nearest neighbor deviation calibration strategy is introduced to calibrate the context deviation caused by the introduction of context samples. The present invention first fills in the designed template, and at the same time, special symbols are marked on the query instance and demonstration sample event mentions in the sentence; in the test phase, a nearest neighbor-based deviation calibration strategy is introduced, by retrieving the training samples that are the nearest neighbors to the test sample, the predicted distribution of these samples is merged with the current prediction result to reduce the deviation introduced by the demonstration sample; a reasonable discrimination scheme is designed, and the probability vector is finally judged to obtain the causal relationship recognition of the event pair. The present invention effectively improves the accuracy of causal relationship recognition through contextual prompt learning and deviation calibration, and provides an efficient solution for event causal relationship recognition without the need for answer space design.

[0174] Compared with the prior art, the above technical scheme conceived by the present invention can achieve better event causal relationship recognition effect: since the present invention is event causal recognition based on the prompt learning paradigm, it can make full use of the implicit knowledge in the pre-trained language model PLM, alleviating the pain point of lack of high-quality labeled data in the field of event causal recognition; at the same time, since the present invention designs a new prompt learning paradigm: a contextual learning model based on deviation calibration, by converting the causal relationship recognition problem into an analogy problem in the context, using contextual prompts and deviation calibration to judge the rationality of the hypothesis, thereby judging whether there is a causal relationship between events, eliminating the problem of constructing the answer space, and promoting the improvement of event causal relationship recognition effect.

[0175] The present invention provides an event causal relationship recognition system based on topic-aware context learning, which adopts the event causal relationship recognition method as described above, and includes:

[0176] A training set construction module is used to extract event pairs from a text data set to generate query instances to be identified, and select event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combine the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship;

[0177] A template processing module, used for performing template processing on the sentences in the training sample set, generating a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template;

[0178] The model training and deviation calibration module is used to input the templated training sample set into the pre-trained language model for training and deviation calibration, obtain a contextual learning model based on deviation calibration, and output the prediction result after deviation calibration;

[0179] The relationship identification module is used to determine the causal relationship between event pairs based on the prediction results after deviation calibration.

[0180] The event causal relationship identification device provided by the present invention is described below. The event causal relationship identification device described below and the event causal relationship identification method described above can be referenced to each other.

[0181] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the event causal relationship identification method, which includes: extracting event pairs from the text data set to generate query instances to be identified, and selecting event pairs with causal relationships as demonstration samples based on the topic similarity retrieval strategy, and combining the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether the event pairs have a causal relationship; performing template processing on the sentences in the training sample set to generate a template containing the query instance sentence and the demonstration sample sentence, and setting a placeholder for predicting the causal relationship in the template; inputting the templated training sample set into the pre-trained language model for training and deviation calibration, obtaining a context learning model based on deviation calibration, and outputting the prediction results after deviation calibration; determining the causal relationship between the event pairs according to the prediction results after deviation calibration.

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

[0183] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the event causal relationship identification method provided by the above-mentioned methods, which includes: extracting event pairs from a text data set to generate query instances to be identified, and selecting event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combining the query instances and demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship; template processing is performed on the sentences in the training sample set to generate a template containing query instance sentences and demonstration sample sentences, and a placeholder for predicting causal relationships is set in the template; the templated training sample set is input into a pre-trained language model for training and deviation calibration to obtain a context learning model based on deviation calibration, and output the prediction results after deviation calibration; according to the prediction results after deviation calibration, the causal relationship between event pairs is determined.

[0184] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the event causal relationship identification method provided by the above-mentioned methods, the method comprising: extracting event pairs from a text data set to generate query instances to be identified, and selecting event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combining the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship; template processing is performed on the sentences in the training sample set to generate a template containing query instance sentences and demonstration sample sentences, and a placeholder for predicting causal relationships is set in the template; the templated training sample set is input into a pre-trained language model for training and deviation calibration to obtain a context learning model based on deviation calibration, and output the prediction results after deviation calibration; and the causal relationship between event pairs is determined according to the prediction results after deviation calibration.

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

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

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

Claims

1. A method for event causal relationship recognition based on topic-aware context learning, characterized in that: The following steps are involved: S1, extracting event pairs from the text data set to generate query instances to be identified, and selecting event pairs with causal relationships as demonstration samples based on the topic similarity retrieval strategy, and combining the query instances with the demonstration samples to form a training sample set; The topic similarity retrieval strategy is used to determine whether a pair of events has a causal relationship; S2, performing template processing on the sentences in the training sample set to generate a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template; S3, inputting the templated training sample set into the pre-trained language model for training and deviation calibration, obtaining a contextual learning model based on deviation calibration, and outputting the prediction result after deviation calibration; S4. Determine the causal relationship between event pairs based on the prediction results after deviation calibration.

2. The event causal relationship identification method based on topic-aware context learning according to claim 1 is characterized in that: The topic similarity retrieval strategy includes: Set topic similarity threshold; The cosine similarity between all event pairs is calculated based on the word vector representation, and the topic similarity of the event pairs is determined based on the cosine similarity and the topic similarity threshold: If the cosine similarity is greater than the topic similarity threshold, the event pair is the same topic; If the cosine similarity is less than the topic similarity threshold, the event pair is of different topics.

3. The event causal relationship identification method based on topic-aware context learning according to claim 2 is characterized in that: The training sample set includes positive samples and negative samples, wherein: Positive samples are event pairs with causal relationships in documents of different topics; Negative samples are event pairs that have no causal relationship in documents of the same topic.

4. The event causal relationship identification method based on topic-aware context learning according to claim 1 is characterized in that: The template includes: Use the [CLS] tag as a sentence start marker and the [SEP] tag as a sentence end marker; Use the [SEP] tag to separate query instance sentences and demonstration sample sentences.

5. The event causal relationship identification method based on topic-aware context learning according to claim 1 is characterized in that: The process of training and bias calibration is as follows: Input each templated training sample into the pre-trained language model for semantic learning, obtain the hidden state vector of each training sample at the placeholder position and its label prediction probability, and build a calibration sample library; A set of samples closest to the query instance to be identified is retrieved from the calibration sample library, and a prediction result after deviation calibration is obtained based on a nearest neighbor deviation calibration strategy; wherein the nearest neighbor deviation calibration strategy is used to reduce the deviation between demonstration samples.

6. The event causal relationship identification method based on topic-aware context learning according to claim 5 is characterized in that: The nearest neighbor deviation calibration strategy includes: Calculate the Euclidean distance between the sample to be predicted and the sample in the calibration sample library in the hidden state vector space; Select K samples with the smallest Euclidean distance as the nearest neighbor sample set; Calculate the weight coefficient of each neighbor sample according to the Euclidean distance; The predicted distribution of neighboring samples is weighted and fused with the current prediction result according to the weight coefficient to obtain the prediction result after deviation calibration.

7. The event causal relationship identification method based on topic-aware context learning according to claim 1 is characterized in that: Step S4 specifically includes: Obtain the probability value of the existence of causal relationship in the prediction results after bias correction; Compare the probability value with the preset decision threshold: When the probability value is greater than the determination threshold, it is determined that there is a causal relationship between the event pair; When the probability value is less than or equal to the determination threshold, it is determined that there is no causal relationship between the event pair.

8. An event causal relationship recognition system based on topic-aware contextual learning, characterized in that: The event causal relationship identification method according to any one of claims 1 to 7 is adopted, comprising: A training set construction module is used to extract event pairs from a text data set to generate query instances to be identified, and select event pairs with causal relationships as demonstration samples based on a topic similarity retrieval strategy, and combine the query instances with the demonstration samples to form a training sample set; the topic similarity retrieval strategy is used to determine whether event pairs have a causal relationship; A template processing module, used for performing template processing on the sentences in the training sample set, generating a template including a query instance sentence and a demonstration sample sentence, and setting a placeholder for predicting causal relationship in the template; The model training and deviation calibration module is used to input the templated training sample set into the pre-trained language model for training and deviation calibration, obtain a contextual learning model based on deviation calibration, and output the prediction result after deviation calibration; The relationship identification module is used to determine the causal relationship between event pairs based on the prediction results after deviation calibration.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the event causal relationship identification method as described in any one of claims 1-7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the event causal relationship identification method as described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Depolarization model attribution evaluation method and device based on random ablation

    CN120259806A