Multi-path thinking chain reasoning generation method based on fine-grained knowledge retrieval

Through the multi-path thinking chain inference generation method of fine-grained knowledge retrieval, the large language model is used for deep semantic analysis and path optimization, solving the problem of insufficient structure of semantic understanding and reasoning in the existing technology, and achieving efficient and reliable inference path generation and consistent answer output.

CN120297425AActive Publication Date: 2025-07-11INST OF INT RELATIONS

Patent Information

Application Number
CN202510786179.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-07-11
Estimated Expiration
2045-06-12

AI Technical Summary

Technical Problem

The existing thinking chain technology has shortcomings in semantic understanding, inference structure and knowledge integration, and it is difficult to capture implicit information and subtle relationships. The reasoning process lacks logical links, and the knowledge injection method is single, which affects the efficiency and accuracy of reasoning.

Method used

A multi-path thinking chain inference generation method based on fine-grained knowledge retrieval is adopted, and in-depth semantic analysis, entity relationship extraction, double-threshold filtering, path construction and optimization, Top-k scoring and majority voting mechanisms are performed through large language models to generate inference paths with high semantic correlation and output consistent answers.

Benefits of technology

It significantly improves the accuracy of knowledge extraction and the logical coherence of inference paths, improves the reliability and robustness of the final conclusions, and enhances the accuracy and interpretability of inference in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120297425A_ABST
    Figure CN120297425A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-path thinking chain reasoning generation method based on fine-grained knowledge retrieval, which comprises the following steps of: performing deep semantic analysis on a user question by adopting a large language model, and extracting a relationship between entities contained in a question text to generate a triple set; the triple is dynamically divided into different confidence sets by setting high and low confidence thresholds; constructing a thinking chain framework by using a predefined path to obtain an initial reasoning path set; optimizing the initial reasoning path, and sampling an optimized reasoning path set by using Top-k scoring to obtain a reasoning path set with high semantic relevancy; dividing the reasoning path set into a plurality of reasoning path groups with complementary internal path information to obtain a plurality of candidate answers; and adopting a majority voting mechanism to select a plurality of candidate answers, and finally obtaining consistent answers. According to the method, the reasoning accuracy and interpretability can be remarkably improved, and the reliability and robustness of a final conclusion are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of artificial intelligence, and particularly relates to a multi-path chain-of-thought reasoning generation method, a computer device, a computer-readable storage medium, and a computer program product based on fine-grained knowledge retrieval. Background Art

[0002] In the field of artificial intelligence, the chain-of-thought (CoT) reasoning technology is an important breakthrough in enhancing the interpretability and logical reasoning ability of artificial intelligence models. Traditional large language models (LLMs) usually generate results in an end-to-end manner, lacking a transparent reasoning process. The chain-of-thought method not only improves the performance of the model in complex tasks by explicitly guiding the model to perform step-by-step reasoning but also makes the decision-making process more traceable and verifiable. This technology significantly enhances the application value of artificial intelligence systems in fields such as mathematical reasoning, logical analysis, and complex problem-solving, laying a foundation for achieving more reliable and trustworthy artificial intelligence.

[0003] However, existing chain-of-thought technologies, especially the zero-shot chain-of-thought (Zero-shot CoT) method, still have several key defects: First, at the semantic understanding level, the model's parsing of text often stays on the surface, making it difficult to capture implicit information and subtle associations, resulting in frequent understanding biases when dealing with polysemous words, complex references, or scenarios requiring domain knowledge. Second, in the reasoning process, although step-by-step reasoning can be generated, there is no clear logical link between steps, and the extracted entities and relationships are discretely distributed, with missing key nodes causing logical breaks and unclear causal associations between intermediate conclusions and the final answer. Finally, in the knowledge integration mechanism, existing methods rely on simple threshold filtering, which may either wrongly filter important associations or retain irrelevant noise. Coupled with the single knowledge injection method's inability to dynamically adjust weights, it seriously affects the reasoning efficiency and accuracy. Therefore, in view of the deficiencies of existing chain-of-thought technologies in semantic understanding, reasoning structuring, and knowledge integration, there is an urgent need for an innovative method that can refine the extraction of semantic relationships and dynamically construct a structured reasoning path to further improve the reasoning ability of large models. Summary of the Invention

