Event causal relationship identification device and method based on large language model guided graph construction

Through the graph construction method based on large language model, the event relationship graph is screened and simplified, and the causal relationship recognition is used to identify the self-attention mechanism and focus loss function, the accuracy and timeliness of causal relationship recognition in the existing technology are solved, and higher recognition accuracy and processing efficiency are achieved.

CN119783804APending Publication Date: 2025-04-0810TH RES INST OF CETC
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411732275.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

When identifying the causal relationship of events in documents, the prior art faces the problems of insufficient global reasoning capabilities of the model, lack of comprehensive knowledge, and excessive false correlation of causality, resulting in a decrease in recognition accuracy.

Method used

The graph construction method based on the large language model is adopted, and the event graph module is selected through the large language model to filter related events. The event graph simplified module reduces noise transmission. The event graph node representation and relationship prediction module use the self-attention mechanism and focus loss function for causal recognition.

Benefits of technology

It improves the comprehensiveness, accuracy and timeliness of causal event judgment, effectively alleviates the false problems in causal relationship identification, and improves the accuracy of causal relationship identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783804A_ABST
    Figure CN119783804A_ABST
Patent Text Reader

Abstract

The present invention discloses an event causal relationship identification device and method based on a large language model guided graph construction, belonging to the field of natural language processing, including: a large language model event graph selection module, an event relationship graph simplification module and an event relationship graph node representation module; a large language model event graph selection module, used to use the implicit knowledge contained in the large language model to filter out other events related to the target event from the event sentence set and construct an event candidate set; an event relationship graph simplification module, used to simplify the event relationship graph and reduce the noise transmission of irrelevant events in the graph; an event relationship graph node representation and relationship prediction module, used to calculate the influence of any node on other nodes in the graph network through a self-attention mechanism. The present invention improves the comprehensiveness, accuracy and timeliness of causal event judgment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and more specifically, to an event causal relationship recognition device and method based on a large language model guided graph. Background Art

[0002] Event causal relationship recognition refers to determining whether one event in a document directly or indirectly causes another event to occur. For example, in the sentence "Jury showed horrific moment innocent mother is shot dead shielding her child when she's caught up in gang attack as she picks up daughter from school", the shielding event triggered the attack event, so there is a clear causal relationship between the two events. By identifying the causal relationship between events in a document, the event context of the entire document can be clarified, which is of great significance for understanding the overall content of the document and predicting the development of subsequent events. Event causal relationship recognition tasks have a wide range of applications in natural language processing, and are often used in many fields such as information retrieval question answering, event graph construction, and event action prediction.

[0003] Existing deep learning models and methods mainly focus on sentence-level event causal relationship recognition, that is, only judging the causal relationship of events in the same sentence. However, in real life, many events that need to be judged are often distributed in different parts of the document. Long documents may contain dozens or even hundreds of events, and the distribution of these events is extremely uneven, which brings greater challenges to the judgment of event causal relationships. Not only that, although many events in a document are related to each other, not all related events are causally related. When identifying the causal relationship between events, a large number of negative samples may be introduced. This problem of imbalance between positive and negative samples can easily cause the model to identify false causal correlations, thereby reducing the accuracy of event causal recognition.

[0004] In order to explore the potential causal relationship of events in documents, some scholars have proposed a document-level event causal detection framework ILP and LR+, which uses the integer linear programming (ILP) model to combine the main events in the document with fine-grained causal structures (such as syntactic structure, discourse relations, and event co-reference relations) to achieve global reasoning. The framework proposed by the researchers, RichGCN, introduces discourse, syntax, and semantic information to construct a document interaction graph, and uses a graph convolutional network (GCN) to capture relevant connections, thereby enhancing the model's robustness to irrelevant or noisy edges. A document-level framework ERGO that transforms event causal detection into a node classification problem captures potential causal chains by constructing an event relationship graph and using a relationship graph converter.

