Causal knowledge graph construction and question-answering system based on retrieval enhancement generation and large language model

By constructing a multi-source heterogeneous knowledge base and employing a hybrid retrieval strategy, combined with a large language model, the problems of timeliness and explicit causal modeling in causal knowledge modeling are solved. A high-precision, interpretable causal knowledge graph is constructed, achieving the integrity and consistency of causal relationships and supporting multi-hop reasoning and credible question answering.

CN121996800APending Publication Date: 2026-05-08CHONGQING UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING UNIV
Filing Date
2025-12-23
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing large language models suffer from insufficient timeliness and illusion problems in causal knowledge modeling, making it difficult to guarantee verifiability and traceability in professional scenarios. Furthermore, existing retrieval enhancement generation methods lack explicit causal modeling, resulting in incomplete causal triples, unverifiable generated answers, insufficient cross-document dependencies, and serious directional misjudgments.

Method used

It employs a multi-source heterogeneous knowledge base construction module, a retrieval enhancement generation module, a named entity recognition and causal triple extraction module, and a knowledge fusion reasoning module. Through multi-level vector indexing, hybrid retrieval strategies, two rounds of causal triple extraction, and conflict detection, it constructs a high-precision and interpretable causal knowledge graph.

Benefits of technology

It achieves high-precision and interpretable causal knowledge graph construction and question answering, improves the coverage of causal relationships and the confidence of directional judgments, ensures the consistency and integrity of knowledge, supports multi-hop causal reasoning, and generates answers with controllable credibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996800A_ABST
    Figure CN121996800A_ABST
Patent Text Reader

Abstract

The invention discloses a causal knowledge graph construction and question-answering system based on retrieval enhancement generation and a large language model. The system comprises a multi-source heterogeneous knowledge base construction module, a retrieval enhancement generation module, a named entity recognition and causal triple extraction module and a knowledge fusion reasoning module, according to the method, a high-quality named entity annotation data set and a causal data set are constructed, and normalization and integrity of input knowledge are guaranteed; a mixed retrieval strategy (keyword + vector + sparse embedding) is provided, and the evidence coverage rate and recall precision are improved. Under RAG driving, LLM is combined, two rounds of causal triple extraction are achieved, and the causal relationship coverage degree and the direction judgment confidence degree are improved; a conflict detection and atlas fusion mechanism is designed to ensure the unity and consistency of new and old causal knowledge; a question answering system based on a causal atlas is also established, multi-hop causal reasoning is supported, and answers with controllable credibility and explainable are output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and natural language processing, specifically to a causal knowledge graph construction and question answering system based on retrieval-enhanced generation and a large language model. Background Technology

[0002] With the growth in the scale of large language models, significant progress has been made in general question answering and information extraction. However, the knowledge embedded within parameters suffers from insufficient timeliness and hallucination, making it difficult to guarantee verifiability and traceability for professional scenarios. A typical approach is to introduce Retrieval-Augmented Generation (RAG), but existing RAGs mostly focus on relevance generation and lack explicit modeling of causality. This makes it difficult to systematically precipitate structures such as "because-therefore" and "cause-effect" into computable knowledge triples, thus restricting multi-hop reasoning and credible question answering, and easily generating answers that are "seemingly reasonable but unverifiable".

[0003] Traditional sequence labeling methods (such as BiLSTM-CRF and BERT-CRF) perform well in short texts and stable domains, but in long texts, cross-domain scenarios, and scenarios with varying domain terminology, entity boundaries, aliases, abbreviations, and word forms cause a decrease in recall and precision. Introducing external evidence into the labeling stage can improve robustness, but there is a lack of a unified evidence selection and scheduling mechanism. Existing causal extraction methods mostly rely on syntactic / trigger word templates or unsupervised statistics (such as pointwise mutual information (PMI)), which are not sensitive enough to long-distance dependencies and temporal order across sentences or even documents, and are prone to directional misjudgments, insufficient evidence, and lack of consistency.

[0004] In addition, single-round extraction is often limited by the evidence retrieved in the first round, missing causal information across documents and paragraphs, and generating incomplete triples; causal triples extracted from different data sources may contradict each other in terms of direction, expression or context, and there is a lack of a unified conflict detection and fusion mechanism. Summary of the Invention

[0005] The purpose of this invention is to provide a causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, including: a multi-source heterogeneous knowledge base construction module, a retrieval enhancement generation module, a named entity recognition and causal triple extraction module, and a knowledge fusion reasoning module.

[0006] The multi-source heterogeneous knowledge base construction module is based on a multi-level vector index to process multi-source raw text data and construct a causal knowledge graph.

[0007] The retrieval enhancement generation module uses a hybrid retrieval strategy to filter out a set of retrieval contexts related to the user's input query from a causal knowledge graph.

[0008] The named entity recognition and causal triple extraction module concatenates the retrieved context set and the user input query, inputs them into the large language model for sequence labeling, and obtains the entity set.

[0009] The named entity recognition and causal triple extraction module generates candidate causal triples based on the entity set and the retrieval context set, and extracts a set of candidate causal triples with an initial confidence level not less than a threshold.

[0010] The named entity recognition and causal triple extraction module performs counterfactual retrieval on candidate causal triples with initial confidence levels less than a threshold to obtain the final set of causal triples.

[0011] The knowledge fusion reasoning module is used to perform conflict detection and knowledge graph fusion on the final causal triple set to obtain the fused causal knowledge graph.

[0012] The knowledge fusion reasoning module infers the user's input query based on the fused causal knowledge graph and generates the corresponding answer.

[0013] Furthermore, the steps for constructing the causal knowledge graph by the multi-source heterogeneous knowledge base construction module are as follows:

[0014] A1 acquires multi-source raw text data and preprocesses the multi-source raw text data.

[0015] The multi-source raw text data includes named entity tags, causal pairs, timestamps, source information, and domain tags.

[0016] A2 constructs a named entity annotation dataset based on preprocessed multi-source raw text data.

[0017] A3 constructs a causal relationship dataset based on preprocessed multi-source raw text data.

[0018] A4 segments the preprocessed multi-source raw text data using a sliding window.

[0019] For each segment, A5 generates both dense and sparse vectors.

[0020] A6 constructs vector indexes and inverted indexes.

[0021] A7 assigns thematic fragmentation and time decay weights to each segment.

[0022] Furthermore, the sources of the multi-source raw text data include publicly available corpora, domain documents, user interaction logs, and experimental records.

[0023] The domain documentation includes standards, reports, and papers.

[0024] The preprocessing includes noise filtering, data merging, and terminology standardization.

[0025] Furthermore, the noise filtering is described in formula (7).

[0026] The data is merged into original text data with a similarity greater than the similarity threshold.

[0027] The terminology standardization is given in formula (9).

[0028] Furthermore, the step of filtering the set of retrieval contexts related to the user's input query from the causal knowledge graph based on the hybrid retrieval strategy is as follows:

[0029] B1 uses a hybrid retrieval strategy to retrieve text related to the user's input query from a causal knowledge graph and construct a candidate set.

[0030] The hybrid retrieval strategy includes keyword retrieval, dense vector retrieval, and sparse embedding retrieval.

[0031] B2 calculates the combined retrieval score for all texts in the candidate set.

[0032] B3 calculates the maximum marginal relevance of all texts in the candidate set based on the hybrid retrieval score, and removes texts with a maximum marginal relevance less than the marginal relevance threshold from the candidate set.

[0033] B4 selects text from the candidate set under the context budget constraint to construct a retrieval context set.

[0034] Furthermore, the steps for obtaining the entity set are as follows:

[0035] C1 concatenates the retrieved context set and the user input query, then inputs the result into a large language model for sequence labeling.

[0036] C2 performs normalization on labeled sequences and entities.

[0037] C3 constructs an entity set based on the normalized annotation sequence, where each entity includes text, type, location, and the normalized annotation sequence.

[0038] The types of entities include, but are not limited to, people, organizations, locations, events, times, physical objects, and abstract concepts.

[0039] Furthermore, the step of extracting the candidate causal triple set is as follows:

[0040] D1 generates candidate causal triples based on the entity set and the retrieval context set.

[0041] D2 calculates the initial confidence level for all candidate causal triples.

[0042] D3 constructs and initializes the set of candidate causal triples.

[0043] D4 determines whether the initial confidence level of all candidate causal triples is not less than the initial confidence level threshold. If so, the corresponding candidate causal triple is added to the candidate causal triple set.

[0044] Furthermore, the steps for obtaining the final set of causal triples are as follows:

[0045] E1 retrieves a set of counterfactual evidence through a counterfactual query.

[0046] E2 determines whether the set of evidence for rebuttal is empty. If not, proceed to step E3; if so, proceed to step E5.

[0047] E3 updates the initial confidence level.

[0048] E4 determines whether the updated confidence of all candidate causal triples is not less than the confidence threshold for proof by contradiction. If so, the corresponding candidate causal triple is added to the candidate causal triple set.

[0049] E5 determines whether there are incomplete causal pairs. If so, it completes the missing entities based on the template and context to form a complete set.

