Database knowledge dialogue method and system based on retrieval enhancement
By adopting a search enhancement method in the database knowledge dialogue system, analyzing user input and combining document topic generation model and large language model, the problem of insufficient relevance of search results and insufficient integration of generated content with search results in the existing system is solved. , achieving more accurate and relevant responses.
Patent Information
- Application Number
- CN202411510064.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-11
AI Technical Summary
When the existing database knowledge dialogue system handles highly specialized or complex queries, the relevance of the search results is insufficient, and the integration of the generated content with the search results is insufficient, resulting in irrelevance of the answers or 'illusions'.
Using a search enhancement method, a structured query vector is analyzed and generated through user input, the document topic generation model is used to calculate the similarity, find the topics most relevant to user problems, and combine the large language model with the retrieved knowledge base information dynamics Generate natural language responses.
It improves the relevance of the search results and the accuracy of the generated content, ensures that the content output by the system is more based on actual database knowledge, and reduces the occurrence of 'illusion' phenomena.
Smart Images

Figure CN119415638A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a database knowledge dialogue method and system based on retrieval enhancement, belonging to the field of database intelligent operation and maintenance. Background Art
[0002] With the development of artificial intelligence and natural language processing technology, the application of dialogue systems in various fields is becoming more and more extensive. The database knowledge dialogue system is an intelligent system that combines the database operation and maintenance knowledge base and natural language processing technology. It aims to interact with users through natural language and retrieve relevant information from the knowledge base to achieve a more accurate and comprehensive dialogue interaction experience.
[0003] At present, large language models are making continuous progress in the field of natural language processing, but they still have obvious limitations when processing queries in specific fields. At the same time, the performance of the dialogue system depends largely on the quality and availability of external data sources. If the retrieved data is inaccurate or incomplete, it will affect the final generation effect. In order to further improve the response accuracy of the dialogue system, retrieval-augmented generation (RAG) technology was introduced. RAG first retrieves relevant information from an external database or knowledge base, and then generates a natural language response in combination with a large language model. This method alleviates the "hallucination" problem of the generative model to a certain extent, making the content output by the system more based on actual database knowledge. However, the existing RAG technology still has the following two key problems in its application in the field of database operation and maintenance:
[0004] (1) Insufficient relevance of retrieval results: RAG technology usually relies on text matching or vectorized retrieval methods. When faced with highly specialized or complex database queries, it cannot accurately capture the deep semantic relationship between user questions and the knowledge base, resulting in a low match between retrieval results and user questions, affecting the performance of the dialogue system.
[0005] (2) Insufficient integration of generated content and retrieval results: Although RAG combines the retrieval and generation models, the generation model fails to fully rely on the retrieval results during the generation process. If the retrieval content does not match the question well, the generation model may still generate irrelevant answers or even "hallucinations", which is particularly obvious in scenarios where high information accuracy is required in database intelligent operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] Figure 1 It is the system flow chart. Summary of the invention
[0007] In response to the problems of "hallucination" and other issues in the field of dialogue systems, this application proposes a database knowledge dialogue method based on retrieval enhancement, the steps are as follows:
[0008] (1) User input: Analyze user input, extract key information and generate structured query vectors;
[0009] (2) Similarity calculation: Using the trained document topic generation model, based on the topic distribution of the user's question, select the topic with the highest probability as the most relevant topic for the user's question, calculate the similarity with the knowledge base, sort the calculated similarities, and find the vector that is most similar to the user's question vector;
[0010] (3) Question response, combining the large language model and the retrieved knowledge base information to dynamically generate natural language responses related to the user's question;
[0011] (4) Output response: Based on the generated answers, integrate and output the final response that matches the user's question.
[0012] Furthermore, when calculating the similarity, a weighted similarity search is used to calculate the similarity. For any two string sets R and S, the similarity is calculated. Any set of strings R = {r1,r 2, …,r |R|}, consisting of a non-empty subset of the global weighted symbol set ∑, and Dataset D = {R1,…,R n} consists of n records, each record consists of an identification field id and a string set field; the global order O(t)∈N, the weight W(t)∈R, the weight of t in R is F(t,R)∈R, N is a natural number set; for any string set R, there is F(t,R)=1,W(t)=1,length len(R)=∑ t∈R (log(F(t,R)+1))·W(t) 2 ; To calculate the set of symbols shared by two string sets R and S.
[0013] Based on the above method, the present invention further proposes a database knowledge dialogue system based on retrieval enhancement, the system comprising:
[0014] (1) Input understanding module, which analyzes user input, extracts key information and generates structured query vectors;
[0015] (2) Similarity calculation module: This module uses the trained document topic generation model to select the topic with the highest probability as the most relevant topic to the user's question based on the topic distribution of the user's question, calculates the similarity with the knowledge base, sorts the calculated similarities, and finds the vector that is most similar to the user's question vector;
[0016] (3) Question response module, which combines the large language model and the retrieved knowledge base information to dynamically generate natural language responses related to user questions;
[0017] (4) Output response module, which integrates and outputs the final response that matches the user question based on the generated answers.
[0018] Furthermore, in the similarity calculation module, a weighted similarity search is used to calculate the similarity. For any two string sets R and S, the similarity is calculated. Any set of strings R = {r1,r 2, …,r |R|}, consisting of a non-empty subset of the global weighted symbol set ∑, and Dataset D = {R1,…,R n} consists of n records, each record consists of an identification field id and a string set field; the global order O(t)∈N, the weight W(t)∈R, the weight of t in R is F(t,R)∈R, N is a natural number set; for any string set R, there is F(t,R)=1,W(t)=1,length len(R)=∑ t∈R (log(F(t,R)+1))·W(t) 2 ; To calculate the set of symbols shared by two string sets R and S.
[0019] The present invention can better respond to user queries and information needs by measuring the similarity between two string sets. Weighted similarity not only considers the existence of symbols, but also focuses on the relative importance of symbols in different contexts, thereby more accurately identifying the actual similarity of two string sets. Through similarity calculation, the dialogue system can effectively associate the current dialogue with relevant information in the database, thereby providing a more coherent user experience.
[0020] Taking into account the weight of symbols and the length of strings, the system can measure the similarity between texts more finely, ensuring that the system has a deep understanding of the context and semantic relationship of the texts. The weighted similarity method dynamically adjusts the calculation of similarity based on the importance and contextual association of symbols in different texts, allowing the system to effectively filter out noise and irrelevant information in complex contexts and focus on the database information most relevant to the user's question. In this way, the system can meet the diverse information needs of different users and provide a more intelligent and humanized interactive experience. DETAILED DESCRIPTION
[0021] The core research of this paper is a database knowledge dialogue system based on retrieval enhancement. The system uses the rich knowledge stored in the query knowledge base as background content and combines the user's input with the most relevant knowledge into questions. The questions are fed into a large language model to generate corresponding answers. At the same time, the system retrieves information based on the user's input in real time and provides relevant information to enhance the interactivity and practicality of the dialogue.
[0022] System flow chart as follows Figure 1 The detailed steps are as follows:
[0023] 1. User input understanding module
[0024] When the dialog enters the dialog system home page, the user will first be asked to select the database type and start interacting with the system. The user can type questions, requests, or queries in the text input box.
[0025] During the interaction between the user and the system, the system will collect the user's text data and other relevant information in real time. This information may include the user's questions, answers, feedback, and other information related to specific tasks or fields.
[0026] At the same time, this stage will use natural language processing techniques such as word segmentation, part-of-speech tagging, entity recognition, etc. to understand and parse the user input and extract the user's intentions and key information.
[0027] 2. Similarity calculation module
[0028] The core part of the system, the knowledge base, contains information and data related to database operation and maintenance, such as documents, logs, reports, etc. In order to map text information to vectors in a high-dimensional space and better represent the semantic information and context of the text, this application uses a pre-trained word vector model to convert text information into vector representation. At the same time, the text information represented by these vectors will be stored in a special vector database to form a component of the knowledge base.
[0029] To provide a richer semantic background, we will perform topic modeling on the text in the knowledge base. Specifically, we will apply LDA to the text data in the knowledge base, represent each text as a vector of topic distribution, and then when a user asks a question, we will combine the vector representation of the user's question to find the topic most relevant to the user's question. The LDA algorithm process is as follows:
[0030] With the subject as the middle layer, θ d is the topic distribution vector of document d, which represents the weight or probability distribution of each topic in the document; t is the word distribution vector of topic t, which represents the weight or probability distribution of each word in the topic.
[0031] a. When the LDA algorithm starts, θ is randomly given d ,φ t Assignment;
[0032] b. For the i-th word w in a specific document d i , according to the current topic distribution θ d and word distribution
[0033] φ t To calculate w i The corresponding probability distribution of each subject is given by P j (w i |d)=P(w i |t)*
[0034] P(t|d);
[0035] c. Enumerate the topics and get all P j (w i |d), the result according to the probability value is the i-th word w in d i Select a topic;
[0036] d. If the i-th word w in d i , here you choose a different topic from the original one, which will affect θ d ,
[0037] φ t has an impact, which in turn affects P j (w i |d) calculation;
[0038] All the words in all the documents in the document set are calculated, and the topics are reselected to complete an iteration. After multiple iterations, the document topic generation model converges.
[0039] In order to reduce the complexity and redundancy of data, topic analysis is applied to large-scale text data. This application uses a trained document topic generation model to select several topics with the highest probability as the most relevant topics for user questions based on the topic distribution of user questions. The design of this model can better understand the content and topic distribution of text data and reduce the dimensionality of high-dimensional text data to the topic space.
[0040] The most relevant topic obtained by the document topic generation model is calculated with the knowledge base for similarity, and the calculated similarities are sorted to find the vector most similar to the user's question vector. At the same time, the corresponding information or data will be retrieved from the database as background content for reference by the large model, which will help generate more targeted and rich answers.
[0041] Furthermore, the similarity calculation in the above steps adopts weight-based similarity retrieval, which is implemented as follows:
[0042] Definition 1 (string set): Any string set R = {r1,r 2, …,r |R|} is composed of a non-empty subset of a global weighted symbol set ∑, |R| represents the total number of subsets in the set, thus we can get:
[0043] A string set can be defined as any field of a record as a type. Assume that the data set D = {R1,…,R n} consists of n records, each of which consists of an identification field (id) and a string field.
[0044] Definition 2 (Biasedness): Each symbol in ∑ has a global order O(t)∈N and a weight W(t)∈R used to identify the order of the symbol in the entire set. The biasedness of symbol t in the string set R is F(t,R)∈R.
[0045] The traditional symbol counting similarity search can be used as a special case of this definition, that is, for any string set R, F(t, R) = 1, W(t) = 1. In order to identify the relative importance of a specific symbol in the text, the present application defines an arbitrary weight for each symbol, and different weights may be assigned to a symbol in different string sets.
[0046] Definition 3 (Length of a string set): Any string set R = {r1,r 2, …,r |R|}, the length is defined as: len(R) = ∑ t∈R (log(F(t,R)+1))·W(t) 2 In this formula, the influence of extreme values is reduced by designing a nonlinear function, so that the contribution of symbols with greater bias to the length is relatively stable, and the global importance of symbols is emphasized.
[0047] Definition 4 (Weighted Similarity of String Sets): The similarity of any two string sets R and S is:
[0048] in To calculate the set of symbols shared by two string sets R and S, the similarity is 1 if and only if R and S are exactly the same, and the similarity is 0 when they are orthogonal, that is, the similarity is 0 when the two string sets have no shared symbols; the similarity is 1 when the symbol weights of the two are the same; in other cases, the similarity between the two is between 0 and 1.
[0049] In the retrieval system, the similarity definition is used to match the query Q with the definition of the string set field of any record in the record set R. The retrieval goal is to find a record set whose similarity with the query is not less than a given threshold τ, that is, to obtain all result sets that satisfy sim(R,S)≥τ|R∈R
[0050] 3. Question response module
[0051] The user's question and the most similar information in the filtered database are combined as context into a rich prompt, which can provide more information and context for the large language model. In this way, the large model generates more accurate and relevant answers based on the user's question and the retrieved data. By combining the database information obtained by real-time filtering with the user's question, the model can dynamically adjust the generated answer based on the user's question and database information, so as to reflect the latest information and situation in a timely manner.
[0052] 4. Output response module
[0053] The generated answer is returned to the user as the system's response. In this way, the user can directly obtain a natural language answer related to his question based on database information, thus completing a closed loop of dialogue interaction between the user and the system.
[0054] The system can accurately understand the natural language questions, requests or queries input by users, and perform information retrieval in real time based on the user's input. Users can directly obtain natural language answers related to their questions based on database information, thus realizing a closed loop of dialogue interaction between users and the system. At the same time, the system uses pre-trained word vector models and LDA topic models. The system can efficiently retrieve information related to user questions in the knowledge base and integrate it into the background content of the questions. The weight-based similarity retrieval method is adopted, considering the weight of symbols and the length of strings, effectively measuring the similarity between texts, and more accurately finding database information related to user questions.
[0055] A more specific embodiment:
[0056] Suppose the user asks, "How do I view the performance metrics of my database?"
[0057] The user system first understands and parses the user input through natural language processing technology to extract the user's intention and key information. In this example, the key information is "view the performance indicators of the database."
[0058] The system will retrieve information related to "database performance indicators" in the database knowledge base. This information may include performance monitoring indicators, performance optimization methods, common performance issues, etc. Through pre-trained word vector models and weight-based similarity retrieval, the system can find the topics and knowledge most relevant to the user's questions.
[0059] A specific example of weight-based similarity retrieval: Based on definition 2, the weights of "operation and maintenance", "server" and "performance" are set to 4, and the weight of "index" is set to 2. The weight of "database" in R3 is defined as 2, and the weight of its "index" is defined as 1; similarly, the weights of the three symbols in R2 are all 1. Then the lengths of R3 and R2 are len(R2) = 4+4+2 = 10 and len(R3) = 4×2+2×1 = 10, respectively.
[0060] R1:{"database","performance","metrics"}n1
[0061] R2:{"server","performance","metrics"}n2
[0062] R3:{"Operation and maintenance","Indicator"}n3
[0063] R4:{"Operation and maintenance", "Monitoring", "Performance"}n4
[0064] For example, given the query {"server", "load capacity", "indicator"}, where the bias of "load capacity" is 1 and the bias of other symbols is 4, it is easy to get that the result under τ=0.4 is R2|sin(Q,R2)≈0.5, which means that the query is more similar to R2.
[0065] The weight-based similarity search in the knowledge base can retrieve relevant background content: "Types of database performance indicators: Understand the types of database performance indicators, including response time, throughput, number of concurrent connections, cache hit rate, query execution time, etc. Common strategies for database performance optimization, including index optimization, query optimization, hardware upgrades, partition table management, etc.".
[0066] The dialogue system without retrieval enhancement retrieved relevant background content: "In order to improve the performance of the database, some key indicators and strategies can be monitored and adjusted. For example, consider monitoring the screen refresh rate to ensure the smooth display of the user interface, and optimize hardware cooling by monitoring the fan speed to prevent the device from overheating. In addition, it is also crucial to regularly evaluate the file compression rate to improve data storage efficiency. When optimizing database performance, the user interaction experience can be improved by adjusting the display resolution and changing the keyboard layout. The latest research also shows that the use of database quantum boost engines and data transmission light speed devices can significantly increase data processing speed."
[0067] Combining the above background content and user questions, the answer sent to the big model is: "To view the performance indicators of the database, you can take the following steps: use database management system tools, use performance monitoring software, view database logs, use third-party performance monitoring tools, and generally speaking, to view the performance indicators of the database, you can use the tools provided by the database management system, use performance monitoring software, view database logs, or use third-party performance monitoring tools to monitor the performance of the database, and adjust and optimize the database configuration in a timely manner to improve the performance and stability of the database."
[0068] Finally, the generated answer is returned to the user as the system's response.
[0069] Comparing the background content retrieved by this application with the relevant background content retrieved by the dialogue system without search enhancement, this application provides detailed background information and specific strategies directly related to the user's query, while the content information retrieved by the prior art lacks specificity and depth and cannot provide detailed solutions, which further proves that this application can respond to user queries more accurately and in detail, and provide valuable background information and specific operational suggestions.
[0070] The units, devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions divided into various modules. Of course, when implementing this application, the functions of each module can be implemented in the same or more software and / or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0071] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.
[0072] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0073] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0074] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0075] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A database knowledge dialogue method based on retrieval enhancement, comprising the following steps: (1) User input: Analyze user input, extract key information and generate structured query vectors; (2) Similarity calculation: Using the trained document topic generation model, based on the topic distribution of the user's question, select the topic with the highest probability as the most relevant topic for the user's question, calculate the similarity with the knowledge base, sort the calculated similarities, and find the vector that is most similar to the user's question vector; (3) Question response, combining the large language model and the retrieved knowledge base information to dynamically generate natural language responses related to the user's question; (4) Outputting a response: Based on the generated answers, integrating and outputting a final response that matches the user's question; characterized in that: When calculating similarity, weight-based similarity retrieval is used to calculate the similarity.
2. A database knowledge dialogue method based on retrieval enhancement as claimed in claim 1, characterized in that: When calculating similarity, for any two string sets R and S, calculate the similarity Any set of strings R = {r1,r 2, …,r |R| }, consisting of a non-empty subset of the global weighted symbol set ∑, and Dataset D = {R1,…,R n } consists of n records, each record consists of an identification field id and a string set field; the global order O(t)∈N, the weight W(t)∈R, the weight of t in R is F(t,R)∈R, N is a natural number set; for any string set R, there is W(t)=1,length len(R)=∑ t∈R (log(F(t,R)+1))·W(t) 2 ; To calculate the set of symbols shared by two string sets R and S.
3. A database knowledge dialogue system based on retrieval enhancement, the system comprising: (1) Input understanding module, which analyzes user input, extracts key information and generates structured query vectors; (2) Similarity calculation module: This module uses the trained document topic generation model to select the topic with the highest probability as the most relevant topic to the user's question based on the topic distribution of the user's question, calculates the similarity with the knowledge base, sorts the calculated similarities, and finds the vector that is most similar to the user's question vector; (3) Question response module, which combines the large language model and the retrieved knowledge base information to dynamically generate natural language responses related to user questions; (4) An output response module, which integrates and outputs a final response matching the user's question based on the generated answers, and is characterized by: In the similarity calculation module, weight-based similarity retrieval is used to calculate the similarity.
4. A database knowledge dialogue system based on retrieval enhancement as claimed in claim 3, characterized in that: In the similarity calculation module, for any two string sets R, S, the similarity is calculated Any set of strings R = {r1,r 2, …,r |R| }, consisting of a non-empty subset of the global weighted symbol set ∑, and Dataset D = {R1,…,R n } consists of n records, each record consists of an identification field id and a string set field; the global order O(t)∈N, the weight W(t)∈R, the weight of t in R is F(t,R)∈R, N is a natural number set; for any string set R, there is W(t)=1,length len(R)=∑ t∈R (log(F(t,R)+1))·W(t) 2 ; To calculate the set of symbols shared by two string sets R and S.
Citation Information
Patent Citations
Medical question and answer text generation method and equipment based on retrieval enhancement generation
CN117763114A
Retrieval enhancement method combining keyword extraction and semantic analysis
CN118535682A
Intelligent question answering method, system and equipment based on large language model and database
CN118606348A
Cited By
Alarm convergence method and system combined with knowledge graph
CN120104807A