Probability distribution and entropy perception fused graph retrieval enhancement generation method
By fusing probability distribution and entropy awareness, the graph retrieval granularity is adaptively adjusted and graph rule verification is performed, which solves the problems of insufficient consistency and interpretability of generated results in existing technologies and achieves higher accuracy and controllability of generated results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2026-01-04
- Publication Date
- 2026-04-10
AI Technical Summary
Existing graph retrieval enhancement generation techniques struggle to adaptively adjust retrieval granularity when faced with multiple candidate results and probability distributions, and lack effective graph rule constraint verification, resulting in insufficient consistency and interpretability of generated results.
By fusing the probability distribution of candidate results, the retrieval granularity is adaptively adjusted, and graph rule constraint verification is performed in the graph retrieval stage, including the generation of local structural evidence, local textual evidence, and macro-semantic evidence. The large model is used to iteratively revise the answer scheme.
It improves the accuracy, interpretability, and controllability of the generated results, reduces the risk of search direction deviation, and realizes the ability to dynamically adjust the search granularity and automatically correct the results.
Smart Images

Figure CN121833898A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of AI large model technology, information retrieval and natural language generation technology, specifically referring to a graph retrieval enhancement generation method that integrates probability distribution. Background Technology
[0002] With the development of Large Language Models (LLMs), Retrieval Augmentation (RAG) techniques have been widely used to improve the factual consistency and interpretability of generated content. Existing RAG techniques typically use input text as the retrieval query, retrieving relevant fragments from external knowledge bases or document repositories based on semantic similarity, and then providing the retrieval results along with the input to the generative model to output the answer. Furthermore, Graph Retrieval Augmentation (GraphRAG) utilizes the entity relationship structure of knowledge graphs for multi-hop expansion, or introduces higher-level pattern knowledge through community partitioning and community summarization, thereby alleviating to some extent the shortcomings of pure text retrieval in utilizing structural information. However, these approaches often use a single query or a single candidate as the retrieval entry point, and the retrieval granularity and scope often employ fixed strategies, making it difficult to adapt to the uncertainties in upstream inference results. This can easily lead to problems such as deviation in retrieval direction or mismatch in the granularity of retrieval evidence.
[0003] The shortcomings of existing technologies lie in the fact that, in practical applications, upstream models or algorithms often output multiple candidate results and provide corresponding confidence levels or probability distributions. These probability distributions carry crucial information about the uncertainty of the results: when the distribution is highly concentrated, local precise retrieval should be prioritized around high-confidence candidates; when the distribution is dispersed, the proportion of global patterns or rule-based knowledge should be increased to avoid premature convergence in the wrong direction. On the other hand, even when external knowledge graphs are introduced as retrieval sources, the generative model may still output combinations that conflict with the explicit constraints of the knowledge graph, logical contradictions, or conclusions lacking necessary premises. Without formal constraint verification and closed-loop error correction mechanisms, these risks are difficult to automatically detect and correct. Summary of the Invention
[0004] In view of the above-mentioned deficiencies of the prior art, the present invention provides a graph retrieval enhancement generation method that integrates probability distribution and entropy awareness. This method can explicitly integrate the probability distribution of candidate results and adaptively adjust the retrieval granularity during the graph retrieval stage. At the same time, it performs graph rule constraint verification and iterative correction on the generated results to improve the correctness, interpretability and controllability of the generated results.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: An enhanced graph retrieval generation method that integrates probability distribution and entropy awareness includes the following steps: S1. Construct a knowledge graph based on unstructured text data; S2. Preprocess the knowledge graph, including dividing communities based on node labels; S3. Receive user input and obtain the probability distribution of candidate answers; S4. Map candidate answers to result entities in the knowledge graph, and use a grouping normalization strategy to construct the initial activation vectors of nodes in the knowledge graph; S5. Adaptively allocate the capacity of local retrieval and community retrieval by calculating the normalized Shannon entropy of the probability distribution of candidate answers, and generate local structural evidence, local textual evidence and macro-semantic evidence. S6. Based on local structural evidence, local textual evidence, and macro-semantic evidence, construct a unified generative context, and then use the large model to output the answer scheme.
[0006] Preferably, S3 includes: S3.1. Guide the large model into reasoning by prompt words, and generate multiple prediction paths and corresponding candidate answers in parallel sampling to obtain a set of candidate answers; S3.2 Generate the probability distribution of candidate answers based on the original confidence scores of the candidate answers.
[0007] Preferably, S4 includes: S4.1 Extract entities from user input and generate a set of observed entities; calculate the graph inverse document frequency of each entity, and then generate entity normalized weights; S4.2. Use the probability distribution of candidate answers as the weights within the set of result entities corresponding to the candidate answers; S4.3. By using a balancing factor, the entity normalization weight and the weight within the result entity set are fused and normalized to construct the initial activation value of any node on the knowledge graph.
[0008] As a preferred embodiment, S5 includes: S5.1 Calculate the normalized Shannon entropy of the candidate answer probability distribution; adaptively determine three types of retrieval capacity through monotonic mapping, including local entity-level capacity, local textual evidence capacity, and community-level capacity; adaptively allocate the three types of retrieval capacity according to the normalized Shannon entropy value of the candidate answer probability distribution. S5.2. Perform local retrieval on the filtered knowledge subgraph, using the union of the observed entity set and the candidate answer set as the retrieval seed to generate local structural evidence and local textual evidence. S5.3 Select highly relevant communities based on the defined community weighted scores; generate macro-semantic evidence based on the semantic text summaries of highly relevant communities.
[0009] Preferably, S5.1 includes: The normalized Shannon entropy of the candidate answer probability distribution is calculated based on its candidate answer probability distribution; Based on the adaptive determination of three types of retrieval capacity using normalized Shannon entropy, the capacity at the local entity level is increased when the normalized Shannon entropy is small. With local textual evidence capacity To obtain richer, more granular evidence; when the normalized Shannon entropy is high, increase the community-level capacity. This allows for the introduction of more community-level pattern knowledge, thereby enabling dynamic fusion of retrieval granularity as uncertainty changes.
[0010] Preferably, S5.2 includes: A filtered knowledge subgraph is constructed by selecting a set of semantically consistent relation types; the initial weight of the retrieval seed is the initial activation vector. Define the local relevance score of the nodes; sort them in descending order of local relevance score and select the top ones. Each entity constitutes a local retrieval entity set; high-confidence triples connected to entities in the local retrieval entity set are extracted to constitute local structural evidence. Text block relevance is defined using a normalized index, and the top [block relevance] is selected. Each text block constitutes local textual evidence.
[0011] As a preferred embodiment, S5.3 includes: The community-weighted score is defined as follows:
[0012] Where y represents the entity node corresponding to the candidate answer in the knowledge graph. For y , For indicator functions, For the community, The set of candidate answer results entities; Communities are sorted in descending order of their weighted community scores, and the top [communities] are selected. Each community is designated as a highly relevant community; macro-level semantic evidence is generated based on the semantic text summaries of the highly relevant communities.
[0013] As a preferred embodiment, S6 includes: S6.1. Based on the construction of a unified generation context, use the large model to generate an initial answer scheme; S6.2. The initial answer scheme is mapped to the knowledge graph through the extraction module to generate a scheme subgraph; S6.3 Define a rule base that includes hard constraint rules and soft constraint rules; output the violation set based on the scheme subgraph, knowledge graph and rule base using a predefined verification function; S6.4. Use an iterative mechanism to generate response schemes that satisfy hard constraint rules; output the response schemes and the violation set.
[0014] Preferably, S6.1 includes: Extract key factual features from user input; summarize the candidate answer result entity set; a unified generation context includes the candidate answer result entity set, key factual features from user input, a summary of the candidate answer result entity set, local structural evidence, local textual evidence, and macro-semantic evidence; under the constraints of the context, use a large model to generate an initial answer scheme, and constrain the output format of the initial answer scheme through prompt engineering.
[0015] As a preferred option, the hard constraint rules in S6.3 include: Mutual exclusion constraint: If mutually exclusive edges exist in the knowledge graph, a hard violation is triggered. State conflict constraints: If an entity's attributes violate the predefined state machine logic, a hard violation is triggered. Soft constraint rules include: Integrity checks are performed. If a high-confidence answer implies the need for a certain precondition, but that condition is missing from the set of key entities involved in the answer, a suggestive alert is triggered.
[0016] Compared with the prior art, the beneficial effects of the present invention are reflected in: 1. Unlike traditional technologies that rely solely on a single candidate prediction result or a single query term as the entry point for graph retrieval, this invention maps the probability distribution of candidate results output from upstream to result seed entities, and performs unified modeling and normalized weighting with the input extracted observation seed entities to form an initial activation distribution. This allows the retrieval entry point to no longer be limited to a single perspective, and can explicitly reflect the uncertainty of candidates and the key information of the input, thereby reducing the risk of deviation in retrieval direction and significantly improving the stability of relevant knowledge recall.
[0017] 2. Unlike traditional techniques that use fixed retrieval strategies or single-granularity evidence collection, this invention employs a technique that uses normalized entropy calculated based on candidate probability distribution to quantify uncertainty, and adaptively allocates the retrieval capacity of local entity evidence and community-level pattern summary. This allows the retrieval granularity to be dynamically adjusted according to the uncertainty of the task (i.e., focusing on precise local evidence when the distribution is concentrated, and introducing more global pattern knowledge when the distribution is dispersed), thereby achieving a more reasonable balance between accuracy and robustness and effectively suppressing the overfitting or insufficient evidence problems caused by fixed strategies.
[0018] 3. Unlike traditional technologies that lack structured constraint verification or only perform single generation without correction mechanisms, this invention adopts a closed-loop technology that maps the generated results to output subgraphs and performs formal constraint verification based on a rule base. When hard constraints are triggered, feedback information drives the model to iteratively correct the model. This enables the system to automatically identify and correct errors that conflict with knowledge graph constraints (such as coexistence of mutually exclusive relationships, missing necessary premises, etc.), thereby ensuring that the output meets hard constraints or can be safely rolled back, significantly improving the consistency, controllability, and verifiability of the generated results. Attached Figure Description
[0019] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 The figure shows the experimental results of Embodiment 1 of the present invention. Detailed Implementation
[0020] To make the technical means, inventive features, objectives, and effects of the invention readily understandable, the invention is further described below with reference to specific illustrations. However, the invention is not limited to the embodiments described below.
[0021] It should be noted that the structures, proportions, sizes, etc., illustrated in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0022] Example 1: like Figure 1 This paper presents a method for enhancing the generation of large-scale graph retrieval by fusing probability distribution and entropy awareness. This method is not limited to a specific domain and can be widely applied to scenarios such as medical diagnosis, legal consultation, financial analysis, and general question-answering systems. The overall process of this embodiment includes: intelligent construction of a general knowledge graph, graph community detection and semantic summarization generation, probability-driven candidate result distribution generation, dual-source weighted graph entry construction, entropy-aware multi-granularity retrieval, and closed-loop correction based on graph constraints. Specifically, it includes the following steps: S1. Construct a graph based on unstructured text data; To address the issues of high cost and rigid patterns in traditional knowledge graph construction, this step adopts a large-model-driven automated construction scheme, which can adapt to the dynamic access of multi-source heterogeneous data.
[0023] S1.1 Entity relation extraction based on prompting engineering, specifically including: First, entity recognition and attribute extraction are performed. Based on preset entity type constraints, the system scans the input document to locate all target entities. For each identified entity, the system normalizes its name to uppercase, determines its specific type, and generates a comprehensive descriptive text covering the entity's attributes and key activities, thus constructing an entity information unit containing name, type, and description.
[0024] Secondly, based on the identified entity set, relation inference and parsing are performed. The system traverses all possible entity combinations and identifies entity pairs with clear semantic relationships. For each pair of related entities, the system explicitly distinguishes between the source and target entities, determines the relationship type based on the principles of generality and non-temporality, and generates descriptive text explaining the basis for the relationship.
[0025] Finally, the system converts all extracted entity and relation attributes into Chinese expressions and encapsulates the information into a unified list format according to predetermined structured rules (such as specific delimiters) for output, thereby completing the transformation from unstructured text to structured knowledge records.
[0026] Receive the unstructured text data to be processed. A general extraction hint template is constructed as follows: KG_Prompt=""" -Target- Given a relevant text document and a list of entity types, identify all entities of these types from the text and all relationships between the identified entities.
[0027] -step- 1. Identify all entities. For each identified entity, extract the following information: -entity_name: Entity name, in uppercase -entity_type: One of the following types: [{entity_types} -entity_description: A comprehensive description of the entity's attributes and activities. Format each entity as ("entity"{tuple_delimiter})<entity_name> {tuple_delimiter}<entity_type> {tuple_delimiter}<entity_description> 2. Identify each other from the entities identified in step 1. Clearly related All entity pairs (source_entity, target_entity).
[0028] For each pair of related entities, extract the following information: -source_entity: The name of the source entity, as identified in step 1. -target_entity: The name of the target entity, as identified in step 1. -relationship_type: Relationship type, ensuring consistency and generality of relation types, using more general and temporally invariant relation types. -relationship_description: Explain why you believe the source and target entities are related. Format each relation as ("relationship"{tuple_delimiter})<source_entity> {tuple_delimiter}<target_entity> {tuple_delimiter}<relationship_type> {tuple_delimiter}<relationship_description> ) 3. Output all attributes of entities and relationships in Chinese. All entities and relationships identified in steps 1 and 2 will be output as a list. (Use...) {record_delimiter} Used as a list separator.
[0029] 4. After completion, output {completion_delimiter}. """ S1.2 Graph Data Storage and Vector Index Construction The structured text output from S1.1 is parsed using regular expression matching and instantiated into nodes and edges in a graph database (such as Neo4j). To support subsequent semantic matching tasks, this embodiment establishes a vector index and uses a general text embedding model (such as BGE-M3 or OpenAI Embedding) to concatenate the entity's name, description, and other content into a high-dimensional vector, which is then stored in the vector index of the graph database for fuzzy semantic alignment.
[0030] S1.3 Entity Disambiguation Based on Vectors and Semantics To address potential duplicate entities in the graph, a two-stage alignment strategy is adopted: first, vector similarity (such as cosine similarity) combined with the KNN algorithm is used to select candidate duplicate pairs with high confidence; second, these candidate pairs are input into a large model for semantic verification to determine whether they refer to the same real-world object, thereby completing the normalization and fusion of the graph.
[0031] S2. Preprocess the graph, including dividing communities based on node labels; Graph community detection and semantic summarization generation. In order to capture the topological structure information of the graph from a macro perspective and support multi-granularity retrieval from micro entities to macro topics, this step preprocesses the graph.
[0032] S2.1 Overlapping Community Division Based on Label Propagation Considering that an entity in a general domain may belong to multiple topic circles, this embodiment adopts the Speaker-Listener Label Propagation Algorithm (SLLPA) that supports overlapping community detection. The basic idea is to simulate the propagation of opinions in a social network: each node has a unique label upon initialization. During iteration, each node "listens" to the labels of all its neighbors and updates its own label list based on the "influence" of these labels (usually measured by frequency or propagation weight). Unlike the classic LPA algorithm, SLLPA allows each node to retain multiple most influential labels (not just one), thus naturally supporting the generation of overlapping communities and ultimately grouping nodes with the same label into the same community. .
[0033] S2.2 Generative Community Summary For each divided community By using a large model to summarize the thematic characteristics of the community, a natural language summary is generated. The summary will be stored as metadata for community nodes.
[0034] S3. Receive user input and obtain the probability distribution of candidate answers; Probability-driven candidate result distribution generation. This step serves as a bridge connecting user input with graph knowledge. Unlike traditional retrieval methods that directly match the question query, this invention first utilizes a large model to generate a potential answer distribution, thereby quantifying the uncertainty of the question.
[0035] S3.1. Guide the large model into inference using prompt words, and generate multiple prediction paths and corresponding candidate answers in parallel sampling across various communities to obtain a candidate answer set. ; Multi-path thought chain sampling. Receiving natural language input from the user. .Will Input large model The model is guided to perform inference through simple prompt word engineering, and parallel sampling and generation are used. Each of the following is a different prediction path and its corresponding candidate answer.
[0036] S3.2 Generate the probability distribution of candidate answers based on the original confidence scores of the candidate answers; Modeling the probability distribution of candidate answers. For the generated... Aggregate and statistically analyze the candidate answers. Calculate the unique candidate answer. The frequency of occurrence or cumulative log probability is used as the original confidence level. The confidence results are then normalized to obtain the probability distribution of the candidate answers:
[0037] This distribution This reflects the model's confidence level in predicting the answer without consulting an external knowledge base. S4. Initial activation vectors for nodes on the graph are constructed using a grouping normalization strategy; Dual-source grouping normalization retrieval entry construction. To balance the objective facts inputted by the user with the potential direction of large-scale model inference, and to address noise interference from common nodes in the graph, this step employs a grouping normalization strategy to construct the initial activation vector. .
[0038] S4.1 Extract entities from user input and generate a set of observed entities; calculate the graph inverse document frequency of each entity, and then generate entity normalized weights; Specificity-based weighting of observed entities. For the set of observed entities extracted from user input... Calculate each entity The graph inverse document frequency (Graph-IDF) is used to measure its specificity in graph topology:
[0039] in For node degree, This represents the total number of nodes in the graph. This is a smoothing term.
[0040] To prevent common nodes from dominating the retrieval flow, in the observed entity set Within the group based Calculate entity normalized weights :
[0041] in This is an adjustment coefficient. This coefficient is used to control the sharpness of the weight distribution. The larger the value, the stronger the model's preference for highly specific entities, thus more aggressively suppressing noise interference from general high-frequency nodes (such as "year").
[0042] S4.2. Use the probability distribution of candidate answers as the weights within the candidate answer result entity set group; The confidence score of the resulting entities is weighted. This applies to the set of resulting entities corresponding to the candidate answers generated by the model. The probability distribution of each candidate answer is obtained directly using S3. As weight within the candidate answer group .in, Indicates each candidate answer The resulting entity obtained by mapping in the graph.
[0043] S4.3. By using a balancing factor, the entity normalization weight and the weight within the candidate answer result entity group are fused and normalized to construct the initial activation value of any node on the graph. Dual-source mixing and initial vector generation. Introducing a balance factor. This parameter controls the retrieval algorithm's dependence on "user input (observations)" and "model predictions (results)". The candidate probability weights and observation discrimination weights are fused and normalized to form the initial activation distribution on the map nodes. This distribution serves as a unified entry point for subsequent local expansion and evidence scoring.
[0044] when At times, retrieval is more conservative, focusing on validating facts surrounding the user's input; when At certain times, the retrieval is more aggressive, focusing on exploring potential answers predicted by the model; in other ranges, the values achieve a better balance between accuracy and exploratory nature.
[0045] Ultimately, any node on the graph initial activation value Defined as:
[0046] It is worth noting that if a node belongs to two sets at the same time, then the weights of both sets are superimposed.
[0047] S5. Adaptively allocate the capacity of local retrieval and community retrieval by calculating the normalized Shannon entropy of the probability distribution of candidate answers, and generate local structural evidence, local textual evidence and macro-semantic evidence. Entropy-aware multi-granularity dynamic retrieval. This step uses the Shannon entropy of the candidate distribution to measure the complexity of the problem, thereby adaptively adjusting the retrieval ratio of "micro" and "macro" information.
[0048] S5.1 Calculate the normalized Shannon entropy of the candidate answer probability distribution; adaptively determine three types of retrieval capacity through monotonic mapping, including local entity-level capacity, local textual evidence capacity, and community-level capacity; adaptively allocate the three types of retrieval capacity according to the normalized Shannon entropy value of the candidate answer probability distribution. Entropy-aware computation and dynamic retrieval capacity routing. After obtaining the probability distribution of candidate answers, it is necessary to retrieve detailed entity-level evidence and community-level pattern knowledge from the knowledge graph. The uncertainty of model prediction directly affects the granularity of the retrieval focus: when the prediction intent is clear, local evidence highly related to specific entities should be deeply explored; when the prediction intent is ambiguous, the perspective should be broadened to refer to a more macro-level community-level background and summary. To this end, this embodiment designs an entropy-aware dynamic routing mechanism that adaptively allocates the capacity of local retrieval and community retrieval based on the normalized Shannon entropy value of the candidate answer probability distribution.
[0049] Let the size of the candidate answer result entity set be Based on its probability distribution, the normalized Shannon entropy of the candidate answer probability distribution is calculated:
[0050] in, Represents the entity of candidate answer results .when When the model prediction is highly focused on a particular hypothesis, it indicates a high degree of certainty; when When the value is 0, it indicates that the predicted distribution is uniform and the uncertainty is high.
[0051] Based on normalized Shannon entropy This invention adaptively determines three types of retrieval capacity through monotonic mapping (e.g., linear routing and rounding): local entity-level capacity. Local textual evidence capacity and community-level capacity Among them, when Smaller, increase and To obtain richer, more granular evidence; when Larger, increase This involves incorporating more community-level pattern knowledge to achieve dynamic fusion of retrieval granularity as uncertainty changes, specifically including: Search capacity (Number of local entities) (Number of local text blocks) and (Number of communities) as the normalized Shannon entropy of the probability distribution of candidate answers The function is dynamically determined. A linear routing strategy is used with rounding:
[0052]
[0053]
[0054] Subscript These are preset upper and lower bounds for capacity. This mapping ensures that when the entropy value is 0 < When the value is less than 0.3 (with a clear intent), the system allocates more capacity to local entity-level retrieval. Increase the field of view (to focus on microscopic evidence); when the entropy value is 0.3 < When the value is less than 1 (intention is uncertain), the system allocates more capacity to community-level searches. (Increase), broaden the perspective to obtain macroscopic semantic patterns.
[0055] S5.2. Perform local retrieval on the filtered knowledge subgraph, using the union of the observed entity set and the candidate answer result entity set as the retrieval seed to generate local structural evidence and local textual evidence. Distance-falldown weighted local entity and text retrieval. Local retrieval in the filtered knowledge subgraph. The above is performed, where V represents an entity node in the graph. This is a set of semantically consistent relation types used to eliminate irrelevant paths and reduce noise. It is based on the observed entity set. and candidate answer result entity set union As a retrieval seed, its initial weight is .
[0056] Define nodes The local relevance score measures the attenuated weighted support of multi-source seed evidence for it: in For subgraph The length of the unweighted shortest path (number of hops) on the [unweighted shortest path]. The attenuation coefficient is... For the maximum propagation radius, Let be the indicator function. This formula implements a seed-centric weighted breadth-first search with exponential decay.
[0057] According to the node Local correlation score Sort in descending order and select the first few. The entities constitute a local retrieval entity set:
[0058] Simultaneously, extract and locally retrieve entity sets. High-confidence triples connected in the middle constitute evidence of local structure. .
[0059] In terms of text evidence retrieval, each text block is set as follows: Associate an entity set To avoid long texts containing a large number of entities receiving systematically high scores, a normalization index is introduced. Define text block relevance:
[0060] in For smoothing terms. Before selection. These text blocks constitute local textual evidence. .
[0061] S5.3 Select highly relevant communities based on the defined community weighted scores; generate macro-semantic evidence based on the semantic text summaries of highly relevant communities; Probability-weighted community-level pattern retrieval. Community-level retrieval aims to provide a more macro-level semantic context for decision-making based on group topic patterns. The community division of the graph is noted as follows: Each community Semantic text summaries have been pre-generated. .
[0062] To ensure that community retrieval is relevant to the candidate distribution generated by the current model, a community is defined. Weighted score: Where y represents the entity node corresponding to the candidate answer in the graph. This is an indicator function. The score reflects the overlap between the distribution of candidate answers and community topics.
[0063] according to Sort in descending order and select the first few. A highly relevant community, whose summaries constitute macro-semantic evidence:
[0064] Ultimately, the system will integrate local evidence. Community-level evidence The data is then input into the subsequent inference module for comprehensive generation. This multi-granularity retrieval mechanism utilizes entropy values. Dynamic routing enables adaptive adjustment of evidence granularity and scope of view based on the uncertainty of the problem.
[0065] S6. Construct a unified generative context based on local structural evidence, local textual evidence, and macro-semantic evidence; use the large model to output the answer scheme.
[0066] Natural language output is transformed into a computable structure in the knowledge graph space, and formal verification and closed-loop error correction are achieved through a rule base. First, the input, a subset of candidate results, and the retrieval context are input into the generative model to obtain the initial generated output. To facilitate subsequent verification, this invention employs structured template constraints on the output, making it stably parsable by the extraction module. Subsequently, the extraction module maps the output to an output subgraph and performs entity links to align it to the knowledge graph space. Next, graph constraint verification is performed on the output subgraph based on the rule base: rules are triggered in the form of "output subgraph and graph relationship / attribute constraints," and the output includes trigger instances and severity labels; hard constraints are used to prohibit conflicting combinations, coexistence of mutually exclusive relationships, and violations of necessary premises. If a hard constraint is triggered, the trigger instance is transcribed into constraint feedback and injected back into the generative model, iteratively executing "generation—extraction—verification" until the hard constraint is eliminated or the maximum number of iterations is reached; when the upper limit is reached and the hard constraint still cannot be satisfied, a fallback result satisfying the hard constraint is output to ensure the controllability and safety boundaries of the output.
[0067] Ontology-constrained closed-loop correction. After completing entropy-aware multi-granularity retrieval, the system obtains evidence of local structure. Local textual evidence Macro-semantic evidence This step constructs a unified reasoning context and ensures that the final generated answer is logically rigorous and conforms to domain constraints through a closed-loop process of "generation—structured extraction—rule verification—feedback correction".
[0068] S6.1. Construct a unified generation context by using structured user input and search results; under the constraints of the unified generation context, use a large model to generate an initial answer scheme. Unified context construction and initial generation. To enable the large model to integrate multi-source information, the user input and multi-granularity retrieval result set (i.e., local structural evidence) are first processed. Local textual evidence With macro-semantic evidence The resulting set is then represented in a structured manner. Let the user's original input information be... Extract the key factual features (such as time, location, and entity status) and denot them as ; Set of candidate answer results Extract a summary, denoted as Build a unified generation context :
[0069] In context Under the constraints of large models Generate initial answer scheme :
[0070] To improve the operability of subsequent verification, the output format is constrained by the prompt word engineering, requiring... It includes clear logical blocks (such as: conclusions, supporting evidence, action recommendations, and risk warnings).
[0071] S6.2. Through the extraction module, the initial answer scheme is mapped to the graph space to generate a scheme subgraph; Structured subgraph extraction and mapping. An extraction module is introduced to enable logical reasoning at the knowledge graph level. The initial response scheme generated from natural language Mapped to scheme subgraphs in the spectral space : in: This represents the set of key entities involved in the answer; This indicates a set of recommended actions or relationships; A collection representing entity attributes or states.
[0072] By using entity linking technology, the above elements are mapped to a general knowledge graph. The entity space, thereby activating the predefined logical rules in the graph.
[0073] S6.3 Define a rule base that includes hard constraint rules and soft constraint rules; use predefined verification functions to check the rules based on the scheme subgraph and the graph. Combine the rule base and output the set of violations; A two-tiered constraint rule base and security verification functions. To balance the rigor of the logic with the flexibility of the response, this embodiment divides the rule base into hard constraints and soft constraints. Verification functions are defined. Input scheme subgraph With atlas Output the set of violations:
[0074] The specific constraint logic is as follows: (1) Hard constraints (Logical blocking type): Mutual exclusion constraint: If mutually exclusive edges exist in the graph. ,and ,in If the edge refers to all mutually exclusive meaning types in the graph, then a hard violation is triggered (e.g., in a legal scenario, the "plaintiff" and the "defendant" cannot be represented by the same person).
[0075] State conflict constraint: If an entity attribute violates predefined state machine logic (e.g., time). However, the order of events is reversed, triggering a hard violation.
[0076] (2) Soft constraints (Suggestions and tips): Integrity check: If the answer has high confidence... It implies that a certain prerequisite is required, but... If this condition is missing, a warning message will be triggered (e.g., it is recommended to back up before proceeding).
[0077] S6.4 Output generated answers and violation information.
[0078] A feedback-based iterative correction loop is employed. An iterative mechanism ensures that the generated answers meet hard constraints. When a hard violation is detected, the violation information is converted into natural language feedback and injected into the model for regeneration; when only soft suggestions exist, they are appended to the final result.
[0079] Example 2: like Figure 2 As shown, this embodiment compares the method of the present invention with other methods. Through comparative analysis, this embodiment details the performance differences between the method of the present invention and traditional RAG (Retrieval Enhancement Generation), traditional KG-RAG (Knowledge Graph-based Retrieval Enhancement Generation), GraphRAG (Graph Retrieval Enhancement Generation), and LightRAG (Lightweight Graph Retrieval Enhancement Generation) in five key technical indicators. The comparative data shows that traditional RAG lacks all advanced retrieval functions. While traditional KG-RAG introduces graph retrieval support, its retrieval breadth is still limited to local retrieval and it does not support probability distribution input or result verification. Although the more advanced GraphRAG and LightRAG achieve a combination of graph retrieval and local and global retrieval, they still cannot support probability distribution input, adaptive adjustment of retrieval result fusion, and result verification when facing complex inputs and result optimization. In contrast, the method of the present invention demonstrates significant technological superiority. It not only comprehensively covers the capabilities of graph retrieval and dual global and local retrieval, but also pioneers support for probability distribution input in the industry. Furthermore, it innovatively achieves adaptive adjustment of retrieval result fusion through entropy-aware calculation, and introduces a result verification mechanism to ensure the accuracy of the output. This indicates that the proposed method surpasses the limitations of existing mainstream technologies in terms of the depth of information processing, the system's adaptive adjustment capability, and the reliability of the final generated results, demonstrating significant comprehensive advantages.
Claims
1. A graph retrieval enhancement generation method that integrates probability distribution and entropy awareness, characterized in that, Includes the following steps: S1. Construct a knowledge graph based on unstructured text data; S2. Preprocess the knowledge graph, including dividing communities based on node labels; S3. Receive user input and obtain the probability distribution of candidate answers; S4. Map candidate answers to result entities in the knowledge graph, and use a grouping normalization strategy to construct the initial activation vectors of nodes in the knowledge graph; S5. Adaptively allocate the capacity of local retrieval and community retrieval by calculating the normalized Shannon entropy of the probability distribution of candidate answers, and generate local structural evidence, local textual evidence and macro-semantic evidence. S6. Based on local structural evidence, local textual evidence, and macro-semantic evidence, construct a unified generative context, and then use the large model to output the answer scheme.
2. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 1, characterized in that, S3 include: S3.
1. Guide the large model into reasoning by prompt words, and generate multiple prediction paths and corresponding candidate answers in parallel sampling to obtain a set of candidate answers; S3.2 Generate the probability distribution of candidate answers based on the original confidence scores of the candidate answers.
3. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 1, characterized in that, S4 include: S4.1 Extract entities from user input and generate a set of observed entities; Calculate the graph inverse document frequency for each entity, and then generate the entity normalized weights; S4.
2. Use the probability distribution of candidate answers as the weights within the set of result entities corresponding to the candidate answers; S4.
3. By using a balancing factor, the entity normalization weight and the weight within the result entity set are fused and normalized to construct the initial activation value of any node on the knowledge graph.
4. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 1, characterized in that, S5 include: S5.1 Calculate the normalized Shannon entropy of the candidate answer probability distribution; adaptively determine three types of retrieval capacity through monotonic mapping, including local entity-level capacity, local textual evidence capacity, and community-level capacity; adaptively allocate the three types of retrieval capacity according to the normalized Shannon entropy value of the candidate answer probability distribution. S5.
2. Perform local retrieval on the filtered knowledge subgraph, using the union of the observed entity set and the candidate answer set as the retrieval seed to generate local structural evidence and local textual evidence. S5.3 Select highly relevant communities based on the defined community weighted scores; generate macro-semantic evidence based on the semantic text summaries of highly relevant communities.
5. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 4, characterized in that, S5.1 includes: The normalized Shannon entropy of the candidate answer probability distribution is calculated based on its candidate answer probability distribution; Based on the adaptive determination of three types of retrieval capacity using normalized Shannon entropy, the capacity at the local entity level is increased when the normalized Shannon entropy is small. With local textual evidence capacity To obtain richer, more granular evidence; when the normalized Shannon entropy is high, increase the community-level capacity. This allows for the introduction of more community-level pattern knowledge, thereby enabling dynamic fusion of retrieval granularity as uncertainty changes.
6. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 5, characterized in that, S5.2 includes: A filtered knowledge subgraph is constructed by selecting a set of semantically consistent relation types; the initial weight of the retrieval seed is the initial activation vector. Define the local relevance score of the nodes; sort them in descending order of local relevance score and select the top ones. Each entity constitutes a local retrieval entity set; high-confidence triples connected to entities in the local retrieval entity set are extracted to constitute local structural evidence. Text block relevance is defined using a normalized index, and the top [block relevance] is selected. Each text block constitutes local textual evidence.
7. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 4, characterized in that, S5.3 includes: The community-weighted score is defined as follows: , Where y represents the entity node corresponding to the candidate answer in the knowledge graph. For y , For indicator functions, For the community, The set of candidate answer results entities; Communities are sorted in descending order of their weighted community scores, and the top [communities] are selected. Each community is designated as a highly relevant community; macro-level semantic evidence is generated based on the semantic text summaries of the highly relevant communities.
8. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 1, characterized in that, S6 include: S6.
1. Based on the construction of a unified generation context, use the large model to generate an initial answer scheme; S6.
2. The initial answer scheme is mapped to the knowledge graph through the extraction module to generate a scheme subgraph; S6.3 Define a rule base that includes hard constraint rules and soft constraint rules; output the violation set based on the scheme subgraph, knowledge graph and rule base using a predefined verification function; S6.
4. Use an iterative mechanism to generate response schemes that satisfy hard constraint rules; output the response schemes and the violation set.
9. The graph retrieval enhancement generation method integrating probability distribution and entropy awareness according to claim 8, characterized in that, S6.1 includes: Extract key factual features from user input; summarize the candidate answer result entity set; a unified generation context includes the candidate answer result entity set, key factual features from user input, a summary of the candidate answer result entity set, local structural evidence, local textual evidence, and macro-semantic evidence; under the constraints of the context, use a large model to generate an initial answer scheme, and constrain the output format of the initial answer scheme through prompt engineering.
10. The graph retrieval enhancement generation method fusing probability distribution and entropy awareness according to claim 8, characterized in that, The hard constraint rules in S6.3 include: Mutual exclusion constraint: If mutually exclusive edges exist in the knowledge graph, a hard violation is triggered. State conflict constraints: If an entity's attributes violate the predefined state machine logic, a hard violation is triggered. Soft constraint rules include: Integrity checks are performed. If a high-confidence answer implies the need for a certain precondition, but that condition is missing from the set of key entities involved in the answer, a suggestive alert is triggered.