Intelligent RAG knowledge base system fused with dynamic knowledge graph
The dynamic knowledge graph-based RAG system addresses the limitations of static knowledge graphs by integrating DPR and PPR retrieval and emotion-aware response optimization, improving retrieval accuracy and user satisfaction.
Patent Information
- Application Number
- CN202510399574.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-04-01
AI Technical Summary
In the existing RAG system, static knowledge graphs are difficult to capture the deep semantic relationship between user spoken expressions and professional terms, and lack emotional signal perception capabilities, resulting in a deviation from the generated solutions and user psychological expectations, which affects the application value of the system in complex interactive scenarios.
The dynamic knowledge graph construction and update mechanism is adopted, combined with DPR and PPR search methods, the dialogue state is maintained through dialogue management and understanding modules, and the response generation is optimized by reinforcement learning to achieve emotional perception response adjustment.
It improves the system's ability to understand complex contexts, accurately capture deep semantic relationships, dynamically adjust the degree of details and expression of reply, and improves user satisfaction and interactive experience.
Smart Images

Figure CN120317344A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information retrieval, and specifically to an intelligent RAG knowledge base system integrating a dynamic knowledge graph. Background Art
[0002] In recent years, the Retrieval-Augmented Generation (RAG) technology has shown significant advantages in fields such as intelligent question answering and decision support. Traditional RAG systems combine an unstructured document library with a pre-trained language model and use a vectorized retrieval mechanism to activate knowledge, effectively alleviating the hallucination problem of large models. With the maturity of knowledge graph technology, the graph-based knowledge representation method has shown stronger semantic expression ability in scenarios such as entity relationship modeling and multi-hop reasoning. Some systems have tried to use static knowledge graphs as external knowledge sources to enhance the reasoning accuracy of RAG.
[0003] The existing technologies generally adopt static knowledge graphs constructed offline and achieve structured storage through predefined ontology architectures. At the retrieval level, the matching mechanism based on word vector similarity is difficult to capture the deep semantic association between users' colloquial expressions and professional terms. At the same time, traditional systems lack the ability to perceive emotional signals during the user interaction process and cannot adjust the detail level and expression mode of the response according to the change of the user's emotional state, resulting in a deviation between the generated solution and the user's psychological expectation. These defects restrict the application value of intelligent knowledge base systems in complex interaction scenarios.
[0004] Therefore, an intelligent RAG knowledge base system integrating a dynamic knowledge graph is proposed. Summary of the Invention
[0005] The purpose of the present invention is to provide an intelligent RAG knowledge base system integrating a dynamic knowledge graph, including: a data processing module that performs preprocessing on the original data to obtain a standardized data set; a graph construction and update module that uses a large model to extract knowledge from the standardized data set, constructs a knowledge graph and performs dynamic updates; a dialogue management and understanding module that records the complete information of the current dialogue, constructs and updates the dialogue state, and calculates the retrieval weight adjustment amount; a hybrid retrieval module that combines the DPR and PPR retrieval methods for hybrid retrieval to obtain a first retrieval result and a second retrieval result, sets an initial retrieval weight according to the question type, and combines the retrieval weight adjustment amount to obtain a comprehensive retrieval result; a response optimization module that uses reinforcement learning based on policy gradients to output an optimal response according to the comprehensive retrieval result and user feedback. The present invention can optimize the retrieval and response generation effects and improve user satisfaction.
[0006] To achieve the above purpose, the present invention provides the following technical solutions:
[0007] An intelligent RAG knowledge base system integrating a dynamic knowledge graph, comprising:
[0008] A data processing module that performs preprocessing on the original data to obtain a standardized data set;
[0009] A graph construction and update module that uses a large model to perform knowledge extraction on the standardized data set to construct a knowledge graph; performs incremental knowledge extraction by monitoring the data source and dynamically updates the knowledge graph;
[0010] A dialogue management and understanding module that records the complete information of the current dialogue to construct a dialogue state, performs semantic parsing, anaphora resolution, and completion on the user's question, updates the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state;
[0011] A hybrid retrieval module that combines DPR and PPR retrieval methods to perform hybrid retrieval on the standardized data set and the updated dialogue state to obtain a first retrieval result and a second retrieval result, sets an initial retrieval weight according to the question type, and performs retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount to obtain a comprehensive retrieval result;
[0012] A response optimization module that uses reinforcement learning based on policy gradients to output an optimal response according to the comprehensive retrieval result and user feedback.
[0013] Further, constructing the knowledge graph specifically includes: splitting each document in the standardized data set into text blocks, performing entity, relationship, and attribute extraction on each text block to obtain knowledge triples, and integrating all knowledge triples into an initial knowledge graph; calculating the edit distance and semantic similarity of the names of every two entities in the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds the merging threshold, and calculating an initial importance weight for the entities in the knowledge graph to obtain the knowledge graph.
[0014] Further, dynamically updating the knowledge graph specifically includes:
[0015] Checking for updates to the data source at a preset time interval, and subscribing to data source update events to obtain change information, performing knowledge extraction on the change information to obtain incremental knowledge; the change information includes a data source ID, a change type, and a content difference; the change type includes data addition, data update, and data deletion;
[0016] For data addition, directly perform knowledge extraction to obtain the first incremental knowledge; for data update, calculate the data difference before and after the update, perform knowledge extraction on the data difference to obtain the second incremental knowledge; for data deletion, retain the relevant knowledge triples and attenuate the relevant initial importance weights, and set a failure timer;
[0017] Update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the decayed initial importance weights.
[0018] Further, updating the dialogue state specifically includes:
[0019] Construct the dialogue state according to the complete information of the current dialogue. The dialogue state includes an entity set, an attribute set, a user intention sequence, a context focus, and a user question sequence.
[0020] When the user asks a new question, extract the explicit entities in the new question; resolve the referential expressions according to the new question and the dialogue state to obtain the resolved referential entities; execute the ellipsis recovery rule according to the new question and the dialogue state to obtain the completed entities; merge the explicit entities, the resolved referential entities, and the completed entities to obtain the new question entity set.
[0021] Perform intention recognition on the new question, the new question entity set, and the dialogue state to obtain the user intention of the new question, and update the context focus according to the new question at the same time.
[0022] Update the dialogue state according to the new question, the new question entity set, the user intention of the new question, and the updated context focus.
[0023] Further, a hybrid retrieval of the standardized data set and the updated dialogue state by combining the DPR and PPR retrieval methods to obtain a first retrieval result and a second retrieval result specifically includes: using a query encoder to convert the user question into a vector representation to obtain a query vector; using a document encoder to convert each document in the standardized data set into a vector representation to obtain a document vector; calculating the vector similarity between the query vector and each document vector, sorting all the documents in descending order according to the vector similarity, and selecting the top k1 documents as the first retrieval result; constructing a query subgraph according to the entity set in the latest dialogue state, executing the PPR algorithm on the query subgraph, generating PPR scores, sorting all the knowledge triples in the query subgraph in descending order, and selecting the top k2 knowledge triples as the second retrieval result.
[0024] Further, set the initial retrieval weight according to the question type, and perform retrieval result integration based on the initial retrieval weight and the retrieval weight adjustment amount to obtain the comprehensive retrieval result, which specifically includes: using a classifier to determine the question type of the user's question, and setting the initial retrieval weights of the first retrieval result and the second retrieval result according to the question type; constructing a knowledge unit set based on the first retrieval result and the second retrieval result, adjusting the initial retrieval weight according to the retrieval weight adjustment amount, calculating the final score of each knowledge unit according to the adjusted initial retrieval weight, sorting the knowledge units from largest to smallest according to the final score, and selecting the top k3 knowledge units as the comprehensive retrieval result.
[0025] Further, the response optimization module specifically includes:
[0026] Generate response candidates through a response generation function based on the comprehensive retrieval result and the latest dialogue state, and define a parameter vector for the response candidates; the parameter vector includes the degree of detail, professional depth, step division, tone style, and degree of certainty;
[0027] Record the explicit feedback obtained from the user's explicit evaluation, analyze the user behavior indicators to obtain implicit feedback, and analyze the user's question sequence to obtain the user's emotional state;
[0028] Construct a reward function based on the explicit feedback, the implicit feedback, and the user's emotional state; construct a state space based on the dialogue state and user characteristics, and configure the parameter vector of the response candidate as the action space;
[0029] Construct a reinforcement learning framework based on policy gradients according to the reward function, the state space, and the action space, and output the optimal response.
[0030] Compared with the prior art, the beneficial effects of the present invention are:
[0031] 1. The dynamic construction and incremental update mechanism of the knowledge graph solves the problem of knowledge aging in the RAG system. The knowledge graph is initially constructed by extracting knowledge from a standardized data set through a large model; subsequently, the edit distance and semantic similarity between entities are calculated to form a comprehensive score to judge entity merging, and an initial importance weight is assigned to each entity. The system checks the data source update at a preset time interval and subscribes to update events, and performs differential processing for different change types. The refined incremental processing method significantly improves the timeliness and computational efficiency of the system, and avoids the resource waste caused by full-scale updates. The real-time nature and accuracy of the dynamic knowledge graph provide a continuously updated knowledge foundation for the system, providing up-to-date knowledge support for the entire system.
[0032] 2. It integrates two retrieval methods, DPR (Dense Passage Retrieval) and PPR (Personalized PageRank), overcoming the limitations of a single retrieval method. The system maintains a complete dialogue state through the dialogue management and understanding module and can dynamically update according to new questions. During the retrieval process, the DPR method provides document matching at the semantic level through vector similarity calculation, while the PPR method constructs a query subgraph based on the entities in the latest dialogue state and executes graph algorithms to obtain structured knowledge. At the same time, initial weights are set for the two retrieval results according to the characteristics of the question, and the weight adjustment amount is calculated based on the dialogue state to achieve dynamic optimization of the retrieval strategy. The dual-channel retrieval mechanism greatly improves the system's ability to understand complex contexts, can accurately capture the deep semantic associations between users' colloquial expressions and professional terms, and takes into account the structured relationships of knowledge. The deep context awareness ability of the hybrid retrieval framework enables the system to provide more accurate retrieval results, laying a solid foundation for generating responses that meet users' expectations.
[0033] 3. Response candidates are created through the response generation function, and a multi-dimensional parameter vector including details level, professional depth, tone style, etc. is defined for each candidate. In terms of user feedback collection, not only the explicit evaluations of users are recorded as explicit feedback, but also user behavior indicators are analyzed to obtain implicit feedback, and the user's emotional state is inferred by analyzing the question sequence. Based on this multi-dimensional feedback information, a reward function is constructed, and a state space is formed by combining the dialogue state and user characteristics. The response parameter vector configuration is used as the action space, and finally a reinforcement learning framework based on policy gradients is constructed. This emotion-aware response optimization mechanism can dynamically adjust the detail level and expression mode of the reply according to the emotional changes of users, achieving accurate grasp of users' psychological expectations. The emotion-aware response optimization system greatly improves the system's emotional interaction ability, making the generated solutions more in line with users' psychological expectations. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a schematic structural diagram of an intelligent RAG knowledge base system integrating a dynamic knowledge graph according to the present invention;
[0035] Figure 2 It is a schematic flow diagram of the hybrid retrieval module according to the present invention;
[0036] Figure 3 It is a schematic application flow diagram of an intelligent RAG knowledge base system integrating a dynamic knowledge graph according to the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0037] Next, in combination with the accompanying drawings in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0038] Please refer to Figures 1 to 3 , the present invention provides an intelligent RAG knowledge base system integrating a dynamic knowledge graph, and the technical solution is as follows:
[0039] Embodiment 1:
[0040] An intelligent RAG knowledge base system integrating a dynamic knowledge graph includes:
[0041] A data processing module that performs preprocessing on the original data to obtain a standardized data set;
[0042] A graph construction and update module that uses a large model to perform knowledge extraction on the standardized data set to construct a knowledge graph; performs incremental knowledge extraction by monitoring data sources to dynamically update the knowledge graph;
[0043] A dialogue management and understanding module that records the complete information of the current dialogue to construct a dialogue state, performs semantic parsing, anaphora resolution and completion on the user's question, updates the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state;
[0044] A hybrid retrieval module that combines DPR and PPR retrieval methods to perform hybrid retrieval on the standardized data set and the updated dialogue state to obtain a first retrieval result and a second retrieval result, sets an initial retrieval weight according to the question type, and performs retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount to obtain a comprehensive retrieval result;
[0045] A response optimization module that uses reinforcement learning based on policy gradients to output an optimal response according to the comprehensive retrieval result and user feedback.
[0046] Specifically, the original data is obtained from multiple data sources of the enterprise through multi-source channel data collection, including but not limited to: product manuals, user guides, frequently asked questions and answers documents, historical customer service dialogue records and solutions, internal knowledge bases and training materials, product update logs and technical support documents, user feedback and evaluation data, etc. For the obtained original data, the preprocessing steps include: data cleaning, text deduplication and format standardization.
[0047] Further, constructing the knowledge graph specifically includes: splitting each document in the standardized dataset into text blocks, extracting entities, relationships, and attributes from each text block to obtain knowledge triples, integrating all the knowledge triples into an initial knowledge graph; calculating the edit distance and semantic similarity of the names of every two entities in the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds the merging threshold, and calculating the initial importance weight for the entities in the knowledge graph to obtain the knowledge graph;
[0048] The calculation formula for the comprehensive score is:
[0049] where S merge (e i , e j ) represents the comprehensive score of entities e i and e j ; α represents a weight parameter, with a value range of [0, 1], set to 0.4; ED(e i , e j ) represents the edit distance, calculated using the Euclidean distance; max(|e i |, |e j |) represents the maximum of the name string lengths of entities e i and e j ; SemSim(e i , e j ) represents the semantic similarity, calculated using the cosine similarity;
[0050] The calculation formula for the initial importance weight of an entity is: W(e i ) = β · Degree(e i ) + (1 - β) · TF(e i );
[0051] where W(e i ) represents the initial importance weight of entity e i ; β represents a balance parameter, with a value range of [0, 1], set to 0.6; Degree(e i ) represents the degree of entity e i in the knowledge graph, that is, the number of connection relationships; TF(e i ) represents the term frequency of entity e i in the original data.
[0052] Structured knowledge representation is formed through document segmentation, knowledge triple extraction, and entity merging optimization. The entity merging mechanism based on edit distance and semantic similarity effectively solves the problem of synonymous expressions and avoids knowledge redundancy. The calculation of the initial importance weight establishes a priority system for entities, provides guidance for subsequent retrieval, enables the knowledge graph to maintain semantic coherence and structural characteristics, and enhances the system's ability to grasp knowledge relevance.
[0053] Furthermore, dynamically updating the knowledge graph specifically includes:
[0054] Check the update of the data source at a preset time interval, and at the same time subscribe to the data source update event to obtain change information, and perform knowledge extraction on the change information to obtain incremental knowledge; the change information includes the data source ID, change type, and content difference; the change type includes data addition, data update, and data deletion;
[0055] For data addition, directly perform knowledge extraction to obtain the first incremental knowledge; for data update, calculate the data difference before and after the update, perform knowledge extraction on the data difference to obtain the second incremental knowledge; for data deletion, retain the relevant knowledge triples and attenuate the relevant initial importance weights, and at the same time set a failure timer;
[0056] Update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the attenuated initial importance weight.
[0057] Specifically, the preset time interval in this embodiment is set to 4 hours, and the failure timer is set to 30 days.
[0058] Through the dual mechanisms of regular inspection and event subscription, real-time dynamic update of the knowledge graph is achieved. Different processing strategies are adopted for different change types: newly added data is directly extracted, updated data only processes the different parts, and deleted data applies the weight attenuation mechanism, avoiding the association break caused by the hard deletion of knowledge. This incremental update mechanism significantly improves the system response speed and calculation efficiency, ensures the timeliness of knowledge, and at the same time retains the historical coherence of knowledge, enabling the system to adapt to the rapidly changing knowledge environment.
[0059] Furthermore, updating the dialogue state specifically includes:
[0060] Construct the dialogue state according to the complete information of the current dialogue. The dialogue state includes an entity set, an attribute set, a user intention sequence, a context focus, and a user question sequence;
[0061] When a user raises a new question, extract the explicit entities in the new question; resolve the referential expressions according to the new question and the dialogue state to obtain the coreferential resolution entities; execute the ellipsis restoration rule according to the new question and the dialogue state to obtain the completed entities; merge the explicit entities, the coreferential resolution entities and the completed entities to obtain a new question entity set;
[0062] Perform intent recognition on the new question, the new question entity set and the dialogue state to obtain the user intent of the new question, and update the context focus according to the new question at the same time;
[0063] Update the dialogue state according to the new question, the new question entity set, the user intent of the new question and the updated context focus.
[0064] Specifically, in this embodiment, the explicit entities in the new question are extracted through a named entity recognition function; the referential expressions are resolved through a coreference resolution algorithm to obtain the coreferential resolution entities; the ellipsis restoration rule is as follows: when the new question lacks a topic but is related to the topic of the previous question, inherit the focus entity of the previous question; when the new question only mentions an attribute but does not specify an entity, inherit the relevant entity in the context focus; when the new question lacks a qualification condition, inherit the constraint condition of the previous question; perform intent recognition through a deep learning-based intent classifier to obtain the user intent; update the context focus through the following formula:
[0065] focus′(e i )=γ·focus(e i )·η Δt +(1 - γ)·mention(e i , Q′);
[0066] Among them, focus′(e i ) and focus(e i ) respectively represent the focus degrees of entity e i after and before the update; γ represents a weight parameter; η represents a time decay factor, set to 0.9; Δt represents the time interval between the new question and the previous user question; Q′ represents the new question; the mention() function is used to calculate the salience of the entity in the new question.
[0067] Through three levels of entity extraction, coreference resolution and ellipsis restoration, the user intent is accurately understood. The system can identify explicit entities, resolve referential expressions and restore ellipsis components, achieving dialogue coherence. Through intent recognition and context focus update, the system can track the development context of the dialogue and accurately capture the changes in the user's attention. This multi-dimensional dialogue understanding mechanism significantly improves the coherence and accuracy of the system in multi-turn interactions, providing precise context support for subsequent retrieval and response generation.
[0068] Further, referring to Figure 2 the schematic diagram of the hybrid retrieval module process shown in the figure, the hybrid retrieval of the standardized data set and the updated dialogue state by combining the DPR and PPR retrieval methods to obtain the first retrieval result and the second retrieval result specifically includes: using a query encoder to convert the user's question into a vector representation to obtain a query vector; using a document encoder to convert each document in the standardized data set into a vector representation to obtain a document vector; calculating the vector similarity between the query vector and each document vector, sorting all the documents from largest to smallest according to the vector similarity, and selecting the top k1 documents as the first retrieval result; constructing a query subgraph based on the entity set in the latest dialogue state, executing the PPR algorithm on the query subgraph, generating PPR scores, sorting all the knowledge triples in the query subgraph from largest to smallest, and selecting the top k2 knowledge triples as the second retrieval result.
[0069] Specifically, a query subgraph G is constructed according to the entity set in the latest dialogue state Q :
[0070]
[0071] where (e i , r j , e k ) represents a knowledge triple in the knowledge graph KG, indicating that there is a relationship r i between the entity e k and the entity e j ; E Q represents the entity set in the latest dialogue state; dist(e p , e i ) represents the shortest path distance between the entity e p and the entity e i in the query subgraph; d max represents the maximum expansion distance.
[0072] Combining the advantages of the DPR and PPR retrieval methods, it realizes dual retrieval of semantics and structure. DPR provides semantic matching ability based on vector similarity calculation, and PPR provides structured knowledge retrieval ability based on executing graph algorithms on the query subgraph. The hybrid retrieval architecture can not only capture the deep semantics of the text but also utilize the structured associations of knowledge, significantly expanding the retrieval boundary. Through dual-channel retrieval, the system can simultaneously handle query requirements with semantic ambiguity and complex structures, improving the comprehensiveness and accuracy of the retrieval.
[0073] Furthermore, set the initial retrieval weights according to the question type, and perform retrieval result integration based on the initial retrieval weights and the retrieval weight adjustment amount to obtain the comprehensive retrieval result, which specifically includes: using a classifier to judge the question type of the user's question, and setting the initial retrieval weights of the first retrieval result and the second retrieval result according to the question type; constructing a knowledge unit set based on the first retrieval result and the second retrieval result, adjusting the initial retrieval weights according to the retrieval weight adjustment amount, calculating the final score of each knowledge unit according to the adjusted initial retrieval weights, sorting the knowledge units from largest to smallest according to the final scores, and selecting the top k3 knowledge units as the comprehensive retrieval result.
[0074] Specifically, set the initial retrieval weight of the first retrieval result according to the question type The initial retrieval weight of the second retrieval result is
[0075] Calculate the retrieval weight adjustment amount ΔW based on the updated dialogue state DPR :
[0076] ΔW DPR = λ1·|E explicit | / |E complete |- λ2·DT(DS′);
[0077] Where λ1 and λ2 represent adjustment parameters; E explicit and E complete represent the explicit entity and the new question entity set respectively, and DT(DS′) represents the number of dialogue turns included in the updated dialogue state DS′;
[0078] The adjusted initial retrieval weight of the first retrieval result The adjusted initial retrieval weight of the second retrieval result
[0079] Calculate the final score
[0080] Where Norm() represents the score normalization function; item represents the knowledge unit; S DFR (item) and S PPR (item) represent the vector similarity and the PPR score respectively.
[0081] Set initial weights for different retrieval methods through a question type classifier, and calculate the weight adjustment amount based on the dialogue state to achieve the adaptive optimization of the retrieval strategy. Calculate the final score using the adjusted retrieval weights to ensure the relevance and integrity of the retrieval results. The dynamic integration mechanism enables the system to flexibly adjust the retrieval strategy according to different question types and dialogue contexts, significantly enhancing the system's adaptability to diverse queries and laying a foundation for generating high-quality responses.
[0082] Furthermore, the response optimization module specifically includes:
[0083] Generate response candidates through a response generation function based on the comprehensive retrieval results and the latest dialogue state, and define a parameter vector for the response candidates; the parameter vector includes the degree of detail, professional depth, step division, tone style, and degree of certainty;
[0084] Record the explicit feedback obtained from the user's explicit evaluation, analyze the implicit feedback from the user's behavior indicators, and analyze the user's question sequence to obtain the user's emotional state;
[0085] Construct a reward function according to the explicit feedback, the implicit feedback, and the user's emotional state; construct a state space based on the dialogue state and user characteristics, and configure the parameter vector of the response candidate as the action space;
[0086] Construct a policy gradient-based reinforcement learning framework according to the reward function, state space, and action space, and output the optimal response.
[0087] Integrate the explicit feedback, implicit feedback, and emotional state to construct a reward function, and continuously optimize the response strategy using the policy gradient reinforcement learning framework. The emotion-driven response mechanism enables the system to perceive the user's emotional changes and make corresponding adjustments, significantly enhancing user satisfaction and interaction experience.
[0088] The present invention realizes the full-link optimization of knowledge representation, retrieval, and response generation. The data processing module and the graph construction and update module jointly establish a dynamically evolving knowledge base, and through the large model knowledge extraction and incremental update mechanism, ensure the timeliness and integrity of the system knowledge. The dialogue management and understanding module accurately grasps the user's intention through multi-level semantic parsing and context management, providing context support for subsequent retrieval. The hybrid retrieval module integrates semantic and structural dual-channel retrieval strategies, and through a dynamic weight adjustment mechanism, effectively solves the deep semantic association problem between the user's colloquial expression and professional terms. The response optimization module introduces an emotion perception mechanism, and continuously optimizes the response strategy through a reinforcement learning framework, enabling the system to adjust the detail level and expression mode of the reply according to the change of the user's emotional state.
[0089] Embodiment 2:
[0090] A certain telecommunications operator is facing problems such as high turnover of customer service staff, insufficient professional knowledge, diverse expressions of user problems, and untimely knowledge updates, resulting in unstable customer service response quality and low user satisfaction. By deploying the intelligent RAG knowledge base system of the present invention, intelligent management and retrieval of a large amount of product manuals, service guides, historical cases, and real-time updated business rules are realized. This embodiment provides an application of an intelligent RAG knowledge base system integrating a dynamic knowledge graph in a telecommunications operator's customer service center, as Figure 3 shown, the following steps are implemented:
[0091] Perform preprocessing on the original data to obtain a standardized data set;
[0092] Use a large model to perform knowledge extraction on the standardized data set to construct a knowledge graph; perform incremental knowledge extraction by monitoring the data source and dynamically update the knowledge graph;
[0093] Record the complete information of the current conversation to construct a conversation state, perform semantic parsing, anaphora resolution, and completion on the user's question, update the conversation state, and calculate the retrieval weight adjustment amount based on the updated conversation state;
[0094] Combine the DPR and PPR retrieval methods to perform hybrid retrieval on the standardized data set and the updated conversation state to obtain a first retrieval result and a second retrieval result, set an initial retrieval weight according to the question type, and perform retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount to obtain a comprehensive retrieval result;
[0095] Use reinforcement learning based on policy gradient to output an optimal response according to the comprehensive retrieval result and user feedback.
[0096] Further, constructing the knowledge graph specifically includes: splitting each document in the standardized data set into text blocks, performing entity, relationship, and attribute extraction on each text block to obtain knowledge triples, and integrating all knowledge triples into an initial knowledge graph; calculating the edit distance and semantic similarity of the names of every two entities in the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds the merging threshold, and calculating an initial importance weight for the entities in the knowledge graph to obtain the knowledge graph.
[0097] Further, dynamically updating the knowledge graph specifically includes:
[0098] Check the update of the data source at a preset time interval, and at the same time subscribe to the data source update event to obtain change information, perform knowledge extraction on the change information to obtain incremental knowledge; the change information includes the data source ID, change type, and content difference; the change type includes data addition, data update, and data deletion;
[0099] For new data addition, directly perform knowledge extraction to obtain the first incremental knowledge; for data update, calculate the data differences before and after the update, perform knowledge extraction on the data differences to obtain the second incremental knowledge; for data deletion, retain the relevant knowledge triples and attenuate the relevant initial importance weights, and at the same time set a failure timer;
[0100] Update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the attenuated initial importance weights.
[0101] Table 1 shows the construction and dynamic update effects of the knowledge graph. Through entity merging optimization and incremental update strategies, the system maintains the timeliness and structural integrity of knowledge, providing a high-quality knowledge foundation for retrieval.
[0102] Table 1 Dynamic Update Effects of Knowledge Graph
[0103]
[0104] Further, updating the dialogue state specifically includes:
[0105] Construct the dialogue state according to the complete information of the current dialogue, where the dialogue state includes an entity set, an attribute set, a user intention sequence, a context focus, and a user question sequence;
[0106] When the user asks a new question, extract the explicit entities in the new question; resolve the referential expressions according to the new question and the dialogue state to obtain the resolved referential entities; execute the ellipsis component restoration rule according to the new question and the dialogue state to obtain the completed entities; merge the explicit entities, the resolved referential entities, and the completed entities to obtain the new question entity set;
[0107] Perform intention recognition on the new question, the new question entity set, and the dialogue state to obtain the user intention of the new question, and at the same time update the context focus according to the new question;
[0108] Update the dialogue state according to the new question, the new question entity set, the user intention of the new question, and the updated context focus.
[0109] Table 2 shows the semantic understanding ability of the system in multi-turn dialogues. Through the triple mechanisms of explicit entity extraction, referential resolution, and ellipsis restoration, the system can accurately grasp the user intention, providing precise context support for subsequent retrieval.
[0110] Table 2 Evaluation of Multi-turn Dialogue State Update and Understanding Effects
[0111]
[0112] Further, a hybrid retrieval is performed on the standardized dataset and the updated dialogue state by combining the DPR and PPR retrieval methods to obtain a first retrieval result and a second retrieval result, which specifically includes: using a query encoder to convert the user question into a vector representation to obtain a query vector; using a document encoder to convert each document in the standardized dataset into a vector representation to obtain a document vector; calculating the vector similarity between the query vector and each document vector, sorting all the documents in descending order according to the vector similarity, and selecting the top k1 documents as the first retrieval result; constructing a query subgraph based on the entity set in the latest dialogue state, performing the PPR algorithm on the query subgraph, generating PPR scores, sorting all the knowledge triples in the query subgraph in descending order, and selecting the top k2 knowledge triples as the second retrieval result.
[0113] Further, an initial retrieval weight is set according to the question type, and the integrated retrieval result is obtained by performing retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount, which specifically includes: using a classifier to determine the question type of the user question, and setting the initial retrieval weights of the first retrieval result and the second retrieval result according to the question type; constructing a knowledge unit set according to the first retrieval result and the second retrieval result, adjusting the initial retrieval weight according to the retrieval weight adjustment amount, calculating the final score of each knowledge unit according to the adjusted initial retrieval weight, sorting the knowledge units in descending order according to the final score, and selecting the top k3 knowledge units as the integrated retrieval result.
[0114] Further, using reinforcement learning based on policy gradients, an optimal response is output according to the integrated retrieval result and user feedback, which specifically includes:
[0115] Generating response candidates through a response generation function based on the integrated retrieval result and the latest dialogue state, and defining a parameter vector for the response candidates; the parameter vector includes the degree of detail, professional depth, step division, tone style, and degree of certainty;
[0116] Recording the explicit feedback obtained from the user's explicit evaluation, analyzing the user behavior indicators to obtain implicit feedback, and analyzing the user question sequence to obtain the user's emotional state;
[0117] Constructing a reward function according to the explicit feedback, the implicit feedback, and the user's emotional state; constructing a state space according to the dialogue state and user characteristics, and configuring the parameter vector of the response candidate as the action space;
[0118] Constructing a reinforcement learning framework based on policy gradients according to the reward function, the state space, and the action space, and outputting the optimal response.
[0119] Although embodiments of the present invention have been shown and described, those of ordinary skill in the art will appreciate that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An intelligent RAG knowledge base system integrating a dynamic knowledge graph, characterized in that, Including: A data processing module that performs preprocessing on the original data to obtain a standardized data set; A knowledge graph construction and update module that uses a large model to perform knowledge extraction on the standardized data set to construct a knowledge graph; performs incremental knowledge extraction by monitoring the data source and dynamically updates the knowledge graph; A dialogue management and understanding module that records the complete information of the current dialogue to construct a dialogue state, performs semantic parsing, anaphora resolution, and completion on the user's question, updates the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state; A hybrid retrieval module that combines DPR and PPR retrieval methods to perform hybrid retrieval on the standardized data set and the updated dialogue state to obtain a first retrieval result and a second retrieval result, sets an initial retrieval weight according to the question type, and performs retrieval result integration based on the initial retrieval weight and the retrieval weight adjustment amount to obtain a comprehensive retrieval result; A response optimization module that uses reinforcement learning based on policy gradients to output an optimal response according to the comprehensive retrieval result and user feedback.
2. The intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, wherein Specifically constructing the knowledge graph includes: splitting each document in the standardized data set into text blocks, performing entity, relationship, and attribute extraction on each text block to obtain knowledge triples, and integrating all knowledge triples into an initial knowledge graph; calculating the edit distance and semantic similarity of the names of every two entities in the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds the merging threshold, and calculating an initial importance weight for the entities in the knowledge graph to obtain the knowledge graph.
3. The intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, characterized in that, Specifically dynamically updating the knowledge graph includes: Checking for updates to the data source at a preset time interval, and subscribing to data source update events to obtain change information, and performing knowledge extraction on the change information to obtain incremental knowledge; the change information includes a data source ID, a change type, and content differences; the change type includes data addition, data update, and data deletion; For data addition, directly perform knowledge extraction to obtain first incremental knowledge; for data update, calculate the data difference before and after the update, perform knowledge extraction on the data difference to obtain second incremental knowledge; for data deletion, retain the relevant knowledge triples and attenuate the relevant initial importance weights, and set a failure timer; Update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the attenuated initial importance weights.
4. The intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, wherein, Specifically updating the dialogue state includes: Constructing the dialogue state according to the complete information of the current dialogue, where the dialogue state includes an entity set, an attribute set, a user intention sequence, a context focus, and a user question sequence; When the user asks a new question, extract the explicit entities in the new question; resolve the anaphoric expressions according to the new question and the dialogue state to obtain anaphorically resolved entities; perform an ellipsis component restoration rule according to the new question and the dialogue state to obtain completed entities; merge the explicit entities, the anaphorically resolved entities, and the completed entities to obtain a new question entity set; Perform intent recognition on the new problem, the new problem entity set, and the dialogue state to obtain the user intent of the new problem, and at the same time update the context focus according to the new problem. Update the dialogue state according to the new problem, the new problem entity set, the user intent of the new problem, and the updated context focus.
5. An intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, characterized in that, The hybrid retrieval of the standardized data set and the updated dialogue state using the DPR and PPR retrieval methods to obtain the first retrieval result and the second retrieval result specifically includes: using a query encoder to convert the user problem into a vector representation to obtain a query vector; using a document encoder to convert each document in the standardized data set into a vector representation to obtain a document vector; calculating the vector similarity between the query vector and each document vector, sorting all documents in descending order according to the vector similarity, and selecting the top k1 documents as the first retrieval result; constructing a query subgraph according to the entity set in the latest dialogue state, performing the PPR algorithm on the query subgraph, generating PPR scores, sorting all knowledge triples in the query subgraph in descending order, and selecting the top k2 knowledge triples as the second retrieval result.
6. An intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, characterized in that Set the initial retrieval weights according to the problem type, and perform retrieval result integration according to the initial retrieval weights and the retrieval weight adjustment amount to obtain the comprehensive retrieval result. Specifically includes: using a classifier to judge the problem type of the user problem, setting the initial retrieval weights of the first retrieval result and the second retrieval result according to the problem type; constructing a knowledge unit set according to the first retrieval result and the second retrieval result, adjusting the initial retrieval weights according to the retrieval weight adjustment amount, calculating the final score of each knowledge unit according to the adjusted initial retrieval weights, sorting the knowledge units in descending order according to the final score, and selecting the top k3 knowledge units as the comprehensive retrieval result.
7. An intelligent RAG knowledge base system integrating a dynamic knowledge graph according to claim 1, characterized in that, The response optimization module specifically includes: Generate response candidates through a response generation function based on the comprehensive retrieval result and the latest dialogue state, and define a parameter vector for the response candidates; the parameter vector includes the degree of detail, the depth of professionalism, the step division, the tone style, and the degree of certainty. Record the explicit feedback obtained from the user's explicit evaluation, analyze the user behavior indicators to obtain implicit feedback, and analyze the user's problem sequence to obtain the user's emotional state. Construct a reward function according to the explicit feedback, the implicit feedback, and the user's emotional state; construct a state space according to the dialogue state and the user characteristics, and configure the parameter vector of the response candidate as the action space. Construct a reinforcement learning framework based on policy gradients according to the reward function, the state space, and the action space, and output the optimal response.
Citation Information
Patent Citations
Large model programming review system based on combination of knowledge graph and RAG
CN119106173A
Method and system for generating enhanced knowledge questions and answers for mixed retrieval of heterogeneous database
CN119311831A
Question and answer generation method and device, equipment and storage medium
CN119719297A
Cited By
Dynamic AI knowledge graph system
CN120892581A
Dynamic AI Knowledge Graph System
CN120892581B
Adaptive RAG system construction method based on dynamic knowledge graph
CN121117226A
A dynamic knowledge graph-based adaptive RAG system construction method
CN121117226B
Self-adaptive dynamic knowledge updating method and system in combination with spatio-temporal data
CN121144328A