[0005] Obviously, although existing research results have achieved a certain degree of global reasoning, this reasoning is based on the global reasoning of the entire document. For the causal judgment of any two events, this unconstrained global reasoning often introduces noise from irrelevant events. In addition, event causal reasoning should not only rely on explicit knowledge in the document, but also combine comprehensive knowledge outside the document to help the model mine more accurate causal reasoning chains. Summary of the invention

[0006] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an event causal relationship identification device and method based on a large language model guided graph, which improves the comprehensiveness, accuracy and timeliness of causal event judgment.

[0007] The object of the present invention is achieved through the following solutions:

[0008] An event causal relationship recognition device based on a large language model guided graph construction includes: a large language model event graph selection module, an event relationship graph simplification module and an event relationship graph node representation module;

[0009] The large language model selection event graph module is used to use the implicit knowledge contained in the large language model to filter out other events related to the target event from the event sentence set and construct an event candidate set;

[0010] The event relationship graph simplification module is used to reduce the noise transmission of irrelevant events in the graph by simplifying the event relationship graph;

[0011] The event relationship graph node representation and relationship prediction module is used to calculate the influence of any node in the graph network on other nodes through a self-attention mechanism.

[0012] Furthermore, in the large language model selection event graph module, the screening process of the large language model considers the correlation between the event and the target event and the transitivity of the causal relationship.

[0013] Furthermore, in the event relationship graph simplification module, event pair nodes are connected by constructing edges that only contain co-referencing events.

[0014] Furthermore, in the event relationship graph node representation and relationship prediction module, during the training process, a binary classification loss function with focal loss is used to alleviate the false problem in causal relationship identification.

[0015] A method for identifying event causal relationships based on a large language model guided graph includes the following steps:

[0016] S1, for the chapter-level document data, through the event extraction module, complete the extraction of event sentences that meet the event characteristics in the document data as an event sentence set;

[0017] S2, select two event sentences from the event sentence set to form an event sentence pair with a causal relationship to be determined, and input them into the big model together with other events in the event sentence set. Through the comprehensive knowledge and reasoning ability implicit in the big model, it is found that the event sentence pairs that are relevant to the event sentence pair with a causal relationship to be determined are connected in pairs to form a fully connected event relationship graph, and the nodes in the graph are event sentence pairs;

[0018] S3, simplifying the full connection event relationship graph according to the set rules to form a simplified connection event relationship graph;

[0019] S4, through the global reasoning ability of graph neural network, the nodes in the simplified connected event relationship graph are semantically represented to obtain the semantic vector representation of the nodes; the semantic vectors of the nodes are processed by the event causal relationship classifier to determine the causal relationship of the event sentence pairs to be determined.

[0020] Furthermore, in step S2, the event sentence pairs that are relevant to the event sentence pairs whose causal relationship is to be determined are found to be connected in pairs through the comprehensive knowledge and reasoning ability implied by the large model to form a fully connected event relationship graph, which specifically includes the following sub-steps:

[0021] S21, in the document, when it is necessary to identify the event e t and event n When there is a potential causal relationship, other events in the document will constitute the background event set E0 = {e1, e2, ..., e m}, some events in set E0 and e t or e n Co-referencing events refer to two events that describe the same content and are scattered in different paragraphs of the document;

[0022] S22, for the event sentence pair to be judged in the document (e t , e n), input the event sentence pair and the background event set into the large language model, and generate t 、e n The most relevant top k sentences are sorted; finally, all the events in the top k sentences are filtered out and e t 、e n Combined into a set of related event sentences E1 = {e t , e n ,…,e m}; For the set of related event sentences, construct a fully connected event relationship graph G = {V, E}; where V is the set of nodes of the fully connected event relationship graph, E is the set of edges of the fully connected event relationship graph, and the nodes are the event pairs in the set of related event sentences.

[0023] Further, in step S3, the setting rule is specifically: "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed", according to the setting rule "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed", the fully connected event relationship graph is simplified to form a simplified connected event relationship graph, which specifically includes the following sub-steps:

[0024] Encode the document. During the encoding process, add a special tag [CLS] at the beginning of the document to obtain the document features: in, is x k The encoding embedding of event pairs (e t ,e n ) is located in the document The encoding embedding of the event to the node is expressed as: concat represents feature connection, node representation plus edge constraints, and the event relationship graph is simplified and constructed.

[0025] Further, in step S4, the global reasoning ability of the graph neural network is used to semantically represent the nodes in the simplified connected event relationship graph to obtain a semantic vector representation of the node; the semantic vector of the node is processed by the event causal relationship classifier to determine the causal relationship of the event sentence pair to be determined, which specifically includes the following sub-steps:

[0026] The global semantic features of events on nodes are deeply mined through the graph neural network method. The input of each layer of the graph network is the node encoding embedding of the previous layer. In the l-layer graph network, the input received is in The labels above indicate the number of layers in the graph network, and the labels below indicate the specific event pair information in the graph network, that is, i indicates an event pair (e t ,e n ), take j to represent the event pair (e t,e1), both have a coreference event e t , in the graph network, will participate in the discussion about e t information transmission;

[0027] The reasoning information transmission part adopts the node-shared self-attention mechanism. The specific process is: using the attention mechanism between nodes to transfer a single node υ j The information is transmitted to υ i :

[0028]

[0029] Among them, W q With W k It's about i and j The weight matrix of is the scaling factor in the attention mechanism, and then ij After normalization, we get:

[0030]

[0031] Among them, N i represents the set of one-hop nodes connected to event pair node i, α ij It represents the causal reasoning information that the event transmits to node i. Finally, after weighted averaging the causal reasoning information of all one-hop nodes, we can obtain the l-layer graph network The output result of the weighted average formula is as follows:

[0032]

[0033] W v is a parameter weight matrix. When the graph network representation of the event pair i that needs to be discriminated in the last layer is obtained, an adaptive focal loss function is used, which is:

[0034] p i =softmax([concat(v i ,h [CLS] )]W p );

[0035]

[0036] Among them, h [CLS] represents the context learned when encoding document D, W p is a parameter weight matrix, the calculated p i As the causal prediction probability of event i; in the calculation process of loss value L, (1-p i ) γIt is used to adjust the model's attention to difficult samples. λ is used as a balancing factor to adjust the ratio of positive and negative samples to complete the causal relationship prediction of event pair i.

[0037] Furthermore, the large language model includes the LLAMA2 large language model.

[0038] A computer device comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded by the processor, the method described in any one of the above items is executed.

[0039] The beneficial effects of the present invention include:

[0040] (1) The method of the present invention fully utilizes the semantic understanding ability of the large language model and the implicit massive comprehensive knowledge for the input chapter-level document, and can quickly and accurately screen out events that are related to the identified event or have potential causal relationships. Compared with existing event processing methods, the method of the present invention significantly improves the comprehensiveness, accuracy and timeliness of the screening of causal event candidate sets.

[0041] (2) The method of the present invention uses a graph neural network to characterize the semantic features of event graph network nodes. Through the global learning and reasoning capabilities of the graph network, it helps the model extract the global features for distinguishing events, effectively improving the accuracy of distinguishing causal relationships between events. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 1 This is a flow chart of a method for identifying event causal relationships based on a large language model guided graph according to an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a method for selecting an event graph for a large language model according to an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of a method for simplifying an event relationship graph according to an embodiment of the present invention;

[0046] Figure 4 Schematic diagram of an event relationship graph node representation and relationship prediction method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0047] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.

[0048] In view of the current situation in the background, the inventors of this application believe that:

[0049] Large Language Model (LLM) is a natural language processing (NLP) model based on deep learning that can understand and generate natural language. These models usually consist of billions or even hundreds of billions of parameters. By training on large-scale text data, they learn complex features such as language syntax, semantics, and contextual relationships. Large language models can understand complex semantic relationships in context and generate high-quality, coherent text based on input.

