Knowledge graph question and answer interaction method and system based on artificial intelligence
By using dynamic weight allocation and multi-path collaborative reasoning algorithms, combined with users' historical interaction preferences, a hierarchical query subgraph is constructed. This addresses the shortcomings of existing question-answering systems in deep semantic association and multi-source evidence fusion, achieving more accurate and interpretable question-answering interaction and improving user experience and information acquisition efficiency.
Patent Information
- Application Number
- CN202511236635.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-12-09
AI Technical Summary
Existing knowledge graph-based question answering systems struggle to accurately capture deep semantic relationships between entities when dealing with complex multi-hop questions and answers. They also lack adaptive learning mechanisms for users' historical interaction preferences, leading to discrepancies between the generated answers and the users' actual needs. Furthermore, most systems fail to effectively integrate heterogeneous evidence from multiple sources, affecting the accuracy and interpretability of the responses.
By using a dynamic weight allocation mechanism to perform hierarchical parsing of entity words and intent words, enhanced semantic vectors are generated. A hierarchical query subgraph containing core entities, related entities, and implicit relationships is constructed. A multi-path collaborative reasoning algorithm is used for reasoning calculation, and adaptive answers are generated by combining user historical interaction preferences, thus forming a closed loop of question-and-answer interaction.
It improves the accuracy and explainability of question-and-answer interactions, enhancing the user experience and information retrieval efficiency.
Smart Images