[0050] E6 constructs the final causal triple set based on the candidate causal triple set and the completion set.

[0051] Furthermore, the steps for obtaining the fused causal knowledge graph are as follows:

[0052] F1 performs entity alignment between the final set of causal triples and the causal knowledge graph.

[0053] F2 performs conflict detection between the final set of causal triples after entity alignment and the causal knowledge graph.

[0054] The conflict detection is used to identify and eliminate causal triples that contain logical contradictions.

[0055] F3 calculates the confidence level for the final set of causal triples that meet the conflict detection criteria.

[0056] F4 integrates the final causal triples with a credibility greater than the credibility threshold into the causal knowledge graph, resulting in the integrated causal knowledge graph.

[0057] Furthermore, the steps for generating the corresponding answer are as follows:

[0058] G1 compiles user-input queries into graph queries and retrieves supporting text based on a hybrid retrieval strategy.

[0059] G2 performs multi-hop reasoning on graph queries on the fused causal knowledge graph.

[0060] G3 calculates the inference confidence and generates an answer that corresponds to the user's input query.

[0061] The answer includes natural language answer, reasoning path, textual evidence, and confidence level.

[0062] The technical effectiveness of this invention is undeniable. It provides an innovative, end-to-end causal knowledge management system that deeply integrates Retrieval-Augmented Generation (RAG) technology with Large Language Models (LLM) capabilities. It is specifically designed to construct high-precision, interpretable causal knowledge graphs and support complex causal reasoning. The system consists of five highly collaborative core modules forming a complete technical chain: a data acquisition and causal dataset construction module responsible for collecting, cleaning, and labeling multi-source heterogeneous data; a vector storage and segmentation management module realizing multi-granular semantic representation and efficient indexing of text; a RAG and LLM-based named entity recognition and two-round causal triple extraction module completing the transformation from unstructured text to structured causal knowledge; a conflict detection and knowledge graph fusion module ensuring the consistency and integrity of knowledge; and a knowledge graph-based causal question answering module providing multi-hop reasoning and interpretable question-answering services. These five modules form a closed-loop processing flow from raw data input to causal question-answering output. While data flows between modules, the performance of each stage is continuously optimized through a feedback mechanism.

[0063] The system provided by this invention adopts a highly modular microservice architecture design, where each module can be deployed, expanded, and updated independently. Seamless integration is achieved through clearly defined interface protocols (including data formats, calling methods, and error handling mechanisms). Particularly in incremental updates, the system implements fine-grained version control and difference synchronization mechanisms: when a new data source is accessed or existing data is updated, only a local reconstruction of the affected modules and knowledge subgraphs is triggered, rather than a global reconstruction, significantly reducing computational resource consumption. Near real-time retrieval capabilities are achieved through a three-layer caching strategy (vector index caching, high-frequency query result caching, and causal path caching) and an asynchronous update queue, ensuring retrieval quality while controlling the latency of including new knowledge in the retrieval scope to the second level. The system employs an adaptive load balancing strategy, dynamically allocating computational resources based on query complexity and resource consumption to ensure stable response quality even under high-concurrency scenarios.

[0064] This invention constructs high-quality named entity annotation datasets and causal datasets to ensure the standardization and completeness of input knowledge; it proposes a hybrid retrieval strategy (keywords + vectors + sparse embedding) to improve evidence coverage and recall accuracy. Driven by RAG and combined with LLM, this invention achieves two rounds of causal triple extraction, improving causal relationship coverage and direction judgment confidence; it designs conflict detection and graph fusion mechanisms to ensure the unity and consistency of new and old causal knowledge; and it establishes a question-answering system based on causal graphs, supporting multi-hop causal reasoning and outputting answers with controllable credibility and interpretability.

[0065] This invention can provide users with high-quality causal knowledge extraction and question-answering services in general and vertical fields (such as engineering design, equipment maintenance, medical diagnosis, etc.), and has important theoretical value and application prospects. Attached Figure Description

[0066] Figure 1 This is a schematic diagram of the causal knowledge graph construction and question-answering system structure of the present invention;

[0067] Figure 2 This is a functional modular deployment architecture diagram of the present invention. Detailed Implementation

[0068] The present invention will be further described below with reference to embodiments, but it should not be construed that the scope of the present invention is limited to the following embodiments. Various substitutions and modifications made based on ordinary technical knowledge and common practices in the art without departing from the above-described technical concept of the present invention should be included within the scope of protection of the present invention.

[0069] Example 1:

[0070] See Figures 1 to 2 A causal knowledge graph construction and question answering system based on retrieval-enhanced generation and large language model includes: a multi-source heterogeneous knowledge base construction module, a retrieval-enhanced generation module, a named entity recognition and causal triple extraction module, and a knowledge fusion reasoning module.

[0071] The multi-source heterogeneous knowledge base construction module is based on a multi-level vector index to process multi-source raw text data and construct a causal knowledge graph.

[0072] The retrieval enhancement generation module uses a hybrid retrieval strategy to filter out a set of retrieval contexts related to the user's input query from a causal knowledge graph.

[0073] The named entity recognition and causal triple extraction module concatenates the retrieved context set and the user input query, inputs them into the large language model for sequence labeling, and obtains the entity set.

[0074] The named entity recognition and causal triple extraction module generates candidate causal triples based on the entity set and the retrieval context set, and extracts a set of candidate causal triples with an initial confidence level not less than a threshold.

[0075] The named entity recognition and causal triple extraction module performs counterfactual retrieval on candidate causal triples with initial confidence levels less than a threshold to obtain the final set of causal triples.

[0076] The knowledge fusion reasoning module is used to perform conflict detection and knowledge graph fusion on the final causal triple set to obtain the fused causal knowledge graph.

[0077] The knowledge fusion reasoning module infers the user's input query based on the fused causal knowledge graph and generates the corresponding answer.

[0078] Example 2:

[0079] A causal knowledge graph construction and question answering system based on retrieval-enhanced generation and a large language model is described in Embodiment 1. Further, the steps for constructing the causal knowledge graph using the multi-source heterogeneous knowledge base construction module are as follows:

[0080] A1 acquires multi-source raw text data and preprocesses the multi-source raw text data.

[0081] The multi-source raw text data includes named entity tags, causal pairs, timestamps, source information, and domain tags.

[0082] A2 constructs a named entity annotation dataset based on preprocessed multi-source raw text data, as shown below:

[0083] (1)

[0084] In the formula, Named entity annotation dataset This represents the preprocessed multi-source raw text data. Indicates text index Represents the total number of texts This represents named entity annotations.

[0085] A3 constructs a causal relationship dataset based on preprocessed multi-source raw text data, as shown below:

[0086] (2)

[0087] In the formula, C represents the causal relationship dataset. Indicating causal pair indexes Indicates the total number of causal pairs Indicates a causal pair, where, For the reason, For the result Indicates contextual evidence Indicates the confidence level.

[0088] A4 segments the preprocessed multi-source raw text data using a sliding window, as shown below:

[0089] (3)

[0090] In the formula, Text representing causal knowledge graphs Represents the set of segments of text in a causal knowledge graph. Indicates segmented index Indicates the total number of segments Indicates the first Each segment Indicates the length of the sliding window Indicates overlap rate Indicates the overlap length between adjacent segments Represents a fragment timestamp.

[0091] For each segment, A5 generates dense and sparse vectors, as shown below:

[0092] (4)

[0093] In the formula, , Representing dense vectors and sparse vectors respectively. , These represent the pre-trained Transformer model and the sparse embedding model, respectively.

[0094] A6 constructs vector indices and inverted indices as follows:

[0095] (5)

[0096] In the formula, , Representing vector index and inverted index respectively Represents vector indexing function Inverted index function All are index parameters.

[0097] A7 assigns topic fragmentation and time decay weights to each segment, as shown below:

[0098] (6)

[0099] In the formula, Indicates the first Each segment's topic fragment identifier consists of the domain, topic, version, and fragment timestamp; Indicates time decay weight Indicates the attenuation coefficient Indicates the current system time Indicates the first The original timestamps of the text corresponding to each segment , , They represent the first Information about the domain, topic, and version of each segment.

[0100] Example 3:

[0101] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model is provided. The main technical contents are described in any one of Embodiments 1 and 2. Furthermore, the sources of the multi-source original text data include public corpora, domain documents, user interaction logs, and experimental records.

[0102] The domain documentation includes standards, reports, and papers.

[0103] The preprocessing includes noise filtering, data merging, and terminology standardization.

[0104] Example 4:

[0105] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of Embodiments 1 to 3, and further, the noise filtering is as follows:

[0106] (7)

[0107] In the formula, Represents the dataset after noise filtering Represents raw text data Represents the quality scoring function This represents the cleaning threshold, with a value range of [value range missing]. .

[0108] The data is merged into sets with a similarity greater than a similarity threshold. The original text data is merged, where, The range of values ​​is The similarity is shown below:

[0109] (8)

[0110] In the formula, Indicates similarity All represent data after noise filtering. Representing data respectively ,data Dense vector representation , , All are similarity weight coefficients, and Jaccard similarity based on word set This indicates similarity based on edit distance.