[0050] Graph Neural Network (GNN) is a type of deep learning model that specializes in processing graph structured data. Graph structured data consists of nodes and edges. During the training process of the graph network, the model can capture the complex relationships between nodes and pass the node information to other nodes through the edge mechanism. This message passing mechanism makes the representation of the node not only rely on its own information, but also integrates the information of neighboring nodes and their relationships. The characteristics of the graph network enable it to effectively learn and reason on non-Euclidean structured data.

[0051] In view of the problems of insufficient model global reasoning ability, lack of comprehensive knowledge, and excessive false causal correlation in existing event causal relationship extraction methods, the present invention discloses an event causal relationship identification scheme based on a large language model guided graph construction, which comprehensively utilizes the implicit knowledge and reasoning ability of the large language model and graph neural network to mine and discover the potential causal relationship between any two events in the document. The event causal relationship prediction task of the present invention involves global reasoning. By learning nodes and edges of event information in the document through the graph network, the representation of events can be continuously enriched, thereby helping the model to more accurately capture the characteristics of the event and mine a richer causal relationship transmission chain.

[0052] In a further embodiment, the present invention provides an event causal relationship identification device constructed based on a large language model guided graph, comprising a large language model selection event graph module, an event relationship graph simplification module and an event relationship graph node representation module;

[0053] The large language model selection event graph module is used to use the implicit knowledge contained in the large language model to filter out other events related to the target event from the event sentence set and construct an event candidate set. It should be noted that the selection process of the large language model not only considers the relevance between the event and the target event, but also focuses on the transitivity of the causal relationship, thereby helping to improve the recognition accuracy of the causal relationship.

[0054] The event relationship graph simplification module is used to simplify the event relationship graph to reduce the noise transmission of irrelevant events in the graph. The event pair nodes are connected by constructing edges containing only co-referencing events, thereby ensuring the accuracy of information transmission and improving the accuracy and timeliness of causal reasoning.

[0055] The event relationship graph node representation and relationship prediction module is used to calculate the influence of any node on other nodes in the graph network through the self-attention mechanism. During the training process, the model uses a binary classification loss function with focal loss to further alleviate the false problem in causal relationship identification.

[0056] In a further embodiment, Figure 1 As shown, the present invention provides an event causal relationship identification method based on a large language model guided graph, which specifically performs the following steps: for chapter-level document data, through the event extraction module, complete the extraction of event sentences that meet the event characteristics in the document data as an event sentence set; select two event sentences from the event sentence set to form an event sentence pair whose causal relationship is to be determined, and input them into the LLAMA2 large model together with other events in the event sentence set, and through the comprehensive knowledge and reasoning ability implicit in the large model, find that the event sentence pairs that are relevant to the event sentence pairs whose causal relationship is to be determined are connected in pairs to form a fully connected event relationship graph, and the nodes in the graph are event sentence pairs; according to the rule "if there are common event sentences in the nodes in the graph, the edge connection is retained, otherwise the edge connection is removed", the fully connected event relationship graph is simplified to form a simplified connected event relationship graph; through the global reasoning ability of the graph neural network, the nodes in the simplified connected event relationship graph are semantically represented to obtain the semantic vector representation of the nodes; the semantic vectors of the nodes are processed by the event causal relationship classifier to determine the causal relationship of the event sentence pairs whose causal relationship is to be determined.