[0004] The purpose of the present invention is to address the problems existing in the prior art and provide a multi-path chain-of-thought reasoning generation method, a computer device, a computer-readable storage medium, and a computer program product based on fine-grained knowledge retrieval, which can significantly improve the accuracy of knowledge extraction, refine the reasoning path while ensuring logical coherence, and greatly enhance the reliability and robustness of the final conclusion.

[0005] One aspect of the present invention provides a multi-path chain-of-thought reasoning generation method based on fine-grained knowledge retrieval, including: Step S1, use a large language model to perform in-depth semantic analysis on the user's question and extract the entity information contained in the question text; Step S2, input the extracted entities into the large language model again, extract all the relationships between the entities, and generate a triple set; Step S3, assign a relevance score to each triple according to the context relevance, set a high confidence threshold and a low confidence threshold, and divide the triple set into three categories: highly relevant, low relevant, and medium relevant according to the relevance score. Provide the highly relevant and low relevant triples as positive and negative samples to the large language model to further distinguish the medium relevant triples and obtain fine-grained triples highly relevant to the user's question; Step S4, input the triples highly relevant to the user's question into the large language model, and use a pre-defined path construction thinking chain framework to obtain an initial inference path set; Step S5, input the initial inference path set into the large language model, and let it optimize the initial inference path according to the optimization strategies of eliminating redundancy, reordering entity order, and merging sub-paths to obtain an optimized inference path set; Step S6, input the optimized inference path set into the large language model, and sample the optimized inference path set using Top-k scoring to obtain an inference path set with high semantic relevance; Step S7, input the user's question and the inference path set with high semantic relevance into the large language model, divide the inference path set into multiple inference path groups with complementary internal path information, and obtain multiple candidate answers corresponding to the multiple inference path groups respectively; Step S8, adopt a majority voting mechanism to select among the multiple candidate answers to finally obtain a consistent answer.

[0006] Another aspect of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of the above method.

[0007] Another aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the above method.

[0008] Another aspect of the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the steps of the above method.

[0009] The multi-path thought chain reasoning generation method, computer device, computer-readable storage medium, and computer program product based on fine-grained knowledge retrieval according to the above aspects of the present invention can significantly improve the accuracy of knowledge extraction, refine the reasoning path while ensuring logical coherence, and can greatly improve the reliability and robustness of the final conclusion, thereby significantly improving the reasoning accuracy and interpretability in complex scenarios, and can provide more reliable technical support for the cognitive decision-making of artificial intelligence systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] To more clearly illustrate the technical solutions of the present invention, the following will briefly introduce the drawings used in the description of the embodiments of the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to these drawings: Figure 1 It is a flowchart of the multi-path thought chain reasoning generation method based on fine-grained knowledge retrieval according to an embodiment of the present invention; Figure 2 It is a structural diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0011] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0012] An embodiment of the present invention provides a multi-path thought chain reasoning generation method based on fine-grained knowledge retrieval, Figure 1 It is a flowchart of the multi-path thought chain reasoning generation method based on fine-grained knowledge retrieval according to an embodiment of the present invention. As Figure 1 shown, the method of the embodiment of the present invention includes the following steps: Entity extraction step S1: Use an open-source large language model to perform in-depth semantic analysis on the user's question, and extract the key entity information contained in the question text through its pre-trained knowledge representation and entity recognition capabilities; Relationship extraction step S2: Input the extracted entities into the open-source large language model again, so that it combines the context for entity disambiguation and relationship linking, extracts all relationships between entities, generates a set of relationship triples, and constructs a complete structured knowledge representation; Double-threshold filtering step S3: Assign a relevance score to each triple according to the context relevance, set a high confidence threshold and a low confidence threshold, and divide the triple set into three categories: highly relevant, lowly relevant, and moderately relevant according to the relevance score. Use the highly relevant and lowly relevant triples as positive and negative samples to provide to the large language model to further distinguish the moderately relevant triples, and obtain fine-grained knowledge triples highly relevant to the user's question. Path construction step S4: Input the triples highly relevant to the user's question into the large language model, and use the pre-defined path construction thinking chain framework to obtain the initial inference path set. Path optimization step S5: Input the initial inference path set into the large language model, and make it optimize the initial inference path according to the optimization strategies of eliminating redundancy, reordering entity sequences, and merging sub-paths, to obtain an optimized inference path set with high reliability content and a concise path structure. Path sampling step S6: Input the optimized inference path set into the large language model, and use Top-k scoring to sample the optimized inference path set to obtain an inference path set with high semantic relevance that combines diversity and representativeness. Candidate answer generation step S7: Input the user's question and the inference path set with high semantic relevance into the large language model, divide the inference path set into multiple inference path groups with complementary internal path information, and obtain multiple candidate answers corresponding to the multiple inference path groups respectively. Consistency decision step S8: Adopt a majority voting mechanism to select from the multiple candidate answers to finally obtain a consistent answer.