[0111] The terminology is standardized as follows:

[0112] (9)

[0113] In the formula, This represents data after terminology normalization. This indicates the merged data. Domain dictionary This indicates that the merged data is normalized using a domain dictionary. Representing data With data In the dictionary The marker variable in the text, the marker variable Representing data With data It was marked as a synonym.

[0114] Example 5:

[0115] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of Embodiments 1 to 4, further comprising the following steps for selecting a set of retrieval contexts related to the user input query from the causal knowledge graph based on a hybrid retrieval strategy:

[0116] B1 uses a hybrid retrieval strategy to retrieve text related to the user's input query from a causal knowledge graph and construct a candidate set.

[0117] The hybrid retrieval strategy includes keyword retrieval, dense vector retrieval, and sparse embedding retrieval.

[0118] B2 calculates the combined retrieval score for all texts in the candidate set, as shown below:

[0119] (10)

[0120] In the formula, This indicates the score for mixed searches. This indicates that the user entered a query. This represents text related to the user's input query. , , These represent the weights for keyword retrieval, dense vector retrieval, and sparse embedding retrieval, respectively. This indicates the keyword search score. , These represent user-input queries. ,text The vector representation of . Indicates user input query ,text Dense vector retrieval score. , These represent user-input queries. ,text sparse embedding functions. This represents the sparse embedding retrieval score.

[0121] B3 calculates the maximum marginal relevance of all texts in the candidate set based on the hybrid retrieval score, and then assigns texts with a maximum marginal relevance less than a marginal relevance threshold. The text is removed from the candidate set. The range of values ​​is .

[0122] The maximum marginal correlation is as follows:

[0123] (11)

[0124] In the formula, Indicates the maximum marginal correlation. This represents the trade-off parameter. This refers to other text in the candidate set. Representing text The vector representation of . This represents the candidate set. Representing text ,text Dense vector retrieval score.

[0125] B4 selects text from the candidate set under the context budget constraint to construct the retrieval context set, as shown below:

[0126] (12)

[0127] (13)

[0128] In the formula, Represents the retrieval context set This represents the context budget constraint, which is the maximum total length of text allowed to be input into the model. , , These represent the weight coefficients for the cross-encoder rearrangement score, novelty measure, and time decay weight, respectively. Indicates the cross encoder for the query and text Rearranged scores Representing text Novelty measure relative to the selected set Representing text Time decay weight Representing text Overall utility score Representing text The length.

[0129] Example 6:

[0130] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of embodiments 1 to 5, further wherein the steps for obtaining the entity set are as follows:

[0131] C1 concatenates the retrieval context set and the user input query, then inputs the result into a large language model for sequence labeling, as shown below:

[0132] (14)

[0133] In the formula, Represents the labeled sequence output by the large language model Indicates user input query Represents the retrieval context set Indicates splicing operation This indicates that the context set will be retrieved. All text is concatenated into one text. Representing a large language model Indicates that in a given query and context set Under the given conditions, output the labeled sequence. The probability of.

[0134] C2 performs normalization on labeled sequences and entities, as shown below:

[0135] (15)

[0136] In the formula, This represents the normalized labeled sequence. This indicates the valid annotation space. This indicates the constraint consistency score. Domain-specific dictionary. Represents the labeled sequence Corresponding entity and domain dictionary Alignment constraints. , These represent the constraint consistency score and the weight of the alignment constraint, respectively.

[0137] C3 constructs an entity set based on the normalized annotation sequence, where each entity includes text, type, location, and the normalized annotation sequence.

[0138] The types of entities include, but are not limited to, people, organizations, locations, events, times, physical objects, and abstract concepts.

[0139] Example 7:

[0140] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of embodiments 1 to 6, further wherein the step of extracting the candidate causal triple set is as follows:

[0141] D1 generates candidate causal triples based on the entity set and the retrieval context set, as shown below:

[0142] (16)

[0143] In the formula, This indicates the entity, corresponding to the entity in formula (2). , This represents the fruit entity, corresponding to the one in formula (2). , It indicates a cause-and-effect relationship. Represents a set of entities.

[0144] D2 calculates the initial confidence scores for all candidate causal triples, as shown below:

[0145] (17)

[0146] In the formula, Indicates candidate causal triples The initial confidence level. This represents the Sigmoid function. , , These represent the weight coefficients of the initial causal confidence score, the temporal sequence feature, and the causal trigger word matching score, respectively. Representing entities With entity The temporal sequence of appearance in the text (if) Prior to (Then it will be a positive value). This indicates the score for matching causal trigger words. Represents the entity description With entity Contextual text fragments relating to the relationship between them.

[0147] Among them, the initial value of causal confidence As shown below:

[0148] (18)

[0149] In the formula, , , , These represent the initial weights of the causal trigger word matching score, temporal sequence features, point mutual information, and discrimination confidence, respectively. This represents point-to-point mutual information. This represents the confidence level of the large language model in discriminating the causal direction. This represents the set of retrieval contexts.

[0150] D3 constructs and initializes the set of candidate causal triples.

[0151] D4. Determine whether the initial confidence level of all candidate causal triples is not less than the initial confidence threshold. If so, the corresponding candidate causal triplet is added to the candidate causal triplet set. The initial confidence threshold... The range of values ​​is .

[0152] Example 8:

[0153] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of embodiments 1 to 7, further wherein the steps for obtaining the final causal triple set are as follows:

[0154] E1 retrieves the set of counterfactual evidence through a counterfactual query, as shown below:

[0155] (19)

[0156] In the formula, Indicates a set of evidence to refute. Text of counter-evidence This indicates the score for mixed searches. This represents the threshold for the combined retrieval score of counter-evidence, with a value range of [value missing]. .

[0157] Among them, counterfactual inquiry As shown below:

[0158] (20)

[0159] In the formula, This indicates that the user entered a query. This represents a query negation function, used to transform the original query into a question asking for the opposite or negated result.

[0160] E2 determines whether the set of evidence for rebuttal is empty. If not, proceed to step E3; if so, proceed to step E5.

[0161] E3 updates the initial confidence level as follows:

[0162] (twenty one)

[0163] In the formula, Indicates due to entity, Indicates the fruit body, This indicates the updated confidence level. This represents the initial confidence level. Indicates the strength of the counter-evidence.

[0164] E4 determines whether the updated confidence levels of all candidate causal triples are not less than the confidence threshold for disproving evidence. If so, the corresponding candidate causal triplet is added to the candidate causal triplet set. The confidence threshold for disproving the evidence... The range of values ​​is .

[0165] E5 determines whether there are incomplete causal pairs. If so, it completes the missing entities based on the template and context to form a complete set.

[0166] E6 constructs the final set of causal triples based on the candidate causal triple set and the completion set, as shown below:

[0167] (twenty two)

[0168] In the formula, This represents the final set of causal triples. This represents the set of candidate causal triples. This indicates the completion of the set. It indicates a cause-and-effect relationship. This represents the chain of evidence, including its source, fragments, timestamps, and retrieval path.

[0169] Among them, the confidence level of the final causal triple. As shown below:

[0170] (twenty three)

[0171] In the formula, This represents the Sigmoid function; , These represent the weight coefficients for supporting strength quantization and supporting counter-strength quantization, respectively. , These represent the support strength quantization and proof-of-contrast strength quantization functions, respectively. Indicates the retrieval context set; This represents a set of evidence to refute the claim; This refers to the Logit function, i.e. .

[0172] Example 9:

[0173] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of embodiments 1 to 8, further wherein the steps for obtaining the fused causal knowledge graph are as follows:

[0174] F1 performs entity alignment between the final set of causal triples and the causal knowledge graph, as shown below.

[0175] (twenty four)

[0176] In the formula, , Each represents the final set of causal triples. Causal knowledge graph Entities in the text. Representing entities and entity Similarity score , , These represent the weight coefficients for vector similarity, text similarity, and attribute similarity, respectively. , Representing entities respectively ,entity The embedding vector. Represents the Jaccard similarity function Representing entities respectively ,entity Name segmentation set This represents the function for calculating entity attribute similarity. When... Greater than the preset threshold At that time, for the entity and entity To merge, The range of values ​​is .

[0177] F2 performs conflict detection between the final set of causal triples after entity alignment and the causal knowledge graph, as shown below:

[0178] (25)

[0179] In the formula, Indicates due to entity, Indicates the fruit body, It indicates a cause-and-effect relationship. This represents the collision detection function. This indicates the simultaneous existence of two causal triples with opposite directions. This indicates the existence of entities Departure ultimately leads back to the physical world A directed cycle. The conflict detection is used to identify and eliminate causal triples that contain logical contradictions.

[0180] F3 calculates the confidence level for the final set of causal triples that meet the conflict detection criteria, as shown below:

[0181] (26)

[0182] In the formula, Representing causal triples Credibility. These represent the weighting coefficients for the average weight of evidence, the confidence mean of multiple rounds of sampling, and the consistency score, respectively. This represents the average weight of the evidence supporting the triple. This represents the average confidence level of the triplet across multiple rounds of sampling. This indicates the consistency score between the triple and existing knowledge in the graph.