[0057] like Figure 2 As shown, in the embodiment of the present invention, selecting an event graph for a large language model specifically includes: in a document, when an event e needs to be identified t and event n When there is a potential causal relationship, other events in the document will constitute the background event set E0 = {e1, e2, ..., e m}, some events in set E0 and e t or e nCo-referencing events refer to two events that describe the same content and are scattered in different paragraphs of the document. t , e n ), the above event sentence pairs and background event sets are input into the large language model LLAMA2, and the e t 、e n The most relevant Top k sentences. Finally, all the events in the filtered Top k sentences are related to e t 、e n Combined into a set of related event sentences E1 = {e t , e n ,…,e m For the above set of related event sentences, a fully connected event relationship graph G = {V, E} is constructed. Where V is the node set of the fully connected event relationship graph, and the node (for example, e 1,2 ) is not a single event, but an event pair in a set of related event sentences (e.g., (e1, e2)). E is the set of edges in the fully connected event relationship graph.

[0058] like Figure 3 As shown, in the embodiment of the present invention, simplifying the event relationship diagram specifically includes: using the LongFormer model to encode the document. During the encoding process, a special tag [CLS] is added to the beginning of the document, so the document features can be obtained: in, is x k The encoding embedding of the event pair (e t ,e n ) is located in the document The encoding embedding of the event to the node is expressed as: Among them, concat represents feature connection. The node representation plus the edge constraint completes the construction of the simplified event relationship graph. The preliminary representation learning of the nodes in the simplified event relationship graph has been completed, and the preliminary causal reasoning chain is constructed through the relevance of event sentences to nodes.

[0059] like Figure 4 As shown, in the embodiment of the present invention, the event relationship graph node representation and relationship prediction specifically include: deeply mining the global semantic features of event pairs of nodes through the graph neural network method, and the input of each layer of the graph network is the node encoding embedding of the previous layer. In the l-layer graph network, the received input is in The labels above indicate the number of layers in the graph network, and the labels below indicate the specific event pair information in the graph network, that is, i indicates an event pair (e t ,e n ), take j to represent the event pair (e t,e1), both have a coreference event e t , in the graph network, will participate in the discussion about e t The reasoning information transmission part adopts the node-shared self-attention mechanism. The specific process is: using the attention mechanism between nodes to transfer a single node j The information is transmitted to υ i :

[0060]

[0061] Where W q With W k It's about i and j The weight matrix of is the scaling factor in the attention mechanism. ij After normalization, we get:

[0062]

[0063] Where N i Represents the set of one-hop nodes connected to event node i. ij It represents the causal reasoning information that the event transmits to node i. Finally, after weighted averaging the causal reasoning information of all one-hop nodes, we can obtain the l-layer graph network The output result of the weighted average formula is as follows:

[0064]

[0065] W v is a parameter weight matrix. When the event pair i (i.e., event pair (e) that needs to be judged in the last layer is obtained, t ,e n )) is used to represent the graph network, in order to alleviate the false positive problem of the prediction results (i.e., the number of negative samples is much larger than the number of positive samples), an adaptive focal loss function is used, specifically:

[0066] p i =softmax([concat(v i ,h [CLS] )]W p )

[0067]

[0068] where h [CLS] represents the context learned when encoding document D, W p is a parameter weight matrix, the calculated p iAs the causal prediction probability of event i. In the calculation process of loss value L, (1-p i ) γ It is used to adjust the model's attention to difficult samples. λ can be used as a balancing factor to adjust the ratio of positive and negative samples. Based on the above process, the event pair i (i.e., the event pair (e t ,e n ))’s causal relationship prediction.

[0069] It should be noted that within the scope of protection defined in the claims of the present invention, the following embodiments can be combined and / or expanded or replaced in any logical way from the above specific implementation methods, such as disclosed technical principles, disclosed technical features or implicitly disclosed technical features.

[0070] Example 1

[0071] An event causal relationship recognition device based on a large language model guided graph construction includes: a large language model event graph selection module, an event relationship graph simplification module and an event relationship graph node representation module;

[0072] The large language model selection event graph module is used to use the implicit knowledge contained in the large language model to filter out other events related to the target event from the event sentence set and construct an event candidate set;

[0073] The event relationship graph simplification module is used to reduce the noise transmission of irrelevant events in the graph by simplifying the event relationship graph;

[0074] The event relationship graph node representation and relationship prediction module is used to calculate the influence of any node in the graph network on other nodes through a self-attention mechanism.

[0075] Example 2

[0076] On the basis of Example 1, in the large language model selection event graph module, the screening process of the large language model takes into account the correlation between the event and the target event and the transitivity of the causal relationship.

[0077] Example 3

[0078] On the basis of Example 1, in the event relationship graph simplification module, event pair nodes are connected by constructing edges that only contain co-referencing events.