[0013] In the embodiment of the present invention, the large language model adopts, for example, the leading open-source large language model LLaMA-3. In each of the above steps, by constructing a prompt template (prompt template), the natural language question input by the user is converted into an instruction format understandable by the model, so as to interact with the large language model and obtain relevant inference information. The prompt template is essentially a parameterized string used to simplify the process of constructing and processing prompt words. In the embodiment of the present invention, the prompt template includes an entity relationship prompt template, a path construction and optimization prompt template, and a consistency answer prompt template. Taking the entity relationship prompt template as an example, the content of this template can be: "The context information is: {context}, based on the given context, please extract the important entity relationships in the context:". The content enclosed by "{}" is the parameter to be received. After obtaining the content corresponding to this parameter and inputting it into the large language model, the corresponding result can be obtained. The path construction and optimization prompt template and the consistency answer prompt template have a similar structure to the entity relationship prompt template.

[0014] In step S1, using the information extraction ability of the large language model, relevant entities are identified and extracted from the given query and context to form a set containing entities. During the extraction process, context parsing is first performed to identify candidate entities, and the entities are screened and normalized through in-depth semantic analysis to improve the accuracy and consistency of extraction. This process can not only identify explicit entities but also infer some implicit entities through context association, thereby enhancing entity coverage and laying a more solid foundation for subsequent relation extraction. The specific implementation process is as follows: Fill the context information (including materials, problems, etc.) into the entity relation prompt template to construct the first prompt text. The content of this template text is: "The context information is: {C}, based on the given context, please extract the important entity relations in the context:". Input the first prompt text into the large language model to obtain the entity set. The formula is as follows:

[0015] where is the context, refers to the large language model (Large Language Model), is the entity set obtained by the inference of the large language model, . n is the number of entities.

[0016] In step S2, based on the entity set , explicit and implicit relations between entities are identified. For each pair of entities , explicit relations are detected or potential implicit relations are inferred to generate standardized relation triples . All the extracted relations form a set , and finally constitute a triple set . During the extraction process, different types of relations can be distinguished, and the inference relations with low confidence are screened to improve the reliability of the final knowledge structure. The specific implementation process is as follows: Fill the context information and the entity set into the entity relation prompt template to construct the second prompt text. The content of this template text is: "Given a context { }, and all the entity sets in the context { }. Extract all relationships between entities directly stated in the context. Each relationship is represented as a triple: (Entity A, Entity B, The relationship between Entity A and B)". Input the second prompt text into the large language model to obtain a complete structured knowledge representation. The formula is as follows:

[0017] Where , is a relationship triple, , is the number of relationship triples, represents the relationship between entity and entity .

[0018] In step S3, high and low confidence thresholds are used to dynamically partition knowledge triples to achieve intelligent classification of high / low / medium confidence, and the method of comparing positive and negative samples is combined to optimize the effect of knowledge sample screening.

