An intelligent RAG knowledge base system fusing dynamic knowledge graph
By constructing and dynamically updating the knowledge graph, combining DPR and PPR retrieval methods, and utilizing reinforcement learning to optimize response generation, the limitations of static knowledge graphs in the RAG system are overcome. This enables the perception and response adjustment of user emotions, thereby improving user satisfaction and interactive experience.
Patent Information
- Application Number
- CN202510399574.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-04-01
AI Technical Summary
In existing RAG systems, static knowledge graphs struggle to capture the deep semantic connections between users' colloquial expressions and technical terms, and lack the ability to perceive emotional signals. This leads to discrepancies between the generated solutions and users' psychological expectations, affecting the system's application value in complex interactive scenarios.
An intelligent RAG knowledge base system that integrates dynamic knowledge graphs is adopted. The knowledge graph is constructed and dynamically updated through a large model. It combines DPR and PPR retrieval methods for hybrid retrieval and uses policy gradient-based reinforcement learning to optimize response generation, thereby realizing the perception and response adjustment of users' emotional states.
The system's ability to understand complex contexts has been improved, enabling it to accurately capture the deep semantic connections between users' colloquial expressions and professional terminology, dynamically adjust the level of detail and expression of responses, and enhance user satisfaction and interactive experience.
Smart Images

