Knowledge base question and answer method and system fusing knowledge graph and RAG
By integrating knowledge graphs and RAG methods, a global knowledge graph and step-by-step search process are constructed, which solves the problem of not being able to fully utilize the capabilities of large models in the existing technology, and achieves a more efficient knowledge base search effect.
Patent Information
- Application Number
- CN202411941681.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-22
AI Technical Summary
The existing technology cannot fully utilize the capabilities of RAG, knowledge graph and large models, resulting in the inability to effectively integrate the advantages of the two and improve the search effect of knowledge bases based on large models.
A knowledge base question-and-answer method is proposed that integrates knowledge graphs and RAG. By acquiring user questions, adjusting questions, building local and global knowledge graphs, and combining RAG processes for step-by-step search and enhancement and refinement to generate answers.
By integrating knowledge graphs and RAG, the knowledge base search effect based on big models is improved, the problem of lack of real-time and limitations of big models is overcome, and hallucinations are reduced in scenarios that are not good at.
Smart Images

Figure CN119862248A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a knowledge base question-answering method and system integrating knowledge graph and RAG. Background Art
[0002] General large models cannot meet the business needs of enterprise knowledge bases. One of the reasons is that they have limited knowledge and lack a large amount of real-time, non-public or offline data knowledge within the enterprise. At the same time, large models are more likely to have illusion problems in scenarios where they do not have knowledge or are not good at a certain aspect. In order to effectively utilize the capabilities of large models and conduct effective question and answer of knowledge bases, RAG technology and technology combining large models with knowledge graphs have developed rapidly.
[0003] The Chinese name of RAG is Retrieval Enhanced Generation, which consists of retrieval technology and big model prompt enhancement. RAG uses a knowledge base plug-in to a big model, usually storing knowledge in a vector database. When answering users, it uses the big model to generate multiple queries and re-rank search results through three processes: retrieval, enhancement, and generation. After the big model understands and generates, it outputs the answer to the user.
[0004] The knowledge graph can store and display knowledge in a graphical form, so that the relationship between things can be understood more intuitively. When the big model is combined with the knowledge graph, the question-answering system first uses the big model to deeply understand the question and identify key information and intent. Then it searches the knowledge graph for entities, concepts, and relationships related to the question to find the most matching knowledge fragment. Finally, combined with the reasoning ability of the big model, the found knowledge is integrated and reasoned to generate accurate and detailed answers.
[0005] The effects of using RAG and knowledge graph alone in combination with large models are not ideal. Combining RAG and knowledge graph large models to optimize and improve their capabilities is a solution. Existing technical solutions have proposed several fusion designs. The first is to split the user question into multiple sub-questions, then integrate them after parallel query, and then verify and calibrate the knowledge graph to get the final answer. The problem is that it is difficult to evaluate the effect of the splitting process. RAG vector retrieval may not return the optimal solution, and the knowledge graph is only used for subsequent verification and calibration, which does not fully utilize the advantages of RAG and knowledge graph large models; the second is to search through multiple channels in parallel, such as re-ranking the search results of each channel through knowledge graph retrieval, vector retrieval and keyword retrieval, and use them for large model reasoning to generate answers. The problem is that parallel processing is inefficient and time-consuming, and a single channel may not return the optimal solution. Both technical solutions weight the multiple answers returned, but reasonable weights are not easy to determine even after a lot of training and verification, so the answers returned by the above two technical solutions are difficult to guarantee to be the optimal solution. Summary of the invention
[0006] The present invention aims to at least solve the technical problem in the prior art that RAG, knowledge graph and large model capabilities cannot be fully utilized, and the advantages of the two cannot be integrated to improve the retrieval effect of knowledge bases based on large models.
[0007] To this end, an object of the present invention is to propose a knowledge base question answering method integrating knowledge graph and RAG, comprising:
[0008] Obtaining a user question, and adjusting the user question based on the big model to obtain an adjusted question;
[0009] Use the internal information data of the enterprise to build a local knowledge graph;
[0010] Using the local knowledge graph and the existing knowledge graph, a global knowledge graph is constructed;
[0011] Using the global knowledge graph to search the adjusted question, and obtain a graph search result;
[0012] The user question is answered based on the graph retrieval results.
[0013] Further, answering the user's question according to the graph search result includes:
[0014] If the graph search result and the type of the user question meet the search success condition, then using the graph search result to generate a corresponding answer;
[0015] If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways.
[0016] Furthermore, if the graph search result and the user question type meet the search success condition, the graph search result is used to generate a corresponding answer, including:
[0017] If the graph search result is a hit and the user question is a global question, the graph search result is sent to the big model for reasoning to generate a corresponding answer.
[0018] Furthermore, if the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including:
[0019] If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result to obtain an enhanced and refined question;
[0020] The RAG process is used to search the semantic vector library for the question after the enhancement and refinement, and a semantic search result is obtained. If the semantic search result meets the set threshold condition, the semantic search result is used to generate a corresponding answer.
[0021] Furthermore, if the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result to obtain an enhanced and refined question, including:
[0022] If the graph search result does not hit and\or the user question is a local question, the graph search result is added to the prompt word background to enhance and refine the adjusted question, thereby obtaining an enhanced and refined question.
[0023] Further, the RAG process is used to search the semantic vector library for the question after the enhancement and refinement, and a semantic search result is obtained. If the semantic search result meets the set threshold condition, the corresponding answer is generated using the semantic search result, including:
[0024] If the semantic search result meets the set threshold condition, the semantic search result is filtered, rearranged and filtered in sequence by using an algorithm to obtain a processed semantic search result;
[0025] The large model is used to infer the processed semantic retrieval results to generate corresponding answers.
[0026] Furthermore, if the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including:
[0027] If the semantic search result does not meet the set threshold condition, the semantic search result is used to enhance and refine the question after the primary enhancement and refinement to obtain the question after the secondary enhancement and refinement;
[0028] Performing a full-text search on the question after the secondary enhancement and refinement to obtain a full-text search result;
[0029] Determine whether the full-text search result is valid. If valid, generate an answer using the full-text search result and send it to the user. If invalid, feedback "no relevant information" to the user.
[0030] Furthermore, we use the internal information data of the enterprise to build a local knowledge graph, including:
[0031] Collect user feedback information;
[0032] Extracting relevant knowledge elements from the user feedback information and the enterprise knowledge base according to the knowledge graph model;
[0033] The knowledge elements are used to generate a local knowledge graph.
[0034] Furthermore, the local knowledge graph and the existing knowledge graph are used to construct a global knowledge graph, including:
[0035] According to the attributes and similarities of the same entity, the entities in the local knowledge graph and the existing knowledge graph are fused to obtain a global knowledge graph.
[0036] The present invention provides a knowledge base question-answering system integrating knowledge graph and RAG, which is implemented by using the above-mentioned knowledge base question-answering method integrating knowledge graph and RAG, and includes:
[0037] Question rewriting module: obtains user questions, adjusts the user questions based on the big model, and generates adjusted questions;
[0038] Local knowledge graph construction module: Use internal enterprise information data to build a local knowledge graph;
[0039] Fusion module: constructing a global knowledge graph using the local knowledge graph and the existing knowledge graph;
[0040] The first retrieval module: uses the global knowledge graph to search the adjusted question, obtains a graph retrieval result, and answers the user question based on the graph retrieval result.
[0041] The present invention proposes a knowledge base question-answering method and system integrating knowledge graph and RAG, which has the following beneficial effects:
[0042] The present invention combines the respective capabilities and advantages of RAG, knowledge graph and big model, and improves the effect of knowledge base retrieval based on big model by constructing global knowledge graph and step-by-step retrieval enhancement problem;
[0043] The present invention will use the internal information data of the enterprise to construct a local knowledge graph, and then merge it with the knowledge graph to achieve the addition of a global vision of the knowledge graph on the basis of the local vision. This overcomes the limitations of existing large models, which lack a large amount of real-time, non-public or offline data knowledge within the enterprise. At the same time, large models are more prone to hallucinations in scenarios where they do not have knowledge in a certain area or are not good at it.
[0044] The present invention has different corresponding retrieval strategies for global questions and local questions, and in subsequent retrieval, the retrieval results of the previous step are used to enhance the questions to obtain comprehensive and accurate answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 is a flow chart of a knowledge base question-answering method integrating knowledge graph and RAG in an embodiment of the present invention;
[0047] Figure 2 It is a global knowledge graph construction flow chart of a knowledge base question-answering method that integrates knowledge graph and RAG in an embodiment of the present invention.
[0048] Figure 3 It is a schematic diagram of a knowledge graph model of a knowledge base question-answering method that integrates knowledge graph and RAG in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] Various aspects and features of the present invention are described herein with reference to the accompanying drawings.
[0050] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of the embodiments. Other modifications within the scope and spirit of the present invention will occur to those skilled in the art.
[0051] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the general description of the invention given above and the detailed description of the embodiments given below, serve to explain the principles of the invention.
[0052] These and other characteristics of the invention will become apparent from the following description of a preferred form of embodiment given as a non-limiting example, with reference to the accompanying drawings.
[0053] It should also be understood that, although the invention has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the invention that have the characteristics recited in the claims and are therefore within the scope of protection defined thereby.
[0054] The above and other aspects, features and advantages of the present invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.
[0055] Specific embodiments of the present invention are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments claimed are merely examples of the present invention, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid obscuring the present invention with unnecessary or redundant details. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present invention in a variety of ways with substantially any suitable detailed structure.
[0056] In the description of the present invention, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0057] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0058] Example
[0059] like Figure 1-Figure 2 As shown, this embodiment provides a knowledge base question answering method integrating knowledge graph and RAG, including the following steps:
[0060] Step S1: Obtain user questions;
[0061] Step S2: Based on the large model, the user question is adjusted to obtain an adjusted question;
[0062] Step S3: Use the internal information data of the enterprise to construct a local knowledge graph;
[0063] Step S4: construct a global knowledge graph using the local knowledge graph and the existing knowledge graph;
[0064] Step S5: using the global knowledge graph to search the adjusted question and obtain a graph search result. If the graph search result and / or the user question type meet the search success condition, then using the graph search result to generate an answer and send it to the user;
[0065] Step S6: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways.
[0066] According to another specific embodiment of the present invention, on the basis of step S3, internal information data of the enterprise is used to construct a local knowledge graph, including:
[0067] Step S31: Collect user feedback information, including the user's rating of the answer;
[0068] Step S32: Extract relevant knowledge elements from the user feedback information and the enterprise knowledge base according to the knowledge graph model, and generate a local knowledge graph using the knowledge elements.
[0069] According to another specific embodiment of the present invention, on the basis of step S4, the local knowledge graph and the existing knowledge graph are used to construct a global knowledge graph, including:
[0070] The local knowledge graph is integrated with the existing knowledge graph to resolve network conflicts and obtain a global knowledge graph.
[0071] According to another specific embodiment of the present invention, on the basis of the above embodiment, the local knowledge graph and the existing knowledge graph are merged to resolve network conflicts and obtain a global knowledge graph, including:
[0072] According to the attributes and similarities of the same entity, the entities in the local knowledge graph and the existing knowledge graph are merged or retained. Specific examples are as follows:
[0073] Example 1: The same person has different names in the local knowledge graph and the existing knowledge graph, but is actually the same person. In this way, when the local knowledge graph and the existing knowledge graph are merged, the content under different names of the same person is merged together;
[0074] Example 2: The local knowledge graph contains relevant content of coal miner A, and the existing knowledge graph contains relevant content of coal miner B. Although both are coal miners, they are of different models. In this case, the content of coal miner A and coal miner B needs to be retained separately.
[0075] According to another specific embodiment of the present invention, based on the step S5, the adjusted question is searched using the global knowledge graph to obtain a graph search result. If the graph search result and the user question type meet the search success condition, an answer is generated using the graph search result and sent to the user, including:
[0076] The adjusted question is searched using the global knowledge graph to obtain a graph search result. If the graph search result and the user question type meet the search success condition, the graph search result is used to generate an answer and sent to the user. If the graph search result is a hit and the user question belongs to a global question, the graph search result is sent to the big model for reasoning, an answer is generated, and sent to the user.
[0077] It should be explained that "hit" in the full text refers to the fact that the content of the graph retrieval results is highly relevant to the user's question; "miss" means that the content of the graph retrieval results is weakly relevant to the user's question.
[0078] According to another specific embodiment of the present invention, based on step S6, if the graph search result and the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result to obtain an enhanced and refined question, including:
[0079] If the graph search result does not hit, or the user question is a local question, the graph search result is added to the prompt word background to enhance and refine the adjusted question, thereby obtaining an enhanced and refined question.
[0080] According to another specific embodiment of the present invention, based on step S6, if the graph search result and the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including:
[0081] If the graph search result and the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, that is, the graph search result is added to the prompt word background to obtain an enhanced and refined question;
[0082] The RAG process is used to search the semantic vector library for the question after the enhancement and refinement to obtain a semantic search result. If the semantic search result meets the set threshold condition, the large model is used to infer the semantic search result, generate an answer, and send it to the user.
[0083] Specifically, if the relevance of the semantic search result is not lower than a set threshold condition, the large model is used to infer the semantic search result, generate an answer, and send it to the user.
[0084] According to another specific embodiment of the present invention, on the basis of the above embodiment, if the graph search result and the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including:
[0085] If the semantic search result does not meet the set threshold condition, that is, the relevance of the semantic search result is lower than the set threshold condition, the semantic search result is used to enhance and refine the question after the primary enhancement and refinement, that is, the semantic search result is added to the prompt word background to obtain the question after the secondary enhancement and refinement;
[0086] Perform a full-text search on the question after the secondary enhancement and refinement to obtain a full-text search result; determine whether the full-text search result is valid. If valid, generate an answer using the full-text search result and send it to the user; if invalid, feedback "no relevant information" to the user.
[0087] It should be explained that the “valid” here means that the full-text search result includes content related to the user's question, and the “invalid” here means that the full-text search result does not include content related to the user's question.
[0088] According to another specific embodiment of the present invention, based on the above embodiment, the semantic vector library is searched for the question after the primary enhancement and refinement using the RAG process to obtain a semantic search result. If the semantic search result meets the set threshold condition, the answer is generated using the semantic search result and sent to the user, including:
[0089] The RAG process is used to search the semantic vector library for the question after the enhancement and refinement to obtain a semantic retrieval result. If the semantic retrieval result meets the set threshold condition, the algorithm is used to filter, rearrange and filter the semantic retrieval result in sequence to obtain a processed semantic retrieval result. The processed semantic retrieval result is inferred using a large model to generate an answer and send it to the user.
[0090] The present invention provides a knowledge base question-answering system integrating knowledge graph and RAG, which is implemented by using any of the above-mentioned knowledge base question-answering methods integrating knowledge graph and RAG, and includes:
[0091] Question rewriting module: obtains user questions, adjusts the user questions based on the big model, and generates adjusted questions;
[0092] Local knowledge graph construction module: Use internal enterprise information data to build a local knowledge graph;
[0093] Fusion module: constructing a global knowledge graph using the local knowledge graph and the existing knowledge graph;
[0094] The first retrieval module: uses the global knowledge graph to search the adjusted question to obtain a graph retrieval result. If the graph retrieval result and the user question type meet the retrieval success condition, the graph retrieval result is used to generate an answer and send it to the user;
[0095] Question enhancement and refinement module: if the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result;
[0096] The second retrieval module: performs other retrieval methods on the enhanced and refined questions.
[0097] The present invention proposes a knowledge base question-answering method and system integrating knowledge graph and RAG, which has the following beneficial effects:
[0098] The present invention combines the respective capabilities and advantages of RAG, knowledge graph and big model, and improves the effect of knowledge base retrieval based on big model by constructing global knowledge graph and step-by-step retrieval enhancement problem;
[0099] The present invention will use the internal information data of the enterprise to construct a local knowledge graph, and then merge it with the knowledge graph to achieve the addition of a global vision of the knowledge graph on the basis of the local vision. This overcomes the limitations of existing large models, which lack a large amount of real-time, non-public or offline data knowledge within the enterprise. At the same time, large models are more prone to hallucinations in scenarios where they do not have knowledge in a certain area or are not good at it.
[0100] The present invention has different corresponding retrieval strategies for global questions and local questions, and in subsequent retrieval, the retrieval results of the previous step are used to enhance the questions to obtain comprehensive and accurate answers.
[0101] The following is a specific embodiment of the present invention, and the use process of a knowledge base question-answering method and system integrating knowledge graph and RAG of the present invention is specifically demonstrated according to this example:
[0102] The user's question is: In coal mine A, what is the reason for the highest failure rate of hydraulic support model B? How is it usually solved?
[0103] Adjusted question:
[0104] 1. For hydraulic support of model B, list all the causes of failure;
[0105] 2. The failure rate of hydraulic supports of model B is ranked in coal mine A, and the reason with the highest failure rate is returned;
[0106] 3. Search for the corresponding solution based on the cause with the highest failure rate.
[0107] In the user feedback information and enterprise knowledge base, according to Figure 3 The knowledge graph model shown extracts relevant knowledge elements and generates a local knowledge graph using the knowledge elements;
[0108] The local knowledge graph and the existing knowledge graph are used to construct a global knowledge graph.
[0109] The global knowledge graph is used to search for the adjusted problem (here we assume that the hydraulic support of model B is not used in coal mine A), so the knowledge graph search results are not hit, but the knowledge graph search results contain content related to the adjusted problem, specifically including the common failure causes and maintenance plans of the hydraulic support of model B.
[0110] The adjusted question is enhanced and refined using the content related to the adjusted question, and the enhanced and refined question is:
[0111] 1. Why does Model B hydraulic support have the highest failure rate among all coal mine applications?
[0112] 2. Why do the superiors and subordinates of Coal Mine A (such as group companies, sister units) have the highest failure rate when using model B hydraulic supports?
[0113] What is the reason why coal mine C and coal mine D have the highest failure rate when using model B hydraulic support?
[0114] Common causes of failure and maintenance plans for model B hydraulic supports.
[0115] The semantic vector library is used to search the question after the enhancement and refinement. If the relevance of the semantic search result is not lower than the set threshold condition, the semantic search result is rearranged and integrated, and given to the big model to generate an answer and send it to the user;
[0116] If the relevance of the semantic search result is lower than the set threshold condition, the semantic search result is used to enhance and refine the question after the enhancement and refinement, and then a full-text search is performed.
[0117] The present disclosure also provides an electronic device, including at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned knowledge base question-answering method integrating knowledge graph and RAG when executing the computer program on the memory, wherein the method includes the following steps:
[0118] Step S1: Obtain user questions;
[0119] Step S2: Based on the large model, the user question is adjusted to obtain an adjusted question;
[0120] Step S3: Use the internal information data of the enterprise to construct a local knowledge graph;
[0121] Step S4: construct a global knowledge graph using the local knowledge graph and the existing knowledge graph;
[0122] Step S5: using the global knowledge graph to search the adjusted question and obtain a graph search result. If the graph search result and the user question type meet the search success condition, then using the graph search result to generate an answer and send it to the user.
[0123] Step S6: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways.
[0124] In some embodiments, the processor executing the computer program may be a processing device including one or more general-purpose processing devices, such as a microprocessor, a central processing unit (CPU), a graphics processing unit (GPU), etc. More specifically, the processor may be a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, a processor running other instruction sets, or a processor running a combination of instruction sets. The processor may also be one or more special-purpose processing devices, such as an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), a system on a chip (SoC), etc.
[0125] The memory may be a read-only memory (ROM), a random access memory (RAM), a phase-change random access memory (PRAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), an electrically erasable programmable read-only memory (EEPROM), other types of random access memory (RAM), a flash disk or other form of flash memory, a cache, a register, a static memory, a compact disk read-only memory (CD-ROM), a digital versatile disk (DVD) or other optical storage, a cassette or other magnetic storage device, or any other possible non-temporary medium used to store information or instructions that can be accessed by a computer device.
[0126] The electronic devices of the embodiments of the present disclosure may include but are not limited to fixed terminal devices such as MCU controllers, servers, desktop computers, digital TVs, etc., and mobile terminal devices such as vehicle-mounted devices (such as head-up display devices), handheld devices (such as mobile phones, tablet computers, etc.), wearable devices (such as smart watches, smart bracelets, etc.), etc.
[0127] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable medium stores a computer program, and when the computer program is executed by a processor, the method for answering questions in a knowledge base integrating a knowledge graph and RAG is implemented, and the method comprises the following steps:
[0128] Step S1: Obtain user questions;
[0129] Step S2: Based on the large model, the user question is adjusted to obtain an adjusted question;
[0130] Step S3: Use the internal information data of the enterprise to construct a local knowledge graph;
[0131] Step S4: construct a global knowledge graph using the local knowledge graph and the existing knowledge graph;
[0132] Step S5: using the global knowledge graph to search the adjusted question and obtain a graph search result. If the graph search result and the user question type meet the search success condition, then using the graph search result to generate an answer and send it to the user.
[0133] Step S6: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways.
[0134] The present invention has the following beneficial effects:
[0135] The present invention combines the respective capabilities and advantages of RAG, knowledge graph and big model, and improves the effect of knowledge base retrieval based on big model by constructing global knowledge graph and step-by-step retrieval enhancement problem;
[0136] The present invention will use the internal information data of the enterprise to construct a local knowledge graph, and then merge it with the knowledge graph to achieve the addition of a global vision of the knowledge graph on the basis of the local vision. This overcomes the limitations of existing large models, which lack a large amount of real-time, non-public or offline data knowledge within the enterprise. At the same time, large models are more prone to hallucinations in scenarios where they do not have knowledge in a certain area or are not good at it.
[0137] The present invention has different corresponding retrieval strategies for global questions and local questions, and in subsequent retrieval, the retrieval results of the previous step are used to enhance the questions to obtain comprehensive and accurate answers.
[0138] The computer-readable storage medium of the embodiments of the present disclosure may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device, for example, the memory described above.
[0139] The computer programs of the embodiments of the present disclosure may be organized into one or more computer executable components or modules. Any number and combination of such components or modules may be used to implement the various aspects of the present disclosure. For example, the various aspects of the present disclosure are not limited to the specific computer executable instructions or specific components or modules shown in the drawings and described herein. Other embodiments may include different computer executable instructions or components with more or less functions than those shown and described herein.
[0140] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
Claims
1. A knowledge base question answering method integrating knowledge graph and RAG, characterized in that: include: Obtaining a user question, and adjusting the user question based on the big model to obtain an adjusted question; Use the internal information data of the enterprise to build a local knowledge graph; Using the local knowledge graph and the existing knowledge graph, a global knowledge graph is constructed; Using the global knowledge graph to search the adjusted question, and obtain a graph search result; The user question is answered based on the graph retrieval results.
2. The knowledge base question answering method integrating knowledge graph and RAG according to claim 1 is characterized in that: Answering the user's question based on the graph search result includes: If the graph search result and the type of the user question meet the search success condition, then using the graph search result to generate a corresponding answer; If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways.
3. The knowledge base question answering method integrating knowledge graph and RAG according to claim 2 is characterized in that: If the graph search result and the user question type meet the search success condition, the graph search result is used to generate a corresponding answer, including: If the graph search result is a hit and the user question is a global question, the graph search result is sent to the big model for reasoning to generate a corresponding answer.
4. The knowledge base question answering method integrating knowledge graph and RAG according to claim 2 is characterized in that: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result to obtain an enhanced and refined question; The RAG process is used to search the semantic vector library for the question after the enhancement and refinement, and a semantic search result is obtained. If the semantic search result meets the set threshold condition, the semantic search result is used to generate a corresponding answer.
5. The knowledge base question answering method integrating knowledge graph and RAG according to claim 4 is characterized in that: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result to obtain an enhanced and refined question, including: If the graph search result does not hit and\or the user question is a local question, the graph search result is added to the prompt word background to enhance and refine the adjusted question, thereby obtaining an enhanced and refined question.
6. The knowledge base question answering method integrating knowledge graph and RAG according to claim 4 is characterized in that: The RAG process is used to search the semantic vector library for the question after the enhancement and refinement, and a semantic search result is obtained. If the semantic search result meets the set threshold condition, the corresponding answer is generated using the semantic search result, including: If the semantic search result meets the set threshold condition, the semantic search result is filtered, rearranged and filtered in sequence by using an algorithm to obtain a processed semantic search result; The large model is used to infer the processed semantic retrieval results to generate corresponding answers.
7. The knowledge base question answering method integrating knowledge graph and RAG according to claim 4 is characterized in that: If the graph search result and / or the user question type do not meet the search success condition, the adjusted question is enhanced and refined using the graph search result, and then the enhanced and refined question is searched in other ways, including: If the semantic search result does not meet the set threshold condition, the semantic search result is used to enhance and refine the question after the primary enhancement and refinement to obtain the question after the secondary enhancement and refinement; Performing a full-text search on the question after the secondary enhancement and refinement to obtain a full-text search result; Determine whether the full-text search result is valid. If valid, generate an answer using the full-text search result and send it to the user. If invalid, feedback "no relevant information" to the user.
8. The knowledge base question answering method integrating knowledge graph and RAG according to claim 1, characterized in that: Use the internal information data of the enterprise to build a local knowledge graph, including: Collect user feedback information; Extracting relevant knowledge elements from the user feedback information and the enterprise knowledge base according to the knowledge graph model; The knowledge elements are used to generate a local knowledge graph.
9. The knowledge base question answering method integrating knowledge graph and RAG according to claim 1, characterized in that: Using the local knowledge graph and the existing knowledge graph, a global knowledge graph is constructed, including: According to the attributes and similarities of the same entity, the entities in the local knowledge graph and the existing knowledge graph are fused to obtain a global knowledge graph.
10. A knowledge base question answering system integrating knowledge graph and RAG, characterized in that: The method for question-answering a knowledge base by integrating a knowledge graph and RAG as claimed in any one of claims 1 to 9 is implemented, comprising: Question rewriting module: obtains user questions, adjusts the user questions based on the big model, and generates adjusted questions; Local knowledge graph construction module: Use internal enterprise information data to build a local knowledge graph; Fusion module: constructing a global knowledge graph using the local knowledge graph and the existing knowledge graph; The first retrieval module: uses the global knowledge graph to search the adjusted question, obtains a graph retrieval result, and answers the user question based on the graph retrieval result.
Citation Information
Cited By
Decision-making auxiliary method and device based on large model
CN120654795A
Retrieval enhancement generation method based on document knowledge base and knowledge graph
CN120780849A
Search enhancement generation method based on document knowledge base and knowledge graph
CN120780849B
Electric power engineering multi-mode RAG system based on knowledge graph and multi-Agent cooperation
CN121051219A
Power engineering multi-modal RAG system based on knowledge graph and multi-agent collaboration
CN121051219B