[0019] In the process of entity relationship extraction, triples often contain irrelevant information, increasing the difficulty of constructing the reasoning path. Traditional single-threshold filtering strategies are difficult to distinguish high- and medium-correlation triples, and are prone to losing valuable information or retaining irrelevant content. Therefore, the embodiments of the present invention design a double-threshold filtering, which realizes accurate classification by setting two semantic correlation confidence thresholds: the high confidence threshold is used to initially screen out noise knowledge fragments irrelevant to the problem; the low confidence threshold is used to further refine the filtering result and only retain knowledge fragments highly relevant to the reasoning task. Through double-threshold filtering, high-correlation triples are retained, low-correlation items are filtered, and medium-correlation triples are refined and evaluated. By comparing high- and low-score triples, the classification accuracy is further improved.

[0020] Specifically, for the triple set extracted from the context , the model assigns a relevance score to each triple according to the context correlation degree, sets a high confidence threshold and a low confidence threshold , and divides the triples into three subsets according to the relevance score: triples with a score greater than are high-correlation triples and are retained as positive samples; triples with a score less than are low-correlation triples and are filtered as negative samples; medium-correlation triples and with scores between need to be further evaluated. For For the medium-related triples in it, the model makes comparisons with positive and negative samples as references. Through semantic context comparison, it autonomously adjusts the classification. Those highly consistent with the positive samples are promoted to the positive sample set, and those similar to the negative samples are classified into the negative sample set. This dual-threshold extraction mechanism can not only ensure the complete retention of highly relevant triples but also intelligently absorb medium-related triples with context value to build a high-quality knowledge base, providing reliable support for the subsequent construction of inference paths.

[0021] In step S3, the specific implementation process of obtaining fine-grained knowledge highly relevant to the user's question is as follows: Fill the context information and the set of structured knowledge triples into the entity-relationship prompt template to construct the third prompt text. The content of this template text is: "Given a context { }, structured knowledge { }, please score it according to the context semantics. Score the confidence of each relationship. The confidence score ranges from 0 to 10, and the higher the score, the higher the probability that the relationship is correct. Each relationship is represented as a triple: (entity A, entity B, the relationship between entity A and B)". Input the third prompt text into the large language model and assign a relevance score to each triple according to the context relevance . The scoring reference standard of the model is as follows: Table 1 Scoring reference standard for triple relevance

[0022] Divide the triple set into three subsets through a high confidence threshold and a low confidence threshold . The formula is as follows:

[0023] where is the score greater than the high confidence threshold for the set of highly relevant triples. is the score between the high confidence threshold and the low confidence threshold for the set of medium-related triples. is the score less than the low confidence threshold for the set of low-related triples.

[0024] For the medium-related triples with scores between and , , by taking and For comparison with reference to and in combination with context information, autonomously adjust the classification, and highly matching ones are promoted to the positive sample set, and similar ones are classified into the negative sample set. Specifically, the context information and the high-correlation triple set , low-correlation triple set , medium-correlation triple set are filled into the entity relationship prompt template to construct the fourth prompt text. The content of this template text is: "Now there are high-score triples and low-score triples here respectively. Please analyze based on the high-score triples, low-score triples and in combination with the context, and determine whether to extract some medium-score triples and put them into the high-score triples, and put some medium-score triples into the low-score triples. This is the context information { }, this is the high-score triples { }, this is the low-score triples { }, this is the medium-score triples { }. Please extract the important medium-score triples according to the previous requirements. Each relationship is returned in the form of a triple: (entity A, entity B, the relationship between entity A and B)". Input the fourth prompt text into the large language model. The formula is as follows:

[0025]

[0026] where represents the part of triples with context value extracted from , and represents the part of triples without context value extracted from .