[0079] Example 4

[0080] On the basis of Example 1, in the event relationship graph node representation and relationship prediction module, during the training process, a binary classification loss function with focal loss is used to alleviate the false problem in causal relationship identification.

[0081] Example 5

[0082] A method for identifying event causal relationships based on a large language model guided graph includes the following steps:

[0083] S1, for the chapter-level document data, through the event extraction module, complete the extraction of event sentences that meet the event characteristics in the document data as an event sentence set;

[0084] S2, select two event sentences from the event sentence set to form an event sentence pair with a causal relationship to be determined, and input them into the big model together with other events in the event sentence set. Through the comprehensive knowledge and reasoning ability implicit in the big model, it is found that the event sentence pairs that are relevant to the event sentence pair with a causal relationship to be determined are connected in pairs to form a fully connected event relationship graph, and the nodes in the graph are event sentence pairs;

[0085] S3, simplifying the full connection event relationship graph according to the set rules to form a simplified connection event relationship graph;

[0086] S4, through the global reasoning ability of graph neural network, the nodes in the simplified connected event relationship graph are semantically represented to obtain the semantic vector representation of the nodes; the semantic vectors of the nodes are processed by the event causal relationship classifier to determine the causal relationship of the event sentence pairs to be determined.

[0087] Example 6

[0088] On the basis of Example 5, in step S2, the comprehensive knowledge and reasoning ability implicit in the large model are used to find that event sentence pairs that are relevant to the event sentence pairs whose causal relationship is to be determined are connected in pairs to form a fully connected event relationship graph, which specifically includes the following sub-steps:

[0089] S21, in the document, when it is necessary to identify the event e t and event n When there is a potential causal relationship, other events in the document will constitute the background event set E0 = {e1, e2, ..., e m}, some events in set E0 and e t or e n Co-referencing events refer to two events that describe the same content and are scattered in different paragraphs of the document;

[0090] S22, for the event sentence pair to be judged in the document (e t , e n ), input the event sentence pair and the background event set into the large language model, and generate t 、e n The most relevant top k sentences are sorted; finally, all the events in the top k sentences are filtered out and e t、e n Combined into a set of related event sentences E1 = {e t , e n ,…,e m}; For the set of related event sentences, construct a fully connected event relationship graph G = {V, E}; where V is the set of nodes of the fully connected event relationship graph, E is the set of edges of the fully connected event relationship graph, and the nodes are the event pairs in the set of related event sentences.

[0091] Example 7

[0092] On the basis of Example 5, in step S3, the setting rule is specifically: "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed". According to the setting rule "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed", the fully connected event relationship graph is simplified to form a simplified connected event relationship graph, which specifically includes the following sub-steps:

[0093] Encode the document. During the encoding process, add a special tag [CLS] at the beginning of the document to obtain the document features: in, is x k The encoding embedding of event pairs (e t ,e n ) is located in the document The encoding embedding of the event to the node is expressed as: concat represents feature connection, node representation plus edge constraints, and the event relationship graph is simplified and constructed.

[0094] Example 8

[0095] On the basis of Example 5, in step S4, the global reasoning ability of the graph neural network is used to semantically represent the nodes in the simplified connected event relationship graph to obtain a semantic vector representation of the node; the semantic vector of the node is processed by the event causal relationship classifier to determine the causal relationship of the event sentence pair to be determined, which specifically includes the following sub-steps:

[0096] The global semantic features of events on nodes are deeply mined through the graph neural network method. The input of each layer of the graph network is the node encoding embedding of the previous layer. In the l-layer graph network, the input received is in The labels above indicate the number of layers in the graph network, and the labels below indicate the specific event pair information in the graph network, that is, i indicates an event pair (e t ,e n ), take j to represent the event pair (e t ,e1), both have a coreference event e t , in the graph network, will participate in the discussion about et information transmission;

[0097] The reasoning information transmission part adopts the node-shared self-attention mechanism. The specific process is: using the attention mechanism between nodes to transfer a single node υ j The information is transmitted to υ i :