Figure CN120317344B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of information retrieval, and in particular to an intelligent RAG knowledge base system fusing a dynamic knowledge graph. BACKGROUND
[0002] In recent years, retrieval-augmented generation (RAG) technology has shown significant advantages in intelligent question answering, decision support and other fields. Traditional RAG systems combine unstructured document libraries with pre-trained language models to activate knowledge using vectorized retrieval mechanisms, effectively alleviating the hallucination problem of large models. With the maturity of knowledge graph technology, knowledge representation methods based on graph structures have shown stronger semantic expression capabilities in entity relationship modeling and multi-hop reasoning scenarios. Some systems attempt to use static knowledge graphs as external knowledge sources to enhance the reasoning accuracy of RAG.
[0003] Existing technologies generally use offline constructed static knowledge graphs to achieve structured storage through predefined ontology architecture. At the retrieval level, the matching mechanism based on word vector similarity cannot capture the deep semantic association between user colloquial expressions and professional terminology. At the same time, traditional systems lack the ability to perceive emotional signals during user interaction, and cannot adjust the level of detail and expression of responses according to changes in user emotional state, resulting in a deviation between the generated solutions and user psychological expectations. These defects restrict the application value of intelligent knowledge base systems in complex interaction scenarios.
[0004] Therefore, an intelligent RAG knowledge base system fusing a dynamic knowledge graph is proposed. SUMMARY
[0005] The application aims to provide an intelligent RAG knowledge base system fusing a dynamic knowledge graph. The system includes a data processing module that performs preprocessing on raw data to obtain a standardized data set; a graph construction and updating 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 DPR and PPR retrieval methods for hybrid retrieval, obtains first and second retrieval results, sets the initial retrieval weight according to the problem type, and obtains the comprehensive retrieval result combined with the retrieval weight adjustment amount; and a response optimization module that uses policy gradient-based reinforcement learning to output the optimal response based on the comprehensive retrieval result and user feedback. The application can optimize retrieval and response generation effects and improve user satisfaction.
[0006] To achieve the above-mentioned purpose, the application provides the following technical solutions:
[0007] An intelligent RAG knowledge base system fusing a dynamic knowledge graph, comprising:
[0008] A data processing module, which performs preprocessing on original data to obtain a standardized data set;
[0009] A graph construction and update module, which extracts knowledge from the standardized data set by using a large model to construct a knowledge graph, and performs incremental knowledge extraction by monitoring data sources to dynamically update the knowledge graph;
[0010] A dialogue management and understanding module, which records complete information of a current dialogue to construct a dialogue state, performs semantic analysis, anaphora resolution and completion on a user question to update the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state;
[0011] A hybrid retrieval module, which performs hybrid retrieval on the standardized data set and the updated dialogue state by combining DPR and PPR retrieval methods to obtain first and second retrieval results, sets an initial retrieval weight according to a 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, which outputs an optimal response according to the comprehensive retrieval result and user feedback by using policy gradient-based reinforcement learning.
[0013] Further, the construction of the knowledge graph specifically comprises: segmenting each document in the standardized data set into text blocks, extracting entities, relationships and attributes from each text block to obtain knowledge triples, and integrating all knowledge triples into an initial knowledge graph; calculating an edit distance and a semantic similarity of each two entity names of the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds a merging threshold, calculating an initial importance weight for entities in the knowledge graph, and obtaining the knowledge graph.
[0014] Further, the dynamic update of the knowledge graph specifically comprises:
[0015] Checking updates of data sources at preset time intervals, subscribing to data source update events to obtain change information, and extracting knowledge from the change information to obtain incremental knowledge; the change information comprises a data source ID, a change type and a content difference; the change type comprises data addition, data update and data deletion;
[0016] For data addition, knowledge extraction is directly performed to obtain first incremental knowledge; for data update, a data difference before and after the update is calculated, and knowledge extraction is performed on the data difference to obtain second incremental knowledge; for data deletion, relevant knowledge triples are retained and relevant initial importance weights are decayed, and a failure timer is set;
[0017] update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the decayed initial importance weight.
[0018] Further, updating the dialogue state specifically comprises:
[0019] constructing the dialogue state according to complete information of the current dialogue, the dialogue state comprising an entity set, an attribute set, a user intent sequence, a context focus, and a user question sequence;
[0020] when a user raises a new question, extracting an explicit entity in the new question; resolving an anaphora expression according to the new question and the dialogue state to obtain an anaphora resolution entity; performing an ellipsis component recovery rule according to the new question and the dialogue state to obtain a complement entity; merging the explicit entity, the anaphora resolution entity, and the complement entity to obtain a new question entity set;
[0021] performing intent recognition on the new question, the new question entity set, and the dialogue state to obtain a user intent of the new question, and updating a context focus according to the new question;
[0022] updating 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.
[0023] Further, the hybrid retrieval of the standardized data set and the updated dialogue state to obtain the first retrieval result and the second retrieval result according to the DPR and PPR retrieval methods specifically comprises: using a query encoder to convert a 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 a vector similarity between the query vector and each document vector, sorting all documents according to the vector similarity from large to small, and selecting the first k1 documents as the first retrieval result; constructing a query subgraph according to an entity set in the latest dialogue state, performing a PPR algorithm on the query subgraph to generate a PPR score, sorting all knowledge triples in the query subgraph according to the PPR score from large to small, and selecting the first k2 knowledge triples as the second retrieval result.
[0024] Further, setting initial retrieval weights according to the question type, and performing 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 question type of the user question, setting 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 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.
[0025] Further, the response optimization module specifically includes:
[0026] Generating a response candidate based on the comprehensive retrieval result and the latest dialogue state through a response generation function, and defining a parameter vector for the response candidate; the parameter vector includes detail level, professional depth, step division, tone style and certainty level;
[0027] Recording explicit feedback obtained by user explicit evaluation, analyzing implicit feedback obtained by user behavior indicators, and analyzing user emotion states obtained by user question sequences;
[0028] Constructing a reward function according to the explicit feedback, the implicit feedback and the user emotion state; constructing a state space according to the dialogue state and the user characteristics, and configuring the parameter vector of the response candidate as an action space;
[0029] Constructing a reinforcement learning framework based on policy gradient according to the reward function, the state space and the action space, and outputting an optimal response.
[0030] Compared with the prior art, the beneficial effects of the present application are:
[0031] 1. Dynamic construction and incremental updating mechanism of the knowledge graph, which solves the problem of knowledge aging of the RAG system. The knowledge graph is initially constructed by a large model extracting knowledge from a standardized data set. Then, the comprehensive score is formed by calculating the edit distance and semantic similarity between entities to judge the entity merging, and each entity is assigned an initial importance weight. The system checks data source updates at preset time intervals, and subscribes to update events. Differentiated processing is performed for different change types. The fine-grained incremental processing significantly improves the timeliness and computational efficiency of the system, avoiding resource waste caused by full update. The real-time and accuracy of the dynamic knowledge graph provide a continuously updated knowledge base for the system, and provide knowledge support for the whole system to keep pace with the times.
[0032] 2、Fusion of DPR (Dense Passage Retrieval) and PPR (Personalized PageRank) two retrieval methods, overcome the limitations of single retrieval way. The system maintains the complete dialogue state through the dialogue management and understanding module, and can be dynamically updated according to the new question. In the retrieval process, the DPR method provides semantic level document matching through vector similarity calculation, while the PPR method constructs query subgraph based on the entity in the latest dialogue state, and executes graph algorithm to obtain structured knowledge. At the same time, according to the characteristics of the question, set the initial weight of the two retrieval results, and calculate the weight adjustment amount based on the dialogue state, realize the dynamic optimization of the retrieval strategy. The double-channel retrieval mechanism greatly improves the system's understanding ability of complex context, can accurately capture the deep semantic association between user's colloquial expression and professional terms, and also considers the structured relationship of knowledge. The deep context perception ability of the mixed retrieval framework enables the system to provide more accurate retrieval results, laying a solid foundation for generating responses that meet the user's expectations.
[0033] 3、Through the response generation function to create response candidates, and define a multi-dimensional parameter vector including detail level, professional depth, tone style, etc. for each candidate. In terms of user feedback collection, not only record the user's explicit evaluation as explicit feedback, but also analyze the user behavior indicators to obtain implicit feedback, and infer the user's emotional state through analyzing the question sequence. Based on these multi-dimensional feedback information, build a reward function, and combine the dialogue state and user features to form a state space, configure the response parameter vector as an action space, and finally build a reinforcement learning framework based on policy gradient. This emotion-aware response optimization mechanism can dynamically adjust the detail level and expression of the reply according to the user's emotional changes, achieving accurate grasp of the user's psychological expectations. The emotion-aware response optimization system greatly improves the system's emotional interaction ability, making the generated solutions more in line with the user's psychological expectations. BRIEF DESCRIPTION OF DRAWINGS
[0034] Fig. 1 It is a structure schematic diagram of an intelligent RAG knowledge base system of the present application which fuses a dynamic knowledge graph;
[0035] Fig. 2 It is a flowchart of a mixed retrieval module of the present application;
[0036] Fig. 3 It is an application flowchart of an intelligent RAG knowledge base system of the present application which fuses a dynamic knowledge graph. DETAILED DESCRIPTION
[0037] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0038] Please refer to Figs. 1 to 3 The present application provides an intelligent RAG knowledge base system fusing dynamic knowledge graph, and the technical solutions are as follows:
[0039] Embodiment one:
[0040] An intelligent RAG knowledge base system fusing dynamic knowledge graph, comprising:
[0041] A data processing module performs preprocessing on original data to obtain a standardized data set;
[0042] A graph construction and updating module extracts knowledge from the standardized data set using a large model to construct a knowledge graph, and performs incremental knowledge extraction by monitoring data sources to dynamically update the knowledge graph;
[0043] A dialogue management and understanding module records complete information of the current dialogue to construct a dialogue state, performs semantic analysis, anaphora resolution and completion on user questions to update the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state;
[0044] A hybrid retrieval module performs hybrid retrieval on the standardized data set and the updated dialogue state using DPR and PPR retrieval methods to obtain first and second retrieval results, sets an initial retrieval weight according to the question type, and performs retrieval result integration to obtain a comprehensive retrieval result according to the initial retrieval weight and the retrieval weight adjustment amount;
[0045] A response optimization module uses policy gradient-based reinforcement learning to output an optimal response according to the comprehensive retrieval result and user feedback.
[0046] Specifically, original data is obtained from multiple data sources of an enterprise through multi-source channel data collection, including but not limited to product manuals, user guides, frequently asked questions 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, preprocessing steps including data cleaning, text deduplication and format standardization are performed.
[0047] Further, the constructing the knowledge graph specifically comprises: segmenting each document in the standardized data set into text blocks, performing entity, relation and attribute extraction on each text block to obtain knowledge triples, and integrating all the knowledge triples into an initial knowledge graph; calculating an edit distance and a semantic similarity of each two entity names of the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds a merging threshold, calculating an initial importance weight of the entities in the knowledge graph, and obtaining the knowledge graph;
[0048] The calculation formula of the comprehensive score is:
[0049] wherein, S merge (e i , e j ) represents the comprehensive score of entities e i and e j ; a represents a weight parameter, and the value range is [0, 1], and is set to 0.4; ED(e i , e j ) represents an edit distance, which is calculated by using the Euclidean distance; max(|e i |, |e j |) represents the maximum value of the name string length of entities e i and e j ; SemSim(e i , e j ) represents a semantic similarity, which is calculated by using the cosine similarity.
[0050] The calculation formula of the initial importance weight of the entity is: W(e i ) = β·Degree(e i ) + (1-β)·TF(e i ).
[0051] wherein, W(e i ) represents the initial importance weight of entity e i ; β represents a balance parameter, and the value range is [0, 1], and is set to 0.6; Degree(e i ) represents the degree of entity e i in the knowledge graph, that is, the number of connection relations; TF(e i ) represents the word frequency of entity e i in the original data.
[0052] The structured knowledge representation is formed through document segmentation, knowledge triple extraction and entity merging optimization. The entity merging mechanism based on the edit distance and semantic similarity effectively solves the synonymous expression problem and avoids knowledge redundancy. The calculation of the initial importance weight establishes a priority system for the entity, which provides guidance for subsequent retrieval, so that the knowledge graph maintains semantic coherence and has a structured feature, and the grasping ability of the system for knowledge correlation is improved.
[0053] Further, the dynamic updating of the knowledge graph specifically comprises:
[0054] checking the data source for updates at preset time intervals, 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 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 first incremental knowledge; for data update, calculate the data difference before and after the update, and perform knowledge extraction on the data difference to obtain second incremental knowledge; for data deletion, retain relevant knowledge triples and decay the relevant initial importance weight, and set a failure timer;
[0056] updating the knowledge graph according to the first incremental knowledge, the second incremental knowledge and the decayed initial importance weight.
[0057] Specifically, the preset time interval of the embodiment is set to 4 hours, and the failure timer is set to 30 days.
[0058] Through the dual mechanism of regular checking and event subscription, real-time dynamic updating of the knowledge graph is realized. Differentiated processing strategies are adopted for different change types: new data is directly extracted, updated data only processes the difference part, and deleted data applies a weight decay mechanism, avoiding the association break caused by hard deletion of knowledge. This incremental updating mechanism significantly improves the system response speed and computing efficiency, ensures the timeliness of knowledge, and at the same time preserves the historical coherence of knowledge, so that the system can adapt to the rapidly changing knowledge environment.
[0059] Further, updating the dialogue state specifically comprises:
[0060] constructing the dialogue state according to the complete information of the current dialogue, the dialogue state including an entity set, an attribute set, a user intent sequence, a context focus and a user question sequence;
[0061] extracting explicit entities in the new question according to the new question; obtaining a resolution entity according to the new question and the dialogue state; obtaining a complement entity according to the new question and the dialogue state; merging the explicit entity, the resolution entity and the complement entity to obtain a new question entity set;
[0062] performing intent recognition on the new question, the new question entity set and the dialogue state to obtain a user intent of the new question, and updating a context focus according to the new question;
[0063] updating 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, the embodiment extracts explicit entities in the new question through a named entity recognition function; obtains a resolution entity by resolving a reference expression through a resolution algorithm; the omission component recovery rule is as follows: when the new question lacks a topic but is related to the topic of the previous question, the focus entity of the previous question is inherited; when the new question only mentions an attribute without indicating an entity, the related entity in the context focus is inherited; when the new question lacks a limiting condition, the constraint condition of the previous question is inherited; performs intent recognition through a deep learning-based intent classifier to obtain a user intent; and updates the context focus through the following formula:
[0065] focus'(e i )=γ·focus(e i )·η Δt +(1-γ)·mention(e i ,Q′);
[0066] wherein, focus'(e i ) and focus(e i ) represent the focus degrees of entity e i before and after updating respectively; γ represents a weight parameter; η represents a time decay factor, which is set to 0.9; Δt represents a time interval between the new question and the previous user question; Q' represents the new question; the mention() function is used to calculate the prominence of the entity in the new question.
[0067] Through the three levels of entity extraction, resolution and omission recovery, the user intent is accurately understood. The system can identify explicit entities, resolve reference expressions and recover omitted components, and realize the coherence of the dialogue. Through intent recognition and context focus updating, the system can track the development of the dialogue and accurately capture the changes in the user's focus. This multi-dimensional dialogue understanding mechanism significantly improves the coherence and accuracy of the system in multi-round interaction, and provides accurate context support for subsequent retrieval and response generation.
[0068] Further, referring to Fig. 2 The mixed retrieval module flowchart shown, combined with DPR and PPR retrieval method to the standardized data set and the updated dialogue state mixed retrieval obtains first retrieval result and second retrieval result specifically includes: using query encoder converts user question into vector representation, obtains query vector; using document encoder converts each document in the standardized data set into vector representation, obtains document vector; the vector similarity of the query vector and each document vector is calculated, all documents are sorted from large to small according to the vector similarity, and the first k1 document is selected as the first retrieval result;According to the entity set in the latest dialogue state, a query subgraph is constructed, and PPR algorithm is executed on the query subgraph to generate PPR score, all knowledge triples in the query subgraph are sorted from large to small, and the first k2 knowledge triple is selected as the second retrieval result.
[0069] Specifically, according to the entity set in the latest dialogue state, a query subgraph G Q :
[0070]
[0071] Wherein, (e i , r j , e k ) represents a knowledge triple in the knowledge graph KG, represents that there is a relationship r j between entity e i and entity e k ; E Q represents the entity set in the latest dialogue state;dist(e p , e i ) represents the shortest path distance between entity e p and entity e i in the query subgraph;d max represents the maximum expansion distance.
[0072] The advantages of DPR and PPR retrieval methods are combined, and dual retrieval of semantics and structure is realized. DPR provides semantic matching ability based on vector similarity calculation, and PPR provides structured knowledge retrieval ability based on query subgraph execution graph algorithm. The mixed retrieval architecture can capture the deep semantics of text and utilize the structured association of knowledge, significantly expanding the retrieval boundary. Through double-channel retrieval, the system can simultaneously cope with the query demand of semantic ambiguity and structural complexity, and improve the comprehensiveness and accuracy of retrieval.
[0073] Further, the setting the initial retrieval weight according to the question type, and performing the retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount to obtain the comprehensive retrieval result specifically comprises: using a classifier to determine the question type of the user question, setting the initial retrieval weight 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 according to the final score from large to small, and selecting the top k3 knowledge units as the comprehensive retrieval result.
[0074] Specifically, the setting 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] The retrieval weight adjustment amount ΔW is calculated based on the updated dialogue state DPR :
[0076] ΔW DPR = λ1·|E explicit | / |E complete |-λ2·DT(DS′);
[0077] Wherein, λ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 rounds contained in the updated dialogue state DS′.
[0078] The adjusted initial retrieval weight of the first retrieval result is The adjusted initial retrieval weight of the second retrieval result is
[0079] The final score is calculated
[0080] Wherein, Norm() represents a score normalization function; item represents a knowledge unit; S DFR (item) and S PPR (item) represent vector similarity and PPR score respectively.
[0081] An initial weight is set for different retrieval methods by the question type classifier, and a weight adjustment amount is calculated based on the dialogue state, so as to realize adaptive optimization of the retrieval strategy. The final score is calculated by using the adjusted retrieval weight, so as to ensure the relevance and integrity of the retrieval result. The dynamic integration mechanism enables the system to flexibly adjust the retrieval strategy according to different question types and dialogue contexts, and significantly improves the adaptability of the system to diversified queries, and lays a foundation for generating high-quality responses.
[0082] Further, the response optimization module specifically comprises:
[0083] A response candidate is generated based on the comprehensive retrieval result and the latest dialogue state through a response generation function, and a parameter vector is defined for the response candidate; the parameter vector comprises a detail level, a professional depth, a step division, a tone style and a certainty level;
[0084] Explicit feedback is obtained by recording user explicit evaluation, implicit feedback is obtained by analyzing user behavior indicators, and user emotional state is obtained by analyzing user question sequences;
[0085] A reward function is constructed according to the explicit feedback, the implicit feedback and the user emotional state; a state space is constructed according to the dialogue state and the user characteristics, and the parameter vector of the response candidate is configured as an action space;
[0086] A reinforcement learning framework based on policy gradient is constructed according to the reward function, the state space and the action space, and an optimal response is output.
[0087] The explicit feedback, the implicit feedback and the emotional state are integrated to construct a reward function, and a policy gradient reinforcement learning framework is applied to continuously optimize the response strategy. The emotion-driven response mechanism enables the system to perceive the emotional changes of the user and make corresponding adjustments, and significantly improves the user satisfaction and the interaction experience.
[0088] The present application realizes the whole-link optimization of knowledge representation, retrieval and response generation. The data processing module and the graph construction and updating module jointly establish a dynamically evolving knowledge base, which guarantees the timeliness and integrity of the system knowledge through the large model knowledge extraction and incremental updating mechanism. The dialogue management and understanding module accurately grasps the user's intention through multi-level semantic analysis and context management, and provides context support for subsequent retrieval. The hybrid retrieval module integrates the semantic and structural dual-channel retrieval strategy, and effectively solves the deep semantic association problem between user colloquial expression and professional terms through the dynamic weight adjustment mechanism. The response optimization module introduces an emotion perception mechanism, and continuously optimizes the response strategy through a reinforcement learning framework, so that the system can adjust the detail and expression of the reply according to the emotional state of the user.
[0089] Embodiment two:
[0090] A certain telecom operator is faced with the problems of large customer service personnel mobility, insufficient professional knowledge, diversified user problem expression and untimely knowledge updating, resulting in unstable customer service response quality and low user satisfaction. By deploying the intelligent RAG knowledge base system of the application, intelligent management and retrieval of massive product manuals, service guides, historical cases and real-time updated business rules are realized. The embodiment provides an application of an intelligent RAG knowledge base system integrating a dynamic knowledge graph in a telecom operator customer service center, as shown in Fig. 3 The following steps are implemented:
[0091] Preprocessing is performed on the original data to obtain a standardized data set;
[0092] Knowledge extraction is performed on the standardized data set using a large model to construct a knowledge graph; incremental knowledge extraction is performed by monitoring the data source to dynamically update the knowledge graph;
[0093] The complete information of the current dialogue is recorded to construct a dialogue state, semantic analysis, anaphora resolution and completion are performed on the user problem, the dialogue state is updated, and a retrieval weight adjustment amount is calculated based on the updated dialogue state;
[0094] The standardized data set and the updated dialogue state are mixedly retrieved using the DPR and PPR retrieval methods to obtain first and second retrieval results, an initial retrieval weight is set according to the problem type, and a comprehensive retrieval result is obtained by integrating the retrieval results according to the initial retrieval weight and the retrieval weight adjustment amount;
[0095] An optimal response is output according to the comprehensive retrieval result and user feedback using reinforcement learning based on policy gradient.
[0096] Further, constructing the knowledge graph specifically includes: segmenting each document in the standardized data set into text blocks, extracting entities, relationships and attributes from 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 each two entity names of the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds a merging threshold, calculating an initial importance weight for the entities in the knowledge graph, and obtaining the knowledge graph.
[0097] Further, dynamically updating the knowledge graph specifically includes:
[0098] Checking the data source for updates at a preset time interval, 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 data source ID, change type and content difference; the change type includes data addition, data update and data deletion;
[0099] For data addition, directly perform knowledge extraction to obtain first incremental knowledge; for data update, calculate the difference between the data before and after the update, perform knowledge extraction on the data difference, and obtain second incremental knowledge; for data deletion, retain relevant knowledge triples and decay the relevant initial importance weight, and set a failure timer;
[0100] Update the knowledge graph according to the first incremental knowledge, the second incremental knowledge, and the decayed initial importance weight.
[0101] Table 1 shows the construction and dynamic updating effect of the knowledge graph. Through entity merging optimization and incremental updating strategy, the system maintains the timeliness and structural integrity of the knowledge, providing a high-quality knowledge base for retrieval.
[0102] Table 1 Knowledge graph dynamic updating effect
[0103]
[0104] Further, updating the dialogue state specifically includes:
[0105] According to the complete information of the current dialogue, construct the dialogue state, which includes entity set, attribute set, user intent sequence, context focus, and user question sequence;
[0106] When the user raises a new question, extract the explicit entity in the new question; according to the new question and the dialogue state, parse the representation of the reference, and obtain the reference resolution entity; according to the new question and the dialogue state, execute the omission component recovery rule, and obtain the completed entity; merge the explicit entity, the reference resolution entity, and the completed entity to obtain the new question entity set;
[0107] 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;
[0108] 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.
[0109] Table 2 shows the semantic understanding ability of the system in multi-round dialogue. Through the triple mechanism of explicit entity extraction, reference resolution, and omission recovery, the system can accurately grasp the user intent and provide precise context support for subsequent retrieval.
[0110] Table 2 Multi-round dialogue state updating and understanding effect evaluation
[0111]
[0112] Further, the mixed retrieval of the standardized dataset 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 comprises: 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 of the query vector and each document vector, and sorting all documents from large to small 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, and generating PPR scores to sort all knowledge triples in the query subgraph from large to small, and selecting the top k2 knowledge triples as the second retrieval result.
[0113] Further, setting an initial retrieval weight according to the question type, and performing retrieval result integration according to the initial retrieval weight and the retrieval weight adjustment amount to obtain the comprehensive retrieval result specifically comprises: using a classifier to determine the question type of the user question, and setting the initial retrieval weight 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 from large to small according to the final score, and selecting the top k3 knowledge units as the comprehensive retrieval result.
[0114] Further, using policy gradient-based reinforcement learning, outputting an optimal response according to the comprehensive retrieval result and user feedback specifically comprises:
[0115] Generating a response candidate by a response generation function based on the comprehensive retrieval result and the latest dialogue state, and defining a parameter vector for the response candidate; the parameter vector includes detail level, professional depth, step division, tone style and certainty level;
[0116] Recording explicit evaluation of the user to obtain explicit feedback, analyzing user behavior indicators to obtain implicit feedback, and analyzing user question sequences to obtain user emotional state;
[0117] Constructing a reward function according to the explicit feedback, the implicit feedback and the user emotional state; constructing a state space according to the dialogue state and the user characteristics, and configuring the parameter vector of the response candidate as an action space;
[0118] Constructing a policy gradient-based reinforcement learning framework according to the reward function, the state space and the action space, and outputting an optimal response.
[0119] While embodiments of the application have been shown and described, it is to be understood that the embodiments described are merely exemplary of the principles and application of the present application. Numerous modifications and adaptions can be effected without departing from the spirit and scope of the present application, which is not limited to the exact construction and arrangement described. It is intended, therefore, to cover all modifications and adaptions that fall within the scope of the claims and their equivalents.
Claims
1. An intelligent RAG knowledge base system fused with dynamic knowledge graph, characterized in that, The method comprises the following steps: a data processing module performs preprocessing on original data to obtain a standardized data set; a graph construction and updating module extracts knowledge from the standardized data set using a large model to construct a knowledge graph; incremental knowledge extraction is performed by monitoring data sources to dynamically update the knowledge graph; constructing the knowledge graph specifically includes: dividing each document in the standardized data set into text blocks, extracting entities, relationships and attributes from 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 each two entity names in the initial knowledge graph to obtain a comprehensive score, merging entities when the comprehensive score exceeds a merging threshold, calculating an initial importance weight for the entities in the knowledge graph, and obtaining the knowledge graph; The initial importance weight calculation formula of the entity is: ; in, Representing entities The initial importance weights; This represents the balance parameter, with a value range of [0,1], and is set to 0.6; Representing entities The degree in a knowledge graph, i.e., the number of connections; Representing entities Word frequencies in the original data; dynamically updating the knowledge graph specifically includes: checking data source updates at preset time intervals, 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 data source ID, change type and content difference; 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, and perform knowledge extraction on the data difference to obtain second incremental knowledge; for data deletion, retain related knowledge triples and decay the related initial importance weight, and set a failure timer; updating the knowledge graph according to the first incremental knowledge, the second incremental knowledge and the decayed initial importance weight; a dialogue management and understanding module records complete information of the current dialogue to construct a dialogue state, performs semantic analysis, anaphora resolution and completion on user questions, updates the dialogue state, and calculates a retrieval weight adjustment amount based on the updated dialogue state; a hybrid retrieval module combines DPR and PPR retrieval methods to perform hybrid retrieval on the standardized data set and the updated dialogue state to obtain first and second retrieval results, 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; a response optimization module uses policy gradient-based reinforcement learning to output an optimal response based on the comprehensive retrieval result and user feedback. 2.The intelligent RAG knowledge base system of fusing dynamic knowledge graph according to claim 1, characterized in that, updating the dialogue state specifically includes: constructing the dialogue state according to the complete information of the current dialogue, the dialogue state including an entity set, an attribute set, a user intent sequence, a context focus and a user question sequence; when a user raises a new question, extracting explicit entities in the new question; resolving anaphoric representations according to the new question and the dialogue state to obtain anaphora resolution entities; performing omission component recovery rules according to the new question and the dialogue state to obtain completed entities; merging the explicit entities, the anaphora resolution entities and the completed entities to obtain a new question entity set; performing intent recognition on the new question, the new question entity set and the dialogue state to obtain a user intent of the new question, and updating a context focus according to the new question; updating 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. 3.The intelligent RAG knowledge base system of fusing dynamic knowledge graph of claim 1, wherein, The DPR and PPR retrieval methods are combined to retrieve the standardized data set and the updated dialogue state to obtain first retrieval results and second retrieval results, specifically including: using a query encoder to convert a 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 a vector similarity between the query vector and each document vector, sorting all documents in descending order according to the vector similarity, and selecting the first documents as the first retrieval results; constructing a query subgraph according to an entity set in the latest dialogue state, performing a PPR algorithm on the query subgraph, generating PPR scores, sorting all knowledge triples in the query subgraph in descending order according to the PPR scores, and selecting the first knowledge triples as the second retrieval results. 4.The intelligent RAG knowledge base system of fusing dynamic knowledge graph of claim 1, wherein, The setting of the initial search weight according to the problem type and the execution of the search result integration according to the initial search weight and the search weight adjustment amount to obtain the comprehensive search result specifically comprises: judging the problem type of the user problem by using a classifier, setting the initial search weight of the first search result and the second search result according to the problem type; constructing a knowledge unit set according to the first search result and the second search result, adjusting the initial search weight according to the search weight adjustment amount, calculating the final score of each knowledge unit according to the adjusted initial search weight, sorting the knowledge units in descending order according to the final score, and selecting the top knowledge units as the comprehensive search result. 5.The intelligent RAG knowledge base system of fusing dynamic knowledge graph of claim 1, wherein, The response optimization module specifically comprises: generating a response candidate based on the comprehensive search result and the latest dialogue state through a response generation function, and defining a parameter vector for the response candidate; the parameter vector comprises a detail level, a professional depth, a step division, a tone style and a certainty level; obtaining explicit feedback through recording user explicit evaluation, obtaining implicit feedback through analyzing user behavior indexes, and obtaining user emotional states through analyzing user question sequences; constructing a reward function according to the explicit feedback, the implicit feedback and the user emotional states; constructing a state space according to dialogue states and user characteristics, and configuring the parameter vector of the response candidate as an action space; constructing a reinforcement learning framework based on a policy gradient according to the reward function, the state space and the action space, and outputting an 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