[0027] In step S4, based on the high-quality triples obtained by the fine-grained knowledge extraction mechanism, construct the initial inference path set , ensuring comprehensive coverage of relevant entity relationships. During the path construction process, first filter the triples to ensure that the selected knowledge units have high confidence and logical consistency. Then, in combination with the semantic relevance of entities and context information, construct the inference path in an autoregressive generation manner based on the large language model, and represent it as: . Among them, each path represents the logical inference link from the initial entity to the target entity , , both represent the relationship between entity and entity. For example For the entity and the entity The relationship between them. To enhance logical coherence, further utilize the internal knowledge of the large language model to expand the path, supplementing the potentially missing intermediate reasoning links to ensure the integrity of the path and the improvement of reasoning ability.

[0028] The specific implementation process is as follows: Put the context information , high-correlation triples into the path construction and optimization prompt template to construct the fifth prompt text. The content of this template text is: "Given the context information and the high-score relationships in the context. One or more reasoning paths need to be generated based on these relationships. The format of the reasoning path is: entity → relationship → entity → relationship…. This is the context information { }, and this is the high-context-value triples { }. The last number of the high-score relationship represents the score of each relationship." Input the fifth prompt text into the large language model to obtain the initial set of reasoning paths . The formula is as follows:

[0029] where = represents the union operation on all paths (from = 1 to = z), represents the reasoning path, represents the entity, represents the relationship, is the number of paths.

[0030] In step S5, generate parallel reasoning paths based on high-quality knowledge triples, and perform dynamic optimization in three stages: deletion - correction - reconstruction, and use node recombination technology to maintain the logical self-consistency of the path.

[0031] During the path construction process, due to the autoregressive generation characteristics of the large language model, semantically similar entities may be redundantly connected, resulting in an overly long path and repeated information. To this end, the present invention adopts an optimization method based on model introspection and error correction mechanism to refine paths that exceed the length threshold to improve the compactness and semantic integrity of the path. The optimization strategy includes the following three aspects: redundancy elimination, analyzing the path structure, deleting duplicate or semantically similar nodes, avoiding information redundancy, and improving reasoning efficiency; structural adjustment, rearranging the order of entities in the path to make the reasoning chain clearer, reduce ambiguity, and improve the logical interpretability of the path; path reconstruction, merging sub-paths while ensuring that core information is not lost, making the reasoning process more compact, while ensuring the coherence and rationality of the reasoning. The reasoning path with high reliability content and streamlined path structure is obtained through optimization.

[0032] The specific implementation process of optimizing the reasoning path is as follows: context information , initial reasoning path set Fill in the path construction and optimization prompt template to construct the sixth prompt text. The content of the template text is: "Please optimize the path length of the path with a length of more than 10 according to the given path and meet the following requirements 1. Eliminate redundancy: Eliminate duplicate or semantically similar nodes to simplify the path.

[0033] How to do it: Remove duplicate nodes, relationships, or words with similar meanings.

[0034] • For example: "A→B→B→C" → simplifies to "A→B→C" • For example: merge synonyms (“happy→happy→happy” is unified into “happy”) 2. Structural adjustments: Reorder entities to improve reasoning clarity.

[0035] How: Reorder nodes to follow a logical sequence (e.g., chronological, cause-effect).

[0036] • For example: "Rain → Wet Ground → Carry Umbrella" can be reordered to "Raining → Carry Umbrella → Wet Ground" 3. Path reconstruction: merge sub-paths to preserve key information while ensuring consistency.

[0037] How to do it: Merge subpaths and keep only basic nodes.

[0038] • For example: "Study → Review → Exam → Pass → Celebrate" is simplified to "Study → Exam → Celebrate" Please optimize these inference paths with a length of more than 10 according to the above requirements and display the optimization results.}, the relationship path { }: ". Input the sixth prompt text into the large language model to obtain an optimized set of inference paths. The formula is as follows:

[0039] Where .

[0040] In step S6, in order to improve the diversity and representativeness of the inference paths, fusion Top-k scoring is used to select the top k inference paths as the final inference paths that are both diverse and representative.

[0041] The specific implementation process of adopting the strategy of fusion Top-k scoring sampling is as follows: Fill the context information , the optimized set of inference paths into the path construction and optimization prompt template to construct the seventh prompt text. The content of this template text is: "Please comprehensively score these sets of inference paths according to their semantic relevance, logical rationality, context consistency, information integrity, and inference coherence based on the given context, and select the top k paths with the highest scores ( ). The context information is { }, and the set of inference paths is { }". Input the seventh prompt text into the large language model to obtain 40 inference paths with high semantic relevance scores. The formula is as follows:

[0042] Where .

[0043] In the embodiment of the present invention, the fusion Top-k (k = 40) strategy is used to let the large language model perform semantic relevance scoring to select the top 40 inference paths as the final inference paths used, so as to provide a richer logical perspective and stronger inference robustness.

[0044] In step S7, the large language model is used to measure the semantic information contained in multiple inference paths, combine multiple paths representing different semantics, and through the method based on the chain of thought, and at the same time combine the context information, independently execute the inference process on different paths to generate multiple possible candidate answers. In order to improve the integrity and coherence of the answers, the information between the associated paths is correlated during the inference process, so that the information of different paths is complementary, thereby reducing the information loss problem that may be brought by single-path inference. At the same time, when generating candidate answers, the context information is combined to enhance the stability and consistency of the answers.

[0045] Specifically, in step S7, the specific implementation process of generating multiple candidate answers by path combination is as follows: First, the context information , and the set of reasoning paths with high semantic relevance scores are filled into the consistency answer prompt template to construct the eighth prompt text. The content of this template text is: "Provide a piece of context information and a set of reasoning paths with high scores in terms of semantic relevance, logical rationality, context consistency, information integrity, and reasoning coherence. Based on this information, and on the premise of ensuring consistency with the context, combine these reasoning paths into several groups of reasoning path groups. Each group should contain several reasoning paths that complement each other in content or perspective, forming a small group of reasoning paths with diverse internal information but consistent semantics. The whole should cover multiple reasonable reasoning directions. There is information complementarity between the internal paths of each group, that is, they supplement or expand the same core reasoning goal from different perspectives; all paths need to maintain semantic consistency and logical coherence with the context; the multiple groups of paths generated should also reflect diversity as much as possible. The following is the context information { }, and the following is the set of reasoning paths { }". Input the eighth prompt text into the large language model to obtain reasoning path groups with complementary information for different paths. The formula is as follows:

[0046] where , and any of , represents the number of finally combined reasoning path groups, .

[0047] After that, the context information , and the reasoning path groups with complementary information for different paths are filled into the consistency answer prompt template to construct the ninth prompt text. The content of this template text is: "Provide a piece of context information and several groups of reasoning path groups with complementary content and consistent logic. Each group of paths starts from different perspectives, conducts reasoning around the same question, and has information complementarity. Please carefully reason and generate the final answer based on the context information and each group of reasoning paths. The following is the context information { }, and the following is the set of reasoning paths { }". Input the ninth prompt text into the large language model to obtain a set of multiple candidate answers. The formula is as follows:

[0048] where , represents the Answers generated by a path group.

[0049] In step S8, a consistency aggregation mechanism is used to calculate the consistency scores of the answers output by multiple inference paths. Then, a voting mechanism is adopted to comprehensively evaluate all candidate answers, and the target answer that is most logically consistent and semantically compatible with the overall inference process is determined from multiple candidate results. Through the answer decision-making mechanism of consistency aggregation, the multi-path inference results are analyzed and integrated, and error correction is achieved based on majority voting, and finally a stability-enhanced solution resistant to interference is output.

[0050] In this step, in order to ensure the reliability of the final answer, a consistency aggregation mechanism is introduced. First, the answers output by multiple inference path groups are statistically calculated. Then, a majority voting mechanism is used to count all candidate answers, and the candidate answer with the highest frequency is used as the final answer, so as to screen out the final answer that best conforms to the global inference logic. With the complementary effect of different inference paths, the final answer can show higher information richness and inference depth.