[0183] F4 indicates a credibility level greater than the credibility threshold. The final causal triples are integrated into the causal knowledge graph to obtain the integrated causal knowledge graph, wherein the credibility threshold is... The range of values ​​is .

[0184] Example 10:

[0185] A causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model, the main technical contents of which are described in any one of embodiments 1 to 9, further wherein the steps for generating the corresponding answer are as follows:

[0186] G1 compiles user-input queries into graph queries and retrieves supporting text based on a hybrid retrieval strategy.

[0187] G2 performs multi-hop reasoning on graph queries on the fused causal knowledge graph, as shown below:

[0188] (27)

[0189] In the formula, This indicates the response to user-input queries. Reasoning path This represents the probability of the correct answer path. This represents a directed path connecting related entities found from the fused causal knowledge graph. Indicates user input query Represents the edges in the path attention weights Representing an edge Final confidence level of the corresponding causal relationship , All of these represent entity nodes in a causal knowledge graph. , Representing entities respectively ,entity vector representation This represents a trainable weight matrix.

[0190] G3 calculates the inference confidence and generates an answer corresponding to the user's input query, as shown below:

[0191] (28)

[0192] (29)

[0193] In the formula, This represents the overall reasoning confidence in the generated answer, when... Less than the preset inference threshold If an answer cannot be generated that corresponds to the user's input query, an insufficient information prompt will be returned, and the preset inference threshold will be triggered. The range of values ​​is . , , represent the weight coefficients of the path reasoning score, text question answering score, and evidence consistency score, respectively. This indicates the generated query is related to the user input. Corresponding answer Representing a large language model Represents a set of supporting texts Represents a set of supporting texts One of the documents Indicates a query and documents Calculated answer matching score Describing the evidence consistency evaluation function Represents the set of all supporting evidence. Represents a constant The first one with the highest probability A reasoning path. Indicates the query input by the user. Most relevant front One document.

[0194] The answer includes natural language answer, reasoning path, textual evidence, and confidence level.

[0195] Example 11:

[0196] See Figures 1 to 2 A causal knowledge graph construction and question answering system based on retrieval-enhanced generation and large language models, the main technical contents of which include:

[0197] (1) Data Acquisition and Causal Dataset Construction:

[0198] 1.1) Collect raw text data from multiple sources, perform quality assessment and cleaning, and retain data that meets the quality threshold. and language consistency Standardized corpus ,in , , For data quality scoring functions;

[0199] 1.2) The text is deduplicated and merged, and hierarchical similarity calculation is used:

[0200]

[0201] like Then the merge is performed, where ;

[0202] Standardization of domain terminology and unification of units:

[0203]

[0204] And with expert glossary Consistency of constraint term mapping:

[0205]

[0206] 1.3) Constructing a Named Entity Labeling Dataset The BIO / BIOLU tagging system is adopted, and the consistency of the labeling is supervised by the conditional random field:

[0207]

[0208] Named entity annotation consistency adopts Cohen's Coefficient measurement, only adopting The samples entered the annotation set .

[0209]

[0210] 1.4) Collect and construct a causal relationship dataset ,in As contextual evidence, For confidence level, and to impose a heuristic prior on causal directionality:

[0211]

[0212] in As a chronological characteristic, A scoring function for causal conjunctions;

[0213] (2) Vector storage and segmentation management:

[0214] 2.1) Segment the text by semantic blocks or sentence-level sliding windows:

[0215]

[0216] And generate dense vectors for each segment. Sparse vectors ;

[0217] Segment length With overlap Automatically selected from the validation set:

[0218]

[0219] 2.2) Establish vector indexes and inverted index ,in , , , For index parameters; HNSW parameters satisfy , , , To optimize the recall-delay tradeoff.

[0220] 2.3) Assign topic fragmentation and time decay weights to the segmented data:

[0221]

[0222] Supports incremental updates and near real-time retrieval;

[0223] (3) Named entity recognition and two-round causal triple extraction based on RAG and LLM:

[0224] 3.1) Hybrid retrieval-driven context acquisition:

[0225] In user query The following retrieval strategy, which integrates keyword retrieval, dense vector retrieval, and sparse embedding, is used to calculate the retrieval score:

[0226]

[0227] in , and These are vector representations of the query and the text, respectively. The function is a sparse embedding function; to suppress redundancy and improve diversity, the maximum marginal relevance screening method is used.

[0228]

[0229] in To balance the parameters, For candidate sets;

[0230] Ultimately in context budget Under constraints, select a set of evidence. The optimization objective is: ,in , The score is rearranged for the cross encoder. As a measure of novelty, As a time decay weight;

[0231] Hybrid search includes pseudo-relevance feedback and query expansion:

[0232]

[0233] And dynamically adjust the weights :

[0234]

[0235] 3.2) RAG-enhanced Named Entity Recognition:

[0236] Based on search context Sequence labeling using a large language model:

[0237]

[0238] in Indicates a splicing operation;

[0239] Constraint decoding ensures that the labeled sequences conform to the BIO / BIOLU specification, and a domain-specific vocabulary is introduced. Perform entity standardization:

[0240]

[0241] in For a valid transition matrix, Alignment constraints between entities and the vocabulary;

[0242] Output entity set Each entity contains text, type, location, and canonical identifier;

[0243] 3.3) First round of causal triple extraction (candidate generation and initial direction determination):

[0244] Based on entity sets and context Generate candidate causal triples:

[0245]

[0246] For each candidate triple, an initial causal confidence score is calculated, taking into account trigger words, temporal order, statistical association, and model discrimination.

[0247]

[0248] in For causal trigger word matching score, As a chronological characteristic, For point-to-point information, The confidence level of the large language model in determining the causal direction;

[0249] The preliminary causal strength calculation is as follows:

[0250]

[0251] in For the Sigmoid function, retain those that satisfy... Candidate triples;

[0252] 3.4) Second round of causal triple completion and counterfactual verification:

[0253] For low confidence ( Candidates for components that are missing or incomplete trigger a re-search and counterfactual verification: - Through counterfactual queries Search for the set of evidence to refute the evidence :

[0254]

[0255] - If there is evidence to the contrary, then reduce the strength of causality:

[0256] in Strength of the counter-evidence;

[0257] - For incomplete causal pairs (such as those with only cause or effect), complete the missing entities based on the template and context to form a completion set. The final set of triples is: And ensure increased coverage: ;

[0258] 3.5) Integration of causal strength and confidence level:

[0259] Calculate the causal strength of the final triples, fusing evidence from multiple sources:

[0260]

[0261] in and These are the strengths of supporting and refutation evidence, respectively. These are weight parameters;

[0262] Output triples along with motive strength, confidence level, and chain of evidence. The format is:

[0263]

[0264] Among them, the chain of evidence Record the source fragment, timestamp, and retrieval path for subsequent conflict detection and question-and-answer tracing.

[0265] (4) Fusion of conflict detection and knowledge graph:

[0266] 4.1) Regarding the new triplet With existing maps Perform entity alignment:

[0267]

[0268] like Then merge the entities;

[0269] 4.2) Detecting causal conflicts and loops:

[0270]

[0271] And it employs soft logic constraints to minimize inconsistencies;

[0272] 4.3) Calculate the confidence level of the triples:

[0273]

[0274] And update the true value estimate using Bayesian methods;

[0275] 4.4) Output the fused knowledge graph Record the chain of evidence ;

[0276] (5) Causal question answering based on knowledge graphs:

[0277] 5.1) User issues Compile as a graph query And it uses a hybrid retrieval method to obtain supporting text;

[0278] 5.2) Perform multi-hop path reasoning on the graph:

[0279]

[0280] 5.3) Generate the answer and calculate the confidence level:

[0281]

[0282]

[0283] like Then it will return "Insufficient information".

[0284] The named entity recognition in step (3.2) employs a dual stabilization mechanism of constraint decoding and label voting:

[0285]

[0286] Step (3.3) causal directionality estimation integrates trigger words, temporal sequence, and causal template:

[0287]

[0288] The entity alignment in step (4.1) uses blocking and the learned matcher:

[0289]

[0290] And at the threshold Decision-making and communication closures are performed on top of each other.

[0291] The loop penalty in step (4.2) is defined as follows:

[0292]

[0293] And minimize For the goal.

[0294] Consistency of step (4.3) Calculated from the structural entropy of the multi-source evidence map:

[0295]

[0296] Step (4.4) involves fusing the knowledge graph to record the evidence chain. To support traceable questions and answers.

[0297]

[0298] The path reasoning in step (5.2) employs temperature regulation and length penalty:

[0299]

[0300] The consistency score for the answer in step (5.3) is:

[0301]

[0302] in For natural language implication determination.

[0303] The retrieval scores from steps (3.1) and (5.1) are Z-score normalized and segmented weighted:

[0304]

[0305] Step (3.2) assembles the RAG context using budget-aware window scheduling:

[0306]

[0307] in .

