Answer generation method and apparatus
By implementing multi-level partitioning management and applying a graph index structure to the database, the shortcomings of RAG technology in terms of data coverage and completeness are resolved, thereby improving the comprehensiveness and accuracy of the answers while ensuring user data privacy and adapting to complex tasks and cross-domain needs.
Patent Information
- Application Number
- PCT/CN2026/089542
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-05-09
- Filing Date
- 2026-04-09
- Publication Date
- 2026-11-12
AI Technical Summary
Existing search augmentation generation (RAG) techniques are lacking in data coverage and completeness, which limits their overall effectiveness and makes it difficult to achieve the expected optimal performance.
The Multi-Partition Cross-Domain Retrieval Enhanced Generation (MPCD-RAG) scheme is adopted. By managing the database through multi-level partitions and utilizing a graph index structure, information management across partitions and databases is achieved. Data retrieval and reasoning are performed by combining databases with different privacy levels to ensure data security and the comprehensiveness and accuracy of the answers.
It improves the comprehensiveness and accuracy of answers, especially when facing cross-domain tasks or accessing data from new domains, maintaining efficient and accurate performance while protecting user data privacy.
Smart Images

Figure CN2026089542_12112026_PF_FP_ABST
Abstract
Description
A method and apparatus for generating answers
[0001] This application claims priority to Chinese Patent Application No. 202510599612.5, filed on May 9, 2025, entitled “An Answer Generation Method and Apparatus”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of artificial intelligence (AI) technology, and in particular to a method and apparatus for generating answers. Background Technology
[0003] Currently, large language models (LLMs) exhibit impressive capabilities, but they also face challenges such as illusions, outdated knowledge, and opaque, untraceable reasoning processes. Retrieval-Augmented Generation (RAG) technology, by integrating knowledge from external databases, has emerged as a promising solution. As a paradigm, RAG introduces an initial retrieval step into the generation task, enabling LLMs to query external databases for relevant information, thereby guiding subsequent text generation. This process not only ensures that the generated content is firmly based on the retrieved "memory" but also significantly improves the performance of LLMs, attracting increasing research attention in recent years.
[0004] To achieve retrieval-enhanced generation techniques, the industry generally employs three approaches: Naive RAG, Advanced RAG, and Modular RAG. Naive RAG follows a standard indexing, retrieval, and generation process, but suffers from several problems in practical applications, such as low retrieval accuracy and susceptibility to illusions and redundancy within the generated content. Advanced RAG addresses the shortcomings of Naive RAG by: improving the quality of indexed content through optimized data embedding during the indexing stage; identifying appropriate context by calculating the similarity between the query and blocks (i.e., text fragments) during the retrieval stage, using techniques such as fine-tuning the embedding model or learning dynamic embeddings for different contexts; and merging the retrieved context with the query as input to the LLM during the generation stage, addressing the challenges posed by context window limitations by reordering the most relevant content or compressing hints. Modular RAG further enhances performance by introducing external modules; for example, Selfmem incorporates a retrieval-enhanced generator into its modules, iteratively creating a memory pool and training a selector to choose memories from the pool to generate responses.
[0005] Despite the many advantages of current RAG methods, such as overcoming data noise, improving the accuracy of generated results, and reducing runtime latency, the data retrieved still lacks coverage or completeness. This limits the overall effectiveness of RAG technology and makes it difficult to achieve the expected optimal performance. Summary of the Invention
[0006] This application provides an answer generation method, apparatus, computing device, computer-readable storage medium, and computer program product containing instructions, which can improve the coverage and completeness of retrieved data, thereby enhancing the overall effect of RAG technology.
[0007] In a first aspect, this application provides an answer generation method, comprising: receiving a query question from a user; performing a search in a first graph index structure related to a first database based on the query question to obtain at least one search path, wherein a node in the first graph index structure represents a partition in the first database, an edge between two nodes in the first graph index structure represents that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common question, and a search path contains at least one node in the first graph index structure; and performing reasoning based on the query question and the data in the partitions represented by each node on the at least one search path to obtain an answer related to the query question.
[0008] In this way, by managing the data in the database in multiple partitions and across partitions based on a specific graph index structure, the information in different partitions of the database can be fully utilized during the answer generation process, reducing the probability of loss or confusion of cross-partition information, thereby improving the comprehensiveness and accuracy of the answer.
[0009] In one possible implementation, before performing a search in the first graph index structure related to the first database based on the query question to obtain at least one search path, the method further includes: filtering the first database from multiple databases based on the query question, wherein the data in different databases have different privacy levels. This allows for filtering the database to be accessed from multiple databases before performing data retrieval, improving the accuracy of data retrieval.
[0010] In one possible implementation, multiple databases include a second database associated with a second graph index structure. A node in the second graph index structure represents a partition within the second database, and an edge between two nodes in the second graph index structure indicates that the data in the partitions represented by those two nodes involves at least one common problem. In this way, different databases can have different graph index structures, facilitating partitioning and cross-partition management and retrieval across different databases.
[0011] In one possible implementation, the privacy level of data in the first database is higher than that of data in the second database; the data in the first partition of the first database and the data in the second partition of the second database involve at least one common issue; the first node in the first graph index structure represents the first partition, and the second node in the second graph index structure represents the second partition; both the first and second nodes are configured as index access points to implement a unidirectional cross-graph index connection from the first node to the second node. This allows access from a database with a high data privacy level to a database with a low data privacy level, but not vice versa. This protects user privacy while efficiently providing personalized intelligent services across databases, and fully utilizes information from different partitions in different databases, reducing the probability of information loss or confusion across databases and partitions, thereby improving the comprehensiveness and accuracy of the answers.
[0012] In one possible implementation, at least one retrieval path includes: a first retrieval path, where nodes on the first retrieval path include a first node. The process of reasoning based on the query question and the data in the partitions represented by the nodes on the first retrieval path to obtain an answer related to the query question includes: retrieving data from the partitions represented by the nodes on the first retrieval path in a first database, based on the first retrieval path, to obtain a first data set; retrieving data from the partitions represented by the second node in a second database, and retrieving data from the partitions represented by nodes directly and indirectly connected to the second node in the second graph index structure, based on the first node, to obtain a second data set; and obtaining an answer related to the query question based on the query question, the first data set, and the second data set. This achieves the retrieval of data from a low-privacy-level database and the inference process combining data from a high-privacy-level database.
[0013] In one possible implementation, the method is applied to an edge device, where a first database resides on the edge device and a second database resides on a cloud device. This allows non-sensitive data to be deployed on the cloud while sensitive data remains on the edge, and ensures data security and efficiency by establishing an index access point between the edge and cloud data.
[0014] In one possible implementation, reasoning is performed based on the query question and the data in the partitions represented by each node on at least one retrieval path to obtain an answer relevant to the query question. This includes: filtering at least one retrieval path based on the query question to obtain a second retrieval path; and performing reasoning based on the data in the partitions represented by each node on the query question and the second retrieval path to obtain an answer relevant to the query question. In this way, the optimal or relatively optimal retrieval path can be selected from multiple retrieval paths, thereby improving the accuracy of subsequent data retrieval and ultimately enhancing the accuracy of the answer.
[0015] In one possible implementation, reasoning is performed based on the data in the partitions represented by the nodes on the second retrieval path to obtain an answer related to the query question. This includes: retrieving data from the partitions represented by the nodes on the second retrieval path from a first database to obtain a third data set; and obtaining an answer related to the query question based on the query question and the third data set. In this way, complete reasoning can be performed using the knowledge in the database to obtain an answer related to the query question.
[0016] In one possible implementation, the method further includes: receiving a data storage instruction from a user, wherein the data storage instruction indicates the storage of multiple knowledge principles used to answer the same question; adding each knowledge principle to a partition represented by a third node in the first graph index structure in a first database based on the similarity between each knowledge principle and a node in the first graph index structure; and constructing edges between multiple third nodes in the first graph index structure, wherein a third node is a node similar to a knowledge principle. This enables partitioned and cross-partition management of the data.
[0017] Secondly, this application provides an answer generation apparatus, comprising: a receiving module and a processing module. The receiving module is used to receive a query question from a user. The processing module is used to perform a search in a first graph index structure related to a first database based on the query question, obtaining at least one search path. In the first graph index structure, a node represents a partition in the first database, and an edge between two nodes in the first graph index structure indicates that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common question. A search path contains at least one node in the first graph index structure. The processing module is also used to perform reasoning based on the query question and the data in the partitions represented by the nodes on the at least one search path to obtain an answer related to the query question.
[0018] In one possible implementation, before the processing module performs a search in the first graph index structure associated with the first database based on the query question to obtain at least one search path, it is further configured to: filter the first database from multiple databases based on the query question, wherein the data in different databases have different privacy levels.
[0019] In one possible implementation, the multiple databases include a second database associated with a second graph index structure. A node in the second graph index structure represents a partition in the second database, and an edge between two nodes in the second graph index structure indicates that the data in the partitions represented by the two nodes in the second graph index structure involve at least a common problem.
[0020] In one possible implementation, the privacy level of data in the first database is higher than that of data in the second database; the data in the first partition of the first database and the data in the second partition of the second database involve at least one common issue; the first node in the first graph index structure is used to represent the first partition, and the second node in the second graph index structure is used to represent the second partition; wherein, both the first node and the second node are configured as index access points to implement a one-way cross-graph index connection from the first node to the second node.
[0021] In one possible implementation, at least one retrieval path includes: a first retrieval path, where nodes on the first retrieval path include a first node. Specifically, when the processing module performs reasoning based on the query question and the data in the partitions represented by the nodes on the first retrieval path to obtain an answer related to the query question, it performs the following: based on the first retrieval path, it retrieves data from the first database in the partitions represented by the nodes on the first retrieval path to obtain a first data set; based on the first node, it retrieves data from the second database in the partitions represented by the second node, and retrieves data from the partitions represented by nodes directly and indirectly connected to the second node in the second graph index structure to obtain a second data set; based on the query question, the first data set, and the second data set, it obtains an answer related to the query question.
[0022] In one possible implementation, the device is deployed on an edge device, wherein the first database is located on the edge device and the second database is located on the cloud device.
[0023] In one possible implementation, when the processing module performs reasoning based on the query question and the data set in the partitions represented by each node on at least one retrieval path to obtain an answer related to the query question, it specifically performs: path filtering on at least one retrieval path based on the query question to obtain a second retrieval path; and performs reasoning based on the data in the partitions represented by each node on the query question and the second retrieval path to obtain an answer related to the query question.
[0024] In one possible implementation, when the processing module performs reasoning based on the data in the partitions represented by each node on the second retrieval path to obtain an answer related to the query question, it specifically performs the following: based on the second retrieval path, it retrieves the data in the partitions represented by each node on the second retrieval path from the first database to obtain a third data set; and based on the query question and the third data set, it obtains an answer related to the query question.
[0025] In one possible implementation, the receiving module is further configured to receive a data storage instruction from a user, wherein the data storage instruction is configured to instruct the storage of multiple knowledge principles for answering the same question; the processing module is further configured to add each knowledge principle to a partition represented by a third node in the first graph index structure in the first database based on the similarity between each knowledge principle and a node in the first graph index structure, and to construct edges between multiple third nodes in the first graph index structure, wherein a third node is a node similar to a knowledge principle.
[0026] Thirdly, this application provides an answer generation apparatus, including at least one processor and an interface; the at least one processor acquires program instructions through the interface; the at least one processor is configured to execute program line instructions to implement the method described in the first aspect or any possible implementation of the first aspect. Exemplarily, the answer generation apparatus may be, but is not limited to, a chip.
[0027] Fourthly, this application provides a computing device, including at least one memory for storing a program; and at least one processor for calling the program stored in the memory to execute the method described in the first aspect or any possible implementation of the first aspect.
[0028] Fifthly, this application provides a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect or any possible implementation thereof.
[0029] In a sixth aspect, this application provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the method described in the first aspect or any possible implementation thereof.
[0030] It is understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0031] Figure 1 is a schematic diagram of the architecture of a database management device provided in an embodiment of this application;
[0032] Figure 2 is a flowchart illustrating an answer generation method provided in an embodiment of this application;
[0033] Figure 3 is a schematic diagram of a reasoning process based on a query question and a retrieval path provided in an embodiment of this application;
[0034] Figure 4 is a schematic diagram of another reasoning process based on query questions and retrieval paths provided in an embodiment of this application;
[0035] Figure 5 is a schematic diagram of an MPCD-RAG technology framework provided in an embodiment of this application;
[0036] Figure 6 is a schematic diagram of an MPCD index structure provided in an embodiment of this application;
[0037] Figure 7 is a schematic diagram of an edge-side intelligent agent solution designed to meet the needs of users accessing personal data and protecting privacy, according to an embodiment of this application.
[0038] Figure 8 is a schematic diagram of a meta-reinforcement learning training paradigm provided in an embodiment of this application;
[0039] Figure 9 is a schematic diagram of the usage process of a voice assistant on a mobile phone according to an embodiment of this application;
[0040] Figure 10 is a schematic diagram illustrating the user data categories based on the business characteristics of a voice assistant, according to an embodiment of this application.
[0041] Figure 11 is a schematic diagram of the training and inference process in a mobile phone voice assistant scenario provided in an embodiment of this application;
[0042] Figure 12 is a schematic diagram of the architecture of a fusion question-and-answer generation system based on the business needs of voice assistants in mobile phones and combined with the capabilities of this patent, provided in an embodiment of this application.
[0043] Figure 13 is a schematic diagram of the architecture of another integrated question-and-answer generation system based on the business needs of voice assistants in mobile phones and combined with the capabilities of this patent, provided in an embodiment of this application.
[0044] Figure 14 is a schematic diagram of the architecture of a fusion question-and-answer generation system based on the business needs of voice assistants in mobile phones and combined with the capabilities of this patent, provided in an embodiment of this application.
[0045] Figure 15 is a schematic diagram of an answer generation device provided in an embodiment of this application;
[0046] Figure 16 is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0047] Figure 17 is a schematic diagram of another answer generation device provided in an embodiment of this application. Detailed Implementation
[0048] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0049] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.
[0050] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0051] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processing units means two or more processing units, multiple elements means two or more elements, etc.
[0052] First, some of the technical terms involved in the embodiments of this application will be introduced.
[0053] (1) Agent
[0054] An agent is a software system that runs in a computer or network environment. It can autonomously perceive its operating environment (such as user input, system status, network data, etc.) and make decisions and execute corresponding operations through built-in logic or algorithms to complete specific tasks or achieve predetermined goals. It acts like an "intelligent software assistant," automatically adjusting its behavior according to environmental changes to meet user needs or optimize system performance. The agent can acquire environmental information, such as user input commands, system status data, and network traffic, through interfaces or data streams to perceive the environment. After perceiving the environment, the agent can determine its next step based on the acquired information, using preset rules, algorithms, or machine learning models—that is, making autonomous decisions. Then, the agent can execute decisions by generating output (such as displaying results, sending commands, adjusting settings, etc.) to achieve its function. All of the agent's actions are aimed at achieving specific goals, such as recommending products, optimizing resource allocation, and automatically answering questions.
[0055] (2) Markov decision process (MDP)
[0056] Mathematical Processing Principle (MPP) is a mathematical model in reinforcement learning (RL) used to describe the interaction between an agent and its environment. It provides a formal framework for agents to make decisions in stochastic environments, with the goal of maximizing cumulative reward by learning an optimal policy. Core concepts in MPP include environment, state, action, and reward.
[0057] The environment is the external system that interacts with the agent, defining the external world that the agent can perceive and the impact of its actions on that world. The environment receives the agent's actions as input and generates new states and rewards as outputs based on the current state and actions. It determines the probability distribution of state transitions and the allocation of rewards.
[0058] A state is a description of the environment at a given moment, containing all the information needed for an agent to make a decision. It can be discrete (such as the position of a piece in a board game) or continuous (such as the speed and position of an autonomous vehicle). The state is the basis for an agent's perception of the environment, and the agent selects actions based on the current state. Changes in state reflect the dynamics of the environment and follow the Markov property: future states depend only on the current state and the current action, and are independent of previous states.
[0059] An action is a behavior that an agent can take in a given state. The choice of action depends on the agent's policy, which is the rule for choosing actions given a state. Actions are the ways an agent influences its environment; by choosing different actions, the agent can change the state of the environment and obtain corresponding rewards. The set of actions is usually finite, but in some cases it can be continuous.
[0060] A reward is the feedback from the environment to an agent's behavior; it is a numerical signal representing the immediate reward an agent receives after taking a certain action in a given state. Rewards can be positive (representing gain or benefit), negative (representing punishment or loss), or zero. It is the learning objective of the agent, which uses reward signals to determine which behaviors are good (receiving high rewards) and which are bad (receiving low rewards or punishments).
[0061] The relationship between environment, state, action, and reward is as follows: the agent operates within the environment, selecting actions by perceiving the state of the environment; the environment generates new states and rewards based on the agent's actions and current state; the agent's goal is to maximize accumulated rewards by learning the optimal policy (i.e., selecting the optimal action in each state). This process is a dynamic interaction, where state, action, and reward jointly determine the agent's behavior and learning process.
[0062] The process of training an agent using MDP can be summarized as follows: a) Define MDP elements: Define the state space (the set of all possible states), action space (the set of actions that can be taken in each state), reward function (defining the immediate reward for each state-action pair), and state transition probabilities (the probability of transitioning from one state to another). b) Initialization: Set the initial policy (the rule that determines which action to choose in each state) and value function (estimating the long-term value of each state or state-action pair). c) Interaction and learning: The agent interacts with the environment, specifically: perceiving the current state; selecting an action based on the current policy; executing the action, with the environment providing feedback on the new state and immediate reward; updating the policy and value function based on the new state and reward. d) Policy optimization: Through iterative interaction and learning, the policy is gradually optimized to maximize the agent's cumulative reward. e) Convergence and evaluation: When the policy converges (i.e., the policy no longer changes significantly), training is stopped, and the agent's performance is evaluated in a test environment to verify its adaptability and effectiveness in the new environment.
[0063] (3) Reinforcement learning (RL)
[0064] Reinforcement learning is a machine learning method that learns to make optimal decisions by allowing an agent to learn through trial and error in an environment. It works based on Markov decision processes, where the agent chooses the action that maximizes cumulative reward given a state. The core elements of reinforcement learning include the agent, the environment, the state, the action, and the reward. In reinforcement learning, the agent first selects an action in the environment based on its current policy; then, the environment provides feedback with a reward and a new state; finally, the agent updates its policy based on this information to maximize cumulative reward. The goal of reinforcement learning is to find the optimal policy that maximizes the agent's gain in long-term interactions.
[0065] (4) Meta-Learning
[0066] Meta-learning is a machine learning method often understood as "learning to learn." It enables models to quickly adapt to new tasks by learning from multiple tasks, performing well even with limited data. The core of meta-learning lies in the "meta-knowledge" learned during the meta-training phase, allowing for rapid adaptation to new tasks during the meta-testing phase.
[0067] Meta-learning frameworks typically include the following two key stages:
[0068] Meta-training phase: The model is exposed to a series of different tasks, each with its own training and validation sets. The goal of the model is to learn general knowledge or strategies from these tasks so that it can quickly adapt to new tasks.
[0069] Meta-testing phase: The model faces a new task not seen during training. Through a small number of training steps on the support set of the new task, the model needs to quickly adjust its parameters to achieve good performance on the query set. This phase primarily evaluates the model's ability to quickly adapt to the new task using the knowledge learned in the meta-training phase.
[0070] In meta-learning, commonly used training methods include matching learning and contrastive learning. Matching learning is a metric-based meta-learning method. Its core is to learn a metric space, enabling the model to predict the category of a query sample by comparing the similarity between samples in the support set and the query sample. Cosine similarity or other distance metrics are typically used to calculate similarity, and the category label from the support set is passed to the query sample through a weighted average. Contrastive learning is a self-supervised learning method that aims to extract data representations by learning the similarities and differences between data points. By constructing positive sample pairs (samples from the same category) and negative sample pairs (samples from different categories) and training the model to bring positive sample pairs closer and push negative sample pairs further apart, contrastive learning helps the model learn the intrinsic structure and features of the data. In meta-learning, contrastive learning can be used to learn more robust feature representations, thereby improving the model's adaptability to new tasks.
[0071] (5) Meta-reinforcement learning (Meta-RL)
[0072] Meta-reinforcement learning is a cutting-edge learning paradigm that integrates the concepts of reinforcement learning and meta-learning. In reinforcement learning, an agent learns optimal behavioral strategies by interacting with the environment and based on reward signals; while meta-learning aims to teach the model how to learn quickly. Meta-reinforcement learning organically combines the two, and its core lies in the agent not only learning behavioral strategies in specific tasks, but also focusing on abstracting a "strategy of learning strategies" from learning experiences across multiple different tasks. That is, learning how to utilize previously accumulated knowledge and experience to quickly construct effective learning strategies in new and potentially significantly different task environments. Meta-reinforcement learning mainly consists of two key stages: meta-training and meta-testing. In the meta-training stage, the agent learns extensively on a diverse set of tasks. Through interaction with various task environments, it mines and extracts general knowledge structures, strategy patterns, or parameter settings, which constitute the agent's knowledge reserves for dealing with new tasks. When entering the meta-testing stage, facing a completely new task, the agent, using the knowledge acquired in the meta-training stage, only needs a minimal amount of interaction data with the new task environment to quickly adjust its internal state and rapidly construct an efficient strategy adapted to the new task. The main methods of meta-reinforcement learning include gradient-based meta-learning, recursive and memory-based meta-learning, and probabilistic inference-based meta-learning. Gradient-based meta-learning optimizes the initial parameters of the model, enabling it to quickly adapt to new tasks with a small number of gradient updates. Recursive and memory-based meta-learning utilizes recurrent neural networks or long short-term memory networks to store and process task information, allowing the agent to quickly adapt to new tasks using its stored experience. Probabilistic inference-based meta-learning treats the meta-learning problem as a probabilistic inference problem, learning the latent representation of the task to enable the model to transfer experience between different tasks and accelerate adaptation to new tasks.
[0073] (6) Depth-first search (DFS) algorithm
[0074] Depth-first search (DFS) is an algorithm used to traverse or search a tree or graph. Its basic idea is to start from a given starting node, explore as deep as possible along a path until it cannot continue, then backtrack to the previous node, choose another path, and continue the depth-first traversal until the entire graph has been traversed.
[0075] (7) Prompt
[0076] A Prompt is a text instruction used to guide a neural network model in generating specific content. Its core function is to provide the model with context and a task objective. To provide context, a Prompt helps the model understand the semantic environment of the input data by including relevant information or background. To specify the task objective, a Prompt tells the model the task to be performed through explicit instructions, such as "check for errors in the data and correct them" or "analyze trends in the data." This instruction guides the model to think and generate content in a specific direction.
[0077] (8) User Query
[0078] A user query is a request submitted by a user to a computer system, software application, database, or intelligent service, aiming to obtain information, perform an action, or solve a specific problem. It typically expresses the user's intent or needs through text, voice, or graphical interface interaction.
[0079] (9) Principles of Knowledge
[0080] Knowledge principles refer to the fundamental theories, laws, rules, and concepts in a specific field or discipline that have been systematically summarized and verified, capable of explaining phenomena, guiding practice, or deriving conclusions. They are a core component of a knowledge system, reflecting the essence and internal connections of things. In the process of problem-solving, knowledge principles are the sum of basic knowledge and core ideas such as theories, laws, concepts, formulas, and methods used; they serve as the theoretical basis and thinking tools for understanding and solving specific problems.
[0081] Next, the solutions provided in the embodiments of this application will be introduced.
[0082] Generally, in RAG technology, the database is typically treated as a whole when constructing the index structure. However, knowledge is essentially an internalized, structured, and semantic form of information, and its retrieval method should be closer to human cognitive and learning patterns. Human memory systems are usually divided by domain, with each domain further subdivided into multiple subcategories for partitioned management. For example, knowledge memory can be divided into major domains such as science, art, and history, while the science domain can be further subdivided into subcategories such as physics, chemistry, and biology. This classification method is similar to human semantic memory, that is, the memory of various organized knowledge, including concepts, theorems, formulas, and reasoning, which are formed through logical thinking processes and are inseparable from words. In RAG technology, if this hierarchical and categorized management method can be adopted, and the database is structured and divided according to domains and subdomains, it will be possible to more effectively support knowledge retrieval and generation tasks, improving the accuracy of retrieval and the relevance of generated content. Based on this concept, a multi-partition RAG (M-RAG) has emerged.
[0083] In M-RAG technology, the database is divided into multiple partitions, each serving as the basic unit for RAG execution. Fine-grained retrieval focuses on key memories, thereby optimizing the performance of the large model. M-RAG introduces two agents: a partition selection agent (Agent-S) and a memory optimization agent (Agent-R). Agent-S is responsible for selecting one partition from multiple partitions for retrieval, modeling the partition selection problem as a multi-armed slot machine problem, and optimizing the selection strategy through reinforcement learning. Agent-R generates candidate memories from the partitions selected by Agent-S and selects high-quality memories by evaluating the generated hypotheses. Through multi-agent reinforcement learning, M-RAG optimizes partition selection and memory optimization in the retrieval enhancement generation process, improving not only retrieval efficiency and accuracy but also significantly enhancing the quality of the generated text.
[0084] As described in the M-RGA technique description, this technique is based on a multi-knowledge partitioning setup, treating each partition as an independent retrieval entity rather than searching the entire database. The core of this technique lies in the effective management and retrieval of knowledge across multiple partitions and domains, thereby improving the comprehensiveness and accuracy of the answers. However, this technique cannot effectively handle noise interference in domain and partition retrieval, resulting in lower quality generated answers. Specifically, if M-RAG only considers multi-partition management and ignores multi-domain management, the system will not be able to effectively adapt to the needs of different domains, potentially leading to the loss or confusion of cross-domain information, thus reducing the model's processing capacity and accuracy in complex tasks.
[0085] In view of this, this application provides a multi-partition cross-domain retrieval-augmented generation (MPCD-RAG) scheme. By performing multi-partition cross-domain knowledge management on the data in the database, it significantly improves the accuracy and adaptability of task execution. Especially when facing cross-domain tasks or accessing data from new domains, including supporting users' private domain data, it can still maintain high efficiency and accuracy, realize RAG generalization capability, and protect user data privacy while improving the accuracy of multi-domain questions.
[0086] For example, Figure 1 shows a schematic diagram of the architecture of a database management device provided in an embodiment of this application. As shown in Figure 1, the database management device 110 can be deployed on a computing device 10, which can be a cloud-side device or an edge-side device. Cloud-side devices refer to computing resources running in a cloud environment, mainly used for processing large-scale data, providing services, and storing data. These devices include: physical servers, virtualization devices (such as virtual machines or containers), or cloud servers, etc. Edge-side devices refer to computing devices located close to users or data sources. These devices include: mobile phones, tablets, laptops, wearable devices, in-vehicle devices, or smart home devices, etc. Of course, the technology device 10 can also be other types of devices such as edge computing devices, depending on the actual situation, and is not limited here.
[0087] In this example, computing device 10 may include processor 121, and memory 122 and network interface 123 communicatively connected to processor 121. Processor 121 is the control center of computing device 10. Processor 121 may be a central processing unit (CPU), graphics processing unit (GPU), data processing unit (DPU), neural processing unit (NPU), etc., but is not limited to these. Memory 122 may be RAM, such as random access memory (RAM), used to store instructions or data that processor 121 may access multiple times. Memory 122 may also be persistent storage, such as a disk, hard disk, optical disk, register, read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), non-volatile RAM (NVRAM), etc. The memory 122 can also be used to store programs related to this embodiment. The network interface 123 may optionally include a standard wired interface, a wireless interface (including but not limited to Wi-Fi, mobile communication interfaces, etc.), etc., for data transmission and reception under the control of the processor 121. It should be understood that the device structure shown in FIG1 does not constitute a limitation on the computing device 10, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0088] Referring again to Figure 1, the database management device 110 is mainly used to construct the graph index structure for each database. For example, the graph index structure constructed by the database management device 110 can also be called a "multi-partition cross-domain (MPCD) index structure". The database management device 110 may include: a multi-level partitioning module 111, a partition vector index construction module 112, and an edge construction module 113 between vector indexes.
[0089] The multi-level partitioning module 111 is primarily used for multi-level partitioning of the database, dividing it into multiple partitions at different levels. In this embodiment, the database can adopt a multi-level partitioning architecture, with a first-level partition serving as the basic unit of division, covering different data ranges, business types, or domains. Within each first-level partition, multiple second-level sub-partitions are set according to more detailed division criteria (such as data type, business scope, time range, etc.). These second-level sub-partitions further refine the data classification, facilitating refined data management and efficient retrieval. This partitioning strategy is recursive; that is, within each second-level sub-partition, multiple third-level sub-partitions, or even more levels of sub-partitions, can be set according to more detailed division criteria. For example, the deepest level partition can be called the "basic partition," meaning the most granular partition in the database. For example, the basic partition can also be called a "partition."
[0090] The partition vector index building module 112 is mainly used to generate a comprehensive vector for the data in each basic partition of the database using aggregation vectorization methods (such as average pooling, max pooling or feature fusion), and build a vector index for the corresponding basic partition based on the vector.
[0091] The edge construction module 113 between vector indices is mainly used to analyze the knowledge involved in the existing question-and-answer database in order to construct edges between the vector indices of the constructed partitions. The question-and-answer database is a collection mainly containing questions, answers, and the knowledge principles (or "knowledge points") used to answer the questions. Of course, the question-and-answer database can also contain at least the knowledge principles used to answer each question, depending on the actual situation, and is not limited here. For example, a "question-answer-knowledge principle" can be: Question: Game A and Game B are both multiplayer competitive games, so does Game A infringe on Game B? Answer: No; Knowledge principle used: The competitive game rules are "xx" + the infringement law is "xx"; In this "question-answer-knowledge principle", the competitive game rules and the infringement law are the knowledge principles used. When multiple knowledge points are used to answer a question, and these knowledge points are located in different partitions of the database, an edge can be constructed between the vector indices of the partitions where these knowledge points are located. In this way, a graph index structure of the database can be constructed. For example, for database 1, the graph index structure of database 1 shown in Figure 1 can be constructed through the database management device 110. In the graph index structure of database 1, a node (e.g., node K1 or K2) represents a vector index of a partition, or in other words, a node can be used to represent a partition in the database. An edge between two nodes indicates that the data in the partitions represented by those two nodes involves at least one common problem. For example, edge K3 between nodes K1 and K2 indicates that the data in the partitions represented by nodes K1 and K2 involve at least one common problem. Exemplarily, in constructing an edge between two nodes, weights can be assigned to the edge based on the number of common problems involved in the data in the partitions represented by the two nodes, thus distinguishing the strength of the association. In this graph index structure, by organizing and managing the data in the database through multi-level partitioning, a multi-level, graph-organized multi-vector index structure is formed. When knowledge in different partitions has a relationship, this relationship can be reflected in the index structure. In this way, one or more desired partitions can be retrieved in a single search, thereby improving retrieval efficiency. For example, referring to Figure 1, when performing a search in the graph index structure of database 1, when node K1 is retrieved, node K2 can be retrieved through the edge connected to node K1. Thus, it can be known that data retrieval needs to be performed from the partitions managed by nodes K1 and K2, and the noise interference between the two partitions can be reduced, making the organization and extraction of cross-partition information more efficient and accurate.
[0092] When there are multiple databases, if the data in these databases has the same privacy level, and a problem involves multiple partitions (i.e., the knowledge points used to solve a problem are multiple and located in different partitions), and these partitions belong to different databases, the graph index structures of these databases can be connected. For example, continuing to refer to Figure 1, the data in database 1 and database N have the same privacy level, and a problem involves the partition represented by node K1 and the partition represented by node K4. In this case, an edge K5 can be established across the graph between nodes K1 and K4. In this way, when it is determined that a search should be performed on the partition represented by nodes K1 or K2, edge K5 can be used to determine across the databases that a search should also be performed on the partitions represented by nodes K4 and K6, thereby achieving cross-database and cross-partition data retrieval and reducing noise interference between different databases and different partitions. Of course, in addition to directly connecting different graph index structures, corresponding nodes in the graph index structures of these databases can also be configured as index access points to achieve cross-graph index connections. For example, continuing to refer to Figure 1, the privacy level of the data in database 1 and database N is the same. One problem involves the partition represented by node K1 and the partition represented by node K4. In this case, both node K1 and node K4 can be configured as index access points, and node K4 can be indexed through node K1, while node K1 can be indexed through node K4.
[0093] When there are multiple databases with varying privacy levels, and a problem involves multiple partitions belonging to different databases, corresponding nodes in the graph index structures of these databases can be configured as index access points to enable cross-graph index connections. Under such a graph index structure, to prevent data privacy leaks, the index access point can only index from the graph index structure of a database with a higher privacy level to the graph index structure of a database with a lower privacy level; that is, the function of the index access point is a one-way cross-graph index connection. In this case, the graph index structures of different databases can be built on different computing devices. For example, when the data in the database is user's personal data, the graph index structure can be built on the user's personal device; when the data in the database is public knowledge data, the graph index structure can be built on cloud services.
[0094] After constructing the graph index structure of the database, the database management device 110 can store the graph index structure in the memory 122 of the computing device 10. Alternatively, the graph index structure can be stored in other devices or locations, depending on the specific circumstances; no limitation is made here. It should be noted that in practical applications, the database management device 110 shown in Figure 1 can be implemented through software, hardware, or a combination of both, depending on the specific circumstances; no limitation is made here.
[0095] After constructing the graph index structure of the database, the constructed graph index structure can be used for reasoning using RAG technology. The following describes an answer generation method provided by an embodiment of this application.
[0096] For example, Figure 2 shows a flowchart of an answer generation method provided in an embodiment of this application. It is understood that this method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. For example, this method can be executed by an answer generation device, which can be implemented by software and / or hardware, and can be, but is not limited to, configured in an electronic device or server. For ease of description, the answer generation method will be described below with a computing device as the execution subject. As shown in Figure 2, the answer generation method may include the following steps:
[0097] S201, Receive a query from the user.
[0098] In this embodiment, a query question refers to an inquiry or request made by a user to a computing device in natural language, aiming to obtain specific information, answers, or solutions to satisfy their cognitive or operational needs regarding a particular topic or situation. After the user enters the query question on the computing device and issues an answer command, the computing device can receive the query question.
[0099] S202. Based on the query problem, perform a search in the first graph index structure related to the first database to obtain at least one search path. In this path, a node in the first graph index structure represents a partition in the first database, and the edge between two nodes in the first graph index structure represents that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common problem. A search path contains at least one node in the first graph index structure.
[0100] In this embodiment, the first graph index structure of the first database is constructed using a computing device or other device and the index construction process described in Figure 1. After the first graph index structure is constructed, a node in the first graph index structure can be used to represent a partition in the first database. An edge between two nodes in the first graph index structure can be used to indicate that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common problem.
[0101] Furthermore, after obtaining the query question, the computing device can input the query question into a pre-trained neural network model, so that the neural network model can perform a retrieval in the first graph index structure to obtain at least one retrieval path. Each retrieval path must contain at least one node from the first graph index structure. For example, continuing to refer to Figure 1, when performing a retrieval in the graph index structure of database 1, the obtained retrieval path could be "node K2 → node K1".
[0102] S203. Based on the query question and the data in the partitions represented by each node on at least one retrieval path, reason to obtain an answer related to the query question.
[0103] In this embodiment, after obtaining the retrieval path, the computing device can retrieve data from the partitions represented by each node on the retrieval path in the first database through the mapping relationship between the nodes on the retrieval path and the partitions in the first database, thus obtaining a first data set. Then, based on the query question, the computing device can use RAG technology in the first data set to obtain key data (or "key knowledge") related to the query question. Finally, the computing device can input the query question and key knowledge into a neural network model such as a large model for reasoning to obtain an answer related to the query question.
[0104] As one possible implementation, the computing device can first perform path filtering based on the query question, for example, by processing the query question and the search path using a neural network model, to obtain an optimal or relatively optimal second search path. The data in the partitions represented by the nodes on the second search path is the most suitable or relatively suitable foundational data for retrieving key data related to the query question. In some embodiments, the retrieval algorithm used in S202 may differ from the algorithm used to filter the second search path. For example, a reinforcement learning algorithm may be used for retrieval in S202, while a classifier may be used when filtering the second search path. The retrieval in S202 can be understood, but is not limited to, as a coarse screening, while the process of filtering the second search path can be understood, but is not limited to, as a precise screening. This combination of "coarse screening + fine screening" can significantly improve path filtering efficiency because this staged screening method can fully utilize the advantages of different stages, gradually narrowing the data range while reducing unnecessary waste of computing resources.
[0105] Then, the computing device performs inference on the data in the partitions represented by each node on the second retrieval path based on the query question to obtain an answer related to the query question. Specifically, as shown in Figure 3, in S301, the computing device can obtain data in the partitions represented by each node on the second retrieval path from the first database based on the second retrieval path to obtain a third data set. Since there is a mapping relationship between the nodes on the retrieval path and the partitions in the database, after knowing the nodes on the retrieval path, data in the corresponding partitions can be obtained from the database to obtain the third data set. In S302, the computing device can perform knowledge filtering in the third data set based on the query question, for example, by filtering using algorithms such as cosine similarity and clustering, to obtain second knowledge points related to the query question. In S303, a second prompt word is generated based on the query question and the second knowledge point. For example, the query question and the second knowledge point can be added to a preset prompt word template to obtain a second prompt word. Finally, in S304, the computing device can input the second prompt word into the large model to obtain an answer related to the query question. For example, S302 to S304 can be understood, but are not limited to, as “obtaining an answer related to the query question based on the query question and a third data set”.
[0106] In this way, by managing the data in the database in multiple partitions and across partitions based on a specific graph index structure, the information in different partitions of the database can be fully utilized during the answer generation process, reducing the probability of loss or confusion of cross-partition information, thereby improving the comprehensiveness and accuracy of the answer.
[0107] In some embodiments, when there are multiple databases, before S202, the computing device can first filter out a first database from the multiple databases based on the query question. For example, the computing device can process the query question using a pre-trained classifier to determine which database to retrieve from. When the multiple databases include a second database, the second database can be associated with a second graph index structure. A node in the second graph index structure represents a partition in the second database, and an edge between two nodes in the second graph index structure indicates that the data in the partitions represented by the two nodes in the second graph index structure involve at least one common question.
[0108] Furthermore, the privacy level of data in the first database can be higher than that of data in the second database. In this case, the data in the first partition of the first database and the data in the second partition of the second database involve at least one common issue, and the first node in the first graph index structure represents the first partition, while the second node in the second graph index structure represents the second partition. Both the first and second nodes can be configured as index access points to implement a one-way cross-graph index connection from the first node to the second node; that is, an index can be placed from the first node to the second node, but not from the second node to the first node, thereby protecting data privacy.
[0109] Furthermore, the retrieval path obtained in S202 may include a first retrieval path, and the nodes on the first retrieval path may include first nodes. In this case, in the aforementioned S203, when it is necessary to perform reasoning based on the query question and the data in the partitions represented by each node on the first retrieval path to obtain an answer related to the query question, as shown in Figure 4, in S401, the computing device, based on the first retrieval path, retrieves the data in the partitions represented by each node on the first retrieval path from the first database to obtain a first data set. Since there is a mapping relationship between the nodes on the first retrieval path and the partitions in the first database, after knowing the nodes on the first retrieval path, the data in the corresponding partitions can be retrieved from the first database to obtain the first data set.
[0110] In S402, the computing device, based on the first node, retrieves data from the partition represented by the second node in the second database, and also retrieves data from the partition represented by nodes directly and indirectly connected to the second node in the second graph index structure, to obtain a second data set. Since the first node in the first graph index structure can be indexed to the second node in the second graph index structure, the computing device can know the second node from the first node, and then retrieve data from the partition represented by the second node in the second database through the mapping relationship between the second node and the partitions in the second database. In the second graph index structure, the nodes directly or indirectly connected to the second node can be known through the second node, and then data from the partitions represented by these nodes can be retrieved horizontally and vertically from the second database to obtain the second data set. For example, when the first database and the second database are stored on different devices, such as the first database located on an edge device and the second database located on a cloud device, since the privacy level of the data in the first database is higher than that of the data in the second database, the computing device in this method can be understood as an edge device. Furthermore, when acquiring the second data set, the edge device can send a data acquisition request to the cloud device. This request may include the identifier of the second node. Upon receiving the data acquisition request from the edge device, the cloud device can retrieve the second data set from the second database through the mapping relationship between the second node and the partitions in the second database, as well as through the mapping relationship between nodes directly or indirectly connected to the second node in the second graph index structure and the partitions in the second database. This second data set is then transmitted to the edge device. In this way, by managing the database through multiple partitions and across partitions, it supports the access and storage of user private domain data on the edge, while storing non-sensitive data in the cloud. This achieves edge-cloud collaborative intelligent agent capabilities, ensuring data privacy while fully leveraging the advantages of cloud computing and storage, thus providing an efficient and secure intelligent solution.
[0111] In S403, the computing device filters knowledge from a first data set and a second data set based on the query question to obtain a first knowledge point related to the query question. In S404, a first prompt word is generated based on the query question and the first knowledge point. In S405, the first prompt word is input into the large model to obtain an answer related to the query question. For example, S403 to S405 can be understood, but is not limited to, as "obtaining an answer related to the query question based on the query question, the first data set, and the second data set." Furthermore, for S403 to S405, please refer to the description of S302 to S304 above; they will not be repeated here.
[0112] In some embodiments, when a computing device receives a data storage instruction from a user, if the instruction indicates the storage of multiple knowledge principles used to answer the same question, the computing device can, based on the similarity between each knowledge principle and nodes in a first graph index structure associated with the first database (e.g., by calculating similarity using cosine similarity algorithms), add each knowledge principle to the partitions represented by third nodes in the first graph index structure, and construct edges between multiple third nodes in the first graph index structure. Here, a third node is a node similar to a knowledge principle.
[0113] In some embodiments, based on the graph index structure described above, this application provides a multi-partition cross-domain retrieval-augmented generation (MPCD-RAG) scheme. By combining multi-partition cross-domain knowledge management, enhanced intelligent agents, and meta-learning mechanisms, a highly efficient RAG retrieval and generation system is created. This system can significantly improve the accuracy and adaptability of task execution, especially when facing cross-domain tasks or accessing data from new domains. It also maintains high efficiency and accuracy, including support for users' private domain data, and achieves RAG generalization capabilities. Furthermore, it improves the accuracy of multi-domain questions while protecting user data privacy.
[0114] For example, Figure 5 shows a schematic diagram of an MPCD-RAG technology framework provided in an embodiment of this application. As shown in Figure 5, the MPCD-RAG technology framework mainly includes: a multi-partition cross-domain (MPCD) index structure, a retrieval agent, and a generation agent.
[0115] The MPCD index structure is an index structure that represents data in a database in the form of a grid graph, which can be the graph index structure described in Figure 1 above. In some embodiments, the knowledge in the database can be organized and managed according to domains and their subclasses in the MPCD index structure, and semantic relationships between domains can be represented by establishing cross-partition connections in the graph structure. For example, the process of constructing an MPCD index structure can be as follows: 1) Domain construction: Define the domain scope covered by the knowledge system (such as science, art, history, etc.) according to business characteristics to lay the overall framework for the knowledge retrieval system. 2) Partition construction: Further partition the data within each domain, using methods such as vector index partitioning, clustering, locality-sensitive hashing, or attribute label partitioning, and optimize the partitioning strategy and number through experiments to achieve refined management of knowledge within the domain. 3) Relationship (edge) construction: Based on cross-domain question-and-answer data analysis, when knowledge involves multiple domains, semantic relationships between domains can be represented by establishing cross-partition connections in the graph structure, thereby supporting cross-domain knowledge association and retrieval. The edges can be assigned corresponding weights based on the common frequency of related domains to distinguish the strength of the association. For example, Figure 6 illustrates an MPCD index structure, which is divided into domains such as games, mathematics, and law, and each domain is further divided into four partitions: P1, P2, P3, and P4. The datasets in partition P2 of the games domain and the datasets in partition P3 of the law domain share a common issue: they are related. Therefore, there can be an edge 63 between node 61 in partition P2 of the games domain and node 62 in partition P3 of the law domain. To facilitate understanding of the MPCD index structure, it is compared with the graph-based retrieval-augmented generation (GraphRAG) index structure. The specific differences are shown in Table 1. As can be seen from Table 1, in the MPCD index structure, the index structure is a graph-organized vector index. The nodes in the graph are defined as vector indexes of a basic partition in the database, and the edges are defined as the relationships between two indexes.
[0116] Table 1
[0117] In the MPCD index structure, knowledge in the database is organized and managed according to domains and their subclasses, forming a multi-level, graph-organized, multi-vector index structure. When knowledge within different domain subclasses has relationships, these relationships are reflected in the index structure. Knowledge within each domain and its subclasses in the database is effectively partitioned and managed through a graph structure. This structure not only makes the data in each partition more semantically related but also improves data retrieval efficiency. The MPCD index structure can solve the noise interference problem in traditional retrieval methods and, through partitioning, makes the organization and extraction of cross-domain information more efficient and accurate.
[0118] The retrieval agent is primarily responsible for efficiently retrieving the required information from the MPCD index structure. It can, but is not limited to, discover key memories within the MPCD index structure using a depth-first search algorithm and locate the most relevant subset of data based on task requirements. Specifically, the retrieval agent can, but is not limited to, retrieve one or more candidate memories from the MPCD index structure based on user queries. Since the MPCD index structure can contain cross-partition connections, the agent can discover candidate memories in multiple different partitions through a single retrieval path (or "decision path," "memory path," etc.). This retrieval method allows the retrieval agent to quickly pinpoint the target domain and effectively reduce retrieval latency when faced with complex queries. This process is optimized through reinforcement learning, enabling the retrieval agent to continuously improve its accuracy and efficiency as training progresses. For example, the retrieval results output by the retrieval agent can, but are not limited to, one or more retrieval paths retrieved from the MPCD index structure. Each retrieval path contains at least one node from the MPCD index structure. For example, referring to Figure 6, "node 61—node 62" can serve as a retrieval path. When node 61 is retrieved, node 62 can be directly retrieved via the edge between node 61 and node 62, significantly reducing retrieval latency. Furthermore, since nodes 61 and 62 in Figure 6 represent data sets from different partitions, effective management and retrieval of data across multiple partitions and domains are achieved, thereby improving the comprehensiveness and accuracy of the answers and effectively addressing noise interference in retrieval across different partitions, resulting in higher-quality answers. In addition, this retrieval method can fully utilize specific information from different partitions in different databases, improving the accuracy of data retrieval and thus influencing the relevance and diversity of the generated answers, while avoiding the loss or confusion of cross-partition information. Referring to Figure 5, the retrieval path output by the retrieval agent can, but is not limited to, serving as the environment required for generating the agent.
[0119] The generative agent is primarily responsible for selecting appropriate paths for processing during the generation task, based on the memories retrieved by the retrieval agent. This allows it to filter key memories from candidate memories, providing crucial information for the text generation process. The generative agent can leverage meta-learning mechanisms to extract path selection strategies from existing task data and can quickly adapt to the incorporation of new domain data. With this capability, it can efficiently and accurately generate target text when facing unknown domains or tasks, ensuring that the generated results are both personalized and highly adapted to the target. For example, referring to Figure 5, the generative agent can select an optimal or relatively optimal retrieval path from multiple retrieval paths retrieved by the retrieval agent, and then filter data relevant to the user's query from the data sets represented by each node on the selected retrieval path. Furthermore, the user's query and the data selected by the generative agent can be added to a prompt word template to obtain prompt words. Finally, the prompt words can be input into a large model for inference to obtain an answer (or "response") relevant to the user's query.
[0120] In the above MPCD-RAG technical framework, the MPCD index structure can be extended to allow for separate management of user private data to avoid privacy leaks and improve data security. In order to effectively protect user privacy in the terminal scenario and solve the balance between data privacy and intelligent services, it is possible to ensure that the user's sensitive data is processed locally and avoid unnecessary external data transmission, thereby protecting the security of user privacy. At the same time, it is also necessary to provide efficient generation solutions across multiple domains or partitions, so as to achieve personalized services and intelligent decision-making while ensuring privacy protection, and meet the dual requirements of security and service quality. Considering these aspects, as shown in Figure 7, for the user's access to personal data and protection of privacy, an innovative terminal intelligent agent solution can be designed to provide personalized intelligent services while protecting user privacy on the terminal. The core technologies include: (1) Terminal cloud map management: deploy non-sensitive data on the cloud side, retain sensitive data on the terminal side, and ensure data security and efficiency by establishing an index access point between terminal and cloud data. This terminal cloud map can be understood as another form of the aforementioned MPCD index structure. In this form, there can be an MPCD index structure related to non-sensitive data on the cloud side and an MPCD index structure related to sensitive data on the endpoint side. When a data set in a certain partition on the endpoint side and a data set in a certain partition on the cloud side involve a common problem, the nodes in the MPCD index nodes on the cloud side that are related to these data sets can be configured as index access points, and the nodes in the MPCD index nodes on the endpoint side that are related to these data sets can also be configured as index access points to achieve a one-way cross-graph index connection from the endpoint side to the cloud side. That is, the endpoint side can retrieve data from the cloud side, but the cloud side cannot retrieve data from the endpoint side. For example, the data sets represented by node 1 in the MPCD index structure on the endpoint side and node 11 in the MPCD index structure on the cloud side in Figure 7 involve a common problem. Therefore, these two nodes can be configured as index access points. (2) Problem domain identification: On the endpoint side, the user's dependence on the endpoint side or cloud side data is determined according to the characteristics of the user query to ensure effective search in the corresponding domain and selective retrieval of cloud side data to optimize the problem solution path. (3) Miniaturized edge model capability: To support the capabilities of personalized intelligent agents, miniaturized models are deployed on the edge, thereby providing fast and accurate intelligent services on the edge. Through this design, it is possible to efficiently provide cross-domain personalized intelligent services while protecting user privacy.
[0121] As described above regarding the MPCD-RAG technical framework, this architecture utilizes a graph index structure built for multi-partition, multi-domain data to support privacy domain knowledge access and index structure updates, ensuring effective data retrieval and meeting diverse user needs. Furthermore, by combining retrieval and generation agents, key memories can be quickly and accurately discovered from the database. This allows for a significant improvement in the generalization efficiency of large models across multi-domain environments through prompts containing these key memories.
[0122] In the aforementioned MPCD-RAG technical framework, to improve the application performance of large models in question answering across different domains and address the issue of insufficient generalization ability of large models in cross-domain tasks, the discovery of key memory points and the selection of decision paths can be optimized to enable large models to adapt more efficiently to new task requirements in changing domain environments. Especially when facing complex cross-domain problems, this significantly improves the knowledge transfer ability of large models across different domains, enabling them to generate more accurate and rapid answers that conform to the context, thereby enhancing the intelligence and practicality of the question answering system. Specifically, as shown in Figure 8, a novel meta-reinforcement learning training paradigm can be used, combining reinforcement learning and graph search techniques to discover key memory points and optimize decision paths. Simultaneously, by integrating the meta-learning framework and the prompt word context optimization mechanism, the problem-solving ability of large models in multi-domain environments is improved, and their generalization performance is significantly enhanced. This paradigm endows the model with the ability to "learn to learn," enabling it to quickly adapt to task requirements in new domains and providing strong support for intelligent decision-making and multi-domain task processing in complex environments. Specifically, to achieve effective training of the retrieval agent, a reinforcement learning-based training mechanism is designed, which includes the following three core components:
[0123] (1) Grid graph search (environment modeling): By using a graph-based path search algorithm, a training environment for the retrieval agent is constructed, enabling it to adaptively select relevant knowledge nodes in the knowledge grid according to a given problem and optimize the knowledge retrieval path.
[0124] (2) MDP modeling (state, action and reward): MDP modeling is performed on the knowledge selection process. The design includes the observation state with knowledge node features, the set of actions for selecting knowledge points, and the reward function for the task completion effect, to ensure that the decision-making process of the retrieval agent has a clear mathematical description.
[0125] (3) Policy gradient training (optimization mechanism): The decision-making ability of the reinforcement learning retrieval agent is optimized by using the policy gradient method. It is trained to select the most relevant knowledge points on the grid graph accurately and efficiently according to the given problem, thereby improving the overall effect of task completion.
[0126] To achieve rapid adaptation of the generated intelligent agent, a training mechanism based on meta-learning can be designed, which includes the following three stages:
[0127] (1) Training phase: Through the meta-learning framework, learn an initial model with strong adaptability (adapted model) so that it can quickly adapt to new data or new models, laying the foundation for subsequent tasks.
[0128] (2) Small sample fine-tuning stage: Rapid fine-tuning is performed on a partial validation set of the test data, and the model parameters are further optimized using a small number of samples to enhance its performance on new tasks.
[0129] (3) Testing phase: Evaluate the performance of the fine-tuned model on the complete test dataset to verify its adaptability and task performance.
[0130] The following section introduces the specific implementation process of the MPCD-RAG technical framework.
[0131] Before using the MPCD-RAG framework for retrieval augmentation, the retrieval agent and the generation agent within the framework need to be trained. After training the retrieval agent and the generation agent, the MPCD-RAG technique can be used for retrieval augmentation. The basic workflow of the MPCD-RAG framework in the training preparation phase and the inference usage phase is described below.
[0132] (I) Training Phase Process:
[0133] (1) Data preparation
[0134] In this step, the database and its partitions required for training will be constructed. Specifically, the data in the database can be divided into two types: user personal data and publicly available external knowledge data. Both types of data can be selected, or only one can be selected, depending on the actual situation; no limitation is made here. When selecting one type of data, multi-level partitioning can be performed on the selected type of data to flexibly adapt to different data management needs and ensure efficient data storage and retrieval. Simultaneously, following the MPCD index structure construction method described above, an MPCD index structure without edges is constructed. When both user personal data and publicly available external knowledge data are selected simultaneously, multi-level partitioning can be performed within each type of data, and the two types of data are isolated to ensure data independence. Also, following the MPCD index structure construction method described above, two MPCD index structures without edges are constructed: one MPCD index structure for user personal data and the other for publicly available external knowledge data.
[0135] Additionally, this step involves analyzing the existing question-and-answer database to identify the knowledge points involved in each question. When a question involves multiple different knowledge points, relationships between these knowledge points can be established within database partitions to obtain an MPCD index structure that includes both nodes and edges. When multiple knowledge points involved in a question reside in different partitions of the database, cross-partition knowledge can be established through this operation. Furthermore, when a question involves multiple knowledge points, and some of these knowledge points belong to user personal data while others belong to publicly available external knowledge data, index access points between the user personal data and the publicly available external knowledge data can be constructed at the corresponding knowledge points in the MPCD index structure corresponding to the user personal data. For example, if question A involves knowledge points 1 and 2, and knowledge point 1 belongs to user personal data while knowledge point 2 belongs to publicly available external knowledge data, an access point for the vector index of knowledge point 2 can be added to the vector index point of knowledge point 1 in the MPCD index structure corresponding to the user personal data. This allows knowledge point 2 to be retrieved from the publicly available external knowledge data when knowledge point 1 is retrieved.
[0136] (2) Memory retrieval
[0137] In this step, questions from the existing question-answering database are input into the retrieval agent. The retrieval agent then retrieves candidate memories from the constructed MPCD index structure to obtain multiple retrieval paths. During the retrieval process, because there are relationships between some knowledge across different partitions, the retrieval agent can retrieve multiple candidate knowledge from different partitions through at least one retrieval path.
[0138] (3) Optimization of prompts
[0139] In this step, the generative agent can filter suitable search paths from multiple search paths retrieved by the retrieval agent to obtain key memories. During this process, a memory pool can be built to store multiple search paths; then, the generative agent selects suitable search paths from these to filter out key memories. Next, the generative agent can retrieve the data sets represented by the nodes on its selected search paths from the database, and based on the question, filter out key memories from these data sets, filling the selected key memories into a Prompt template to obtain a Prompt containing the question and key memories.
[0140] Next, the Prompt can be input into the large model to generate a response related to the question. Subsequently, based on the difference between the response generated by the large model and the answer corresponding to the question, a reward signal related to the retrieval agent is calculated. This reward signal is used to update the parameters of the retrieval agent. Furthermore, based on the difference between the response generated by the large model and the answer corresponding to the question, and combined with matching learning or contrastive learning in meta-learning, the loss of the generating agent is calculated, and based on the loss of the generating agent, the parameters of the generating agent are updated using an optimizer (such as stochastic gradient descent). By continuously repeating the above steps (2) and (3), the parameters of the retrieval agent and the generating agent are gradually adjusted until their performance reaches a convergent state.
[0141] (II) Reasoning Stage Process:
[0142] (1) Accessing data
[0143] In this step, the first step is to determine whether to access the user's personal data or publicly available external knowledge data, based on the specific details of the user's query. This determination can be made quickly and accurately using keyword-based matching rules.
[0144] (2) Memory retrieval
[0145] In this step, the retrieval agent prepared during the training phase can be directly invoked to retrieve multiple retrieval paths from the MPCD index structure corresponding to the database to be accessed.
[0146] (3) Generate response
[0147] In this step, following the standard RAG inference paradigm, firstly, the generative agent, prepared during the training phase, selects a suitable retrieval path from multiple retrieval paths retrieved by the retrieval agent. Then, the generative agent performs a search within the dataset represented by the nodes on the suitable retrieval path selected by the generative agent to obtain key memories (i.e., critical memories). Next, the critical memories are concatenated with the user query to form a Prompt. Finally, this Prompt is input into the larger model to generate the final question-and-answer result.
[0148] The above is an introduction to the training and inference processes of the MPCD-RAG technical framework. For ease of understanding, the following example uses a mobile phone's voice assistant to perform retrieval enhancement generation using the MPCD-RAG framework.
[0149] Voice assistants on mobile phones can have memory functions to provide a more coherent and user-friendly conversational experience. Users can set and save personal information through voice dialogue or manual input, allowing the voice assistant to better understand user needs and provide convenient functions. This information includes, but is not limited to, nickname, gender, birthday, license plate number, home address, work address, and parking location. All user information can be stored locally on the device to ensure user privacy and data security. The following example, Figure 9, illustrates how to use a voice assistant on a mobile phone: As shown in Figure 9(A), the user first uses the screen recognition function to have the voice assistant record their purchased train ticket information from Shenzhen to Hong Kong (i.e., "record"). The relevant text information is saved in the local memory. Next, as shown in Figures 9(B) and (D), the user can obtain the seat number and hotel address information through dialogue to book a taxi. Furthermore, as shown in Figure 9(C), the voice assistant can also remind and assist the user with their travel through intelligent reminders and time management functions (i.e., "remember").
[0150] For the process of using retrieval enhancement to generate data for the voice assistant, please refer to Figure 9. As shown in Figure 9(A), during the retrieval stage, the voice assistant needs to organize user-related data and store it within the MPCD index structure. As shown in Figure 10, based on the business characteristics of the voice assistant, user data can be divided into five categories: travel, food, education, finance, and interests. These five types of data are managed independently, and each category uses an index structure adapted to its data characteristics. During the generation stage, there are three generation scenarios based on the voice assistant: (1) As shown in Figure 9(C), based on time and space information, the voice assistant can generate intelligent reminders by retrieving relevant stored memories; (2) As shown in Figure 9(B), based on the representation of user dialogue input, the voice assistant first locks a data category within the MPCD index structure (e.g., item order memory under the item category), and then generates a question-and-answer response about seat information based on the retrieved key input information; (3) As shown in Figure 9(D), similarly, the voice assistant can recall multiple memories within a certain category to achieve the function of filling slots and recommending taxi destinations.
[0151] The training process for MPCD-RAG in a mobile phone voice assistant scenario is shown in Figure 11(A). First, data preparation involves building the database and its partitions required for the mobile phone voice assistant scenario. Specifically, the data is divided into two types: user personal memory data (e.g., previous memory data saved through screenshots) and publicly available external knowledge data (connected to cloud services for consumer users to share). For user data partitioning, five types of partitions as shown in Figure 10 are provided, each partition recording user data labels. Existing data management methods such as inverted indexes can be used for data storage. Next, memory retrieval involves modeling the process of selecting data partitions as a Markov decision problem in reinforcement learning. By training a retrieval agent, state, action, and reward functions are constructed to locate the query question (e.g., high-speed rail seat number) to the user's specific partition, in this case, the user's event database. Finally, prompt optimization involves fusing question-answering based on the selected memories using a large language model. This step involves constructing a memory pool containing various selected memory combinations. A generative agent is then trained to select appropriate memories, fill them into prompts, and generate a response. Based on this response, further feedback is generated and passed to the agent, completing end-to-end training and optimization. Upon convergence, the final query response (e.g., seat number 03F in car 02) is generated.
[0152] The inference process of MPCD-RAG in a mobile phone voice assistant scenario can be illustrated in Figure 11(B). First, user data access is performed. In this step, the system determines whether to access the user's personal memory data or publicly available external knowledge data based on the specific details of the user's query. In this example, the system needs to query the user's personal ticketing information, thus requiring access to the user's personal memory data. Next, memory retrieval is performed. In this step, the agent prepared during the training phase can be directly invoked to determine the selection of the event library based on the user's personal memory data. Finally, response generation is performed. In this step, following the standard RAG inference paradigm, the key retrieval memory (i.e., the memory selected by the generative agent) is first obtained and concatenated with the user's query to form a prompt message, which helps the large language model generate the final question-and-answer result.
[0153] For example, Figure 12 illustrates a fusion question-and-answer generation system built based on the business needs of a voice assistant in a mobile phone and combined with the capabilities of this patent, according to an embodiment of this application. For the retrieval content part, integration and container technologies are used for support. Figure 12 shows the component structure diagram of this embodiment; the various functional components and their logical connections will be described below. The functional components shown in Figure 12 include: integration and container technology, a data layer, a routing layer, a large model generation layer, and a user service layer. The integration and container technology includes the building and container components required to support retrieval capabilities, such as Docker, Maven, Kubernetes (K8s), Jenkins, GitLab, etc. The data layer is divided into two categories. The first category manages the content recorded by the user before using the voice assistant service, such as personal information. Furthermore, to meet the broad question-and-answer needs of the service, support for knowledge databases can be extended. In the architecture, a public cloud service is also connected, containing multiple knowledge domains and partitioning each domain to meet user requests. Locally, this data connection is a public cloud service, covering multiple knowledge domains and partitions. The routing layer is mainly built by a retrieval agent to select a specific data partition. This layer's function is to determine the partition route required for the user's question. The partition selection is determined by the key features identified through accessing each partition's database. The large model generation layer mainly consists of offline training and online inference. During the offline training phase, the retrieval agent optimizes the retrieval memory to eliminate data noise and illusions. During the online inference phase, the cloud-based large model (such as the Pangu large model) is directly invoked to generate the final question-and-answer response based on the retrieval memory. The user service layer is mainly used to directly interact with users and receive their queries. For example, a user might need to query previously recorded high-speed rail orders. By invoking a voice assistant, the final response is generated and fed back to the user based on the characteristics of the question (e.g., choosing between the user database and the knowledge database).
[0154] The logical connections among the functional components shown in Figure 12 are described below. Taking the query of a high-speed rail seat number as an example during the online inference phase:
[0155] Step 1: After the user enters their query question, the voice assistant determines that access to the user database is required.
[0156] Step 2: At the routing layer, the system accesses the user database on the data layer and constructs the agent's state. Subsequently, based on the decision results, the agent determines the access event partition and retrieves key memories, such as previous high-speed rail ticket bookings.
[0157] Step 3: In the large model generation layer, the system calls the Pangu large model to concatenate the user's input question and key information from the high-speed rail ticket booking form to generate prompts via an intelligent agent. Then, the large model generates the final response, such as seat number 02, car 03F, and the result is fed back to the user.
[0158] Figure 13 illustrates another fusion question-answering generation system provided by an embodiment of this application, based on the business needs of voice assistants in mobile phones and combined with the capabilities of this patent. The main difference between Figure 13 and Figure 12 is that the domain-specific architecture in Figure 13 uses a unified indexing method to achieve knowledge retrieval. As shown in Figure 13, various types of user data are merged to achieve a unified vector indexing method for data management. During retrieval, the system uses a similarity search method to filter key memories and relies on the capabilities of large-scale models for fusion to generate the final result.
[0159] Figure 14 illustrates another fusion question-answering generation system provided by an embodiment of this application, based on the business needs of voice assistants in mobile phones and combined with the capabilities of this patent. The main difference between Figure 14 and Figure 12 is that the offline training node uses a similarity-based search method to select key memories. As shown in Figure 14, during the training phase, the following methods may be used to accelerate the training process: instead of using an agent to retrieve and construct prompt words, a greedy rule is used to select the memory closest to the question from the candidate memory pool at once and retain it to construct the prompt words needed in the generation process.
[0160] It is understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. In addition, the various embodiments and features described in the above embodiments can be combined according to actual conditions, and the combined solutions are still within the protection scope of this application.
[0161] Next, based on the methods in the above embodiments, an answer generation device provided in this application will be introduced.
[0162] For example, Figure 15 shows a schematic diagram of the structure of an answer generation device provided in an embodiment of this application. As shown in Figure 15, the answer generation device 1500 includes a receiving module 1501 and a processing module 1502. The receiving module 1501 is used to receive a query question from a user. The processing module 1502 is used to perform a search in a first graph index structure related to a first database based on the query question, obtaining at least one search path. A node in the first graph index structure represents a partition in the first database, and an edge between two nodes in the first graph index structure indicates that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common question. A search path contains at least one node in the first graph index structure. The processing module 1502 is also used to perform reasoning based on the query question and the data in the partitions represented by the nodes on the at least one search path to obtain an answer related to the query question.
[0163] In some embodiments, before the processing module 1502 performs a search in a first graph index structure associated with the first database based on the query question to obtain at least one search path, it is further configured to: filter the first database from multiple databases based on the query question, wherein the data in different databases of the multiple databases have different privacy levels.
[0164] In some embodiments, the plurality of databases include a second database associated with a second graph index structure, wherein a node in the second graph index structure represents a partition in the second database, and an edge between two nodes in the second graph index structure represents that the data in the partitions represented by the two nodes in the second graph index structure involve at least a common problem.
[0165] In some embodiments, the privacy level of data in the first database is higher than that of data in the second database; the data in the first partition of the first database and the data in the second partition of the second database involve at least one common issue; the first node in the first graph index structure is used to represent the first partition, and the second node in the second graph index structure is used to represent the second partition; wherein, both the first node and the second node are configured as index access points to implement a one-way cross-graph index connection from the first node to the second node.
[0166] In some embodiments, at least one retrieval path includes: a first retrieval path, where nodes on the first retrieval path include a first node. Specifically, when the processing module 1502 performs reasoning based on the query question and the data in the partitions represented by the nodes on the first retrieval path to obtain an answer related to the query question, it is configured to: obtain data from the partitions represented by the nodes on the first retrieval path in a first database based on the first retrieval path to obtain a first data set; retrieve data from the partitions represented by the second node in a second database based on the first node, and retrieve data from the partitions represented by nodes directly and indirectly connected to the second node in the second graph index structure to obtain a second data set; and obtain an answer related to the query question based on the query question, the first data set, and the second data set.
[0167] In some embodiments, the device is deployed on an edge device, wherein the first database is located on the edge device and the second database is located on a cloud device.
[0168] In some embodiments, when the processing module 1502 performs reasoning based on the query question and the data in the partitions represented by each node on at least one retrieval path to obtain an answer related to the query question, it is specifically used to: perform path filtering on at least one retrieval path based on the query question to obtain a second retrieval path; and perform reasoning based on the query question and the data in the partitions represented by each node on the second retrieval path to obtain an answer related to the query question.
[0169] In some embodiments, when the processing module 1502 performs reasoning based on the data in the partitions represented by each node on the second retrieval path to obtain an answer related to the query question, it is specifically used to: obtain the data in the partitions represented by each node on the second retrieval path from the first database based on the second retrieval path to obtain a third data set; and obtain an answer related to the query question based on the query question and the third data set.
[0170] In some embodiments, the receiving module 1501 is further configured to receive a data storage instruction from a user, wherein the data storage instruction is used to instruct the storage of multiple knowledge principles, which are used to answer the same question. The processing module 1502 is further configured to, based on the similarity between each knowledge principle and a node in the first graph index structure, add each knowledge principle to a partition represented by a third node in the first graph index structure in the first database, and construct edges between multiple third nodes in the first graph index structure, wherein a third node is a node similar to a knowledge principle.
[0171] In some embodiments, both the receiving module 1501 and the processing module 1502 shown in FIG. 15 can be implemented in software or in hardware. For example, the implementation of the receiving module 1501 will be described below. Similarly, the implementation of the processing module 1502 can refer to the implementation of the receiving module 1501.
[0172] As an example of a software functional unit, the receiving module 1501 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, the receiving module 1501 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0173] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0174] As an example of a hardware functional unit, the receiving module 1501 may include at least one computing device, such as a server. Alternatively, the receiving module 1501 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0175] The multiple computing devices included in the receiving module 1501 can be distributed in the same region or in different regions. Similarly, the multiple computing devices included in the receiving module 1501 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices included in the receiving module 1501 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0176] It should be noted that, in other embodiments, the receiving module 1501 can be used to execute any step in the answer generation method described in the above embodiments, and the processing module 1502 can also be used to execute any step in the answer generation method described in the above embodiments. Furthermore, the steps implemented by the receiving module 1501 and the processing module 1502 can be specified as needed. By having the receiving module 1501 and the processing module 1502 respectively implement different steps in the answer generation method described in the above embodiments, all the functions of the answer generation device 1000 shown in FIG. 15 can be achieved.
[0177] This application also provides a computing device 1600. As shown in FIG16, the computing device 1600 includes: a bus 1602, a processor 1604, a memory 1606, and a communication interface 1608. The processor 1604, the memory 1606, and the communication interface 1608 communicate with each other via the bus 1602. The computing device 1600 may be a server or a terminal device, etc., and is not limited here. It should be understood that this application does not limit the number of processors and memories in the computing device 1600.
[0178] Bus 1602 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 16, but this does not imply that there is only one bus or one type of bus. Bus 1604 can include pathways for transmitting information between various components of computing device 1600 (e.g., memory 1606, processor 1604, communication interface 1608).
[0179] Processor 1604 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0180] The memory 1606 may include volatile memory, such as random access memory (RAM). The processor 1604 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0181] The memory 1606 stores executable program code, and the processor 1604 executes this executable program code to implement the functions of the acquisition module 1001 and the processing module 1002 shown in FIG. 10, thereby implementing the answer generation method described in the above embodiments. That is, the memory 1606 stores instructions for executing the answer generation method described in the above embodiments. Alternatively, the memory 1606 stores executable code, and the processor 1604 executes this executable code to implement the functions of the answer generation device 1000 shown in FIG. 10, thereby implementing the answer generation method described in the above embodiments. That is, the memory 1606 stores instructions for executing the answer generation method described in the above embodiments. In addition, the memory 1606 may store one or more graph index structures of databases, i.e., MPCD index structures, so that the processor 1604 can execute the answer generation method described in the above embodiments.
[0182] The communication interface 1608 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 1600 and other devices or communication networks.
[0183] Based on the methods in the above embodiments, this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods in the above embodiments. Exemplarily, the computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives).
[0184] Based on the methods in the above embodiments, this application provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the methods in the above embodiments.
[0185] Based on the methods in the above embodiments, this application also provides an answer generation device. Please refer to Figure 17, which is a schematic diagram of another answer generation device provided in this application. As shown in Figure 17, the answer generation device 1700 includes one or more processors 1701 and interface circuits 1702. Optionally, the answer generation device 1700 may also include a bus 1703. Wherein:
[0186] Processor 1701 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed through integrated logic circuits in the hardware of processor 1701 or through software instructions. The processor 1701 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods and steps disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor.
[0187] The interface circuit 1702 can be used to send or receive data, instructions or information. The processor 1701 can use the data, instructions or other information received by the interface circuit 1702 to process the data, instructions or other information, and can send the processed information out through the interface circuit 1702.
[0188] Optionally, the answer generation device 1700 also includes a memory, which may include read-only memory and random access memory, and provides operation instructions and data to the processor. A portion of the memory may also include non-volatile random access memory (NVRAM).
[0189] Optionally, the memory stores executable software modules or data structures, and the processor can execute corresponding operations by calling the operation instructions stored in the memory (which may be stored in the operating system).
[0190] Optionally, the interface circuit 1702 can be used to output the execution results of the processor 1701.
[0191] It should be noted that the functions of processor 1701 and interface circuit 1702 can be implemented through hardware design, software design, or a combination of hardware and software; no restrictions are imposed here.
[0192] It should be understood that each step of the above method embodiments can be completed by hardware logic circuits or software instructions in a processor.
[0193] It is understood that the processor in the embodiments of this application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.
[0194] The method steps in the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.
[0195] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0196] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.
[0197] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.
Claims
1. A method for generating answers, characterized in that, The method includes: Receive queries from users; Based on the query question, a search is performed in the first graph index structure related to the first database to obtain at least one search path. In this path, a node in the first graph index structure represents a partition in the first database, and the edge between two nodes in the first graph index structure represents that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common question. A search path contains at least one node in the first graph index structure. Based on the query question and the data in the partitions represented by each node on the at least one retrieval path, inference is performed to obtain an answer related to the query question.
2. The method according to claim 1, characterized in that, Before performing a search in the first graph index structure related to the first database based on the query question to obtain at least one search path, the method further includes: Based on the query question, the first database is selected from multiple databases, wherein the data in different databases have different privacy levels.
3. The method according to claim 2, characterized in that, The plurality of databases includes a second database, which is associated with a second graph index structure. A node in the second graph index structure represents a partition in the second database, and an edge between two nodes in the second graph index structure indicates that the data in the partitions represented by the two nodes in the second graph index structure involve at least one common problem.
4. The method according to claim 3, characterized in that, The privacy level of the data in the first database is higher than the privacy level of the data in the second database; The data in the first partition of the first database and the data in the second partition of the second database both involve at least one common problem; The first node in the first graph index structure is used to represent the first partition, and the second node in the second graph index structure is used to represent the second partition; Both the first node and the second node are configured as index access points to enable one-way cross-graph index connections from the first node to the second node.
5. The method according to claim 4, characterized in that, The at least one search path includes: a first search path, wherein the nodes on the first search path include the first node; Specifically, reasoning is performed based on the query question and the data in the partitions represented by each node on the first retrieval path to obtain an answer related to the query question, including: Based on the first retrieval path, data from the partitions represented by each node on the first retrieval path are obtained from the first database to obtain a first data set; Based on the first node, data in the partition represented by the second node is retrieved from the second database, and data in the partition represented by nodes that are directly and indirectly connected to the second node in the second graph index structure is retrieved to obtain a second data set; Based on the query question, the first data set, and the second data set This yields an answer related to the query question.
6. The method according to any one of claims 3-5, characterized in that, The method is applied to an end-side device, wherein the first database is located on the end-side device and the second database is located on a cloud-side device.
7. The method according to any one of claims 1-6, characterized in that, The reasoning based on the query question and the data in the partitions represented by each node on the at least one retrieval path to obtain an answer related to the query question includes: Based on the query question, path filtering is performed on the at least one search path to obtain a second search path; Based on the query question and the data in the partitions represented by each node on the second retrieval path, inference is performed to obtain an answer related to the query question.
8. The method according to claim 7, characterized in that, The reasoning based on the query question and the data in the partitions represented by each node on the second retrieval path to obtain an answer related to the query question includes: Based on the second retrieval path, data from the partitions represented by each node on the second retrieval path are obtained from the first database to obtain a third data set; Based on the query question and the third data set, the answer related to the query question is obtained.
9. The method according to any one of claims 1-8, characterized in that, The method further includes: A data storage instruction is received from a user, wherein the data storage instruction is used to instruct the storage of multiple knowledge principles, the multiple knowledge principles being used to answer the same question; Based on the similarity between each of the knowledge principles and the nodes in the first graph index structure, each of the knowledge principles is added to the partitions represented by each third node in the first graph index structure in the first database, and edges are constructed between multiple third nodes in the first graph index structure, wherein a third node is a node similar to a knowledge principle.
10. An answer generation device, characterized in that, include: The receiving module is used to receive queries from users; The processing module is used to perform a search in a first graph index structure related to the first database based on the query question, and obtain at least one search path, wherein a node in the first graph index structure is used to represent a partition in the first database, the edge between two nodes in the first graph index structure is used to indicate that the data in the partitions represented by the two nodes in the first graph index structure involve at least one common question, and a search path contains at least one node in the first graph index structure. The processing module is also used to perform reasoning based on the query question and the data in the partitions represented by each node on the at least one retrieval path to obtain an answer related to the query question.
11. The apparatus according to claim 10, characterized in that, Before the processing module performs a search in the first graph index structure related to the first database based on the query question to obtain at least one search path, it is also used for: Based on the query question, the first database is selected from multiple databases, wherein the data in different databases have different privacy levels.
12. The apparatus according to claim 11, characterized in that, The plurality of databases includes a second database, which is associated with a second graph index structure. A node in the second graph index structure represents a partition in the second database, and an edge between two nodes in the second graph index structure indicates that the data in the partitions represented by the two nodes in the second graph index structure involve at least one common problem.
13. The apparatus according to claim 12, characterized in that, The privacy level of the data in the first database is higher than the privacy level of the data in the second database; The data in the first partition of the first database and the data in the second partition of the second database both involve at least one common problem; The first node in the first graph index structure is used to represent the first partition, and the second node in the second graph index structure is used to represent the second partition; Both the first node and the second node are configured as index access points to enable one-way cross-graph index connections from the first node to the second node.
14. The apparatus according to claim 13, characterized in that, The at least one search path includes: a first search path, wherein the nodes on the first search path include the first node; Specifically, when the processing module performs reasoning based on the query question and the data in the partitions represented by each node on the first retrieval path to obtain an answer related to the query question, it is used to: Based on the first retrieval path, data from the partitions represented by each node on the first retrieval path are obtained from the first database to obtain a first data set; Based on the first node, data in the partition represented by the second node is retrieved from the second database, and data in the partition represented by nodes that are directly and indirectly connected to the second node in the second graph index structure is retrieved to obtain a second data set; Based on the query question, the first data set, and the second data set, an answer related to the query question is obtained.
15. The apparatus according to any one of claims 12-14, characterized in that, The device is deployed on an edge device, wherein the first database is located on the edge device and the second database is located on a cloud device.
16. The apparatus according to any one of claims 10-15, characterized in that, When the processing module performs reasoning based on the query question and the data in the partitions represented by each node on the at least one retrieval path to obtain an answer related to the query question, it is specifically used for: Based on the query question, path filtering is performed on the at least one search path to obtain a second search path; Based on the query question and the data in the partitions represented by each node on the second retrieval path, inference is performed to obtain an answer related to the query question.
17. The apparatus according to claim 16, characterized in that, When the processing module performs reasoning based on the query question and the data in the partitions represented by each node on the second retrieval path to obtain an answer related to the query question, it is specifically used for: Based on the second retrieval path, data from the partitions represented by each node on the second retrieval path are obtained from the first database to obtain a third data set; Based on the query question and the third data set, the answer related to the query question is obtained.
18. The apparatus according to any one of claims 10-17, characterized in that, The receiving module is further configured to receive a data storage instruction from a user, wherein the data storage instruction is configured to instruct the storage of multiple knowledge principles, the multiple knowledge principles being used to answer the same question; The processing module is further configured to add each of the knowledge principles to the partitions represented by each third node in the first graph index structure in the first database based on the similarity between each of the knowledge principles and the nodes in the first graph index structure, and to construct edges between multiple third nodes in the first graph index structure, wherein a third node is a node similar to a knowledge principle.
19. An answer generation device, characterized in that, Includes at least one processor and interface; The at least one processor obtains program instructions through the interface; The at least one processor is configured to execute the program line instructions to implement the method as described in any one of claims 1-9.
20. A computing device, characterized in that, Includes at least one memory for storing programs; At least one processor is configured to invoke a program stored in the memory to perform the method as described in any one of claims 1-9.
21. A computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-9.
22. A computer program product comprising instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-9.