[0051] The multi-path thinking chain inference generation method based on fine-grained knowledge retrieval according to the embodiments of the present invention has the following beneficial effects: 1. The present invention realizes fine-grained knowledge extraction and optimization through dual-threshold fine-grained knowledge extraction: by setting high and low confidence thresholds, the extracted knowledge triples are dynamically divided into different confidence sets, and combined with context relevance evaluation, the accuracy of knowledge extraction is significantly improved, and noise interference is effectively reduced, providing a reliable knowledge basis for the subsequent inference process, and solving the problem of inaccurate semantic understanding caused by coarse-grained knowledge extraction in the prior art.

[0052] 2. The present invention adopts a multi-path explicit construction and optimization strategy, generates multiple independent inference paths based on high-quality knowledge triples, and dynamically optimizes the path nodes through systematic deletion, correction and reconstruction operations. While ensuring logical coherence, the refinement of the inference paths is realized. The diverse inference paths generated by this method have been strictly optimized, retaining the necessary inference nodes and eliminating redundant information, making the inference process of complex problems more efficient and reliable, and overcoming the defects of loose structure and insufficient logical coherence of the existing inference paths. Verified by the standard test set, the accuracy of this method in common sense reasoning, logical reasoning and mathematical reasoning tasks is improved by at least 5.5 percentage points compared with the baseline model.

[0053] 3. Through the answer decision-making of consistency aggregation, the present invention can effectively identify and correct the inference deviation that may be generated by a single path by using the intelligent fusion of multi-path results and the majority voting mechanism, and can output stable and reliable final conclusions in various complex inference scenarios, greatly improving the reliability and robustness of the final conclusions, while maintaining the transparency and traceability of the decision-making process.

[0054] An embodiment of the present invention further provides a computer device, which may be a server, and its internal structure diagram may be as shown in Figure 2 the following figure. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the operation parameter data of each framework. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it realizes the steps of the method according to the embodiment of the present invention.

[0055] Those skilled in the art can understand that Figure 2 the structure shown in the figure is only a block diagram of some parts related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. Specifically, the computer device may include more or fewer parts than those shown in the figure, or combine some parts, or have different component arrangements.

[0056] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it realizes the steps of the method according to the embodiment of the present invention.

[0057] An embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by a processor, it realizes the steps of the method according to the embodiment of the present invention.

[0058] Only some exemplary embodiments of the present invention have been described above by way of illustration. Undoubtedly, for those of ordinary skill in the art, without departing from the spirit and scope of the present invention, the described embodiments can be modified in various different ways. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the protection scope of the claims of the present invention.

Claims

1. A multi-path thinking chain reasoning generation method based on fine-grained knowledge retrieval, characterized in that Including: Step S1: Use a large language model to perform in-depth semantic analysis on the user's question, and extract the entity information contained in the question text; Step S2: Input the extracted entities into the large language model again, extract all the relationships between the entities, and generate a triple set; Step S3: Assign a relevance score to each triple according to the context relevance degree, set a high confidence threshold and a low confidence threshold, and divide the triple set into three categories: high relevance, low relevance, and medium relevance according to the relevance score. Provide the high-relevance and low-relevance triples as positive and negative samples to the large language model to enable it to further distinguish the medium-relevance triples and obtain fine-grained triples highly relevant to the user's question; Step S4: Input the triples highly relevant to the user's question into the large language model, and use a pre-defined path construction thinking chain framework to obtain an initial inference path set; Step S5: Input the initial inference path set into the large language model, and enable it to optimize the initial inference path according to the optimization strategies of eliminating redundancy, reordering entity order, and merging sub-paths to obtain an optimized inference path set; Step S6: Input the optimized inference path set into the large language model, and sample the optimized inference path set using Top-k scoring to obtain an inference path set with high semantic relevance; Step S7: Input the user's question and the inference path set with high semantic relevance into the large language model, divide the inference path set into multiple inference path groups with complementary internal path information, and obtain multiple candidate answers corresponding to the multiple inference path groups respectively; Step S8: Adopt a majority voting mechanism to select from the multiple candidate answers to finally obtain a consistent answer.