[0308] The confidence calculation of the answer in step (5.3) introduces an entropy-based uncertainty measure:

[0309]

[0310] The causal strength output interval confidence of step (3.3) is as follows:

[0311]

[0312] in The number of pieces of evidence.

[0313] The combined retrieval weights in steps (3.1) and (5.1) are adaptively allocated based on the question type:

[0314]

[0315] And iterate stably using a temperature annealing strategy:

[0316]

[0317] Step (5.3) of answer generation includes aligning the explanation template with the evidence:

[0318]

[0319] The post-processing of the answer in step (5.3) introduces a contradiction detector:

[0320]

[0321] If a contradiction is detected, backtracking to step (3.1) to enhance the retrieval and step (3.3) to complete the causal triple is triggered.

[0322] Example 12:

[0323] An apparatus includes a processor and a memory, the memory storing instructions that, when executed by the processor, implement the method as described in Example 11.

[0324] The memory stores a dual index library. and And achieve near real-time updates through memory mapping:

[0325]

[0326] Example 13:

[0327] See Figures 1 to 2 A causal knowledge graph construction and question answering system based on retrieval-enhanced generation and large language models, the main technical contents of which include:

[0328] 1. Data collection, cleaning, and label set construction

[0329] 1.1) Data Collection and Multi-Source Integration: Data sources include publicly available corpora, domain documents (such as standards, reports, and papers), user interaction logs, and experimental records. For data from different sources, unified encoding (such as UTF-8) and language detection are performed to ensure consistency in format and language. Each data entry includes metadata such as timestamp, source, and domain tag.

[0330] 1.2) Data cleaning and quality assessment: To ensure data reliability, the following cleaning strategy is adopted:

[0331] Noise filtering: Removes redundant parts such as garbled text, repeated paragraphs, and footnotes.

[0332]

[0333] in, For quality scoring functions, This is the cleaning threshold.

[0334] Duplicate Detection and Merging: Using Multi-Indicator Similarity calculate.

[0335] like If so, then merge is performed to avoid duplicate annotation of entities / relationships.

[0336] Terminology standardization: utilizing domain dictionaries Normalize synonyms, abbreviations, and different expressions:

[0337]

[0338] 1.3) Construction of Named Entity Labeling Dataset

[0339] Cleaned text A sequence labeling dataset was constructed using BIO / BIOLU labels:

[0340]

[0341] Cross-annotation by multiple annotators and Cohen's Consistency of coefficient evaluation:

[0342]

[0343] Only when Only then do the samples enter the final labeled set.

[0344] 1.4) Construction of Causal Datasets

[0345] Initial screening of candidate causal pairs using trigger words and dependency syntax rules. And preserve supporting context for each causal relationship. Confidence level labeling for causal pairs:

[0346]

[0347] in, As a chronological characteristic, Causal connector detection was performed. The final causal dataset was obtained:

[0348]

[0349] 1.5) Output: Normalized entity annotation dataset Causal datasets with evidence and confidence levels And the data's metadata (timestamp, source, domain tag).

[0350] 2. Vector Storage and Segmentation Management

[0351] 2.1) Text segmentation and hierarchical slicing: To address the issues of information loss and decreased retrieval accuracy when long texts are vectorized, this invention introduces a hierarchical segmentation strategy.

[0352] Sliding window segmentation: for documents By length With overlap rate slice:

[0353]

[0354] Ensure that adjacent segments are continuous in context to reduce semantic loss caused by truncation.

[0355] Multi-granularity slicing: generating indexes at the document, paragraph, and sentence levels respectively.

[0356]

[0357] By satisfying the hierarchical inclusion relationship, the retrieval can achieve both coarse recall and fine positioning.

[0358] 2.2) Multimodal vectorized coding: To improve semantic coverage and causal recognition capabilities, this invention employs multimodal coding fusion: dense encoding (Dense Embedding) is used to capture deep semantic features.

[0359]

[0360] in For pre-trained Transformer models (such as BERT, RoBERTa).

[0361] Sparse encoding (Sparse Embedding), employing sparse embedding models (such as SPLADE), maintains interpretability and keyword traceability at the word level:

[0362]

[0363] Causal feature encoding introduces causal prompts or causal trigger word embeddings into standard semantic vectors: ,in Capture suggestive causal signals such as "because," "cause," and "result."

[0364] Finally, the text fragment vector representation is as follows: This achieves a triple fusion of dense, sparse, and causal features.

[0365] 2.3) Index Structure and Efficient Retrieval: To support efficient retrieval, this invention employs a dual index structure:

[0366] Vector indexing (approximate nearest neighbor search ANN)

[0367]

[0368] Among them, HNSW (Hierarchical Navigable Small World Graph) is able to Achieving high recall with low complexity; where: The maximum number of neighbors controls the graph density; The size of the candidate set during construction; Expanding parameters during retrieval affects the recall-latency tradeoff.

[0369] 2.4) Sparse Index (Inverted Index)

[0370]

[0371] The BM25 section ensures rapid location of keywords and technical terms.

[0372] 2.5) Dual-index fusion retrieval: During the query, keywords are first screened using a sparse index, and then semantic similarity is calculated using a vector index on the candidate set to achieve a hybrid retrieval strategy of "fast screening + fine ranking".

[0373] 2.6) Segmented Management and Dynamic Updates

[0374] To ensure the timeliness of knowledge, this invention assigns a time decay factor to each segment:

[0375]

[0376] in The attenuation coefficient is... This is a timestamp for the segment.

[0377] Fragmented storage and topic clustering: Clustering algorithms (such as K-means or Spectral Clustering) are used to group fragments by topic to form fragmented storage, which facilitates the rapid location of causal information within a domain or topic.

[0378]

[0379] 2.7) Incremental update strategy: When new data arrives, incremental vectorization and local index insertion are performed.

[0380]

[0381] No need to rebuild the global index, ensuring the real-time scalability of the system.

[0382] 3. A multi-level retrieval architecture design, employing a hierarchical retrieval strategy, mainly includes:

[0383] 3.1) Document-level retrieval technology: Implementing a hybrid retrieval strategy that combines sparse and dense representations.

[0384]

[0385]

[0386] in, For query, For document, These are the weighting coefficients. For query and document encoders.

[0387] 3.2) Paragraph-level retrieval technology: Constructing a fine-grained interaction matrix and calculating paragraph similarity:

[0388]

[0389] Introducing context enhancement mechanism:

[0390]

[0391] in, Indicates text concatenation, PE For position encoding.

[0392] 3.3) Fusion Layer Design: Implementing a Dynamic Weighted Attention Mechanism:

[0393]

[0394] in, For each level of features, This is the global context vector.

[0395] The final fusion result is obtained through residual connections and layer normalization:

[0396]

[0397] 4 RAG-driven Named Entity Recognition and Two-Round Causal Triple Extraction

[0398] 4.1) Hybrid Retrieval and Context Building: Evidence recall is performed on the input query or candidate text through both keyword retrieval and vector retrieval channels to obtain a fusion score.

[0399]

[0400] in, Keyword retrieval score (e.g., BM25). This refers to the similarity of dense vectors (such as cosine similarity). Score for sparse representation (optional); For weight fusion.

[0401] To balance relevance and diversity, the candidate set is subjected to maximum marginal relevance screening, and context budgeting is applied. Next, select the evidence set. :

[0402]

[0403] in, Suppress redundancy, Due to time-related decay; These are the weight parameters.

[0404] 4.2) RAG-enhanced Named Entity Recognition (NER)

[0405] Based on the selected evidence With input sequence Sequence labeling for enhanced retrieval is achieved through a large language model:

[0406]

[0407] in, For valid annotation space (such as BIO / BIOLU). This indicates the score for constraint consistency (such as transfer constraints / structural consistency). Representation and domain vocabulary / ontology Alignment constraints; As weight.

[0408] Get the entity set: in, This represents a normalization / disambiguation mapping, outputting normalized entity identifiers. .

[0409] 4.3) First round of causal triplet extraction (candidate and direction determination)

[0410] by With evidence Based on this, construct a set of candidate causal triples. For each candidate, calculate the causal direction and initial confidence value:

[0411]

[0412] in, Scoring of causal trigger words / patterns (such as "cause / initiate / therefore / thus") This is a time sequence indicator (points are awarded if the cause precedes the effect). For cross-document point mutual information, For the model to be oriented The confidence level of the judgment; Non-negative weights This is an S-shaped mapping. It will satisfy... The candidates were selected as the results of the first round.

[0413] 4.4) Second round of causal completion and verification

[0414] For candidates with low confidence, incompleteness, or uncertain direction, a RAG-based re-search and supplementary verification is triggered to form a complete set. The confidence level is updated by integrating the supporting and refutating strengths of supplementary evidence.

[0415]

[0416] in, The supporting evidence set obtained from the subsequent retrieval, A set of reverse / counterfactual evidence; and These are quantifications of the strength of support and dissent, respectively. As weights. For incomplete pairs that only identify "cause" or "effect," fill in the missing items based on the template retrieval: The confidence level is then updated according to the above formula; the final set of triples is obtained.

