Causal path generation method and device, equipment, medium and product
By generating a causal map and using cross attention and causal map neural networks, the causal paths are dynamically generated, and the adaptability problem of causal relationship analysis in the field of dynamic change is solved, and a more accurate and explainable causal relationship analysis is achieved.
Patent Information
- Application Number
- CN202510846482.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-06-24
Smart Images

Figure CN120354928A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of artificial intelligence, and particularly relates to a causal path generation method, device, equipment, medium and product. Background Technique
[0002] The statements in this part only provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] Currently, causal relationships are mainly described based on knowledge graphs to represent static associations between entities. However, in some special scenarios, such as tax scenarios and supply chain scenarios, with the introduction of new policies or market changes, both the nodes on the causal chain and the influence of the cause nodes on the result nodes may change. The method of using static associations cannot adapt to domain changes. Summary of the Invention
[0004] In view of this, the present invention provides a causal path generation method, device, equipment, medium and product.
[0005] To achieve the above object, the first aspect of the present invention provides a causal path generation method, including the following steps: Obtain domain text data, perform entity and relationship extraction, and generate a causal graph; Obtain real-time domain text data, based on the real-time domain text data and the causal graph, perform semantic alignment based on the cross-attention mechanism, and fuse the context information of each entity with the feature representation of the corresponding entity to update the feature representation of each entity; Construct a causal graph neural network based on the causal graph, calculate the association weights based on the attention mechanism according to the updated feature representations of each entity, and perform information transmission according to the association weights between entities to dynamically generate a causal path.
[0006] In some embodiments, after performing entity and relationship extraction on the domain text data, causal relationship verification is also performed on the relationships between entities through counterfactual reasoning, specifically including: pre-constructing a counterfactual reasoning rule library for storing counterfactual reasoning rules, and each counterfactual reasoning rule includes a baseline value of the change rate of another entity caused by the change rate of one entity; for every two associated entities, when other entities meet the given conditions, calculate the change rate of one entity when it changes by a set change rate, and if the change rate of the other entity significantly deviates from the baseline value, determine that there is a causal relationship between the two.
[0007] In some embodiments, semantic alignment based on the cross-attention mechanism includes: Obtain real-time domain text data and perform text segment segmentation on it, and extract the embedding vectors of each text segment; Based on the cross-attention mechanism, by calculating the similarity between the entities in the causal graph and the embedding vectors of each text segment, entities and text segments with similar semantics are aligned into the same semantic space.
[0008] In some embodiments, dynamically generating a causal path includes: Determining a candidate causal direction according to a causal mask, where the causal mask is used to represent the causal relationship and direction between entities in the causal graph; According to the updated feature representations of each entity, starting from the first entity, along the candidate causal path, based on the attention mechanism, calculate the association weights with other entities, and select the next associated entity according to the association weights to dynamically generate a causal path.
[0009] In some embodiments, after obtaining the causal path, the association weights in the causal path are further corrected based on domain text data for a period of time, specifically including: for each real-time domain text data, respectively based on the cross-attention mechanism, perform semantic alignment with the entities in the causal graph, extract the causal relationships existing therein, for the same causal relationship that appears multiple times, increase the association weights between the corresponding entities, and if a certain causal relationship in the causal graph is not extracted from the real-time domain text data, reduce the association weights between the corresponding entities.
[0010] In some embodiments, the method further includes: for the causal path, performing quantitative evaluation from one or more aspects of fidelity, robustness, and consistency with expert scores.
[0011] The second aspect of the present invention provides a causal path generation device, including: A causal graph generation module, configured to: obtain domain text data, perform entity and relationship extraction, and generate a causal graph; An entity semantic enhancement module, configured to: obtain real-time domain text data, based on the real-time domain text data and the causal graph, perform semantic alignment based on the cross-attention mechanism, and fuse the context information of each entity with the feature representation of the corresponding entity to update the feature representation of each entity; A causal path generation module, configured to: construct a causal graph neural network based on the causal graph, calculate association weights based on the attention mechanism according to the updated feature representations of each entity, perform information transmission according to the association weights between entities, and dynamically generate a causal path.
[0012] The third aspect of the present invention provides an electronic device, including a processor and a memory, and a computer instruction is stored on the memory. When the computer instruction is executed by the processor, the electronic device executes the method described above.
[0013] A fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method described above is implemented.
[0014] A fifth aspect of the present invention is a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0015] After creating the causal graph with one or more of the above technical solutions, the context information of each entity in the causal graph is further obtained based on real-time domain text data, the context information is embedded into the feature representation of each entity, and then information is transmitted through the graph neural network constructed by the causal graph. Based on the entities with embedded context information, the association weights between entities are updated, with strong dynamic adaptability, capable of more accurately reflecting the current causal relationship, having stronger interpretability, and being applicable to complex causal reasoning scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The specification drawings forming a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention.
[0017] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application; Figure 2 It is a flowchart of the causal path generation method provided by an embodiment of the present application; Figure 3 It is a flowchart of verifying the causal relationship provided by an embodiment of the present application; Figure 4 It is a flowchart of updating the entity feature representation based on real-time domain text provided by an embodiment of the present application; Figure 5 It is a flowchart of dynamically generating a causal path provided by an embodiment of the present application; Figure 6 It is a program module architecture diagram of the causal path generation device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] The embodiments of the present application will be described in more detail below with reference to the drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to more thoroughly and completely understand the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not used to limit the protection scope of the present application.
[0019] In the description of the embodiments of the present application, the term "including" and its similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "at least partially based on".
[0020] As described in the background art, the current causal relationships are mainly based on knowledge graphs to describe the static associations between entities, and cannot adapt to the dynamically changing domain data, resulting in the inability to adapt to causal reasoning in complex scenarios and insufficient interpretability. In addition, the underlying logic of the currently commonly used causal analysis methods is probability statistics driven by data. For example, causal inference based on Bayesian networks has a high computational complexity when dealing with large-scale data, and the relationships obtained cannot distinguish whether they only belong to correlation relationships or causal relationships. For example, "policy adjustment → corporate behavior".
[0021] Figure 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. Refer to Figure 1 , this implementation environment includes: a terminal 101 and a server 102. The terminal 101 and the server 102 are directly or indirectly connected through wired or wireless communication methods. Through the interaction between the terminal 101 and the server 102, various functions such as causal graph visualization and dynamic generation of causal paths can be realized.
[0022] In a possible implementation manner, a target application provided by the server 102 is installed on the terminal 101, and the terminal 101 can realize functions such as causal graph creation, causal graph visualization, and causal path query through the target application. Optionally, the target application is an application in the operating system of the terminal 101 or an application provided by a third party. For example, the target application is a causal path generation application. Optionally, the server 102 is the background server of the target application or a cloud server that provides services such as cloud computing and cloud storage.
[0023] In a possible implementation manner, the server 102 provides historical and real-time domain text data to the terminal 101. Based on user operations, the terminal 101 can create a causal graph based on the domain text data, and through counterfactual reasoning, determine the causal relationship between the entities and generate a causal graph; furthermore, the generated causal graph can be stored in the server 102 as domain prior knowledge. When needed, the terminal 101 retrieves the causal graph from the server 102 and dynamically generates a causal path in combination with real-time domain text data.
[0024] In a possible implementation, the terminal 101 can be various types of devices such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, etc. The server 102 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The embodiments of the present application do not limit this.
[0025] Figure 2 is a flowchart of a causal path generation method provided by an embodiment of the present application. Refer to Figure 2 , the method includes: S210: Obtain domain text data, perform entity and relationship extraction, and generate a causal graph.
[0026] The domain text data is text data in specific domains such as tax policy texts and supply chain node information for which causal relationships are to be constructed. After obtaining the domain text data, entity and relationship extraction are performed on it. Entities such as "tax rate" and "supplier", and relationships such as "adjustment" relationship and "dependency" relationship.
[0027] S220: Obtain real-time domain text data, based on the real-time domain text data and the causal graph, perform semantic alignment based on the cross-attention mechanism, and fuse the context information of each entity with the feature representation of the corresponding entity to update the feature representation of each entity.
[0028] Through the cross-attention mechanism, the embedding vectors of the entities in the structured causal graph and the real-time domain text data are aligned to the same semantic space, and then the entities in the causal graph are associated with the corresponding text fragments in the real-time domain text data. The feature representation of the entity is updated according to the context information of the text fragment corresponding to each entity (i.e., the context information of the entity), so that it contains richer semantic information, which is convenient for the real-time domain text data to guide the update of the entities and causal relationships in the causal graph, and the transmission of relationships.
[0029] S230: Construct a causal graph neural network based on the causal graph, calculate the association weights based on the attention mechanism according to the updated feature representations of each entity, and perform information transmission according to the association weights between entities to dynamically generate causal paths.
[0030] The Causal Graph Neural Network (Causal GNN) is obtained by modeling a causal graph through a Graph Neural Network (GNN) structure. It can utilize node features (such as the initial weights of "purchase price") and edge relationships (such as "causal masks") for information transmission. For example, node embeddings gradually derive multi-hop paths (such as "purchase price → subsidiary profit → tax declaration amount") by aggregating the causal masks and attention weights of neighboring nodes.
[0031] After creating the causal graph, the above method also obtains the context information of each entity in the causal graph based on real-time domain text data, embeds the context information into the feature representations of the entities, and then conducts information transmission through the graph neural network constructed by the causal graph. Based on the entities with embedded context information, the association weights between the entities are updated. It has strong dynamic adaptability, can more accurately reflect the current causal relationship, has stronger interpretability, and can be applied to complex causal reasoning scenarios.
[0032] In step S210, after extracting entities and relationships from the domain text data, based on the Bayesian network, for each node, the probability distribution of other associated nodes under the condition of this node is calculated, and the relationships between entities are preliminarily screened based on the probability distribution. The nodes of the Bayesian network represent random variables, which can be observable variables, latent variables, or unknown parameters. The directed edges represent the dependence relationships between variables, and the conditional probability table defines the probability distribution of each node under the condition of its parent nodes. For example, if node A affects node B, it is represented by an arrow A → B, and the greater the conditional probability P(B|A), the greater the influence relationship. By preliminarily screening the relationships between entities, noise filtering can be achieved, and the core causal associations can be retained.
[0033] It should be noted that the adjustment relationships or dependence relationships in the above relationships are not necessarily causal relationships. For example, in the tax compliance scenario, the co-occurrence of policy adjustments and enterprise behaviors may only be a temporal association, rather than a causal relationship; another example is that in the tax scenario, "tax rate adjustment" and "enterprise profit change" may only be correlated, rather than a causal relationship. Therefore, it is necessary to determine the causal relationships of the above relationships.
[0034] Exemplarily, in some embodiments, after performing entity and relationship extraction in step S210, it further includes: verifying the causal relationships between entities through counterfactual reasoning.
[0035] By using counterfactual reasoning to determine the causal relationships of the above relationships, a structured causal graph can be generated. The causal graph includes entities and the causal relationships between entities, where the causal relationships are represented by causal masks, and the causal masks M is a N × N binary matrix, and the element Mij∈{0,1} represents an entity i and j the causal relationship and direction thereof ( Mij =1 represents a causal relationship, Mij =0 represents a correlation).
[0036] As a possible implementation, the verification step can be implemented through steps S211 - S212, see Figure 3 , and the details are as follows: S211: Through counterfactual reasoning, verify the correctness of the causal relationship between entities, and generate a causal graph after verification. Among them, the causal relationship and direction between entities in the causal graph are represented by a causal mask.
[0037] Combine counterfactual reasoning to verify the causal direction. Counterfactual reasoning verifies the stability of the causal chain by simulating a counterfactual scenario of "how the result changes if the input conditions change". Specifically, when verifying the causal relationship between two entities, each entity is used as a variable. When other entities meet the given conditions, calculate the change rate of the other entity when one entity changes at a set change rate. If the change rate of the other entity significantly deviates from the baseline value, it is determined that there is a causal relationship between the two. When the verification ratio and accuracy rate reach the set requirements, the current data is considered reliable, and a causal graph is constructed accordingly. It can be understood that a counterfactual reasoning rule base is constructed in advance. For a specific domain, based on factual data, construct the change situation of one entity with respect to another entity, and based on the factual change situation, construct counterfactual reasoning rules. Each counterfactual reasoning rule includes the baseline value of the change rate of another entity caused by the change rate of one entity.
[0038] The counterfactual reasoning is implemented based on the Do-Calculus framework, and statistical tests (such as t-test, chi-square test, etc.) are used to calculate the p-value to judge whether the difference between the reasoning result and the actual result is significant. Verify the reliability based on the p-value (such as p < 0.01). For example: (1) Simulate the counterfactual scenario of "if the procurement price increases by 10%, whether the profit rate of the subsidiary decreases". If the actual profit rate decreases by 8% (p = 0.004 < 0.01), mark it as a causal relationship ( M procurement price, subsidiary profit = 1).
[0039] (2) Simulate the counterfactual scenario of "if the policy is not adjusted, what will the result be". For example, in the supply chain scenario, if the change rate of the supplier switching probability ≤ 4.2% when the tariff increases or decreases by ±5%, it is marked as a causal relationship.
[0040] (3) Simulate the impact of different procurement prices (such as ±5%) on the tax declaration amount of the subsidiary. If the change rate < 3%, it is marked as a causal relationship.
[0041] Causal mask M Used to represent the causal relationship and direction between entities in the causal graph. The causal mask M is a N × N binary matrix, and the element Mij ∈{0,1} represents the causal relationship and direction between entities i and j ( Mij =1 represents a causal relationship, Mij =0 represents a correlation). For example, the element M12=1 , indicates that there is a causal relationship between the first entity and the second entity, and the first entity is the cause and the second entity is the effect. Through the causal mask, the explicit annotation of the causal relationship and direction is realized.
[0042] Exemplarily, in the tax scenario, through counterfactual reasoning: if the change in the enterprise profit after the policy adjustment significantly deviates from the baseline value (p-value < 0.01), then the "policy" entity (the i-th entity) and the "enterprise profit" (the j-th entity) are marked as having a causal relationship Mij =1; if there is only a time association, it is marked as a correlation Mij =0.
[0043] By constructing a causal graph with the help of counterfactual reasoning, the computational complexity problem of statistical analysis is avoided. At the same time, the correlation relationship and the causal relationship are effectively distinguished, which serves as the basis for subsequent dynamic updates and ensures the correctness of the causal relationship and direction in the causal graph.
[0044] S212: According to the causal graph and the causal mask, based on the self-attention mechanism, obtain the attention weights between entities with causal relationships.
[0045] Exemplarily, based on the Transformer architecture, by using the self-attention mechanism (Self-Attention), calculate the attention weights between nodes and obtain the probability distribution between entities with causal relationships. The main steps are as follows: (1) Input embedding. Convert entity nodes such as "purchase price" and "subsidiary profit" into vectors through feature encoding; (2) Self-attention calculation. Generate three vectors for each node: a query vector, a key vector, and a value vector, which can be achieved by performing a linear transformation on the embedding vector. For example, to calculate the self-attention for the nodes "purchase price" and "subsidiary profit", three vectors are generated for each of these two nodes respectively; then calculate the attention scores between them; (3) Causal relationship probability distribution calculation. Use the Softmax function for normalization to normalize the scores of all node pairs into a probability distribution (i.e., attention weights).
[0046] Based on this, a causal graph for a specific domain can be obtained. This causal graph can be stored in a server. When there is a need for causal reasoning in this domain, the causal graph is retrieved and updated based on new real-time domain data, and then the causal path construction is performed based on the following steps.
[0047] It can be understood that the server periodically collects domain text data and periodically updates the causal graph. When a new policy is released or the supply chain structure is adjusted, new nodes may be generated, or the probability distribution between nodes may change. Therefore, the causal graph is also periodically updated. Specifically, incremental domain text data is regularly received, and the above steps are re-executed. Entity and relationship recognition are performed again based on the incremental data, and causal relationship verification is performed through counterfactual reasoning to regenerate the causal mask. Based on this, when there is a new policy or market fluctuation, the causal graph can be updated in a timely manner, invalid causal edges are removed or new nodes are added, and the constructed causal graph can be ensured to adapt to domain changes through a dynamic update mechanism, guaranteeing the accuracy of subsequent causal reasoning. For example, if the p-value of a certain causal relationship is greater than 0.05 in three consecutive verifications, this causal relationship is deleted.
[0048] Existing methods (such as RAG) rely on explicit path retrieval and are difficult to handle implicit causal chains (such as "tariff adjustment → supply chain resilience decline → financial risk"). For example, in a supply chain scenario, if the causal path is broken (such as the middle node is missing), the generated result may be incomplete or incorrect.
[0049] As a possible implementation, step S220 can be achieved through steps S221 - S223, which are elaborated as follows: S221: Obtain real-time domain text data, perform text segment splitting on it, and extract the embedding vectors of each text segment; it can be understood that pre-trained language models such as BERT and RoBERTa can be used to perform embedding vector extraction on the text segments. Among these text segments, in addition to the segments corresponding to each entity in the causal graph, they also include the context information of these segments. For example, for the sentence "Central bank interest rate hike occurs during an economic downturn", the embedding vectors of "central bank interest rate hike" and "economic downturn" are extracted.
[0050] S222: Based on the cross-attention mechanism, by calculating the similarity between the embeddings of entities in the causal graph and each text segment, establish the corresponding relationship between entities and text segments based on the similarity, align entities and text segments with similar semantics into the same semantic space, and establish an association between entities in the causal graph (such as "interest rate increase") and text segments in real-time domain text data (such as "the central bank's interest rate hike leads to an increase in corporate financing costs") to guide the generation of subsequent causal paths. For example, align the embedding vectors of the entity "interest rate increase" in the causal graph with the text segment "the central bank's interest rate hike", indicating that both point to the same event; another example is to align the embedding vectors of "increase in debt cost" in the causal graph with the text segment "increase in financing cost".
[0051] S223: For each pair of associated entities and text segments, fuse the embedding vector of the context information of the text segment with the initial embedding vector of the entity to update the embedding vector of the corresponding node of the entity. Exemplarily, the embedding vector of the context information can be fused with the initial embedding vector of the entity using weighted average or concatenation. Taking the sentence "the central bank's interest rate hike occurs in an economic downturn" as an example, align the entity "interest rate increase" in the knowledge graph with the text segment "the central bank's interest rate hike", and "occurs in an economic downturn" is the embedding vector of the context information of this text segment; by integrating the context information in real-time domain text into the feature representation of entities in the causal graph, the semantics of entities can be made richer and more in line with reality. For example, after integrating economic environment information into the embedding vector of the "interest rate increase" node, it can better reflect the impact on "increase in debt cost".
[0052] In step S230, construct a Causal Graph Neural Network (Causal GNN) based on the causal graph. The causal graph neural network combines the structure of the Graph Neural Network (GNN) and the ability of causal reasoning. Nodes transmit information through edges. During the message passing process, calculate the attention weights between each node and its neighbor nodes through the attention mechanism, and weight the messages according to the attention weights, so that more important neighbor nodes have a greater impact on the current node. During the message passing process, select the most important neighbor node for information transmission according to the attention weights to achieve dynamic adjustment of path priorities.
[0053] As a possible implementation, step S230 can be implemented through steps S231 - S233, which are elaborated as follows: S231: Construct a causal graph neural network based on the causal graph.
[0054] S232: Determine the candidate causal directions according to the causal mask to avoid operations between non-causal relationship nodes.
[0055] S233: According to the feature representations of each entity after update, starting from the first entity, along the candidate causal path, calculate the association weights with other entities based on the attention mechanism, select the next associated entity according to the association weights, and dynamically generate the causal path. Among them, if an entity is connected to multiple other entities along the candidate causal path, select the entity with the largest association weight as the next entity.
[0056] By using a causal mask to shield non-causal directions, optimize the association weights of the entity feature representations enhanced by the context based on the attention mechanism. For example, when the causal mask Mij between node I and node j = 1, calculate the attention weights between these two nodes, avoiding interference from non-causal relationship nodes, saving the amount of computation, and ensuring the accuracy of the association weights.
[0057] In addition, for the causal path obtained in step S140, based on counterfactual reasoning, dynamically adjust the causal strength between nodes to ensure the logical consistency of path generation.
[0058] With the update and accumulation of text data in important fields such as policies, the association weights between nodes on the causal path may change. For example, new policies may introduce new regulatory requirements, incentives or restrictions, thus changing the relationships between certain nodes. If a certain causal relationship appears repeatedly in multiple independent data sources or texts, this usually means that the causal relationship has a high credibility and importance. If a certain causal relationship does not appear in the latest data, this may mean that the relationship is no longer important or no longer holds in the current context. Based on this, in some embodiments, after obtaining the causal path, the association weights in the causal path are also corrected based on domain text data for a period of time, specifically including: for each real-time domain text data, respectively based on the cross-attention mechanism, perform semantic alignment with the entities in the causal graph, extract the existing causal relationships, for the same causal relationship that appears multiple times, increase the association weights between the corresponding entities. If a certain causal relationship in the causal graph is not extracted from the real-time domain text data, then reduce the association weights between the corresponding entities.
[0059] Example: For the specific scenario of Chinese enterprise A setting up subsidiary B in country A, identify tax risks by establishing a causal path.
[0060] First, construct a causal graph based on step S210. Specifically, it includes: (1) Entity and relationship extraction. Extract key entities (such as "Chinese parent company", "subsidiary in Country A", "raw material procurement", "processing costs") and relationships (such as "procurement → cost", "processing → profit") from the enterprise resource management system. Perform noise filtering to remove non-critical information (such as equipment depreciation, employee salaries), and retain data related to related-party transactions.
[0061] (2) Causal graph construction. Combine counterfactual reasoning to verify causal relationships and directions. For example, simulate "if the procurement price increases by 10%, will the profit margin of the subsidiary decrease?". If the actual profit margin decreases by 8% (p = 0.004 < 0.01), mark it as a causal relationship ( M procurement price, subsidiary profit = 1); generate a causal mask. Let N = 6 nodes (parent company, subsidiary, procurement price, processing costs, profit margin, tax declaration amount), Mij representing the causal mask. If M procurement price, subsidiary profit = 1, it means that the procurement price directly affects the profit of the subsidiary.
[0062] Then, dynamically generate causal paths based on steps S220 - S230. Specifically, it includes: (3) Integrate enterprise resource management system data (such as procurement contract amount, processing costs) with local data in Country A (such as prices of similar products in the Country A market, requirements of the electronic invoice system), and strengthen the relevance through the cross-attention mechanism.
[0063] (4) Use a causal graph neural network to infer multi-hop paths based on node features and edge relationships: procurement price → subsidiary profit → tax declaration amount → tax anomaly. Among them, the association weights between the procurement price and the subsidiary profit, between the subsidiary profit and the tax declaration amount, and between the tax declaration amount and the tax anomaly are 0.88, 0.72, and 0.91 respectively.
[0064] Causal relationship inference: probability of tax anomaly = 0.88 × 0.72 × 0.91 = 0.574.
[0065] As the model is trained, the weights will be optimized through backpropagation. For example, if the impact of the procurement price on the profit is more significant in the actual data (such as R 2 = 0.85), the model will automatically adjust w to be close to 0.85.
[0066] When Country A issues a new policy, update the causal graph, add a node "policy compliance", and then automatically adjust the association weights on the causal path to generate a new path: purchase price → subsidiary profit → policy compliance → tax anomaly. Among them, the association weights between the purchase price and the subsidiary profit, between the subsidiary profit and the policy compliance, and between the policy compliance and the tax anomaly are 0.88, 0.72, and 0.85 respectively.
[0067] Based on this, a complete causal path from "purchase price" to "abnormal tax declaration" is generated to reveal hidden risks.
[0068] The existing generation of causal chains lacks a unified evaluation standard, resulting in low credibility of the results. For example, in the financial scenario, the causal relationship between "tax rate reduction" and "profit increase" generated may be misused due to lack of data support. To solve the above problems, the method further includes step S240: for the causal path, conduct a quantitative evaluation from one or more aspects of fidelity, robustness, and consistency with expert scores, and then form a closed-loop iterative process: if at least one of the fidelity, robustness, and consistency with expert scores of a certain path is lower than the threshold, trigger the dynamic correction process of the causal graph (such as adding entities or adjusting masks).
[0069] As an implementation method of fidelity evaluation, based on counterfactual reasoning, verify the reliability of the causal path. It can be understood that to ensure that the rules included in the counterfactual reasoning rule base can cover as many entities as possible, periodically update the rule base, such as regularly performing entity and relationship recognition and counterfactual verification on incremental domain text data, and updating the baseline values in the rule base. At the same time, allow business experts to manually adjust the baseline values according to prior knowledge.
[0070] As another implementation method of fidelity evaluation, verify the rationality of the causal path through historical data matching. Specifically, for the generated causal path, arrange and splice the embedding vectors of the entities in the path in the order in the path to obtain the vector representation of the causal path to be verified; analyze multiple historical cases in the same domain, and for each case, respectively construct the true causal path; for each true causal path, arrange and splice the embedding vectors of the entities in the path in the order in the path to obtain the vector representation of each true causal path; calculate the similarity between the vector representation of the causal path to be verified and the vector representations of each true causal path. If all meet the set threshold requirements, mark it as high-fidelity. Exemplarily, use cosine similarity to measure the similarity between the generated causal path and the causal path of historical cases. The cosine similarity is used as the fidelity score. If the fidelity score is greater than or equal to the preset threshold, mark it as high-fidelity. For example, in the tax scenario, if the similarity between the causal path and the historical 5 tax rate adjustment cases ≥ 0.85, mark it as high-fidelity.
[0071] (2)Robustness Evaluation Through input perturbation testing, increase or decrease one or more entities by a certain percentage, calculate the change rate of their associated nodes. If the change rate does not exceed the set threshold, mark the corresponding causal path as highly robust. For example, increase or decrease the purchase price by 10% to simulate market fluctuations, calculate the change rate of the predicted value of the tax declaration amount. If the predicted value changes from 100 to 103 after perturbation, the change rate is 3%. In the enterprise tax scenario, the threshold can be set according to the enterprise's risk tolerance.
[0072] (3)Consistency Evaluation Verify logical compatibility by combining domain expert scores (1 - 5 points). For example, in the financial scenario, if the path score ≥ 4.3 points, mark it as highly consistent.
[0073] Modify the model according to the evaluation results. If the fidelity of a certain causal chain S= is 0.72 (lower than the threshold of 0.85), trigger the correction process: a. Add a new node "Related Party Fund Flow" and adjust the causal mask (such as M Subsidiary Profit, Related Party Fund Flow = 1); b. Retrain the large model and optimize the attention weights (such as w Subsidiary Profit, Related Party Fund Flow = 0.82).
[0074] It should be noted that the retraining here is through incremental learning rather than complete retraining, only updating the affected parts to reduce the training cost.
[0075] Based on the above method, one or more embodiments of the present invention also provide a causal path generation device, see Figure 6 , including: a causal graph generation module 310, configured to: obtain domain text data, perform entity and relationship extraction, and generate a causal graph; an entity semantic enhancement module 320, configured to: obtain real-time domain text data, based on the real-time domain text data and the causal graph, perform semantic alignment based on the cross-attention mechanism, and fuse the context information of each entity with the feature representation of the corresponding entity to update the feature representation of each entity; a causal path generation module 330, configured to: build a causal graph neural network based on the causal graph, calculate the association weights based on the attention mechanism according to the updated feature representations of each entity, and perform information transmission according to the association weights between entities to dynamically generate causal paths.
[0076] It should be noted that the relationship graph creation device provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be allocated to different functional modules as needed, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the relationship graph creation device provided in the above embodiments and the embodiments of the relationship graph creation method belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.
[0077] One or more embodiments of the present invention also provide an electronic device, which can be used to implement the methods in the above embodiments. The electronic device includes one or more processors, one or more memories coupled to the processor, and a communication module coupled to the processor.
[0078] The memory in the embodiments of the present invention is used to store various types of data to support the execution of the method as Figure 1 shown.
[0079] It can be understood that the memory can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. The memory in the embodiments of the present invention can store computer programs corresponding to the respective steps in the method as Figure 1 shown. Among them, the operating system includes various system programs, such as the framework layer, the core library layer, the driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application program can include various application programs.
[0080] As an example, the processor can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0081] In particular, according to the embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium. The computer program includes program codes for executing Figure 1 the method shown. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part and / or installed from a removable medium. When the computer program is executed by the central processing unit, various functions defined in the device of the present application are executed.
[0082] Among them, Figure 1The computer program instructions corresponding to the methods shown can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in the function.
[0083] The foregoing are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A causal path generation method, characterized in that, Including the following steps: Obtain domain text data, perform entity and relationship extraction, and generate a causal graph; Obtain real-time domain text data. Based on the real-time domain text data and the causal graph, perform semantic alignment based on the cross-attention mechanism, and fuse the context information of each entity with the feature representation of the corresponding entity to update the feature representation of each entity; Construct a causal graph neural network based on the causal graph. Based on the updated feature representations of each entity, calculate the association weights based on the attention mechanism, and perform information transmission according to the association weights between entities to dynamically generate causal paths.
2. The causal path generation method according to claim 1, wherein After performing entity and relationship extraction on the domain text data, the causal relationship between entities is also verified through counterfactual reasoning, specifically including: pre-constructing a counterfactual reasoning rule library for storing counterfactual reasoning rules, and each counterfactual reasoning rule includes a baseline value of the change rate of another entity caused by the change rate of one entity; for every two associated entities, when other entities meet the given conditions, calculate the change rate of one entity when it undergoes a set change rate, and if the change rate of the other entity significantly deviates from the baseline value, determine that there is a causal relationship between the two.
3. The causal path generation method according to claim 1, characterized in that Performing semantic alignment based on the cross-attention mechanism includes: Obtain real-time domain text data and perform text segment segmentation on it, and extract the embedding vectors of each text segment; Based on the cross-attention mechanism, by calculating the similarity between the entities in the causal graph and the embedding vectors of each text segment, align the entities with similar semantics and the text segments into the same semantic space.
4. The causal path generation method according to claim 1, wherein Dynamically generating causal paths includes: Determine candidate causal directions according to the causal mask, where the causal mask is used to represent the causal relationship and direction between entities in the causal graph; Based on the updated feature representations of each entity, starting from the first entity, along the candidate causal path, calculate the association weights with other entities based on the attention mechanism, and select the next associated entity according to the association weights to dynamically generate causal paths.
5. The causal path generation method according to claim 4, wherein After obtaining the causal path, the association weights in the causal path are also corrected based on the domain text data for a period of time, specifically including: for each real-time domain text data, respectively perform semantic alignment with the entities in the causal graph based on the cross-attention mechanism, extract the causal relationships existing therein, and increase the association weights between the corresponding entities for the same causal relationship that appears multiple times. If a certain causal relationship in the causal graph is not extracted from the real-time domain text data, then reduce the association weights between the corresponding entities.
6. The causal path generation method according to claim 1, wherein The method further includes: quantitatively evaluating the causal path from one or more aspects of fidelity, robustness, and consistency with expert scores.
7. A causal path generation device, characterized in that Including: A causal graph generation module configured to: obtain domain text data, perform entity and relationship extraction, and generate a causal graph; The entity semantic enhancement module is configured to: obtain real-time domain text data, perform semantic alignment based on the cross-attention mechanism according to the real-time domain text data and the causal graph, and fuse the context information of each entity with the corresponding entity feature representation to update the feature representation of each entity; The causal path generation module is configured to: construct a causal graph neural network based on the causal graph, calculate the association weights based on the attention mechanism according to the updated feature representations of each entity, and perform information transmission according to the association weights between entities to dynamically generate causal paths.
8. An electronic device, characterized in that, It includes a processor and a memory, and computer instructions are stored on the memory. When the computer instructions are executed by the processor, the electronic device is caused to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, the computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Multi-modal knowledge graph entity alignment method and system based on inter-modal interaction
CN116932770A
Medical knowledge graph automatic alignment method based on neighbor entities
CN119227796A
AI-driven multilingual intelligent document abstract and mind map generation system
CN119494394A
Name disambiguation method based on multi-relation deep retrieval text matching
CN119862878A
Risk prediction method and apparatus, and device and storage medium
WO2023065545A1
Cited By
Enterprise tax declaration data intelligent comparison and automatic verification optimization method and system
CN121481753A
Artificial intelligence diagnosis auxiliary method and device based on medical image, equipment and medium
CN121747903A