Figure CN121094130A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of knowledge graph technology, and in particular to an artificial intelligence-based knowledge graph question-answering interaction method and system. Background Technology
[0002] In recent years, with the rapid development of artificial intelligence technology, knowledge graph-based question-answering systems have gradually become a research hotspot in the field of natural language processing. Knowledge graphs, with their powerful semantic representation capabilities and structured association characteristics, provide rich information support for question-answering interactions. Existing methods typically rely on entity linking and relation extraction techniques to parse user questions and return answers based on graph queries. However, when dealing with complex multi-hop question-answering, these methods often struggle to accurately capture deep semantic relationships between entities and have limited ability to understand implicit relationships and dynamic contexts. Furthermore, most systems lack adaptive learning mechanisms for users' historical interaction preferences, leading to discrepancies between the generated answers and the user's actual needs. In addition, traditional question-answering models often rely on single-path retrieval during the reasoning process, making it difficult to effectively integrate multi-source heterogeneous evidence, thus limiting the accuracy and interpretability of the answers. Summary of the Invention
[0003] The purpose of this invention is to provide a knowledge graph-based question-answering interaction method and system based on artificial intelligence, so as to overcome the shortcomings of the existing technology, improve the accuracy and interpretability of question-answering interaction, and enhance the user interaction experience and information acquisition efficiency.
[0004] One embodiment of this application provides a knowledge graph question-answering interaction method based on artificial intelligence, the method comprising:
[0005] The system receives natural language questions from users and performs hierarchical parsing of entity words and intent words in the questions through a dynamic weight allocation mechanism. This generates an enhanced semantic vector that includes entity association strength and intent probability distribution. The dynamic weights are adjusted in real time based on historical interaction data of similar questions.
[0006] Based on the knowledge graph traversal of enhanced semantic vectors, a hierarchical query subgraph containing core entities, related entities and implicit relationships is constructed. The core entity layer retains direct relationships, the related entity layer filters indirect relationships through path decay coefficients, and the implicit relationship layer mines potential relationships based on co-occurrence frequency.
[0007] A multi-path collaborative reasoning algorithm is used to perform reasoning calculations on the hierarchical query subgraph to generate a set of candidate answers. The algorithm verifies explicit relational paths through rule reasoning, completes implicit relational paths through graph embedding models, and dynamically allocates reasoning weights based on path confidence.
[0008] The candidate answer set is semantically consistent and redundant is eliminated. Adaptive answers and related explanation paths are generated by combining the user's historical interaction preferences. Newly discovered entity relationships are fed back to the knowledge graph for incremental updates, forming a closed loop of question-and-answer interaction.
[0009] Optionally, the natural language question received from the user input is used to perform hierarchical parsing of entity words and intent words in the question through a dynamic weight allocation mechanism to generate an enhanced semantic vector containing entity association strength and intent probability distribution. The dynamic weights are adjusted in real time based on historical interaction data of similar questions, including:
[0010] The system receives natural language questions input by users, performs word segmentation and part-of-speech tagging using a word segmentation tool, distinguishes parts of speech and filters stop words, and obtains a preprocessed word segmentation sequence.
[0011] Extract entity words and intent words from the segmented sequence to obtain entity word sets and intent word sets;
[0012] The historical interaction database is called to extract the contribution data of entity words and intent words in similar questions. The dynamic weights of the two types of words in the current question are calculated by using a time-series decay function to obtain the entity word weights and intent word weights.
[0013] The entity word set and intent word set are mapped to vectors respectively, and weighted fusion is performed according to dynamic weights. The association strength between entities and the probability distribution of intent are calculated to generate enhanced semantic vectors.
[0014] Optionally, the step of traversing the knowledge graph based on enhanced semantic vectors to construct a hierarchical query subgraph containing core entities, related entities, and implicit relationships, wherein the core entity layer retains direct relationships, the related entity layer filters indirect relationships through path decay coefficients, and the implicit relationship layer mines potential relationships based on co-occurrence frequency, including:
[0015] The enhanced semantic vectors are matched with the entity vectors in the knowledge graph for similarity, and entities with a matching degree higher than a preset matching threshold are selected as core entities to obtain the core entity set.
[0016] Starting with the core entity set, traverse the knowledge graph, extract the direct relationships and attribute information between the core entities, construct the core entity layer containing entity nodes and direct relationship edges, and obtain the core entity layer subgraph.
[0017] The query path is expanded based on the core entity layer subgraph. The path decay coefficient of each indirect path is calculated. Indirect related entities and relationships with coefficients higher than the preset coefficient threshold are retained to construct the related entity layer and obtain the related entity layer subgraph.
[0018] In a statistical knowledge graph, entity pairs that are not directly related but co-occur frequently are analyzed to calculate the potential association strength based on their co-occurrence frequency. Implicit relationships are then mined and an implicit relationship layer is constructed. By integrating the core entity layer, the related entity layer, and the implicit relationship layer, a hierarchical query subgraph is obtained.
[0019] Optionally, the multi-path collaborative reasoning algorithm is used to perform reasoning calculations on the hierarchical query subgraph to generate a candidate answer set. This algorithm verifies explicit relationship paths through rule-based reasoning, completes implicit relationship paths through graph embedding models, and dynamically allocates reasoning weights based on path confidence, including:
[0020] The explicit relational paths in the hierarchical query subgraph are validated by applying preset inference rules. Paths that do not conform to the rules are eliminated, and valid explicit paths are retained to obtain the validated set of explicit paths.
[0021] A graph embedding model is used to learn the vector representation of the hierarchical query subgraph. Implicit relation paths are completed by calculating vector similarity, resulting in a complete set of implicit paths.
[0022] The confidence scores of each path in the verified explicit path set and the completed implicit path set are calculated separately. The confidence scores of explicit paths are calculated based on the rule matching degree, and the confidence scores of implicit paths are calculated based on the vector similarity. The path confidence scores are then obtained.
[0023] The reasoning weights are dynamically allocated based on the path confidence values. Explicit and implicit paths are then used for collaborative reasoning according to their weights. The reasoning results are then merged to obtain a set of candidate answers.
[0024] Optionally, the step of performing semantic consistency verification and redundancy removal on the candidate answer set, generating suitable answers and related explanation paths based on user historical interaction preferences, and simultaneously feeding newly discovered entity relationships back to the knowledge graph for incremental updates, forming a closed loop of question-and-answer interaction, includes:
[0025] Calculate the semantic similarity between each answer in the candidate answer set and the original question, filter out answers with similarity higher than a preset similarity threshold, remove semantically conflicting answers, and obtain a subset of candidate answers with consistent semantics;
[0026] Redundancy calculation is performed on the semantically consistent subset of candidate answers, and answers with different expressions but the same core content are merged to obtain a simplified candidate answer set;
[0027] By calling upon users' historical interaction preference data, analyzing users' preferences for the level of detail and style of answer expression, adjusting and simplifying the expression of candidate answers, and generating suitable answers and corresponding reasoning and explanation paths;
[0028] Newly discovered entity relationships are extracted during the reasoning process, and their validity is verified before incremental updates to the knowledge graph are performed, forming a closed loop of question-and-answer interaction.
[0029] Another embodiment of this application provides a knowledge graph question-answering interaction system based on artificial intelligence, the system comprising:
[0030] The parsing module receives natural language questions input by the user and performs hierarchical parsing of entity words and intent words in the question through a dynamic weight allocation mechanism to generate an enhanced semantic vector containing entity association strength and intent probability distribution. The dynamic weights are adjusted in real time based on historical interaction data of similar questions.
[0031] The construction module is used to traverse the knowledge graph based on enhanced semantic vectors and build a hierarchical query subgraph containing core entities, related entities, and implicit relationships. The core entity layer retains direct relationships, the related entity layer filters indirect relationships through path decay coefficients, and the implicit relationship layer mines potential relationships based on co-occurrence frequency.
[0032] The reasoning module is used to perform reasoning calculations on the hierarchical query subgraph using a multi-path collaborative reasoning algorithm to generate a set of candidate answers. The algorithm verifies explicit relational paths through rule-based reasoning, completes implicit relational paths through graph embedding models, and dynamically allocates reasoning weights based on path confidence.
[0033] The generation module is used to perform semantic consistency verification and redundancy removal on the candidate answer set, generate suitable answers and related explanation paths by combining user's historical interaction preferences, and simultaneously feed newly discovered entity relationships back to the knowledge graph for incremental updates, forming a closed loop of question-and-answer interaction.
[0034] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.
[0035] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.
[0036] Compared with existing technologies, this invention provides an AI-based knowledge graph question-answering interaction method. It receives natural language questions input by users, performs hierarchical parsing of entity words and intent words in the questions through a dynamic weight allocation mechanism, and generates enhanced semantic vectors containing entity association strength and intent probability distribution. Based on these enhanced semantic vectors, it traverses the knowledge graph to construct a hierarchical query subgraph containing core entities, related entities, and implicit relationships. A multi-path collaborative reasoning algorithm is used to perform reasoning calculations on the hierarchical query subgraph to generate a candidate answer set. The candidate answer set undergoes semantic consistency verification and redundancy removal. Combined with the user's historical interaction preferences, it generates suitable answers and related explanation paths. Simultaneously, newly discovered entity relationships are fed back to the knowledge graph for incremental updates, forming a closed loop for question-answering interaction. This improves the accuracy and interpretability of question-answering interaction, enhances user interaction experience, and improves information acquisition efficiency. Attached Figure Description
[0037] Figure 1 A hardware structure block diagram of a computer terminal for an artificial intelligence-based knowledge graph question-answering interaction method provided in an embodiment of the present invention;
[0038] Figure 2 A flowchart illustrating a knowledge graph-based question-answering interaction method based on artificial intelligence, provided in an embodiment of the present invention;
[0039] Figure 3 This is a schematic diagram of the structure of a knowledge graph question-answering interactive system based on artificial intelligence, provided in an embodiment of the present invention. Detailed Implementation
[0040] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0041] This invention first provides an artificial intelligence-based knowledge graph question-answering interaction method, which can be applied to electronic devices, such as computer terminals, specifically ordinary computers.
[0042] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware structure block diagram of a computer terminal for an artificial intelligence-based knowledge graph question-answering interaction method provided in an embodiment of the present invention. Figure 1 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0043] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any AI-based knowledge graph question-answering interaction method.
[0044] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0045] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When these computer programs are executed by a processor, the processor can execute any knowledge graph question-answering interaction method based on artificial intelligence.
[0046] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 1 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0047] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0048] See Figure 2 The present invention provides an artificial intelligence-based knowledge graph question-answering interaction method, which may include the following steps:
[0049] S201 receives natural language questions input by the user, performs hierarchical parsing of entity words and intent words in the question through a dynamic weight allocation mechanism, and generates an enhanced semantic vector containing entity association strength and intent probability distribution. The dynamic weights are adjusted in real time based on historical interaction data of similar questions.
[0050] Specifically, it can receive natural language questions input by users, perform word segmentation and part-of-speech tagging using word segmentation tools, distinguish parts of speech and filter stop words to obtain a preprocessed word segmentation sequence;
[0051] Receiving the natural language question input by the user is the starting point of the interaction. This question can be a query in any field, such as "What fruits can diabetic patients eat?" in the medical field, "What are the basic principles of quantum mechanics?" in the education field, etc. To achieve accurate parsing, it is necessary to first remove noise through word segmentation and preprocessing, and retain the core vocabulary.
[0052] Word segmentation tool and vocabulary segmentation: Use a Chinese word segmentation tool based on the bidirectional maximum matching algorithm (such as jieba segmentation). This tool can achieve accurate segmentation by combining the context semantics. For example, for the question "What fruits can diabetic patients eat?", the initial vocabulary sequence obtained is: "diabetes, patient, can, eat, which, fruits,?" During the segmentation process, the tool will automatically recognize compound words (such as "diabetes" will not be split into "sugar, urine, disease") to ensure the integrity of professional terms.
[0053] Part-of-speech tagging: Use the Hidden Markov Model (HMM) to perform part-of-speech tagging on the segmented vocabulary. The tagging categories include nouns (n), verbs (v), pronouns (r), adjectives (a), etc. For example, the tagging result of the above sequence is: "diabetes (n), patient (n), can (v), eat (v), which (r), fruits (n),? (w)", where "w" represents punctuation marks. The role of part-of-speech tagging is to distinguish the grammatical functions of vocabulary and provide a basis for extracting entity words and intention words in the subsequent steps.
[0054] Stop word filtering: Stop words refer to words with no actual semantics or little impact on the query intention, such as the auxiliary word "de", the adverb "can", the pronoun "which", and punctuation marks, etc. The filtering rules are based on a preset stop word list (containing more than 2,000 common stop words) and are dynamically adjusted according to the problem domain (such as additional filtering of colloquial words like "oh", "ne" in the medical field). After filtering, the word segmentation sequence of the above example is streamlined to: "diabetes, patient, eat, fruits".
[0055] Output of the preprocessed word segmentation sequence: The sequence needs to retain the original order and part-of-speech information of the vocabulary. For example, the final output is "diabetes (n), patient (n), eat (v), fruits (n)", which lays the foundation for extracting entity words and intention words in the next step.
[0056] Extract entity words and intention words from the word segmentation sequence to obtain the entity word set and the intention word set;
[0057] Entity words are the core concepts involved in the question (such as specific things, names, etc.), and intention words are the words that reflect the user's query purpose (such as actions, question directions, etc.). The accurate extraction of both is the key to understanding the question.
[0058] Entity word extraction: Based on the part-of-speech tagging results, nouns (n) and proper nouns (nr, ns, nt, etc.) are extracted first, and then validated using the entity database in the domain knowledge graph. For example, in the medical domain knowledge graph, "diabetes", "patient", and "fruit" are all entities ("diabetes" is a disease entity, "patient" is a role entity, and "fruit" is a food entity). Therefore, the entity word set extracted from the preprocessed sequence "diabetes (n), patient (n), eat (v), fruit (n)" is: {diabetes, patient, fruit}.
[0059] Entity extraction needs to handle ambiguity. For example, "apple" is a brand entity in "the price of an Apple phone" but a fruit entity in "the nutritional value of apples." In this case, it is necessary to combine the part of speech in the context and the domain database to distinguish between them. If the question is "Can apples cure diabetes?", combining "diabetes" (a disease entity) can determine that "apple" is a fruit entity.
[0060] Intent word extraction: Intent words mainly include verbs (v), interrogative words (r), and words that reflect the purpose of the query. Semantic analysis is needed to determine whether they point to the user's needs. For example, in the above sequence, "eat (v)" reflects that the user wants to know "Can diabetic patients eat fruit?", which is a core intent word. If the question is "What are the causes of diabetes?", then "cause (n)," "is (v)," and "what (r)" together constitute intent words, reflecting the need for "the reason for the query."
[0061] The intent word set extracted from "diabetes, patient, eat, fruit" is {eat}, as it directly reflects the core action intent of "consuming". For complex questions, there may be multiple intent words. For example, the intent word set for "How to prevent diabetes and reduce the risk of complications?" is {prevent, reduce, risk}, which together reflect the intent of "prevention and risk control".
[0062] Boundary verification between entity words and intention words: If a word simultaneously meets the characteristics of both entity words and intention words (e.g., "treatment" in "treatment methods for diabetes" is both an action intention word and a entity word in the medical field), then it is determined according to its grammatical function in the sentence—it is an intention word when used as a predicate and an entity word when used as an attributive. For example, in "treatment (v) diabetes", "treatment" is an intention word, while in "treatment (n) plan", "treatment" is an entity word.
[0063] The final output consists of a set of entity words and a set of intent words. For example, in the above example, the entity word set is {diabetes, patient, fruit}, and the intent word set is {eat}.
[0064] The historical interaction database is called to extract the contribution data of entity words and intent words in similar questions. The dynamic weights of the two types of words in the current question are calculated by using a time-series decay function to obtain the entity word weights and intent word weights.
[0065] Dynamic weights reflect the importance of entity words and intent words in understanding the question. Their values are calculated based on historical interaction data and adjusted in real time according to feedback from similar questions to ensure that the weights are adapted to the current query scenario.
[0066] Historical interaction database access: The database stores interaction records for similar questions within the past 6 months. Each record includes the question text, entity words, intent words, user satisfaction (1-5 points), and interaction time. For example, similar questions to "What fruits can diabetic patients eat?" include "Can diabetics eat apples?" and "Fruit restrictions for diabetic patients," resulting in 1000 relevant records.
[0067] The contribution data of entity words and intent words are extracted from the records: Contribution = (Number of times the word appears in high satisfaction records / Total number of occurrences) × 100%, reflecting the word's influence on accurate answers. For example, in 1000 records, "diabetes" appears 950 times, of which 900 times appear in high satisfaction (4-5 points) records, its contribution = 900 / 950≈94.7%; "eat" appears 800 times, of which 600 times appear in high satisfaction records, its contribution = 600 / 800=75%.
[0068] Time-series decay function calculation: Since recent interaction data better reflects current user habits, a time-series decay function is used to adjust the contribution. The formula is: Dynamic contribution = Historical contribution × e^(-k×Δt).
[0069] Where Δt is the interval between the historical record and the current time (in days), and k is the decay coefficient (taken as 0.01 to ensure that data from 30 days ago decays to 74% of the initial value).
[0070] For example, in a record from 30 days ago, "diabetes" contributes 94.7%, Δt=30, and the dynamic contribution is 94.7%×e^(-0.01×30)≈94.7%×0.74≈70.1%; in a record from 10 days ago, "diabetes" contributes 94.7%, and the dynamic contribution is 94.7%×e^(-0.01×10)≈94.7%×0.90≈85.2%.
[0071] Entity word weight and intent word weight calculation: Take the average of the dynamic contributions of all similar questions. Entity word weight = Average dynamic contribution of entity words / (Average dynamic contribution of entity words + Average dynamic contribution of intent words). Intent word weight = 1 - Entity word weight.
[0072] For example, if the average dynamic contribution of entity words (diabetes, patient, fruit) is calculated to be 75%, and the average dynamic contribution of intent word (eat) is 25%, then the entity word weight = 75% / (75%+25%) = 0.75, and the intent word weight = 0.25. If the question involves emerging concepts (such as "AI treatment methods for diabetes") and historical data is scarce, the contribution of the entity word "AI" is calculated according to the default value (60%) of the domain knowledge base.
[0073] The entity word set and intent word set are mapped to vectors respectively, and weighted fusion is performed according to dynamic weights. The association strength between entities and the probability distribution of intent are calculated to generate enhanced semantic vectors.
[0074] Vector mapping and fusion transform textual vocabulary into computable numerical vectors, which, combined with entity associations and intent distribution, form enhanced vectors that comprehensively reflect the semantics of the problem.
[0075] Word vector mapping: The Word2Vec model (Skip-gram architecture) is used to map entity words and intent words into 300-dimensional vectors. This model is trained on a large-scale corpus (such as Wikipedia + domain literature) to make the vectors of semantically similar words closer together. For example:
[0076] The vector for the entity word "diabetes" is [0.12, 0.35, ..., -0.21] (300 dimensions);
[0077] The vector for the entity word "fruit" is [0.08, -0.22, ..., 0.15].
[0078] The vector for the intent word "eat" is [-0.15, 0.28, ..., 0.09].
[0079] After mapping, normalization processing is required (vector magnitude = 1) to ensure that the numerical range of different word vectors is consistent.
[0080] Weighted fusion: The entity word vector and the intent word vector are weighted and summed according to the dynamic weights obtained in step 3 (entity word weight 0.75, intent word weight 0.25). The formula is: Fusion vector = (mean of entity word vector × entity word weight) + (mean of intent word vector × intent word weight).
[0081] For example, if the mean of the entity word vector is ("diabetes" + "patient" + "fruit" vector) / 3, assuming it's [0.10, 0.15, ..., -0.02], and the mean of the intent word vector is the vector for "eat" [-0.15, 0.28, ..., 0.09], then the fused vector = 0.75. [0.10, 0.15, ..., -0.02] + 0.25 [-0.15, 0.28, ..., 0.09] = [0.075-0.0375, 0.1125+0.07, ..., -0.015+0.0225] = [0.0375, 0.1825, ...,0.0075].
[0082] Calculation of the association strength between entities: The association strength between entity word vectors is calculated by cosine similarity. The formula is: Association strength = Entity word vector i • Entity word vector j / (||Entity word vector i|| • ||Entity word vector j||).
[0083] For example, the vector dot product of "diabetes" and "fruit" is 0.3, both with a magnitude of 1, and the association strength is 0.3, indicating a certain association between the two. The association strength between "diabetes" and "patient" is 0.8, indicating a strong association. The association strength ranges from [-1, 1], with larger values indicating a stronger association.
[0084] Intent probability distribution calculation: The similarity of the intent word vector with the preset intent category vectors (such as "query feasibility", "query reason", "query method", etc.) is performed to obtain the probability of each category. For example, the similarity between the vector of "eat" and the category vector of "query feasibility" is 0.8, and the similarity between "query method" and "query method" is 0.2. Then the intent probability distribution is: query feasibility = 0.8, query method = 0.2.
[0085] Enhanced semantic vector generation: The fusion vector, entity association strength matrix (e.g., a 3×3 matrix formed by 3 entities), and intent probability distribution vector are concatenated to form the final enhanced semantic vector. For example, the enhanced semantic vector in the above example has a dimension of 300 (fusion vector) + 3×3 (association strength) + 2 (intent distribution) = 311 dimensions, fully containing the entity associations and intent information of the question, providing accurate semantic guidance for subsequent traversal of the knowledge graph.
[0086] S202, based on the enhanced semantic vector traversal of the knowledge graph, constructs a hierarchical query subgraph containing core entities, related entities and implicit relationships. Among them, the core entity layer retains direct relationships, the related entity layer filters indirect relationships through path decay coefficients, and the implicit relationship layer mines potential relationships based on co-occurrence frequency.
[0087] Specifically, the enhanced semantic vectors can be matched with the entity vectors in the knowledge graph for similarity, and entities with a matching degree higher than a preset matching threshold can be selected as core entities to obtain the core entity set.
[0088] The enhanced semantic vector contains fused information of entity words and intent words in the question. Its matching with entity vectors in the knowledge graph is the key to locating core entities, which are the basic nodes of subsequent query subgraphs.
[0089] Entity Vectors and Similarity Calculation: Each entity in the knowledge graph (such as "diabetes", "fruit", "insulin") is pre-generated with a 300-dimensional vector (trained using the TransE model, which maps entities and relations to a low-dimensional vector space, ensuring that the vector relationship "head entity + relation ≈ tail entity" holds true). For example, the entity vector for "diabetes" is V1, and the vector for "type II diabetes" is V2. Due to their semantic similarity, the two have high vector similarity.
[0090] The matching degree between the enhanced semantic vector and the entity vector is calculated using cosine similarity. The formula is: Similarity = (Enhanced semantic vector • Entity vector) / (||Enhanced semantic vector|| • || Entity vector||).
[0091] For example, the dot product of the enhanced semantic vector (from "What fruits can diabetic patients eat?") with the entity vector of "diabetes" is 0.85, both with a magnitude of 1, and the similarity is 0.85; the dot product with the entity vector of "hypertension" is 0.3, and the similarity is 0.3.
[0092] Preset matching threshold: Set according to domain characteristics. The threshold is 0.6 for general domains, and increased to 0.7 for specialized domains (such as medical) due to the high degree of entity specialization, to reduce ambiguous matching. For example, in the medical field, only entities with a similarity of ≥0.7 are considered as candidate core entities.
[0093] Core entity set filtering: All entities are sorted by similarity, and the top N (N is usually 3-5) entities with similarity ≥ the threshold are selected. For example, the matching results for the above question are: "diabetes" (0.85), "fruit" (0.78), and "patient" (0.72), all ≥ 0.7, forming the core entity set {diabetes, fruit, patient}; the similarity of "insulin" is 0.65 < 0.7, and it is excluded.
[0094] If an entity's ambiguity leads to scattered matching (e.g., "apple" refers to both fruit and brand), then by combining intent words from the enhanced semantic vector (e.g., "eat"), priority should be given to matching "fruit" type entities to ensure that the core entity matches the question intent. Figure 1 To.
[0095] Starting with the core entity set, traverse the knowledge graph, extract the direct relationships and attribute information between the core entities, construct the core entity layer containing entity nodes and direct relationship edges, and obtain the core entity layer subgraph.
[0096] The core entity layer focuses on the direct relationships between entities and forms the basis of the hierarchical query subgraph. Direct relationships reflect the closest semantic connections between entities.
[0097] Knowledge graph traversal method: Breadth-first search (BFS) is used, starting from each core entity and exploring only adjacent entities with a distance of 1 (i.e., directly related entities) to avoid overexpansion. For example, starting from "diabetes", directly related entities include "symptoms", "causes", "treatment methods", "forbidden foods", etc.; starting from "fruit", directly related entities include "sugar content", "nutritional value", "suitable population", etc.
[0098] Direct association relationship types: Relationship edges must be labeled with specific semantics, such as "Diabetes - Forbidden Foods → Fruits" (meaning "Forbidden foods for diabetes include certain fruits"), "Fruits - Sugar Content → High / Medium / Low" (meaning the sugar content attribute of fruits), and "Patients - Suffering → Diabetes" (meaning the relationship between a patient and the disease). Relationship types must conform to the predefined schema of the knowledge graph (such as "forbidden," "included," "attribute," etc.).
[0099] Attribute information extraction: Entity attributes are supplementary descriptions of the entity. For example, the attributes of "fruit" include "name", "sugar content", and "GI value" (glycemic index), while the attributes of "diabetes" include "type" and "high-risk groups". These attributes are attached to the entity node in the form of key-value pairs, for example, "Fruit (apple): sugar content = 13.5g / 100g, GI = 36".
[0100] Core entity layer subgraph construction: The subgraph uses core entities as nodes, direct relationships as edges, and attribute information as node attributes. For example, the core entity layer subgraph for the above problem includes:
[0101] Nodes: Diabetes (Attribute: Type = Type II), Fruit (Attribute: GI Value Range = Low → Medium), Patient (Attribute: Group = Middle-aged and elderly);
[0102] Side: Diabetes - Forbidden Foods → Fruits (Relationship Weight = 0.9), Patients - Suffering → Diabetes (Relationship Weight = 0.8), Fruits - Suitable Population → Patients (Relationship Weight = 0.7, needs to be determined based on specific fruits).
[0103] The subgraph must ensure that there is no redundancy in the direct relationships between core entities, and that each relationship edge has a clear semantic label and weight (reflecting the confidence level of the relationship), providing a clear starting point for the subsequent expansion of the associated entity layer.
[0104] The query path is expanded based on the core entity layer subgraph. The path decay coefficient of each indirect path is calculated. Indirect related entities and relationships with coefficients higher than the preset coefficient threshold are retained to construct the related entity layer and obtain the related entity layer subgraph.
[0105] The associated entity layer expands the association range of the core entity through indirect paths, while filtering valuable indirect relationships through attenuation coefficients to avoid excessive expansion of the subgraph.
[0106] Query path expansion rules: Starting from entities in the core entity layer, explore indirectly related entities with a distance of 2 (i.e., entities connected through an intermediate entity), with the path format "core entity → intermediate entity → indirect entity". For example, starting from "diabetes", expand to the indirect entity "pancreas" through the intermediate entity "insulin" (path: diabetes → effect → insulin → secretion → pancreas); starting from "fruit", expand to "blood sugar" through "sugar content" (path: fruit → has → sugar content → effect → blood sugar).
[0107] Path attenuation coefficient calculation: The influence of indirect paths decreases as path length increases. The coefficient formula is as follows:
[0108] Attenuation coefficient = Initial relation weight × ∏(Intermediate relation weight × e^(-0.5 × path length))
[0109] Wherein, the initial relation weight is the relation weight from the core entity to the intermediate entity, the intermediate relation weight is the relation weight from the intermediate entity to the indirect entity, the path length is 2 (because it only extends to a distance of 2), and e is the natural constant (approximately 2.718).
[0110] For example, in the path "diabetes → influence → insulin → secretion → pancreas", the initial relationship weight = 0.8 (the relationship between diabetes and insulin), the intermediate relationship weight = 0.9 (the relationship between insulin and pancreas), and the decay coefficient = 0.8×(0.9×e^(-0.5×2))=0.8×(0.9×0.3679)≈0.8×0.331≈0.265.
[0111] Threshold setting and filtering: The attenuation coefficient threshold of the associated entity layer is set to 0.2 (experimentally verified that this value can retain more than 70% of valuable indirect relationships). The attenuation coefficient of the above path is 0.265≥0.2, so "pancreas" is retained as an associated entity; the attenuation coefficient of the other path "diabetes→prohibition→high sugar food→includes→cake" is 0.9×(0.8×0.3679)≈0.9×0.294≈0.265≥0.2, so "cake" is retained.
[0112] If the path length is 3 (indirect entities at a distance of 3), the coefficient will be further reduced when the path length is 3 in the attenuation coefficient formula (e.g., e^(-0.5×3)=0.223). Usually, only paths at a distance of 2 are retained to ensure the semantic relevance between related entities and core entities.
[0113] Construction of the subgraph for related entity layers: The subgraph contains indirectly related entity nodes, indirect relationship edges, and corresponding decay coefficients, for example:
[0114] Related entities: pancreas, blood sugar, cake;
[0115] Side: Insulin → secreted in → pancreas (attenuation coefficient 0.265), sugar content → affects → blood sugar (0.28), high sugar foods → contain → cake (0.265);
[0116] Connection with the core entity layer: A complete indirect path is formed by linking intermediate entities (insulin, sugar content, high-sugar foods) with core entities (diabetes, fruit).
[0117] In a statistical knowledge graph, entity pairs that are not directly related but co-occur frequently are analyzed to calculate the potential association strength based on their co-occurrence frequency. Implicit relationships are then mined and an implicit relationship layer is constructed. By integrating the core entity layer, the related entity layer, and the implicit relationship layer, a hierarchical query subgraph is obtained.
[0118] The implicit relationship layer captures potential relationships between entities that are not explicitly labeled but are actually related, and reveals semantic associations through co-occurrence frequency, enriching the relationship dimension of the subgraph.
[0119] Co-occurrence frequency statistics: Co-occurrence refers to the number of times two entities appear simultaneously in the same triple, the same syntactic structure, or the same domain document in a knowledge graph. For example, in a medical knowledge graph, "diabetes" and "exercise" are not directly related (no explicit relationship edge), but in 1000 triples about diabetes, they appear together 300 times, with a co-occurrence frequency of 300 / 1000 = 0.3.
[0120] The statistical scope includes the triple set of the knowledge graph, the associated document library, and user historical query logs to ensure that co-occurrence data covers information from multiple sources. For low-frequency entities (such as rare diseases), the co-occurrence frequency needs to be adjusted in conjunction with domain expert knowledge (such as manually labeling potential associations).
[0121] Potential association strength calculation: Based on co-occurrence frequency, the association strength is obtained through normalization. The formula is: Association Strength = Co-occurrence Frequency / (Max Co-occurrence Frequency). Where, the maximum co-occurrence frequency is the highest co-occurrence frequency of all entity pairs in the knowledge graph (e.g., the co-occurrence frequency of "diabetes" and "blood sugar" is 0.8). For example, the association strength between "diabetes" and "exercise" = 0.3 / 0.8 = 0.375.
[0122] The correlation strength needs to be filtered in conjunction with entity type. For example, the correlation strength of 0.375 between "diabetes" (disease) and "exercise" (behavior) is clinically significant, while the co-occurrence frequency of "diabetes" and "car" (irrelevant type) is 0.05, and even if the strength is 0.0625, it is still judged as unrelated.
[0123] Implicit relation layer construction: Retain entity pairs with an association strength ≥ 0.3 and label the implicit relation type (e.g., "auxiliary treatment", "risk factor"), for example:
[0124] Entity pair “Diabetes-Exercise”: Association strength 0.375, implicit relation = “adjunctive therapy”;
[0125] Entity pair “Fruit-Blood Sugar”: Association strength 0.4 (co-occurrence frequency 0.32 / 0.8), implicit relation = “Influence”.
[0126] Hierarchical query subgraph fusion: The core entity layer (direct relationships), related entity layer (indirect relationships), and implicit relationship layer (potential relationships) are merged by entity node. Relationship edges are labeled with "direct," "indirect," and "implicit" types and weights (direct relationships have the highest weight; implicit relationships have weights based on association strength). For example, the fused subgraph includes:
[0127] Core entities: diabetes, fruit, patients;
[0128] Related entities: pancreas, blood sugar, cake;
[0129] Implicit entity: motion;
[0130] Relationship edges: direct relationship (weight 0.7-0.9), indirect relationship (attenuation coefficient 0.2-0.3), implicit relationship (association strength 0.3-0.4).
[0131] The merged subgraph retains the core associations and expands the semantic scope through indirect and implicit relationships, providing a comprehensive graph structure foundation for multi-path reasoning.
[0132] S203 employs a multi-path collaborative reasoning algorithm to perform reasoning calculations on the hierarchical query subgraph and generate a set of candidate answers. The algorithm verifies explicit relational paths through rule-based reasoning, completes implicit relational paths through graph embedding models, and dynamically allocates reasoning weights based on path confidence.
[0133] Specifically, the explicit relational paths in the hierarchical query subgraph can be verified by applying preset inference rules, eliminating paths that do not conform to the rules, retaining valid explicit paths, and obtaining a set of verified explicit paths.
[0134] Explicit relational paths are clearly labeled association paths between entities in a hierarchical query subgraph (such as "diabetes → forbidden foods → fruit" or "patient → suffering from → diabetes"). These paths need to be verified by pre-defined inference rules within the domain to ensure their logical consistency and eliminate contradictory or unreasonable paths.
[0135] Definition of predefined reasoning rules: Rules are formulated based on domain knowledge and logical axioms. For example, rules in the medical field include:
[0136] Rule 1: "Taboo relations are one-way" (if A is taboo to B, then B cannot be taboo to A).
[0137] Rule 2: "Inclusion relations are transitive" (if A contains B, and B contains C, then A contains C).
[0138] Rule 3: "The subject of the relationship must be a biological entity" (e.g., "patient" is a biological entity and can "suffer" from a disease, while "stone" cannot).
[0139] Explicit path verification process: Traverse each explicit path in the hierarchical query subgraph, match each path against the inference rules, and determine if it conforms to the logic. For example:
[0140] The path "diabetes → forbidden foods → fruits → contains → apples": check if it meets rule 2 (inclusion relationship transitivity). Since "fruits contain apples" is true and "fruits forbidden for diabetes" is reasonable, the verification is successful.
[0141] The path "Fruit → Forbidden Foods → Diabetes" violates Rule 1 (one-way forbidden relationship). Since "Fruit is forbidden for diabetes" is not common sense, it is determined to be an invalid path and is removed.
[0142] The path "cake → suffer → diabetes" violates rule 3 ("cake" is not a biological entity and cannot "suffer" from a disease), and is therefore deemed an invalid path and removed.
[0143] Valid explicit path filtering: All paths that meet the rules are retained, forming a validated set of explicit paths. For example, the paths retained in the above example include:
[0144] The paths include “diabetes → forbidden foods → fruits → contain → apples”, “diabetes → effects → insulin → secretion → pancreas”, and “patient → suffers from → diabetes”. Each path is accompanied by a rule matching result (such as “matches rule 2”, “matches rule 3”).
[0145] A graph embedding model is used to learn the vector representation of the hierarchical query subgraph. Implicit relation paths are completed by calculating vector similarity, resulting in a set of completed implicit paths.
[0146] Implicit relationship paths are paths between entities that are not explicitly labeled but have potential connections (such as "diabetes → exercise → blood sugar," where the relationship between "exercise" and "diabetes" is not directly labeled in the knowledge graph). These need to be mined and completed using a graph embedding model.
[0147] Graph Embedding Model Selection and Training: The Node2Vec model is used. This model generates entity sequences by simulating random walks and learns low-dimensional vector representations of entities, making the vectors of semantically similar entities closer together. The training data consists of entities and relations in a hierarchical query subgraph. Parameter settings: walk length = 10, window size = 5, vector dimension = 128. For example, the vector for "diabetes" is Vd, the vector for "exercise" is Vm, and the vector for "blood sugar" is Vg.
[0148] Vector similarity calculation: The cosine similarity is used to calculate the correlation strength between entity vectors. The formula is:
[0149] Similarity = (Vi•Vj) / (||Vi||•||Vj||)
[0150] For example, the similarity between Vd and Vm is calculated to be 0.75 (indicating a strong association between "diabetes" and "exercise"), and the similarity between Vm and Vg is 0.8 (indicating a strong association between "exercise" and "blood sugar").
[0151] Implicit path completion rule: If the similarity between entities A and B is ≥0.6, and the similarity between B and C is ≥0.6, then complete the path "A→implicit relation→B→implicit relation→C", and label the implicit relation type according to the entity type. For example:
[0152] Since the similarity between Vd and Vm is 0.75≥0.6, and the similarity between Vm and Vg is 0.8≥0.6, the complete path is "diabetes → auxiliary regulation → exercise → impact → blood sugar". Among them, "auxiliary regulation" is an implicit relationship based on medical common sense (exercise assists in the regulation of diabetes).
[0153] The similarity between the entity "fruit" and "GI value" is 0.7, and the similarity between "GI value" and "blood sugar" is 0.85. Complete the path "fruit → has → GI value → affects → blood sugar".
[0154] The completed implicit path set: includes the completed paths and vector similarity, for example:
[0155] "Diabetes → Assisted Regulation → Exercise → Impact → Blood Glucose (Similarity 0.75 / 0.8)" and "Fruit → Has → GI Value → Impact → Blood Glucose (0.7 / 0.85)" Each path is labeled with the implicit relationship type and the similarity value on which it is based.
[0156] The confidence scores of each path in the verified explicit path set and the completed implicit path set are calculated separately. The confidence scores of explicit paths are calculated based on the rule matching degree, and the confidence scores of implicit paths are calculated based on the vector similarity. The path confidence scores are then obtained.
[0157] Confidence reflects the reliability of the path, the degree of matching of explicit path dependency rules, and the similarity of implicit path dependency vectors, providing a basis for subsequent weight allocation.
[0158] Explicit path confidence calculation: Rule matching degree = (Number of matching rules / Number of relations contained in the path) × 100%, Confidence degree = Rule matching degree. For example:
[0159] The path "diabetes → forbidden foods → fruits → contain → apples" contains two relations (forbidden foods, contain), both of which conform to the rules (rule 1 and rule 2). The rule matching degree = 2 / 2 × 100% = 100%, and the confidence degree = 1.0.
[0160] The path "patient → affected → diabetes → impact → insulin" contains two relationships (affected, impact), both of which conform to Rule 3 and domain common sense. The rule matching degree = 2 / 2 × 100% = 100%, and the confidence degree = 1.0.
[0161] If a path contains 3 relations, 2 of which conform to the rule, the rule matching degree = 2 / 3 ≈ 66.7%, and the confidence degree = 0.67.
[0162] Implicit path confidence calculation: The confidence score is calculated by taking the minimum vector similarity in the path (because path reliability is determined by the weakest link). For example:
[0163] The similarity of the path "diabetes → auxiliary regulation → exercise → impact → blood sugar" was 0.75 and 0.8, with the lowest being 0.75, and the confidence level was 0.75.
[0164] The similarity of the path "Fruit → Has → GI Value → Affects → Blood Sugar" is 0.7 and 0.85, with a minimum of 0.7 and a confidence level of 0.7.
[0165] Confidence normalization: The confidence of explicit and implicit paths is uniformly mapped to the [0,1] interval (explicit paths have already been satisfied, and implicit paths do not require additional processing), ensuring the consistency of subsequent weight calculations.
[0166] The reasoning weights are dynamically allocated based on the path confidence values. Explicit and implicit paths are then used for collaborative reasoning according to their weights. The reasoning results are then merged to obtain a set of candidate answers.
[0167] Collaborative reasoning avoids the limitations of a single path by integrating information from explicit and implicit paths and combining them with weights to generate a comprehensive answer.
[0168] Inference weight allocation: The weights are positively correlated with the path confidence, as shown in the formula:
[0169] Path weight = Path confidence / Sum of confidence scores of all paths
[0170] For example, given explicit path A (confidence 1.0), explicit path B (confidence 1.0), implicit path C (confidence 0.75), and implicit path D (confidence 0.7), the total confidence score = 1.0 + 1.0 + 0.75 + 0.7 = 3.45. Therefore:
[0171] Path A weight = 1.0 / 3.45 ≈ 0.29;
[0172] Path B weight = 1.0 / 3.45 ≈ 0.29;
[0173] The weight of path C is approximately 0.75 / 3.45 ≈ 0.22.
[0174] The weight of path D is approximately 0.7 / 3.45.
[0175] Collaborative reasoning process:
[0176] Explicit path reasoning: Extracting answers from explicit paths, such as path A "diabetes → forbidden foods → fruits → contain → apples" which infers "diabetic patients should avoid eating apples"; path B "patient → suffer from → diabetes → impact → insulin" which infers "the insulin secretion of diabetic patients may be abnormal".
[0177] Implicit path reasoning: Extracting answers from implicit paths, such as path C "diabetes → auxiliary regulation → exercise → influence → blood sugar" which infers "exercise can help regulate blood sugar in diabetic patients"; path D "fruit → has → GI value → influence → blood sugar" which infers "the GI value of fruit affects blood sugar in diabetic patients".
[0178] Weighted Fusion: The inference results are sorted by weight, with results of higher weight being retained first, while answers with similar semantics are merged. For example, paths A and B have higher weights (total 0.58), so their answers are retained first; answers for paths C and D are used as supplementary results.
[0179] Candidate answer set generation: includes all reasoning results and their corresponding path weights, for example:
[0180] "People with diabetes should avoid eating apples (weight 0.29, from explicit pathway A)";
[0181] "Insulin secretion may be abnormal in diabetic patients (weight 0.29, from explicit pathway B)";
[0182] "Exercise can help regulate blood sugar in diabetic patients (weight 0.22, from implicit pathway C)";
[0183] "The GI value of fruit affects blood sugar in diabetic patients (weight 0.20, from implicit pathway D)."
[0184] The answers in the set need to be labeled with their source path and confidence level to provide a basis for subsequent verification.
[0185] S204 performs semantic consistency verification and redundancy removal on the candidate answer set, generates suitable answers and related explanation paths by combining user historical interaction preferences, and simultaneously feeds newly discovered entity relationships back to the knowledge graph for incremental updates, forming a closed loop of question-and-answer interaction.
[0186] Specifically, the semantic similarity between each answer in the candidate answer set and the original question can be calculated, answers with similarity higher than a preset similarity threshold can be filtered out, and answers with semantic conflicts can be eliminated to obtain a subset of candidate answers with consistent semantics.
[0187] The candidate answer set may contain content that is not closely related to the original question or contains logical contradictions. Semantic consistency checks are required to ensure the matching of the answer with the question and the consistency of the internal logic.
[0188] Semantic similarity calculation method: A BERT-based vector representation is used to convert the original question and each candidate answer into 768-dimensional semantic vectors. The degree of association between the two is calculated using cosine similarity. The cosine similarity formula is:
[0189] Similarity = (Question vector • Answer vector) / (||Question vector|| • ||Answer vector||)
[0190] For example, the vector of the original question "What fruits can diabetic patients eat?" is Q, and the vector of the candidate answer "Diabetic patients should avoid eating high-sugar fruits such as lychees" is A1, with a similarity of 0.82; the vector of the candidate answer "Hypertensive patients need to control their salt intake" is A2, with a similarity of 0.35.
[0191] Preset similarity threshold: Set according to the question domain, 0.6 for general domains and 0.7 for professional domains (such as medical), to ensure that the answers focus on the core of the question. For example, in the medical field, only answers with a similarity of ≥0.7 are retained, such as A1 (0.82≥0.7), while A2 (0.35<0.7) is discarded.
[0192] Semantic conflict detection: The retained answers are compared pairwise. If two answers describe the same entity in opposite ways (e.g., "Apples are suitable for diabetics" vs. "Apples are not suitable for diabetics"), they are considered to be in conflict. The conflict handling rule is: retain the answer with the higher confidence level (from the path weight in step four); if the confidence levels are the same, both are temporarily retained and marked as pending verification. For example, answer A1 (confidence 0.29) conflicts with A3 "Diabetics can eat apples in moderation" (confidence 0.25), so A1 is retained.
[0193] Semantically consistent subset of candidate answers: After filtering and conflict removal, the subset contains answers that are highly relevant to the question and do not contradict each other, for example:
[0194] "Diabetic patients should avoid eating high-sugar fruits such as lychees (similarity 0.82, confidence 0.29)". "The GI value of fruits affects blood sugar in diabetic patients (similarity 0.78, confidence 0.20)". "Exercise can help regulate blood sugar in diabetic patients (similarity 0.75, confidence 0.22)".
[0195] Redundancy calculation is performed on the semantically consistent subset of candidate answers, and answers with different expressions but the same core content are merged to obtain a simplified candidate answer set;
[0196] Subsets with semantically consistent results may contain answers with different expressions but repeated core information. These need to be merged through redundancy calculation to reduce information redundancy and improve the conciseness of the answers.
[0197] Redundancy calculation method: A comprehensive judgment is made by combining lexical overlap rate and semantic vector similarity. Lexical overlap rate = (Number of common keywords between answer A and answer B / Total number of keywords) × 100%. Semantic vector similarity uses the cosine similarity of BERT vectors. Redundancy = (Lexical overlap rate × 0.4 + Semantic vector similarity × 0.6). For example:
[0198] Answer A: "Diabetic patients should avoid high-sugar fruits such as lychees and mangoes";
[0199] Answer B: "High-sugar fruits such as lychees and mangoes are not suitable for diabetic patients";
[0200] The common keywords are "diabetic patients, high-sugar fruits, lychee, mango", with a word overlap rate of 4 / 4 × 100% = 100%; semantic vector similarity = 0.95; redundancy = (100% × 0.4 + 0.95 × 0.6) = 0.4 + 0.57 = 0.97.
[0201] Redundancy threshold setting: Answers with a redundancy of ≥0.85 are considered redundant and must be merged. The redundancy of A and B above is 0.97, which is ≥0.85, therefore they are considered redundant.
[0202] Answer merging rules: Retain answers with more complete statements and richer information, or combine the core content of both to form a new answer. For example, merge A and B into: "Diabetic patients should avoid high-sugar fruits, such as lychees and mangoes." For partially overlapping answers (redundancy 0.7-0.85), retain their unique information and do not merge them. For example, answer C "Low-GI fruits are suitable for diabetic patients" and answer D "Apples have a low GI value" have a redundancy of 0.75 and are not merged because the former is a general conclusion, while the latter is a specific example.
[0203] Streamlining the candidate answer set: The merged set removes redundancy and retains differentiated information, for example:
[0204] "Diabetic patients should avoid high-sugar fruits, such as lychees and mangoes (combining A and B)". "Low-GI fruits are suitable for diabetic patients (C)". "Apples have a low GI value (D)". "Exercise can help regulate blood sugar in diabetic patients (retain)".
[0205] By calling upon users' historical interaction preference data, analyzing users' preferences for the level of detail and style of answer expression, adjusting and simplifying the expression of candidate answers, and generating suitable answers and corresponding reasoning and explanation paths;
[0206] Different users have different preferences for the level of detail and style of expression in answers. Adjusting the answer format based on historical data can improve user experience and enhance interactive adaptability.
[0207] User historical interaction preference data composition: The data includes interaction records from the past 6 months, covering:
[0208] Detail preference: The number of times a user selects "detailed explanation" or "concise answer" (e.g., if 70% of the user's interactions involve selecting detailed explanation, then the user prefers detailed explanation);
[0209] Style preference: Frequency of use of technical terms in answers (e.g., users click more often on answers containing terms such as "GI value" or "insulin," indicating a preference for a technical style; conversely, they prefer a more colloquial style).
[0210] Feedback rating: User satisfaction rating of historical answers (1-5 points), with high-scoring answers (such as clear structure and rich examples) being given priority.
[0211] Preference analysis method: A weighted statistical method is used. The detail preference weight = (number of detailed selections / total number of selections), and the style preference weight = (average score of the technical term answers / average score of all answers). For example, if a user selects "detailed" 80% of the time and the average score of the technical term answers is 4.2 (out of an overall average of 3.8), then the user is judged to prefer the "detailed + technical" style.
[0212] Expression format adjustment: Adjust the structure and language of the answer according to preferences:
[0213] Detail adjustment: Those who prefer detail can add background information (such as "GI value refers to the rate at which food raises blood sugar"), while those who prefer brevity can retain only the core conclusions;
[0214] Style adjustment: The professional style retains the terminology and adds explanations (such as "fruits with a GI value (glycemic index) <55 are low GI fruits"), while the colloquial style is replaced with everyday language (such as "fruits with a slow glycemic index are more suitable").
[0215] Structural adjustments: Users who prefer list formatting should use bullet points (but not list notation, and use natural paragraph breaks), while users who prefer continuous text should use paragraph-based integration.
[0216] Suitable answer and explanation path generation: For example, for users with a preference for "detailed + professional", the suitable answer would be:
[0217] "People with diabetes should prioritize low-GI fruits (GI value < 55), such as apples (GI=36) and pears (GI=36). These fruits raise blood sugar levels more slowly, reducing fluctuations in blood sugar. High-sugar fruits such as lychees (GI=72) and mangoes (GI=55) should be avoided or consumed in small amounts, as they can cause a rapid rise in blood sugar."
[0218] Explanation path: Inferred from the explicit path 'diabetes → forbidden foods → fruit' (confidence 1.0) and the implicit path 'fruit → has → GI value → affects → blood sugar' (confidence 0.7), combined with the domain rule 'low GI foods are suitable for diabetic patients' for verification.
[0219] The explanation path should include the core reasoning path, confidence level, and key rules to enhance the interpretability of the answer.
[0220] Newly discovered entity relationships are extracted during the reasoning process, and their validity is verified before incremental updates to the knowledge graph are performed, forming a closed loop of question-and-answer interaction.
[0221] During the reasoning process, entity relationships not recorded in the knowledge graph may be discovered. After verification, these relationships are updated to the graph, which can continuously enrich the knowledge base, improve the accuracy of subsequent question answering, and form a closed-loop iteration.
[0222] Extraction of new entity relationships: Extracting relationships that do not explicitly exist in the knowledge graph from implicit paths of multi-path reasoning and collaborative reasoning results, for example:
[0223] From the path "diabetes → supportive regulation → exercise → impact → blood sugar", a new relationship is extracted: "diabetes - supportive regulation → exercise".
[0224] Extract a new relationship from the answer "Low-GI fruits are suitable for diabetic patients": "Low-GI fruits - suitable → diabetic patients".
[0225] The extracted relations must include the head entity, relation type, tail entity, and confidence level of the source path (e.g., the confidence level of "diabetes-adjuvant regulation → exercise" is 0.75).
[0226] Validation method: A combination of "automatic verification + manual review" is used.
[0227] Automatic verification: Check whether the new relationship contradicts the existing knowledge in the knowledge graph (if it conflicts with existing rules, it is marked as invalid), and calculate the similarity between the new relationship and known relationships of the same type (e.g., "diabetes - auxiliary regulation → exercise" has a similarity of 0.65 with the known "diabetes - improvement → diet control", which is judged as reasonable).
[0228] Manual review: New relationships that pass automatic verification are reviewed for their scientific validity by domain experts (such as doctors). For example, "diabetes - auxiliary regulation → exercise" conforms to medical common sense and passes the review; "diabetes - cure → fruit" does not conform to medical common sense and fails the review.
[0229] Incremental updates to the knowledge graph: For newly validated relations, add them to the graph according to the knowledge graph schema format (head entity, relation, tail entity, confidence score), for example:
[0230] (Diabetes, auxiliary management, exercise, 0.75);
[0231] (Low GI fruit, suitable for diabetics, 0.8).
[0232] When updating, the source of the relationship should be recorded (e.g., "from the reasoning process of user query 'What fruits can diabetic patients eat?' on 2024-05-20") to facilitate subsequent tracing.
[0233] A closed-loop question-and-answer interaction is formed: The incrementally updated knowledge graph can provide richer relationship paths for subsequent similar questions. For example, when a user asks again, "How can diabetic patients control their blood sugar?", the new relationship "diabetes - auxiliary regulation → exercise" can be used to generate a more comprehensive answer, realizing a closed-loop iteration of "interaction - reasoning - update - re-interaction".
[0234] As can be seen, the natural language questions received from users are parsed hierarchically using a dynamic weight allocation mechanism to generate enhanced semantic vectors containing entity association strength and intent probability distribution. Based on these enhanced semantic vectors, the knowledge graph is traversed to construct a hierarchical query subgraph containing core entities, related entities, and implicit relationships. A multi-path collaborative reasoning algorithm is used to reason and calculate on the hierarchical query subgraph to generate a set of candidate answers. The candidate answer set is then subjected to semantic consistency verification and redundancy removal. Adaptive answers and related explanation paths are generated by combining user historical interaction preferences. Newly discovered entity associations are simultaneously fed back to the knowledge graph for incremental updates, forming a closed loop for question-and-answer interaction. This improves the accuracy and interpretability of question-and-answer interaction, enhances user interaction experience, and improves information acquisition efficiency.
[0235] Another embodiment of the present invention provides a knowledge graph question-answering interactive system based on artificial intelligence, see [link to relevant documentation]. Figure 3 The system may include:
[0236] The parsing module 301 is used to receive natural language questions input by the user. It performs hierarchical parsing of entity words and intent words in the question through a dynamic weight allocation mechanism to generate an enhanced semantic vector containing entity association strength and intent probability distribution. The dynamic weights are adjusted in real time based on historical interaction data of similar questions.
[0237] The construction module 302 is used to traverse the knowledge graph based on the enhanced semantic vector and construct a hierarchical query subgraph containing core entities, related entities and implicit relationships. The core entity layer retains direct relationships, the related entity layer filters indirect relationships through path decay coefficients, and the implicit relationship layer mines potential relationships based on co-occurrence frequency.
[0238] The reasoning module 303 is used to perform reasoning calculations on the hierarchical query subgraph using a multi-path collaborative reasoning algorithm to generate a set of candidate answers. The algorithm verifies explicit relational paths through rule reasoning, completes implicit relational paths through graph embedding models, and dynamically allocates reasoning weights based on path confidence.
[0239] The generation module 304 is used to perform semantic consistency verification and redundancy removal on the candidate answer set, generate suitable answers and related explanation paths by combining user historical interaction preferences, and simultaneously feed newly discovered entity relationships back to the knowledge graph for incremental updates, forming a closed loop of question-and-answer interaction.
[0240] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0241] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0242] Specifically, the aforementioned electronic device may further include a transmission device and an input receiving device, wherein the transmission device is connected to the aforementioned processor, and the input receiving device is connected to the aforementioned processor.
[0243] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.
Claims
1. An artificial intelligence-based knowledge graph question and answer interaction method, characterized in that, The method comprises: receiving a natural language question input by a user, performing hierarchical analysis on entity words and intent words in the question through a dynamic weight distribution mechanism, and generating an enhanced semantic vector containing entity correlation strength and intent probability distribution, wherein the dynamic weight is adjusted in real time according to historical interaction data of similar questions; based on the enhanced semantic vector, traversing the knowledge graph, and constructing a hierarchical query subgraph containing core entities, associated entities and implicit relationships, wherein the core entity layer retains direct correlation, the associated entity layer filters indirect correlation through a path attenuation coefficient, and the implicit relationship layer mines potential correlation based on co-occurrence frequency; using a multi-path collaborative reasoning algorithm to perform reasoning calculation on the hierarchical query subgraph, and generating a candidate answer set, wherein the algorithm verifies explicit relationship paths through rule reasoning, completes implicit relationship paths through a graph embedding model, and dynamically allocates reasoning weights according to path confidence; performing semantic consistency verification and redundancy elimination on the candidate answer set, generating an adaptive answer and an associated explanation path in combination with user historical interaction preferences, and synchronously feeding back newly discovered entity correlation relationships to the knowledge graph for incremental updating, forming a question and answer interaction closed loop.
2. The method of claim 1, wherein, The receiving of the natural language question input by the user, the hierarchical analysis of the entity words and the intent words in the question through the dynamic weight distribution mechanism, and the generation of the enhanced semantic vector containing the entity correlation strength and the intent probability distribution, wherein the dynamic weight is adjusted in real time according to historical interaction data of similar questions, comprises: receiving a natural language question input by a user, performing word segmentation and part-of-speech tagging on the question through a word segmentation tool, distinguishing parts of speech and filtering stop words, and obtaining a preprocessed word segmentation sequence; extracting entity words and intent words from the word segmentation sequence to obtain an entity word set and an intent word set; calling a historical interaction database, extracting contribution data of entity words and intent words in similar questions, calculating dynamic weights of the two types of words in the current question through a time series attenuation function, and obtaining entity word weights and intent word weights; mapping the entity word set and the intent word set into vectors respectively, weighting and fusing according to the dynamic weights, calculating the correlation strength between entities and the probability distribution of intent, and generating an enhanced semantic vector.
3. The method of claim 2, wherein, The traversal of the knowledge graph based on the enhanced semantic vector, and the construction of a hierarchical query subgraph containing core entities, associated entities and implicit relationships, wherein the core entity layer retains direct correlation, the associated entity layer filters indirect correlation through a path attenuation coefficient, and the implicit relationship layer mines potential correlation based on co-occurrence frequency, comprises: performing similarity matching between the enhanced semantic vector and entity vectors in the knowledge graph, screening out entities with a matching degree higher than a preset matching threshold as core entities, and obtaining a core entity set; traversing the knowledge graph from the core entity set as a starting point, extracting direct correlation between core entities and attribute information, constructing a core entity layer containing entity nodes and direct relationship edges, and obtaining a core entity layer subgraph; based on the core entity layer subgraph, expanding the query path, calculating the path attenuation coefficient of each indirect path, retaining indirect associated entities and relationships with a coefficient higher than a preset coefficient threshold, constructing an associated entity layer, and obtaining an associated entity layer subgraph; The statistical knowledge graph is used to mine the implicit relationship and construct an implicit relationship layer by calculating the potential association strength of the entity pairs that are not directly associated but have high frequency co-occurrence, and the hierarchical query subgraph is obtained by fusing the core entity layer, the associated entity layer and the implicit relationship layer.
4. The method of claim 3, wherein, The multi-path collaborative reasoning algorithm is used to perform reasoning calculation on the hierarchical query subgraph to generate a candidate answer set, wherein the algorithm verifies the explicit relationship path through rule reasoning, completes the implicit relationship path through a graph embedding model, and dynamically allocates a reasoning weight according to the path confidence, including: A preset reasoning rule is applied to the explicit relationship path in the hierarchical query subgraph to perform verification, eliminate the paths that do not meet the rule, retain the effective explicit paths, and obtain a verified explicit path set; A graph embedding model is used to perform vector representation learning on the hierarchical query subgraph, complete the implicit relationship path through vector similarity calculation, and obtain a completed implicit path set; The confidence of each path in the verified explicit path set and the completed implicit path set is calculated respectively, wherein the explicit path confidence is calculated based on the rule matching degree, the implicit path confidence is calculated based on the vector similarity, and a path confidence value is obtained; The reasoning weight is dynamically allocated according to the path confidence value, the explicit path and the implicit path are collaboratively reasoned according to the weight, the reasoning results are fused, and a candidate answer set is obtained.
5. The method of claim 4, wherein, The semantic consistency of the candidate answer set is verified, and the redundancy is removed, the adaptability answer and the associated explanation path are generated in combination with the user historical interaction preference, the newly discovered entity association relationship is fed back to the knowledge graph for incremental update, a question and answer interactive closed loop is formed, including: The semantic similarity of each answer in the candidate answer set and the original question is calculated, the answers with a similarity higher than a preset similarity threshold are screened, the answers with semantic conflicts are removed, and a candidate answer subset with semantic consistency is obtained; The redundancy of the candidate answer subset with semantic consistency is calculated, the answers with different expressions but the same core content are merged, and a simplified candidate answer set is obtained; The user historical interaction preference data is called, the user's preference for the expression style of the answer detail and brevity is analyzed, the expression form of the simplified candidate answer is adjusted, the adaptability answer and the corresponding reasoning explanation path are generated; The newly discovered entity association relationship is extracted from the reasoning process, the effectiveness is verified, and the knowledge graph is incrementally updated to form a question and answer interactive closed loop.
6. An artificial intelligence-based knowledge graph question and answer interaction system, characterized in that, The system comprises: An analysis module is configured to receive a natural language question input by a user, perform hierarchical analysis on entity words and intent words in the question through a dynamic weight allocation mechanism, and generate an enhanced semantic vector comprising entity association strength and intent probability distribution, wherein the dynamic weight is adjusted in real time according to historical interaction data of similar questions; A construction module is configured to traverse a knowledge graph based on the enhanced semantic vector, and construct a hierarchical query subgraph comprising core entities, associated entities and implicit relationships, wherein the core entity layer retains direct association relationships, the associated entity layer filters indirect association relationships through a path decay coefficient, and the implicit relationship layer mines potential associations based on co-occurrence frequency. The reasoning module is configured to perform reasoning calculation on the hierarchical query subgraph by using a multi-path collaborative reasoning algorithm to generate a candidate answer set, wherein the algorithm verifies an explicit relationship path by rule-based reasoning, supplements an implicit relationship path by using a graph embedding model, and dynamically allocates a reasoning weight according to a path confidence. The generation module is configured to perform semantic consistency verification and redundancy elimination on the candidate answer set, generates an adaptive answer and an associated explanation path in combination with a user historical interaction preference, feeds back a newly discovered entity association relationship to the knowledge graph for incremental updating, and forms a question and answer interaction closed loop.
7. The system of claim 6, wherein, The analysis module is specifically configured to: receive a natural language question input by a user, perform word segmentation and part-of-speech tagging on the question by using a word segmentation tool, distinguish the parts of speech and filter stop words, and obtain a preprocessed word segmentation sequence; extract entity words and intent words from the word segmentation sequence to obtain an entity word set and an intent word set; call a historical interaction database, extract contribution data of the entity words and the intent words in similar questions, calculate dynamic weights of the two types of words in the current question by using a time decay function, and obtain entity word weights and intent word weights; map the entity word set and the intent word set into vectors respectively, perform weighted fusion according to the dynamic weights, calculate the association strength between entities and the probability distribution of the intent, and generate an enhanced semantic vector.
8. The system of claim 7, wherein, The construction module is specifically configured to: perform similarity matching between the enhanced semantic vector and entity vectors in the knowledge graph, filter out entities with a matching degree higher than a preset matching threshold as core entities, and obtain a core entity set; traverse the knowledge graph from the core entity set as a starting point, extract direct association relationships and attribute information between the core entities, construct a core entity layer containing entity nodes and direct relationship edges, and obtain a core entity layer subgraph; expand a query path based on the core entity layer subgraph, calculate a path decay coefficient of each indirect path, retain indirect association entities and relationships with a coefficient higher than a preset coefficient threshold, construct an associated entity layer, and obtain an associated entity layer subgraph; statistically analyze entity pairs that are not directly associated but frequently co-occur in the knowledge graph, calculate a potential association strength by using a co-occurrence frequency, mine implicit relationships, and construct an implicit relationship layer, and fuse the core entity layer, the associated entity layer, and the implicit relationship layer to obtain a hierarchical query subgraph.
9. A storage medium, characterized by The storage medium stores a computer program, and the computer program is configured to execute the method in any one of claims 1-5 when running.
10. An electronic device comprising a memory and a processor, characterized in that, The storage medium stores a computer program, and the computer program is configured to execute the method in any one of claims 1-5 when running.
Citation Information
Cited By
Question answering method and system based on knowledge graph
CN121071073A
Intelligent question and answer semantic understanding and enhanced rewriting optimization method based on multiple rounds of dialogues
CN121614598A
Intelligent question and answer interaction method fusing private database and enterprise knowledge graph
CN122047493A