[0417] 4.5) Consistency and entry threshold

[0418] To prevent "correlation as causation" and reversal of direction, for the same Consistency testing and conflict flagging of multi-source evidence:

[0419]

[0420] in, For indicator functions, This is the threshold for map entry; those that do not meet the criteria are marked as "pending adjudication" and handed over to the "conflict detection and existing map fusion" module for processing.

[0421] 5. Conflict Detection and Map Fusion

[0422] 5.1) Conflict detection mechanism: The newly extracted causal triples... Integrating into existing maps At this time, entity alignment, conflict detection, and loop constraints are required. Detection includes directional conflicts and loop formation to ensure the directed acyclic property of causal relationships.

[0423] 5.2) Fusion Confidence Calculation: Fusion confidence is obtained based on evidence-rule-consistency multi-source weighted average.

[0424]

[0425] in For the average weight of evidence, To extract the confidence mean in multiple rounds, A consistency score is given.

[0426] 5.3) Evidence Chain Records and Traceability

[0427] Preserve a complete chain of evidence for each causal relationship. This includes: source document identifier and fragment location, retrieval path and timestamp, extraction model version and parameter configuration.

[0428] 6. Question-answering reasoning and answer evaluation based on causal graphs

[0429] 6.1) Multi-hop causal reasoning: For user-generated causal questions such as "why," "due to what," and "if...will," the system performs multi-hop reasoning on the causal graph.

[0430]

[0431] in, For the reasoning path, For attention weights, The strength of causality.

[0432] 6.2) Answer generation and confidence assessment: Answers are generated by combining textual evidence and graph path confidence, and the answer confidence and consistency scores are calculated. When the confidence level is lower than a set threshold, "Insufficient Information" is returned to reduce the risk of errors and meet audit requirements.

[0433] 6.3) System output: Natural language answer; support for causal paths and textual evidence; answer confidence score and consistency assessment results.

[0434] Example 14:

[0435] See Figures 1 to 2 A causal knowledge graph construction and question answering system based on retrieval-enhanced generation and large language models, the main technical contents of which include:

[0436] Data Acquisition and Causal Dataset Construction Module: This module is responsible for acquiring raw text from multi-source data and constructing a high-quality causal dataset. It collects raw text data from multiple domains and adds metadata such as source, timestamp, and domain label to each data record. The data cleaning process employs a quality scoring function.

[0437] ,

[0438] A quality threshold τ=0.6 is set to automatically filter low-quality content. Text deduplication and merging are achieved through hierarchical similarity calculation; a merging operation is triggered when the similarity exceeds the threshold. For specialized fields, domain expert vocabularies (such as medical UMLS and engineering terminology databases) are integrated, and terminology standardization is achieved through string matching and semantic similarity calculation. Named entity annotation adopts the BIO / BIOLU tagging system, and only high-quality annotated samples with κ>0.75 are retained through cross-annotation by multiple annotators and calculation of Cohen's κ coefficient. The causal relationship dataset construction process includes causal trigger word identification (such as "cause", "initiate", "therefore", etc.), temporal feature extraction, and confidence scoring to ensure that the constructed causal dataset has a clear direction and verifiable evidence support.

[0439] The vector storage and segmentation management module transforms the cleaned text into an efficient retrieval structure. Text segmentation employs a multi-granularity strategy: document-level metadata is preserved, paragraph-level segmentation is based on topic, and sentence-level segmentation ensures fine-grained retrieval. The sliding window segmentation is set to a length L=256±32 characters and an overlap rate o=15%, ensuring contextual continuity between adjacent segments. Vector encoding utilizes a triple fusion mechanism: the SPLADE model generates sparse vectors, the sentence-transformers / all-mpnet-base-v2 model generates dense vectors, and causal feature enhancement is added to further enhance the vectors. Index construction employs a dual-channel design, with HNSW parameters set to M=32, ef_search=50, ef_construction=200, and BM25 parameters k1=1.2, b=0.75. To support timeliness control, each segment is assigned a time decay weight w_t=e^(-λ(t_now-t_doc)), where λ=0.01. The system supports incremental updates; after a new document is vectorized, only partial index insertion is needed, avoiding full reconstruction and ensuring the system's real-time scalability. The topic sharding function is implemented using the K-means clustering algorithm, organizing texts on similar topics into the same shard, accelerating domain-specific retrieval efficiency.

[0440] The retrieval enhancement generation module enables multi-level information retrieval from the knowledge base and, combined with the ability to generate large models, provides accurate and semantically rich answers. This module significantly improves the response speed and the relevance and accuracy of answers through the organic integration of sparse and dense retrieval, thereby achieving efficient query response and intelligent answer generation in knowledge-based question-answering applications in the design field.

[0441] Multi-level retrieval strategy: This module employs a multi-level retrieval strategy to achieve efficient filtering and precise positioning of user queries. The core of this module lies in processing user queries at different semantic levels through a layered combination of sparse and dense retrieval, thereby meeting diverse query needs and adapting to complex question-and-answer scenarios.

[0442] 1) Sparse Retrieval: Sparse retrieval uses the classic BM25 model for keyword matching and relevance calculation, primarily for quickly filtering out the most relevant documents to the query. The BM25 model is a traditional retrieval algorithm based on term frequency and inverse document frequency, suitable for information filtering tasks in large-scale knowledge bases. Its relevance calculation formula is:

[0443]

[0444] in, Indicates a query. Represents a document. Total number of documents For containing query terms The number of documents, For words In the document The frequency in and These are the adjustment parameters for the model. Using this formula, the system can quickly filter out highly relevant documents containing keywords, meeting the basic needs of user queries. The main function of sparse retrieval is to initially filter candidate documents that have obvious lexical matches with the query, making it particularly suitable for queries with dense lexical matching and explicit keywords. This method can quickly narrow down the search space in the early stages of the query, providing a high-quality candidate set for subsequent intensive retrieval, thereby improving overall retrieval efficiency.

[0445] 2) Dense Retrieval: After initial candidate documents are selected through sparse retrieval, deeper semantic matching is performed using semantic vector representations generated by large models (such as BERT or GPT). Its advantage lies in its ability to overcome the limitations of surface-level word matching, identifying content that is semantically relevant to the query, even if the representations are not lexically identical. Dense retrieval measures the relevance between the query and the document using vector similarity, calculated using the following formula: .in, and Let represent the vector representations of the query and the document, respectively; · represents the dot product operation; and . and represent the norms of the vectors, respectively. Using this formula, dense retrieval can capture the deep semantic connections between queries and documents, enabling question-answering systems to answer questions with different vocabulary but similar semantics, further improving the accuracy and coverage of retrieval.

[0446] By combining preliminary filtering through sparse retrieval with semantic matching through dense retrieval, a highly efficient hierarchical filtering framework is constructed. It can adapt to diverse user needs in different query scenarios, ensuring an optimal balance between query efficiency and answer quality, and providing a highly relevant candidate document set for subsequent processing.

[0447] Enhanced Retrieval Generation: Building upon multi-level retrieval strategies, this feature further incorporates generative techniques from large-scale models to provide users with coherent and semantically rich answers. Centered on a generative model, it integrates and reconstructs candidate documents based on knowledge base content in the power sector, generating accurate answers that match the user's query intent.

[0448] The generation process consists of the following three key steps:

[0449] 1) Contextual Understanding: The generation module first performs contextual analysis on the retrieved candidate document set to extract background information and key points relevant to the query. This contextual understanding process relies on the semantic modeling capabilities of the generative model, enabling the system to accurately grasp the user's query intent and context, and reflect content highly aligned with the user's needs in the response. In design applications, this process can identify key contextual factors related to the query, such as technical background, equipment type, and exterior / interior design.

[0450] 2) Content Generation and Organization: Based on the results of contextual understanding, the generation module organically integrates and reconstructs the answer content through a generation model. According to the query intent and contextual information, the generation model extracts and summarizes key information from candidate documents, generating logically coherent answer content that conforms to design domain terminology and expression habits. The generation process is not merely a simple combination of information, but also includes reasoning and interpretation of knowledge. For example, for complex design information, the generation module can provide detailed operational steps and theoretical basis, thereby enhancing the practicality and professionalism of the answer.

[0451] 3) Optimization of Generated Results: To ensure the accuracy, consistency, and readability of the answers, the generation module further optimizes the generated results, including grammatical correction, logical consistency checks, and terminology standardization. This process ensures the accuracy of the generated answers in terms of professional terminology, grammatical structure, and logical order. Especially for question-and-answer scenarios in the design field, the result optimization steps effectively improve the professionalism of the answers, providing users with clear and easy-to-understand responses.

[0452] By designing a retrieval-enhanced generation module, this system achieves rapid response and high-quality answers to user queries in the design field, overcoming the disconnect between retrieval and generation in traditional knowledge-based question-answering systems. While improving the accuracy of information retrieval, this module further enriches the answer content through generation technology. It is suitable not only for simple knowledge query scenarios but also for complex problem reasoning and professional explanation needs, providing effective technical support for the practical application of knowledge-based question-answering systems in the power industry.

