Conversation method, electronic equipment and storage medium
By exploring node labels and generating candidate answer sets in the knowledge graph, the shortcomings of the RAG model in cross-document reasoning are solved, and more accurate and comprehensive answer generation is achieved, improving the user experience.
Patent Information
- Application Number
- CN202510110545.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-23
AI Technical Summary
When faced with complex queries and fuzzy problems, the existing RAG models lack cross-document reasoning capabilities and cannot accurately connect key information from different documents, resulting in incomplete or inaccurate answers, reducing the user's user experience.
By obtaining the dialogue information of the target object in the knowledge graph, determining the initial node, generating a node queue, exploring node labels and generating candidate answer sets, and outputting the response information corresponding to the dialogue information. This method uses the hierarchical relationship of labels to efficiently organize knowledge of different documents, and conducts deeper reasoning and information integration.
Improves the model's cross-document reasoning ability in multiple documents or knowledge bases, generates more accurate, coherent and comprehensive answers, and improves the user experience.
Smart Images

Figure CN120030124A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of information retrieval, and in particular to a dialogue method, an electronic device and a storage medium. Background Art
[0002] In recent years, many powerful dialogue systems have been developed based on large language models (such as GPT, BERT, etc.). These systems combine information retrieval with the generation process and use external knowledge bases to enhance the ability of dialogue generation. In these dialogue systems, in order to improve the information retrieval ability of the dialogue system, the RAG (Retrieval-Augmented Generation) model is often used. The RAG model combines the advantages of information retrieval and generation models and shows significant advantages when processing knowledge-rich queries. The traditional RAG model consists of two main parts: an information retrieval module and a generation module. The information retrieval module retrieves documents or fragments related to the user's query from an external knowledge base, while the generation module generates a coherent answer based on the retrieved documents and the query entered by the user. In this way, RAG can make up for the domain knowledge that may not be involved in the training process of the large language model, making the generated answers more accurate and rich.
[0003] However, existing RAG models still have the disadvantage of insufficient cross-document reasoning capabilities when facing complex queries and fuzzy questions. When retrieving documents, traditional RAG models only retrieve single document fragments related to the query question from the document library, while ignoring the possible relationships between different documents and lacking effective integration of cross-document information. For example, document A may discuss the symptoms of a certain disease, while document B discusses the treatment of the disease. Although the information in these two documents is related, RAG cannot recognize the association between them and cannot integrate them together during retrieval. Therefore, for questions that require extracting information from multiple documents and performing reasoning, RAG may not be able to accurately connect the key information of different documents, resulting in incomplete or inaccurate generated answers, which reduces the user experience. Summary of the invention
[0004] In response to the shortcomings of existing methods, this application proposes a dialogue method, electronic device and storage medium, which can solve the problem that the existing model has insufficient cross-document reasoning capabilities and cannot accurately connect the key information of different documents during cross-document reasoning, resulting in incomplete or inaccurate generated answers, thereby reducing the user experience.
[0005] According to one aspect of an embodiment of the present application, an embodiment of the present application provides a dialogue method for a RAG model, the method comprising:
[0006] Acquire the conversation information of the target object, and determine the initial node corresponding to the conversation information in the knowledge graph according to the correlation, wherein the knowledge graph is created by using a large language model, each node in the knowledge graph includes an atomic fact and multiple labels, and the relationship between the nodes is represented by the hierarchy of the labels;
[0007] Generate a first node queue including the initial node, perform node label exploration according to the label in the first node queue, update the first node queue according to the exploration result, and generate a second node queue, wherein the explored node includes information related to the response to the dialogue information;
[0008] A candidate answer set is generated according to the atomic facts in the second node queue, and response information corresponding to the dialog information is output based on the candidate answer set, wherein the candidate answer set includes labels and atomic facts related to the response information.
[0009] In a possible implementation, determining the initial node corresponding to the conversation information in the knowledge graph according to the correlation includes:
[0010] Determining a relevance score for each node in the knowledge graph according to the relevance of each node, wherein the relevance includes a relevance score determined by the relevance of the node to the answer;
[0011] The node with the highest correlation score is determined as the initial node.
[0012] In a possible implementation, performing node label exploration according to the labels in the first node queue includes:
[0013] Obtain a tag in the knowledge graph that meets a preset condition, where the preset condition is that the tag is associated with at least one tag in the first queue;
[0014] If it is determined that the node corresponding to the tag includes information related to the response, the node is read and determined as the explored node.
[0015] In a possible implementation, the obtaining of tags in the knowledge graph that meet preset conditions includes:
[0016] Traverse the nodes in the first queue, obtain the level of each label in the node, and obtain the labels in the knowledge graph that meet the preset conditions based on the level and the label information.
[0017] In a possible implementation, generating a candidate answer set according to the atomic facts in the second node queue includes:
[0018] Traversing the nodes in the second queue and reading the atomic facts of the nodes;
[0019] If it is determined that the atomic fact can be used to answer the dialog message, the atomic fact and the label of the node are included in the candidate answer set.
[0020] In a possible implementation, outputting response information corresponding to the dialogue information based on the candidate answer set includes:
[0021] Detecting whether the information included in the atomic facts in the candidate answer set can generate the response information;
[0022] If yes, outputting response information according to the candidate answer set;
[0023] If not, node label exploration and candidate answer set generation are performed based on the second node queue iteration.
[0024] In a possible implementation, the method includes:
[0025] Extracting key tags from the conversation information;
[0026] If it is determined that the key tag is incomplete based on the matching result between the key tag and the candidate answer set, generating a clarification question based on the incomplete part of the key tag;
[0027] The target object's interaction information regarding the clarification question is obtained, and the knowledge graph retrieval is performed again based on the interaction information and the dialogue information.
[0028] In a possible implementation, the detection of whether the key tag is complete includes:
[0029] Generate a tag set according to the tags in the candidate answer set, wherein the tag set includes all tags in the candidate answer set;
[0030] The key tag is compared with the tag, and whether the key tag is complete is detected according to the comparison result.
[0031] According to one aspect of an embodiment of the present application, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any of the methods described above.
[0032] According to one aspect of an embodiment of the present application, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed, the steps of the method described above are implemented.
[0033] The beneficial technical effects brought about by the technical solution provided by the embodiment of the present application include:
[0034] The present application provides a conversation method, which has the beneficial effects of obtaining conversation information of a target object, determining an initial node in the knowledge graph corresponding to the conversation information according to relevance, wherein the knowledge graph is created by the large language model, each node in the knowledge graph includes an atomic fact and multiple labels, and the relationship between nodes is represented by a hierarchy of labels; generating a first node queue including an initial node, performing node label exploration according to the labels in the first node queue, updating the first node queue according to the exploration results, generating a second node queue, and the explored nodes include information related to the response to the conversation information; generating a candidate answer set according to the atomic facts in the second node queue, and outputting the response information corresponding to the conversation information based on the candidate answer set, wherein the candidate answer set includes labels and atomic facts related to the response information. The present application can utilize the hierarchical relationship of labels to efficiently organize the knowledge of different documents, facilitate deeper and more complex reasoning of interrelated information, facilitate the model to understand and utilize the relationship between documents, and perform effective information integration and reasoning, thereby generating more accurate, coherent and comprehensive answers, and improving the user experience.
[0035] Additional aspects and advantages of the present application will be partially given in the following description, which will become apparent from the following description, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0037] Figure 1 A flowchart of a conversation method provided in an embodiment of the present application;
[0038] Figure 2 An overall flow chart of the dialogue method provided in the embodiment of the present application;
[0039] Figure 3 A schematic diagram of the knowledge graph structure provided in the embodiment of the present application;
[0040] Figure 4 A flowchart of knowledge graph retrieval provided for an embodiment of the present application;
[0041] Figure 5 A flow chart for active clarification of the model provided in the embodiment of the present application;
[0042] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0044] It will be understood by those skilled in the art that, unless specifically stated, the "said" and "the" used herein may also include plural forms. It should be further understood that the wording "including" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the implementation of other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element may be directly connected or coupled to the other element, or it may refer to the connection relationship between the element and the other element through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein refers to at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B".
[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0046] The embodiment of the present application provides a dialogue method, which can be used for a RAG model. The RAG model receives the data of the dialogue information input by the target object, and starts a knowledge question-answering process based on the data. In this process, the RAG model performs a knowledge graph search based on the data to obtain a set of candidate answers, and generates clarifying questions based on the labels in the candidate answer set and the dialogue information. It searches again based on the clarifying questions and the dialogue information to obtain response information related to the dialogue information, and the model generates an answer corresponding to the dialogue information based on the response information. Among them, the target object can be a user using the RAG model, or it can be a model terminal that can generate dialogue information. Among them, when searching the knowledge graph, atomic facts and labels related to the dialogue information can be retrieved, and a candidate answer set is generated based on the atomic facts and labels. When generating clarifying questions, clarifying questions can be generated based on active chain thinking.
[0047] Optionally, when the RAG model conducts a conversation based on the conversation information, it can also obtain information about historical conversations, identifiers (Session_id), conversation states, and configuration parameters, and combine this information to obtain answer information to improve the accuracy of the answer information. Among them, the historical conversation includes the previous conversation records between the target object and the model in the current conversation, including the target object's questions and the model's answers. The historical conversation provides context information for the model to help clarify the intention of the target object's current query in multiple rounds of conversations. The identifier is an identifier used to uniquely identify a complete conversation between the target object and the model. It is used to distinguish different conversations, ensure that the operation of the target object in one conversation is independent of another conversation, and a conversation can include multiple conversation information. The conversation state records the status information of the current conversation, including the target object's intention, the conversation process, the operations completed by the system, etc. The conversation state records the known tags and retrieval process in the current conversation, which helps to accurately retrieve in the knowledge graph and ensure that each round of clarification questions is generated based on the latest context. The configuration parameters include configuration parameters for setting the role, behavior style, and conversation style of the model (Bot). These parameters determine the model’s answer style (professional, concise, friendly, etc.), and affect the generation and language style of clarification questions.
[0048] like Figure 1-Figure 5 As shown, the dialogue method of the present application includes:
[0049] S101: Obtain the conversation information of the target object, and determine the initial node corresponding to the conversation information in the knowledge graph based on the relevance.
[0050] Optionally, the dialogue information includes natural language questions or requests input by the target object in the current dialogue. The dialogue information is the entry point for triggering knowledge graph retrieval and active clarification of the model. After obtaining the dialogue information, the retrieval target is clarified according to the dialogue information. Among them, the dialogue information can be transmitted to the RAG model in one or more forms such as voice, text, gesture, etc.
[0051] Optionally, the knowledge graph is created using a large language model (LLM), each node in the knowledge graph includes an atomic fact and multiple labels, and the relationship between nodes is represented by a hierarchy of labels.
[0052] Optionally, the knowledge graph is constructed based on the knowledge base text in the knowledge base, and the type of the knowledge base can be determined according to the application field of the RAG model or the information retrieval requirements. Each node in the knowledge graph includes an atomic fact and at least one label. Among them, the atomic fact is the smallest, indivisible fact that can be presented by a concise sentence. The label can be composed of basic nouns (such as characters, time, events, places, numbers), verbs (such as actions) and adjectives (such as states, emotions) that are essential to the narrative of the knowledge base text. Each node may contain multiple labels, and there are three types of relationships between the labels of different nodes: same, parent and child. The atomic facts and labels in the knowledge base text can be extracted through a large language model, and these atomic facts and labels can be used to construct a knowledge graph for information retrieval.
[0053] In one embodiment, Figure 3 As shown, each circle in the figure represents a node. Each node in the knowledge graph contains N labels. These labels may have their own parent labels, child labels or the same labels. These relationships are represented by the edges connecting the labels. This graphical structure can efficiently organize knowledge and facilitate retrieval and reasoning. Unlike the traditional method of building knowledge graphs based on relationship triples, the knowledge graph of this application emphasizes the hierarchical structure between labels. These hierarchical relationships are represented by node labels at different levels.
[0054] Optionally, the selection of the initial node is crucial to improving search efficiency. The RAG model evaluates all labels of all nodes of the knowledge graph and selects the initial node with the highest relevance based on the incoming conversation information, wherein the initial node corresponding to the conversation information in the knowledge graph is determined based on the relevance, including: determining the relevance score of each node based on the relevance of each node in the knowledge graph, the relevance includes the relevance determined by the relevance between the node and the answer; determining the node with the highest relevance score as the initial node. The relevance score of each node can be obtained by calculating the similarity by calculating semantic similarity or the like.
[0055] In one embodiment, the relevance can be determined as the relevance of the node to the potential answer to the dialogue information, and the relevance score can range from 0 to 100, and the larger the score, the higher the relevance. When selecting the initial node, traverse the nodes in the knowledge graph and evaluate its relevance to the potential answer to the dialogue information by assigning a relevance score between 0 and 100 to the node. 100 points means a high probability of being relevant to the answer, while 0 points means a low relevance. The relevance scores of these nodes are counted, and the node with the highest relevance score in the statistical results is determined as the starting node. The number of the initial nodes can be at least one.
[0056] Optionally, for the above operation of obtaining the initial node, the RAG model can be implemented by a pre-stored prompt word or command, and the command can be:
[0057] Task: Your current task is to examine the list of nodes and select the most relevant initial node from the graph to answer the question efficiently based on the question entered by the user. The selection of the initial node is crucial because it is the starting point for searching for relevant information.
[0058] Require:
[0059] 1. Once you have chosen a starting node, evaluate its relevance to the potential answer by assigning a score between 0 and 100. A score of 100 means a high probability of being relevant to the answer, while a score of 0 means little relevance.
[0060] 2. Present each selected starting node in a separate row with its relevance score. Each row has the following format: Node: [node label], Score: [relevance score].
[0061] 3. Please select the node with the highest relevance score as the starting node.
[0062] 4. When choosing a starting node, choose from the ones provided, don't make up your own. The node you output must correspond exactly to the one given by the user, with the same wording.
[0063] Output: The first node queue containing the initial node.
[0064] After obtaining the conversation information, the model searches for the initial node related to the conversation information from the knowledge graph based on the stored commands, and outputs the first node queue including the initial node.
[0065] S102: Generate a first node queue including an initial node, perform node label exploration according to labels in the first node queue, update the first node queue according to the exploration result, and generate a second node queue.
[0066] Optionally, after obtaining the initial node, nodes in the knowledge graph that are connected to the node (connected by edges) can be obtained, and a first node queue is generated based on these nodes.
[0067] Optionally, node label exploration is performed based on the labels in the first node queue, including: obtaining labels in the knowledge graph that meet preset conditions, the preset condition being that the label is associated with at least one label in the first queue; if it is determined that the node corresponding to the label includes information related to the response, then reading the node and determining the node as the explored node.
[0068] Optionally, during node label exploration, nodes in the knowledge graph that are not included in the first node queue are explored based on the labels in the first node queue to obtain more nodes related to potential answers to the dialogue information.
[0069] Optionally, the explored nodes include information related to the response to the dialogue information. The first node queue is expanded using these nodes to obtain a second node queue.
[0070] Optionally, when performing node label exploration, the labels under each node in the first node queue are explored to obtain other labels in the knowledge graph that have a hierarchical relationship with the label, and when the node corresponding to the obtained label contains information related to the response to the conversation information, the node is read and determined as the explored node.
[0071] Optionally, obtaining labels in the knowledge graph that meet preset conditions includes: traversing the nodes in the first queue, obtaining the level of each label in the node, and obtaining labels in the knowledge graph that meet the preset conditions based on the level and label information.
[0072] Optionally, if the labels of the nodes in the knowledge graph that are not included in the first node queue have the following conditions, it can be determined that there is an association:
[0073] 1. A certain label included is the same as a label in the first node queue; 2. A certain label included is the parent label of a label in the first node queue; 3. A certain label included is the child label of a label in the first node queue; 4. A certain label included has the same parent label as a label in the first node queue; 5. A certain label included has the same child label as a label in the first node queue.
[0074] Optionally, when exploring node labels, the first node queue is updated each time a node is explored, and the explored node is included in the first node queue. After the node label exploration is completed, the updated first node queue is determined as the second node queue.
[0075] In one embodiment, after obtaining the initial node queue, the RAG model can perform the node label exploration operation according to the pre-stored prompt words. The pre-stored prompt words limit the tasks that the model needs to perform, the requirements for task execution, and the output content. The relevant prompt words can be:
[0076] Task: You will receive a node queue (a node queue for node label exploration). Your task is to explore the labels under each node in the node queue and update the nodes that meet the conditions to the node queue. For each label in the node, you can choose the following operations:
[0077] ##
[0078] 1. Read nodes with the same label: If you think any nodes with the same label may contain information related to the question, select this operation (read nodes with the same label).
[0079] 2. Read nodes with the parent label: If you think any nodes with the parent label may contain information related to the question, select this operation.
[0080] 3. Read nodes with the child label: If you think any nodes with the child label may contain information related to the question, select this operation.
[0081] 4. Read nodes with the same parent label: If you think any nodes with the label having the same parent as this label may contain information related to the question, select this operation.
[0082] 5. Read nodes with the same child label: If you think any nodes with the label having the same child as this label may contain information related to the question, select this operation.
[0083] ##
[0084] Requirements:
[0085] 1. Explore all labels of all nodes in the queue and perform appropriate operations to read nodes with the corresponding labels. 2. After exploring each node, update the node queue, incorporate nodes with relevant information into the node queue, and ensure that there are no duplicate nodes in the queue.
[0086] ***
[0087] Output: The updated node queue.
[0088] The model explores the labels in the first node queue according to this prompt, explores nodes that meet the preset conditions from the knowledge graph, and adds them to the first node queue to obtain the second node queue.
[0089] S103: Generate a candidate answer set based on the atomic facts in the second node queue, and output the response information corresponding to the dialogue information based on the candidate answer set.
[0090] Optionally, the candidate answer set includes labels and atomic facts related to the response information. Generating the candidate answer set according to the atomic facts in the second node queue includes: traversing the nodes in the second queue, reading the atomic facts of the nodes; if it is determined that the atomic facts can be used to respond to the dialogue information, then the atomic facts and labels of the nodes are included in the candidate answer set. Among them, it can be detected whether the atomic facts in the node can be used to generate the response information. If the atomic facts in the node cannot be used to generate the response information, the atomic facts and labels under the node are not included in the candidate answer set. If so, the atomic facts and labels under the node are included in the candidate answer set.
[0091] Optionally, the RAG model can perform a candidate answer set generation operation using a pre-stored prompt word, which can be:
[0092] Task: Your current task is to explore the nodes in the node queue and their associated atomic facts, with the goal of determining whether the atomic facts under the node are helpful for answering the question. If you think it is helpful, you should include both the label and atomic facts contained in this node in the candidate answer set.
[0093] Requirements: Record the explored nodes to avoid exploring duplicate nodes.
[0094] Output: Returns a set of candidate answers containing labels and atomic facts
[0095] ***
[0096] In generating the second node queue, a candidate answer set is generated according to the pre-stored prompt word and the second node queue.
[0097] Optionally, outputting response information corresponding to the dialogue information based on the candidate answer set includes: detecting whether the information included in the atomic facts in the candidate answer set is capable of generating response information; if so, outputting the response information according to the candidate answer set; if not, performing node label exploration and candidate answer set generation based on the second node queue iteration.
[0098] Optionally, when it is determined that the atomic facts in the candidate answer set are insufficient to generate response information, the node label exploration step can be returned to, that is, the node label exploration is performed again according to the second node queue to generate a new node queue, and the candidate answer set corresponding to the new node queue is obtained. The candidate answer set is used to determine whether it is sufficient to generate response information. If so, the response information is generated. If not, node label exploration and candidate answer set generation are performed based on the new node queue until a candidate answer set containing atomic facts that meet the response information generation requirements is obtained.
[0099] In one embodiment, after obtaining the candidate answer set, it can be determined whether the candidate answer set is sufficient to answer the question in the dialogue information based on the following prompt words. The prompt words include:
[0100] Task: Your current task is to determine whether the current information is sufficient to answer the user's question. You will receive a set of candidate answers containing labels and atomic facts. Based on the current atomic facts, you will determine whether there is enough information to answer the user's question. Based on your judgment, you can choose from the following two operations:
[0101] #####
[0102] 1. If the judgment information is sufficient to answer the question, the candidate answer set is returned;
[0103] 2. If it is determined that the information is not enough to answer the question, the expanded node queue is returned and its node labels are explored again.
[0104] #####
[0105] Output:
[0106] Based on the operation you choose, the corresponding output content is returned (the output is determined by the selected operation. If the model determines that the information is sufficient, a set of candidate answers will be returned; if the model determines that it is insufficient, an expanded node queue will be returned).
[0107] ***
[0108] Optionally, because there are vague or incomplete questions in some dialogue information, in order to obtain the incomplete part of the question, the method of the present application also includes: extracting key tags in the dialogue information; if it is determined that the key tags are incomplete based on the matching results between the key tags and the candidate answer set, generating clarification questions based on the incomplete part of the key tags; obtaining the interaction information of the target object for the clarification question, and executing the dialogue method again based on the interaction information and the dialogue information.
[0109] Optionally, key tags include but are not limited to nouns (such as people, places, time, events, etc.), verbs (such as behaviors, actions, processes), adjectives (such as states, emotions, characteristics) and other elements in the dialogue information. The key tags include the core content of the questions in the dialogue information (such as subjects, actions, conditions, etc.), and after the key tags are extracted, the key tags are stored.
[0110] In one embodiment, after acquiring the dialogue information, the model can extract key tags according to the pre-stored prompt words. The specific prompt words can be:
[0111] ***
[0112] Definition: As a model with proactive clarification capabilities, your task is to extract key tags from user questions for analysis and matching in subsequent processing.
[0113] Task: You need to analyze the questions input by the user and extract the key tags. These tags usually include but are not limited to nouns (such as people, places, time, events, etc.), verbs (such as behavior, action, process), adjectives (such as state, emotion, characteristics) and other elements.
[0114] Require:
[0115] 1. Ensure that the extracted tags cover the core content of the question, such as the topics, actions, or conditions involved.
[0116] 2. Record the extracted labels and provide a basis for matching and reasoning in subsequent steps.
[0117] Output: The set of tags extracted from the question
[0118] ***
[0119] Optionally, the key tag completeness test includes:
[0120] A label set is generated according to the labels in the candidate answer set, and the label set includes all labels in the candidate answer set; the key label is compared with the label, and whether the key label is complete is detected according to the comparison result.
[0121] Optionally, the key indicator can be detected based on the comparison result to see whether it includes the necessary tags or information in the tag set (for example, "What awards has the author of this book won?" The extracted tags are: ["Book Title", "Author", "Awards"]. However, the specific book title is not provided, which is the part where the information is insufficient). If it is determined to be included, the key tag is determined to be complete; if it is determined not to be included, the key tag is determined to be incomplete. Specifically, the prompt words used to indicate whether the key tag is complete can be:
[0122] ***
[0123] Definition: After a user query, it is necessary to compare the key tags extracted from the conversation information with the candidate node tag set returned by the knowledge graph to determine whether necessary tags or information are missing, and thus decide whether further clarification is needed.
[0124] Task: You first need to receive the joint labels extracted from the dialogue information and compare them with the labels of the candidate nodes to identify missing labels or parts with insufficient information.
[0125] Requirement: Compare the labels extracted from the user query with the candidate node labels returned from the knowledge graph to identify missing or incomplete labels.
[0126] Output:
[0127] 1. Determine whether the label is complete and answer 'yes' or 'no'
[0128] 2. The set of tags extracted from the question
[0129] ***
[0130] Optionally, when it is determined that the key tag is incomplete, a tag matching analysis can be performed on the key tag and the tags in the tag set (matching the tags in the tag set with the key tags one by one), and the missing parts of the current information can be determined based on the matching results. For the missing tags or information, clarifying questions are generated based on the predetermined prompt words to guide the target object to supplement the specific content, thereby improving the completeness and accuracy of the query. In addition, a multi-round clarification mechanism can be executed. For queries that are still vague or incomplete, clarifying questions can be generated again, and multiple rounds of interaction can be performed with the target object to ensure the comprehensiveness of the query. Finally, after receiving the target object's feedback on the clarifying questions, the supplementary information is integrated into the dialogue information, and a new retrieval and reasoning process is triggered.
[0131] In one embodiment, the prompt words indicating the generation of a clarification question may be:
[0132] ***
[0133] Definition: When it is found that the label or information is incomplete, it will be based on the dialogue information and candidate nodes for step-by-step reasoning, and generate clarifying questions to guide the target object to supplement specific information. This process should have the ability to clarify multiple times to ensure the completeness and accuracy of the query content.
[0134] Task: You need to analyze the missing parts and generate clarifying questions based on the labels extracted from the dialogue information and candidate nodes. Ask specific counter-questions for the missing labels or information and guide the target object to provide a more detailed description. The system should have the ability to clarify multiple rounds to ensure that the questions are thoroughly understood and answered.
[0135] Require:
[0136] 1. Analyze missing parts of labels and information to determine what needs to be clarified.
[0137] 2. Based on chain thinking (CoT), gradually generate clarifying questions for missing labels or information.
[0138] 3. If the target object’s answer is still incomplete or vague, conduct multiple rounds of interaction until sufficient information is obtained.
[0139] 4. After obtaining the supplementary information of the target object, integrate the new set of labels and conduct a new retrieval and reasoning process. After confirming that the missing labels and information are supplemented, give a complete and accurate answer.
[0140] Output:
[0141] A rhetorical question about missing labels.
[0142] ***
[0143] Through the above prompt words, the model can generate clarifying questions and obtain feedback from the target object on the clarifying questions after determining that the key tags are incomplete, combine the feedback and dialogue information to obtain the complete question, and perform knowledge graph retrieval based on the question, thereby outputting more accurate response information.
[0144] The dialogue method of this application has the following advantages:
[0145] Cross-document reasoning ability: When dealing with long contexts, traditional RAG models often divide documents into multiple segments due to context length limitations. This method easily loses logical relationships across paragraphs. However, this application uses knowledge graphs combined with the GraphReader idea for multi-hop reasoning, which can perform deeper and more complex reasoning on interrelated information and capture more complex multi-step relationships. This significantly improves the weaknesses of traditional RAG models in that they cannot capture connections between documents in multiple documents or knowledge bases and lack cross-document reasoning, enabling the model to understand and utilize the relationships between documents, perform effective information integration and reasoning, and thus generate more accurate, coherent, and comprehensive answers.
[0146] Active clarification capability: When faced with ambiguous or incomplete queries, traditional RAG models usually generate answers passively and lack the ability to actively interact with the target object, which easily leads to ambiguous or erroneous results. This application is based on the active clarification capability of CoT (Chain-of-Thought) to analyze the query needs of the target object through step-by-step reasoning, clarify the existing information and missing parts (such as incomplete labels or entities), and then call LLM to generate clarifying questions for the missing information. After the target object supplements the information, the context and labels are dynamically updated, retrieval and reasoning are re-triggered, and accurate answers are finally generated. This mechanism effectively improves the accuracy and coverage of the answers by gradually decomposing the questions and completing the information.
[0147] Based on the same inventive concept, the embodiment of the present application provides an electronic device, such as Figure 6 As shown, Figure 6 The electronic device 2000 shown includes: a processor 2001 and a memory 2003. The processor 2001 and the memory 2003 are connected in communication with each other, for example, via a bus 2002.
[0148] Processor 2001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 2001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0149] The bus 2002 may include a path to transmit information between the above components. The bus 2002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 2002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0150] The memory 2003 can be a ROM (Read-Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (random access memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read-Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0151] Optionally, the electronic device 2000 may further include a communication unit 2004. The communication unit 2004 may be used for receiving and sending signals. The communication unit 2004 may allow the electronic device 2000 to communicate with other devices wirelessly or by wire to exchange data. It should be noted that in actual applications, the communication unit 2004 is not limited to one.
[0152] Optionally, the electronic device 2000 may further include an input unit 2005. The input unit 2005 may be used to receive input digital, character, image and / or sound information, or generate key signal input related to user settings and function control of the electronic device 2000. The input unit 2005 may include, but is not limited to, one or more of a touch screen, a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, a camera, a microphone, etc.
[0153] Optionally, the electronic device 2000 may further include an output unit 2006. The output unit 2006 may be used to output or display information processed by the processor 2001. The output unit 2006 may include but is not limited to one or more of a display device, a speaker, a vibration device, and the like.
[0154] Although the electronic device 2000 having various devices is shown in the figure, it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0155] Optionally, the memory 2003 is used to store a computer program for executing the solution of the present application, and the execution is controlled by the processor 2001. The processor 2001 is used to execute the computer program stored in the memory 2003 to implement the steps of any method provided in the embodiments of the present application.
[0156] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by an electronic device / processor, it implements the steps of any method provided in the present application / implements the steps of various optional implementation methods of the method provided in the present application.
[0157] Those skilled in the art will appreciate that the various operations, methods, steps, measures, and schemes in the processes discussed in this application may be alternated, changed, combined, or deleted. Furthermore, other steps, measures, and schemes in the various operations, methods, and processes discussed in this application may also be alternated, changed, rearranged, decomposed, combined, or deleted. Furthermore, steps, measures, and schemes in the related art that are similar to those disclosed in this application may also be alternated, changed, rearranged, decomposed, combined, or deleted.
[0158] In the description of the present application, the directions or positional relationships indicated by words such as "center", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside" are based on the exemplary directions or positional relationships shown in the accompanying drawings. They are for the convenience of describing or simplifying the description of the embodiments of the present application, and do not indicate or imply that the referred device or component must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be understood as limitations on the present application.
[0159] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0160] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0161] In the description of this specification, specific features, structures, materials or characteristics may be combined in an appropriate manner in any one or more embodiments or examples.
[0162] The above is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the scheme of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A conversation method, characterized in that: For the RAG model, the method comprises: Acquire the conversation information of the target object, and determine the initial node corresponding to the conversation information in the knowledge graph according to the correlation, wherein the knowledge graph is created by using a large language model, each node in the knowledge graph includes an atomic fact and multiple labels, and the relationship between the nodes is represented by the hierarchy of the labels; Generate a first node queue including the initial node, perform node label exploration according to the label in the first node queue, update the first node queue according to the exploration result, and generate a second node queue, wherein the explored node includes information related to the response to the dialogue information; A candidate answer set is generated according to the atomic facts in the second node queue, and response information corresponding to the dialog information is output based on the candidate answer set, wherein the candidate answer set includes labels and atomic facts related to the response information.
2. The dialogue method according to claim 1, characterized in that: The determining, according to the correlation, an initial node in the knowledge graph corresponding to the conversation information includes: Determining a relevance score for each node in the knowledge graph according to the relevance of each node, wherein the relevance includes a relevance score determined by the relevance of the node to the answer; The node with the highest correlation score is determined as the initial node.
3. The dialogue method according to claim 1, characterized in that: The performing node label exploration according to the label in the first node queue includes: Obtain a tag in the knowledge graph that meets a preset condition, where the preset condition is that the tag is associated with at least one tag in the first queue; If it is determined that the node corresponding to the tag includes information related to the response, the node is read and determined as the explored node.
4. The dialogue method according to claim 3, characterized in that: The obtaining of tags in the knowledge graph that meet preset conditions includes: Traverse the nodes in the first queue, obtain the level of each label in the node, and obtain the labels in the knowledge graph that meet the preset conditions based on the level and the label information.
5. The dialogue method according to claim 1, characterized in that: The step of generating a candidate answer set according to the atomic facts in the second node queue includes: Traversing the nodes in the second queue and reading the atomic facts of the nodes; If it is determined that the atomic fact can be used to answer the dialog message, the atomic fact and the label of the node are included in the candidate answer set.
6. The dialogue method according to claim 1, characterized in that: The outputting response information corresponding to the dialogue information based on the candidate answer set includes: Detecting whether the information included in the atomic facts in the candidate answer set can generate the response information; If yes, outputting response information according to the candidate answer set; If not, node label exploration and candidate answer set generation are performed based on the second node queue iteration.
7. The dialogue method according to claim 1, characterized in that: The method comprises: Extracting key tags from the conversation information; If it is determined that the key tag is incomplete based on the matching result between the key tag and the candidate answer set, generating a clarification question based on the incomplete part of the key tag; The target object's interaction information regarding the clarification question is obtained, and the knowledge graph retrieval is performed again based on the interaction information and the dialogue information.
8. The dialogue method according to claim 1, characterized in that: The detection of whether the key tags are complete includes: Generate a tag set according to the tags in the candidate answer set, wherein the tag set includes all tags in the candidate answer set; The key tag is compared with the tag, and whether the key tag is complete is detected according to the comparison result.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Financial document question and answer method and device based on label hierarchical knowledge graph
CN121614577A
Financial document question answering method and device based on label hierarchical knowledge graph
CN121614577B