[0098]

[0099] Among them, W q With W k It's about i and j The weight matrix of is the scaling factor in the attention mechanism, and then ij After normalization, we get:

[0100]

[0101] Among them, N i represents the set of one-hop nodes connected to event pair node i, α ij It represents the causal reasoning information that the event transmits to node i. Finally, after weighted averaging the causal reasoning information of all one-hop nodes, we can obtain the l-layer graph network The output result of the weighted average formula is as follows:

[0102]

[0103] W v is a parameter weight matrix. When the graph network representation of the event pair i that needs to be discriminated in the last layer is obtained, an adaptive focal loss function is used, which is:

[0104] p i =softmax([concat(v i ,h [CLS] )]W p );

[0105]

[0106] Among them, h [CLS] represents the context learned when encoding document D, W p is a parameter weight matrix, the calculated p i As the causal prediction probability of event i; in the calculation process of loss value L, (1-p i ) γ It is used to adjust the model's attention to difficult samples. λ is used as a balancing factor to adjust the ratio of positive and negative samples to complete the causal relationship prediction of event pair i.

[0107] Example 9

[0108] Based on Example 6, the large language model includes the LLAMA2 large language model.

[0109] Example 10

[0110] A computer device, a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded by the processor, the method described in any one of Examples 5 to 9 is executed.

[0111] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.

[0112] According to one aspect of an embodiment of the present invention, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the above various optional implementations.

[0113] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

Claims

1. An event causal relationship recognition device based on a large language model guided graph, characterized in that: include: The large language model selects the event graph module, the event relationship graph simplification module and the event relationship graph node representation module; The large language model selection event graph module is used to use the implicit knowledge contained in the large language model to filter out other events related to the target event from the event sentence set and construct an event candidate set; The event relationship graph simplification module is used to reduce the noise transmission of irrelevant events in the graph by simplifying the event relationship graph; The event relationship graph node representation and relationship prediction module is used to calculate the influence of any node in the graph network on other nodes through a self-attention mechanism.

2. The event causal relationship identification device based on the large language model guided graph construction according to claim 1 is characterized in that: In the large language model selection event graph module, the screening process of the large language model takes into account the correlation between the event and the target event and the transitivity of the causal relationship.

3. The event causal relationship identification device based on the large language model guided graph construction according to claim 1 is characterized in that: In the event relationship graph simplification module, event pair nodes are connected by constructing edges that only contain co-referencing events.

4. The event causal relationship identification device based on the large language model guided graph construction according to claim 1 is characterized in that: In the event relationship graph node representation and relationship prediction module, during the training process, a binary classification loss function with focal loss is used to alleviate the false problem in causal relationship identification.

5. A method for identifying event causal relationships based on a large language model guided graph, characterized in that: The steps include: S1, for the chapter-level document data, through the event extraction module, complete the extraction of event sentences that meet the event characteristics in the document data as an event sentence set; S2, select two event sentences from the event sentence set to form an event sentence pair with a causal relationship to be determined, and input them into the big model together with other events in the event sentence set. Through the comprehensive knowledge and reasoning ability implicit in the big model, it is found that the event sentence pairs that are relevant to the event sentence pair with a causal relationship to be determined are connected in pairs to form a fully connected event relationship graph, and the nodes in the graph are event sentence pairs; S3, simplifying the full connection event relationship graph according to the set rules to form a simplified connection event relationship graph; S4, through the global reasoning ability of graph neural network, the nodes in the simplified connected event relationship graph are semantically represented to obtain the semantic vector representation of the nodes; the semantic vectors of the nodes are processed by the event causal relationship classifier to determine the causal relationship of the event sentence pairs to be determined.