[0453] Named Entity Recognition and Two-Round Causal Triple Extraction Module Based on RAG and LLM: This module is the core component of the system, realizing the transformation from text to structured causal knowledge. In the hybrid retrieval stage, the system calculates a fusion score.

[0454]

[0455] The weights are dynamically adjusted based on the query type. To balance relevance and diversity, the Maximum Marginal Relevance (MMR) algorithm is used for candidate selection, with λ=0.7. Under context budget constraints, the optimal evidence set is obtained through cross-encoder rearrangement. RAG-enhanced named entity recognition utilizes the retrieved context and performs sequence labeling through a large language model. Constraint decoding is introduced to ensure that the labeling conforms to the BIO / BIOLU specification and is aligned with the domain vocabulary. The first round of causal triple extraction generates a candidate set and calculates the initial causal confidence value, integrating trigger word matching, temporal features, point mutual information, and model-discriminated confidence. The second round performs completion and counterfactual verification, triggering re-retrieval of candidates with low confidence and verifying causal strength through counterfactual queries to form an evidence chain record. The final output triple contains subject and object entities, causal strength, confidence, and a complete evidence chain, providing high-quality input for knowledge graph construction.

[0456] Conflict Detection and Knowledge Graph Fusion Module: This module ensures the consistency between newly extracted causal triples and the existing knowledge graph. Entity alignment employs a combination of blocking and the learned matcher; entity merging is triggered when the similarity exceeds a threshold θ=0.85. The conflict detection stage focuses on identifying two types of problems: directional conflicts (both A→B and B→A exist simultaneously) and causal loops (A→B→C→A). For conflicts, soft logic constraints are used to minimize inconsistencies. Triple credibility calculation integrates multi-dimensional evidence:

[0457]

[0458] Each weight is determined through Bayesian optimization. Truth estimation is achieved through a Bayesian update mechanism, using historical credibility as prior and new evidence as likelihood. The knowledge graph fusion process preserves a complete chain of evidence, including source document identifiers, fragment locations, retrieval paths, timestamps, and model versions, ensuring that each causal relationship is traceable and verifiable. Conflict resolution strategies include: evidence weight comparison (prioritizing high-weight evidence), time priority (newer evidence takes precedence), and expert rule intervention (automatic judgment of specific domain rule coverage), forming a unified and consistent causal knowledge graph.

[0459] A knowledge graph-based causal question-answering module implements user-oriented causal reasoning and question-answering functions. User questions are first compiled into graph queries, and supporting textual evidence is obtained through hybrid retrieval. Multi-hop path reasoning is performed on the causal knowledge graph, employing an attention mechanism to evaluate the contribution of different paths. Path weight calculation considers causal strength, evidence quality, and time decay factors. Answer generation combines the graph reasoning results with the retrieved textual evidence to generate a natural language answer using a large language model. Confidence assessment employs a multi-dimensional fusion method.

[0460] .

[0461] When the confidence level is below the threshold τ_a = 0.65, the system returns "insufficient information" rather than a low-quality answer. Post-processing of the answer introduces a contradiction detector, verifying answer consistency through a Natural Language Entailment (NLI) model. If a contradiction is detected, a backtracking mechanism is triggered to enhance retrieval or complete causal triples. The system output not only includes the natural language answer but also provides supporting causal paths, textual evidence, and confidence scores, enhancing interpretability. For counterfactual questions ("if...would"), the system provides hypothetical reasoning through intervention simulation and path replanning, expanding application scenarios.

[0462] Example 15:

[0463] A causal knowledge graph construction and question-answering system based on retrieval enhancement generation and large language model, the main technical content of which is described in Example 14, further includes: 1. Attribution analysis of automotive exterior styling: In automotive exterior design reviews or market feedback analysis, designers often need to answer causal questions such as "Why is a certain model perceived by users as 'lacking in sportiness'?" Traditional keyword retrieval cannot reveal the deep causal chain between "design elements—perceived attributes—user evaluation". This system achieves accurate attribution through causal knowledge graphs:

[0464] 1) Query input: User asked, "Why is the front of the Model X considered to lack a sporty look?"

[0465] 2) Hybrid retrieval and evidence acquisition: The system integrates keywords ("ModelX", "front face", "sporty", etc.), dense vectors (semantic matching style words such as "aggressive", "low-profile", "wide body") and sparse embedding to recall relevant fragments from texts such as design reports, user surveys, and competitor analysis.

[0466] 3) Two-round causal triple extraction:

[0467] - The first round identifies candidate causal pairs, such as <small grille size> → <weak sense of movement>, and calculates the initial confidence level based on trigger words ("appears conservative"), time sequence (design precedes evaluation), and PMI (co-occurrence intensity);

[0468] - In the second round, counterfactual queries are initiated against low-confidence triples (such as those that only mention "small grille" but do not specify causality): "Would increasing the grille improve the sense of sportiness?" Engineering simulations or A / B test reports are retrieved as supporting / counterfactual evidence.

[0469] 4) Multi-hop causal reasoning and answer generation: The system's reasoning path on the causal graph:

[0470] Small grille size → lower visual center of gravity → conservative user perception → lower sportiness score

[0471] The report provides a chain of evidence: "According to feedback from the Q2 2024 user focus group (ID: FG-2024-06), 78% of respondents believed that the Model X's front grille area was smaller than that of its competitor, Model Y, resulting in insufficient visual impact (evidence fragment #128). The CAE sentiment analysis model also shows that for every 5% decrease in grille proportion, the 'sportiness' NPS drops by 3.2 points (evidence fragment #205)."

[0472] 2. Interior Human-Machine Interface (HMI) Experience Optimization: In cockpit design, it's necessary to understand causal issues such as "why a certain functional layout leads to an increased error rate." This invention supports design iteration by constructing a causal graph of "control location—operation path—error type." The application process is as follows:

[0473] 1) Search query: "Why does placing the air conditioning knob below the center console screen increase driver distraction?"

[0474] 2) Entity recognition and causal extraction:

[0475] -RAG enhanced NER accurately identifies entities such as "air conditioning knobs", "below the center console screen", and "distracting driving objects";

[0476] - Extract the causal triple <knob located below the screen> → <gaze deflection angle > 15°> → ​​<increased distraction level>, and correlate it with eye-tracking experimental data as evidence.

[0477] 3) Conflict detection and fusion: If there is a positive relationship in the existing map such as "knob down → operation convenience ↑", the system detects a directional conflict and activates soft logic constraints: combining ergonomic rules (ISO15008) and measured data, it determines that "safety takes priority" in high-speed scenarios and retains negative causality.

[0478] 4) Explainable Q&A Output: The system returned: "Eye-tracking data (Project ID: HMI-2023) shows that when the knob is located below the screen, the driver's average line-of-sight shift reaches 18.3°, exceeding the safety threshold of 15° (ISO15008). Although this layout improves static operation efficiency (+12%), the false touch rate increases by 27% at speeds above 60km / h (Evidence chain: ET-2023-112→HMI-Report-v3). It is recommended to refer to the floating knob design of the Model Z."

[0479] 3. Configuration Optional Logic and Causal Modeling of User Decisions: In customized configuration recommendations, it is necessary to understand the reasons behind decisions such as "why users abandon the option of upgrading to a high-end audio system." This invention extracts the causal chain of "configuration item—price sensitivity—alternative solution" from sales logs, customer service dialogues, and forum comments. Example:

[0480] 1) Question: "Why do car owners under 300,000 yuan rarely opt for branded audio systems?"

[0481] 2) Cross-source causal fusion:

[0482] - Extracted from the sales system log: <Budget <300,000> → <Abandon branded audio equipment> (confidence level 0.82);

[0483] - Add counterfactual evidence from the forum text: "If a free upgrade package is included, the optional installation rate increases to 41%";

[0484] - A conflict with prior knowledge of "strong correlation with sound preference" was detected, and the confidence level was adjusted by updating it using Bayesian methods.

[0485] 3) Multi-hop inference output: The system infers a complete causal path:

[0486] Budget constraints → perceived low cost-effectiveness → shift towards basic audio system + aftermarket solutions

[0487] The suggestion was: "A 'speaker + seat heating' bundled discount package could be launched. Historical data shows that this combination increases conversion rate by 19% in the 250,000-300,000 range (evidence: CRM-2024-Q3)."

[0488] 4. Material-Process-Cost Causal Chain Construction (for early design decisions): During the conceptual design phase, engineers need to assess the impact of using a carbon fiber hood on the overall vehicle cost and performance. This invention constructs a cross-domain causal graph, connecting nodes related to materials, processes, weight, cost, and regulations. Application process:

[0489] 1) Question: "What are the chain reactions that will result from using a carbon fiber hood?"

[0490] 2) Causal triple completion and verification:

[0491] - First round of sampling: <carbon fiber hood> → <weight reduction of 12kg> → <fuel consumption per 100km ↓0.3L>;

[0492] - The second round of triggering and re-searching: "carbon fiber repair cost" and "pedestrian protection regulation compliance" found counter-evidence: <carbon fiber> → <low-speed collision repair cost ↑300%>, and the system downgraded the positive causal strength accordingly.