2. The method according to claim 1, characterized in that, In step S1, fill the context information of the user's question text into the entity relationship prompt template to construct the first prompt text, and input the first prompt text into the large language model to obtain an entity set: Among them is the context is the set of entities obtained through large language model reasoning , where is an entity and n is the number of entities; In step S2, fill the context information and the entity set into the entity relationship prompt template to construct the second prompt text, and input the second prompt text into the large language model to generate a triple set: Among them is a set of triples , is a relational triple is the number of relational triples , represents the entity and the entity 's relationship 3. The method according to claim 2, characterized in that, In step S3, fill the context information and the triple set into the entity relationship prompt template to construct the third prompt text, and input the third prompt text into the large language model to enable it to assign a relevance score to each triple in the generated triple set according to the context relevance degree, set a high confidence threshold and a low confidence threshold, take the triples with a score greater than the high confidence threshold as high-relevance triples, take the triples with a score less than the low confidence threshold as low-relevance triples, and take the triples with a score between the high confidence threshold and the low confidence threshold as medium-relevance triples to obtain: Among them is the set of high - correlation triples, is the set of medium - correlation triples, is the set of low - correlation triples.

4. The method according to claim 3, wherein In step S3, the context information and the set of highly relevant triples , the set of low-relevant triples , and the set of medium-relevant triples are filled into the entity-relationship prompt template to construct the fourth prompt text. The fourth prompt text is input into the large language model, which makes a comparison with reference to the set of highly relevant triples and the set of low-relevant triples and in combination with the context information. The medium-relevant triples that highly match the set of highly relevant triples are promoted to the set of highly relevant triples, and the medium-relevant triples that are similar to the set of low-relevant triples are classified into the set of low-relevant triples, resulting in: Among them, represents the part of triples with context value extracted from , and represents the part of triples without context value extracted from .

5. The method according to claim 4, characterized in that In step S4, the context information and the set of highly relevant triples are filled into the path construction and optimization prompt template to construct the fifth prompt text, and the fifth prompt text is input into the large language model to obtain the initial set of inference paths : Among them , each path represents a logical reasoning link from the initial entity to the target entity . , both represent the relationship between entities, is the number of paths; In step S5, the context information, the initial inference path set, and the optimization strategy are filled into the path construction and optimization prompt template to construct the sixth prompt text, and the sixth prompt text is input into the large language model to obtain the optimized inference path set : Among them ; In step S6, the context information and the optimized set of inference paths are filled into the path construction and optimization prompt template to construct the seventh prompt text. The seventh prompt text is input into the large language model to obtain a set of k inference paths with high semantic relevance : Among them , 。 6. The method according to claim 5, characterized in that, In step S7, the context information, the set of inference paths with high semantic relevance, and the path combination strategy are filled into the consistency answer prompt template to construct the eighth prompt text. The eighth prompt text is input into the large language model to obtain multiple groups of inference paths : Among them , , represents the number of inference path groups, ; Among them, the path combination strategy is: combine the inference paths into several inference path groups, each group contains several inference paths that are complementary in content or perspective, there is information complementarity between the internal paths of each group, and the paths of multiple groups show diversity.

7. The method according to claim 6, wherein In step S8, the context information and multiple inference path groups are filled into the consistency answer prompt template to construct the ninth prompt text, and the ninth prompt text is input into the large language model to obtain multiple candidate answers corresponding to the multiple inference path groups: Among them , represents the answer generated by the th inference path group.

8. A computer device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Domain knowledge session method, system and device based on large model and multistage reasoning

    CN118964538A

  • Knowledge graph open domain construction and RAG question and answer method and device and storage medium

    CN119416882A

  • Conversational reasoning with knowledge graph paths for assistant systems

    US11442992B1

Cited By

  • Method, system and equipment for dynamically selecting and optimizing retrieval path based on intention perception

    CN120893588A

  • Evidence-reasoning-verification chain-based scientific research trusted agent construction method

    CN121212338A

  • Crop gene function research scheme planning method based on experimental reasoning chain

    CN121278119A

  • Big language model-based reasoning method, training method, device and equipment

    CN121279469A

  • Subject knowledge multi-hop question and answer method based on structured planning and reflection reasoning

    CN121480651A