6. The event causal relationship identification method based on the large language model guided graph construction according to claim 5 is characterized in that: In step S2, through the comprehensive knowledge and reasoning ability implicit in the large model, event sentence pairs that are relevant to the event sentence pairs whose causal relationship is to be determined are found to be connected in pairs to form a fully connected event relationship graph, which specifically includes the following sub-steps: S21, in the document, when it is necessary to identify the event e t and event n When there is a potential causal relationship, other events in the document will constitute the background event set E0 = {e1, e2, ..., e m }, some events in set E0 and e t or e n Co-referencing events refer to two events that describe the same content and are scattered in different paragraphs of the document; S22, for the event sentence pair to be judged in the document (e t , e n ), input the event sentence pair and the background event set into the large language model, and generate t 、e n The most relevant top k sentences are sorted; finally, all the events in the top k sentences are filtered out and e t 、e n Combined into a set of related event sentences E1 = {e t , e n ,…,e m }; For the set of related event sentences, construct a fully connected event relationship graph G = {V, E}; where V is the set of nodes of the fully connected event relationship graph, E is the set of edges of the fully connected event relationship graph, and the nodes are the event pairs in the set of related event sentences.

7. The event causal relationship identification method based on large language model guided graph construction according to claim 5 is characterized in that: In step S3, the setting rule is specifically: "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed". According to the setting rule "If there is a common event sentence between nodes in the graph, the edge connection is retained, otherwise the edge connection is removed", the fully connected event relationship graph is simplified to form a simplified connected event relationship graph, which specifically includes the following sub-steps: Encode the document. During the encoding process, add a special tag [CLS] at the beginning of the document to obtain the document features: in, is x k The encoding embedding of event pairs (e t ,e n ) is located in the document The encoding embedding of the event to the node is expressed as: concat represents feature connection, node representation plus edge constraints, and the event relationship graph is simplified and constructed.

8. The event causal relationship identification method based on large language model guided graph construction according to claim 5 is characterized in that: In step S4, the global reasoning ability of the graph neural network is used to semantically represent the nodes in the simplified connected event relationship graph to obtain a semantic vector representation of the node; the semantic vector of the node is processed by the event causal relationship classifier to determine the causal relationship of the event sentence pair to be determined, which specifically includes the following sub-steps: The global semantic features of events on nodes are deeply mined through the graph neural network method. The input of each layer of the graph network is the node encoding embedding of the previous layer. In the l-layer graph network, the input received is in The labels above indicate the number of layers in the graph network, and the labels below indicate the specific event pair information in the graph network, that is, i indicates an event pair (e t ,e n ), take j to represent the event pair (e t ,e1), both have a coreference event e t , in the graph network, will participate in the discussion about e t information transmission; The reasoning information transmission part adopts the node-shared self-attention mechanism. The specific process is: using the attention mechanism between nodes to transfer a single node υ j The information is transmitted to υ i : Among them, W q With W k It's about i and j The weight matrix of is the scaling factor in the attention mechanism, and then ij After normalization, we get: Among them, N i represents the set of one-hop nodes connected to event pair node i, α ij It represents the causal reasoning information that the event transmits to node i. Finally, after weighted averaging the causal reasoning information of all one-hop nodes, we can obtain the l-layer graph network The output result of the weighted average formula is as follows: W v is a parameter weight matrix. When the graph network representation of the event pair i that needs to be discriminated in the last layer is obtained, an adaptive focal loss function is used, which is: p i =softmax([concat(v i ,h [CLS] )]W p ); Among them, h [CLS] represents the context learned when encoding document D, W p is a parameter weight matrix, the calculated p i As the causal prediction probability of event i; in the calculation process of loss value L, (1-p i ) γ It is used to adjust the model's attention to difficult samples. λ is used as a balancing factor to adjust the ratio of positive and negative samples to complete the causal relationship prediction of event pair i.

9. The event causal relationship identification method based on large language model guided graph construction according to claim 6 is characterized in that: The large language model includes the LLAMA2 large language model.

10. A computer device, characterized in that: A processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded by the processor, the method according to any one of claims 5 to 9 is executed.

Citation Information

Cited By

  • Enterprise knowledge base content retrieval method and device based on event graph, equipment and storage medium

    CN121071101A