[0493] 3) Conflict resolution and integration: The original <lightweighting → increased safety> in the graph has been revised to conditional causality: "It only holds true in high-speed collision scenarios. In low-speed scenarios, the rating may be lowered due to differences in energy absorption characteristics."

[0494] 4) Structured output: The system generates a causal network diagram with confidence level and attaches a chain of evidence: "Weight reduction data comes from CAE simulation (SIM-CF-2024), maintenance costs are from the Insurance Institute report (IIS-2023-089), and pedestrian protection test results are from Euro NCAP 2024 Q2 announcement."

Claims

1. A causal knowledge graph construction and question-answering system based on retrieval-enhanced generation and a large language model, characterized in that, include: The module includes a multi-source heterogeneous knowledge base construction module, a retrieval enhancement generation module, a named entity recognition and causal triple extraction module, and a knowledge fusion reasoning module. The multi-source heterogeneous knowledge base construction module is based on a multi-level vector index to process multi-source raw text data and construct a causal knowledge graph. The retrieval enhancement generation module uses a hybrid retrieval strategy to filter out a set of retrieval contexts related to the user's input query from a causal knowledge graph. The named entity recognition and causal triple extraction module concatenates the retrieval context set and the user input query, inputs them into the large language model for sequence labeling, and obtains the entity set. The named entity recognition and causal triple extraction module generates candidate causal triples based on the entity set and the retrieval context set, and extracts a set of candidate causal triples with an initial confidence level not less than a threshold. The named entity recognition and causal triple extraction module performs counterfactual retrieval on candidate causal triples whose initial confidence is less than the threshold to obtain the final set of causal triples. The knowledge fusion reasoning module is used to perform conflict detection and knowledge graph fusion on the final causal triple set to obtain the fused causal knowledge graph. The knowledge fusion reasoning module infers the user's input query based on the fused causal knowledge graph and generates the corresponding answer.

2. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 1, characterized in that, The steps for constructing a causal knowledge graph using the multi-source heterogeneous knowledge base construction module are as follows: A1 acquires multi-source raw text data and preprocesses the multi-source raw text data; The multi-source raw text data includes named entity tags, causal pairs, timestamps, source, and domain tags; A2 constructs a named entity annotation dataset based on preprocessed multi-source raw text data, as shown below: (1) In the formula, A represents the named entity annotation dataset; This represents the preprocessed multi-source raw text data; M represents the text index; M represents the total number of texts. Indicates named entity annotation; A3 constructs a causal relationship dataset based on preprocessed multi-source raw text data, as shown below: (2) In the formula, C represents the causal relationship dataset; Indicates a cause-and-effect index; Indicates the total number of causal pairs; Indicates a causal pair, where, For the reason, For the result; Indicates contextual evidence; Indicates confidence level; A4 segments the preprocessed multi-source raw text data using a sliding window, as shown below: (3) In the formula, Represents text in a causal knowledge graph; Represents a set of segments of text in a causal knowledge graph; Indicates a segmented index; Indicates the total number of segments; Indicates the first Each segment; Indicates the sliding window length; o represents the overlap rate; overlap represents the overlap length between adjacent segments; t represents the segment timestamp; For each segment, A5 generates dense and sparse vectors, as shown below: (4) In the formula, These represent dense vectors and sparse vectors, respectively. These represent the pre-trained Transformer model and the sparse embedding model, respectively. A6 constructs vector indices and inverted indices as follows: (5) In the formula, These represent vector index and inverted index, respectively. Represents a vector indexing function; Indicates the inverted index function; All are index parameters; A7 assigns topic fragmentation and time decay weights to each segment, as shown below: (6) 3. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 2, characterized in that, The sources of the multi-source raw text data include public corpora, domain documents, user interaction logs, and experimental records; The domain documentation includes standards, reports, and papers; The preprocessing includes noise filtering, data merging, and terminology standardization.

4. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 3, characterized in that, The noise filtering is as follows: (7) The data is merged into original text data with a similarity greater than a similarity threshold, where the similarity is as follows: (8) The terminology is standardized as follows: (9) Record as a synonym.

5. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 1, characterized in that, The steps for selecting the set of retrieval contexts related to the user's input query from the causal knowledge graph based on the hybrid retrieval strategy are as follows: B1 uses a hybrid retrieval strategy to retrieve text related to the user's input query from a causal knowledge graph and construct a candidate set. The hybrid retrieval strategy includes keyword retrieval, dense vector retrieval, and sparse embedding retrieval. B2 calculates the combined retrieval score for all texts in the candidate set, as shown below: (10) B3 calculates the maximum marginal relevance of all texts in the candidate set based on the hybrid retrieval score, and removes texts with a maximum marginal relevance less than the marginal relevance threshold from the candidate set. The maximum marginal correlation is as follows: (11) B4 selects text from the candidate set under the context budget constraint to construct the retrieval context set, as shown below: (12) (13) 6. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 1, characterized in that, The steps to obtain the entity set are as follows: C1 concatenates the retrieval context set and the user input query, then inputs the result into a large language model for sequence labeling, as shown below: (14) C2 performs normalization on labeled sequences and entities, as shown below: (15) C3 constructs an entity set based on the normalized annotation sequence, where each entity includes text, type, location, and the normalized annotation sequence; The types of entities include, but are not limited to, people, organizations, locations, events, times, physical objects, and abstract concepts.

7. The causal knowledge graph construction and question answering system based on retrieval enhancement generation and large language model according to claim 1, characterized in that, The steps for extracting the candidate causal triple set are as follows: D1 generates candidate causal triples based on the entity set and the retrieval context set, as shown below: (16) D2 calculates the initial confidence scores for all candidate causal triples, as shown below: (17) (18) D3 constructs and initializes a set of candidate causal triples; D4 determines whether the initial confidence level of all candidate causal triples is not less than the initial confidence level threshold. If so, the corresponding candidate causal triple is added to the candidate causal triple set.

8. A causal knowledge graph construction and question answering system based on retrieval enhancement generation and a large language model according to claim 7, characterized in that, The steps to obtain the final set of causal triples are as follows: E1 retrieves the set of counterfactual evidence through a counterfactual query, as shown below: (19) (20) E2 determines whether the set of evidence to refute is empty. If not, proceed to step E3; if so, proceed to step E5. E3 updates the initial confidence level as follows: (21) E4 determines whether the updated confidence of all candidate causal triples is not less than the confidence threshold for proof by contradiction. If so, the corresponding candidate causal triple is added to the candidate causal triple set. E5 determines whether there are incomplete causal pairs. If so, it completes the missing entities based on the template and context to form a complete set. E6 constructs the final set of causal triples based on the candidate causal triple set and the completion set, as shown below: (22) In the formula, Represents the final set of causal triples; Represents the set of candidate causal triples; Indicates the completion of a set; causes indicate a causal relationship. This indicates the chain of evidence, including its source, fragments, timestamps, and retrieval path. Among them, the confidence level of the final causal triple. As shown below: (23) 9. A causal knowledge graph construction and question answering system based on retrieval enhancement generation and a large language model according to claim 1, characterized in that, The steps to obtain the fused causal knowledge graph are as follows: F1 performs entity alignment between the final set of causal triples and the causal knowledge graph, as shown below; (24) F2 performs conflict detection between the final set of causal triples after entity alignment and the causal knowledge graph, as shown below: The conflict detection is used to identify and eliminate causal triples that contain logical contradictions; F3 calculates the confidence level for the final set of causal triples that meet the conflict detection criteria, as shown below: (26) F4 integrates the final causal triples with a credibility greater than the credibility threshold into the causal knowledge graph, resulting in the integrated causal knowledge graph.

10. A causal knowledge graph construction and question answering system based on retrieval enhancement generation and a large language model according to claim 1, characterized in that, The steps for generating the corresponding answer are as follows: G1 compiles user-input queries into graph queries and retrieves supporting text based on a hybrid retrieval strategy; G2 performs multi-hop reasoning on graph queries on the fused causal knowledge graph, as shown below: (27) G3 calculates the inference confidence and generates an answer corresponding to the user's input query, as shown below: (28) (29) In the formula, This represents the overall reasoning confidence in the generated answer, when... Less than the preset inference threshold When the query is not generated, an answer corresponding to the user's input will be returned with an insufficient information message. , represent the weight coefficients of the path reasoning score, text question answering score, and evidence consistency score, respectively. ; This represents the generated answer corresponding to the user's input query q; LLM stands for Large Language Model; docs represents the set of supporting texts. This refers to a document within the supporting text collection docs; This indicates the query q and the document. Calculated answer matching score; Represents the function for evaluating the consistency of evidence; Let K represent the set of all supporting evidence; K represents a constant. These represent the top K inference paths with the highest probability. This represents the top K documents most relevant to the user's input query q; The answer includes natural language answer, reasoning path, textual evidence, and confidence level.

Citation Information

Cited By

  • A multi-agent collaborative retrieval system and method based on large model causal verification

    CN122262318A