Interactive model question and answer method, device and equipment based on graph retrieval enhancement
This interactive question-answering method, enhanced by graph retrieval, combines action and graph retrieval information. By utilizing training sample data and a group-relative strategy optimization algorithm, it constructs an efficient graph retrieval-enhanced interactive large language model. This solves the problems of incomplete coverage and redundancy in graph-structured data in existing question-answering methods, achieving high accuracy and scalability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-24
AI Technical Summary
Existing question-answering methods suffer from incomplete coverage or redundant retrieval when processing graph-structured data, and are limited by similarity data and context window size, resulting in poor scalability and accuracy.
This interactive question-answering method, enhanced by graph retrieval, combines action and graph retrieval information, utilizes training sample data and a group-relative policy optimization algorithm for reinforcement learning, and constructs an efficient graph retrieval-enhanced interactive large language model, reducing retrieval volume and improving accuracy.
It achieves complete coverage of the retrieval scope in graph structure data, while reducing the amount of retrieval, improving the accuracy and scalability of question answering, and avoiding dependence on similarity data and context window size.
Smart Images

Figure CN121722863A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of interactive question answering technology, and in particular to an interactive model question answering method, apparatus, and device based on graph retrieval enhancement. Background Technology
[0002] Large Language Models (LLMs) have demonstrated superior performance in various natural language processing tasks, including text understanding, content generation, and question answering. To further enhance their reliability in knowledge-intensive scenarios, existing research has proposed Retrieval-Augmented Generation (RAG) technology—enhancing LLM capabilities by incorporating external information into the generation process. RAG works by retrieving the most relevant documents from a large corpus and inputting them into the LLM's context, thus providing useful information for LLM generation while avoiding consuming limited context length. However, most existing RAG pipelines are designed for unstructured text corpora and are difficult to apply to other types of data; graphs are a typical example. In fact, a large amount of data in the real world has graph structures, such as knowledge graphs, social networks, recommendation systems, and interconnected IoT devices.
[0003] Existing question answering methods mainly include the following approaches: ① Similarity-based question answering methods, which often rely on embedding or keyword matching, ignoring the structural information of the graph, resulting in incomplete coverage or redundant retrieval; ② Graph-based question answering methods, which require constructing similarity data of nodes on the graph and rely on task-specific training and high-quality labeled data, resulting in limited scalability; ③ LLM-based question answering methods, which heavily rely on the model's own reasoning ability and are limited by the size of the context window.
[0004] To address the aforementioned problems in existing technologies, a new question-and-answer method is urgently needed. Summary of the Invention
[0005] This invention provides a graph retrieval-enhanced interactive model question answering method, apparatus, and device to address the shortcomings of existing similarity-based question answering methods, which rely on embedding or keyword matching, ignoring graph structural information and resulting in incomplete coverage or retrieval redundancy; graph-based question answering methods require constructing similarity data of nodes on the graph and depend on task-specific training and high-quality labeled data, limiting scalability; LLM-based question answering methods heavily rely on the model's own reasoning ability and are limited by the context window size. The technical solution of this invention, through the interactive combination of actions and graph retrieval information, achieves complete retrieval coverage, significantly reducing retrieval volume while maintaining higher accuracy. The graph retrieval-enhanced interactive large language model also does not rely on similarity data and is less limited by the context window size.
[0006] This invention provides an interactive model question answering method based on graph retrieval enhancement, comprising the following steps.
[0007] The user's target question is input into the graph retrieval enhanced interactive large language model, and the first action output by the graph retrieval enhanced interactive large language model is obtained; the graph retrieval enhanced interactive large language model is trained based on training sample data; Based on the first action, determine the target graph retrieval information corresponding to the user's target question; The target answer corresponding to the user's target question is determined based on the target graph retrieval information.
[0008] According to the present invention, an interactive model question-answering method based on graph retrieval enhancement is provided, wherein determining the target graph retrieval information corresponding to the user's target question based on the first action includes: S1. Determine the graph retrieval information corresponding to the first action; S2. Input the graph retrieval information into the graph retrieval enhanced interactive large language model to obtain a new first action output by the graph retrieval enhanced interactive large language model. Repeat steps S1 and S2 until the graph retrieval information corresponding to the first action satisfies the answer requirements corresponding to the user's target question. The graph retrieval information that satisfies the answer requirements is determined as the target graph retrieval information.
[0009] According to the present invention, an interactive question-answering method based on graph retrieval enhancement is provided, wherein the graph retrieval enhanced interactive large language model is trained based on the following steps: Obtain training sample data; Based on the training sample data, the general large language model is supervised and fine-tuned to obtain the fine-tuned large language model corresponding to the general large language model. Based on the training sample data and the group relative policy optimization algorithm, reinforcement learning is performed on the fine-tuned large language model to obtain the graph retrieval enhanced interactive large language model corresponding to the fine-tuned large language model.
[0010] According to the present invention, an interactive model question answering method based on graph retrieval enhancement is provided, wherein the fine-tuning of the large language model is performed on the training sample data and the group relative policy optimization algorithm, including: The training sample data is refined using the shortest path method to obtain refined data. The fine-tuned large language model is subjected to reinforcement learning based on the refined data and the group relative policy optimization algorithm.
[0011] According to the present invention, an interactive model question answering method based on graph retrieval enhancement is provided, wherein the training sample data includes multiple graph exploration trajectories; The process of refining the training sample data using the shortest path method to obtain refined data includes: For each of the graph exploration trajectories, starting from the initial state of the graph exploration trajectory, after multiple second actions, the target graph exploration trajectory in the final state is obtained; Refined data is determined based on the exploration trajectories of all the aforementioned target maps.
[0012] According to the graph retrieval-enhanced interactive model question answering method provided by the present invention, the step of obtaining training sample data includes: Input the graph training data, training question, predefined instructions and action description into the general large language model to obtain the third action output by the general large language model; The training sample data is determined based on the third action.
[0013] According to the present invention, an interactive model question answering method based on graph retrieval enhancement is provided, wherein determining the training sample data based on the third action includes: N1. Determine the graph exploration trajectory corresponding to the third action; N2. Input the graph exploration trajectory into the general large language model to obtain the new third action output by the general large language model. Repeat steps N1 and N2 until the maximum number of iterations is reached. Then, determine the training sample data based on the graph exploration trajectories corresponding to all the third actions.
[0014] According to the present invention, an interactive model question answering method based on graph retrieval enhancement is provided, wherein the first action includes: an exploration action and a relationship selection action; The exploration action is used to determine the context entity of a specific entity in the user's target question; The selection relationship action is used to determine whether the relationship between entities is relevant to the user's objective problem.
[0015] The present invention also provides an interactive model question-answering device based on graph retrieval enhancement, comprising the following modules: The interaction module is used to input the user's target question into the graph retrieval enhanced interactive large language model and obtain the first action output by the graph retrieval enhanced interactive large language model; the graph retrieval enhanced interactive large language model is trained based on training sample data; The determination module is used to determine the target graph retrieval information corresponding to the user's target question based on the first action; The answer module is used to determine the target answer corresponding to the user's target question based on the target graph retrieval information.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the graph retrieval-enhanced interactive model question answering method as described above.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the graph retrieval-enhanced interactive model question-answering method as described above.
[0018] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the graph retrieval-enhanced interactive model question answering method as described above.
[0019] The present invention provides a graph retrieval-enhanced interactive model question-answering method, apparatus, and device. This method involves inputting a user's target question into a graph retrieval-enhanced interactive large language model, obtaining a first action output by the model. The graph retrieval-enhanced interactive large language model is trained based on training sample data. Based on the first action, target graph retrieval information corresponding to the user's target question is determined. Based on the target graph retrieval information, the target answer corresponding to the user's target question is determined. The technical solution of this invention, through the interactive combination of actions and graph retrieval information, achieves comprehensive retrieval coverage, significantly reducing retrieval volume while maintaining higher accuracy. The graph retrieval-enhanced interactive large language model also does not rely on similarity data and is less limited by the context window size. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating the interactive model question-answering method based on graph retrieval enhancement provided by the present invention.
[0022] Figure 2 This is a schematic diagram of the interactive model question-answering device based on graph retrieval enhancement provided by the present invention.
[0023] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0025] To address the aforementioned problems in the prior art, this invention provides an interactive model question-answering method based on graph retrieval enhancement. Figure 1 This is a flowchart illustrating the interactive model question-answering method based on graph retrieval enhancement provided by the present invention, as shown below. Figure 1 As shown, the method includes the following steps 110 to 130.
[0026] Step 110: Input the user's target question into the graph retrieval enhanced interactive large language model to obtain the first action output by the graph retrieval enhanced interactive large language model; the graph retrieval enhanced interactive large language model is trained based on training sample data.
[0027] Specifically, the user's target question is obtained and input into a pre-trained graph retrieval-enhanced interactive large language model, resulting in the first action output by the graph retrieval-enhanced interactive large language model. The graph retrieval-enhanced interactive large language model is a general-purpose large language model trained on training sample data. This general-purpose large language model could be, for example, Chat-GPT4, or other large language models; this embodiment of the invention does not impose specific limitations.
[0028] In one embodiment, the first action includes: an exploration action and a relationship selection action; The exploration action is used to determine the context entity of a specific entity in the user's target question; The selection relationship action is used to determine whether the relationship between entities is relevant to the user's objective problem.
[0029] Specifically, the first action includes: an exploration action and a relationship selection action. The exploration action is used to determine the context entity of a specific entity in the user's target question. Formally, the operation is based on the target entity. As input, return all related entities and their corresponding relationships, as shown in formula (1): (1) in, Indicates a relationship. Represents the context entity, This represents a knowledge graph. When this function is invoked, the observed entities and relationships are added to the perception window. middle.
[0030] The select relationship action is used to determine whether the relationships between entities are relevant to the user's target problem, even though the explore action has already generated a set of entity-relationships. However, the perceptual window is still too large for LLMs—directly inputting such a long context inevitably leads to performance degradation. Therefore, the goal of the relation selection action is to prune the perceptual window and extract the graph retrieval information that is ultimately input into the LLM. The form is shown in formula (2): (2) in, This indicates a user goal issue. express The triplet in the middle, This represents a binary classifier (implemented by a closed-source LLM). The select relation action is used to determine whether each relation is relevant to the user's target question; output 1 if relevant, and output 0 if irrelevant.
[0031] In the above embodiments, by setting exploration actions and relationship selection actions, the interaction between the reasoning process and the knowledge graph is ensured, thus building the foundation for graph retrieval.
[0032] Step 120: Determine the target graph retrieval information corresponding to the user's target question based on the first action.
[0033] Specifically, the target graph retrieval information corresponding to the user's target question can be determined based on the first action.
[0034] In one embodiment, determining the target graph retrieval information corresponding to the user's target question based on the first action includes: S1. Determine the graph retrieval information corresponding to the first action; S2. Input the graph retrieval information into the graph retrieval enhanced interactive large language model to obtain a new first action output by the graph retrieval enhanced interactive large language model. Repeat steps S1 and S2 until the graph retrieval information corresponding to the first action satisfies the answer requirements corresponding to the user's target question. The graph retrieval information that satisfies the answer requirements is determined as the target graph retrieval information.
[0035] Specifically, in step S1, the graph retrieval information corresponding to the first action can be determined. This graph retrieval information can be understood as a graph exploration trajectory with a reasoning process.
[0036] In step S2, graph retrieval information can be input into the graph retrieval enhanced interactive large language model to obtain a new first action output by the graph retrieval enhanced interactive large language model. Steps S1 and S2 are repeated until the graph retrieval information corresponding to the first action meets the answer requirements corresponding to the user's target question, that is, indicating that the current... The information in the database is sufficient to answer the user's target question. The first action will terminate immediately, and the graph retrieval information that meets the answer requirements can then be identified as the target graph retrieval information.
[0037] In the above embodiments, the iterative process can determine the graph retrieval information that meets the answer requirements, further improving the retrieval accuracy.
[0038] Step 130: Determine the target answer corresponding to the user's target question based on the target graph retrieval information.
[0039] Specifically, the target graph retrieval information (current state at the time the first action terminates) can be retrieved. ) and user goal issues The input is combined with the general large language model to obtain the target answer corresponding to the user's target question output by the general large language model, in the form of formula (3): (3) in, This indicates that information is retrieved based on the target graph to answer the user's target question. .
[0040] This invention provides a graph retrieval-enhanced interactive model question answering method. The method inputs a user's target question into a graph retrieval-enhanced interactive large language model, which outputs a first action. The graph retrieval-enhanced interactive large language model is trained on training sample data. Based on the first action, target graph retrieval information corresponding to the user's target question is determined. Based on the target graph retrieval information, the target answer corresponding to the user's target question is determined. This invention's technical solution, through the interactive combination of actions and graph retrieval information, achieves comprehensive retrieval coverage, significantly reducing retrieval volume while maintaining higher accuracy. The graph retrieval-enhanced interactive large language model also does not rely on similarity data and is less limited by the context window size.
[0041] In one embodiment, the graph retrieval-enhanced interactive large language model is trained based on the following steps: Obtain training sample data; Based on the training sample data, the general large language model is supervised and fine-tuned to obtain the fine-tuned large language model corresponding to the general large language model. Based on the training sample data and the group relative policy optimization algorithm, reinforcement learning is performed on the fine-tuned large language model to obtain the graph retrieval enhanced interactive large language model corresponding to the fine-tuned large language model.
[0042] Specifically, training sample data can be obtained first. To improve the model's graph understanding and reasoning capabilities, the technical solution of this invention can adopt a two-stage training method: In the first stage, supervised fine-tuning is performed using the training sample data to enable the model to possess basic instruction understanding and graph reasoning capabilities, resulting in a fine-tuned large language model corresponding to the general large language model. Based on the conclusion of existing research that "reinforcement learning can improve the model's reasoning ability and increase the efficiency of reasoning path exploration," the second stage introduces the Group Relative Policy Optimization (GRPO) algorithm. Based on the training sample data and the GRPO algorithm, reinforcement learning is performed on the fine-tuned large language model to obtain a graph retrieval enhanced interactive large language model corresponding to the fine-tuned large language model.
[0043] In the above embodiments, the two-stage training of supervised fine-tuning and group relative policy optimization algorithm further improves the graph understanding and reasoning ability of the model, enabling the trained graph retrieval enhanced interactive large language model to perform high-precision question answering.
[0044] In one embodiment, the reinforcement learning of the fine-tuned large language model based on the training sample data and the group relative policy optimization algorithm includes: The training sample data is refined using the shortest path method to obtain refined data. The fine-tuned large language model is subjected to reinforcement learning based on the refined data and the group relative policy optimization algorithm.
[0045] Specifically, in terms of reward design, existing methods mainly rely on outcome-based reward signals, which have proven effective in fields such as mathematical reasoning and code generation. However, research shows that in more complex scenarios such as graph retrieval, traditional outcome-based reward signals are often too sparse, which hinders effective credit allocation for early actions and ultimately leads to low learning efficiency for long action chains. Therefore, the model training process in this invention can employ process-level rewards. However, directly applying process-level rewards to synthetic data can lead to a decline in model performance. Analysis of typical failure cases shows that the main reason is the presence of noise in the synthetic data, causing misalignment of reward signals. To solve this problem, the technical solution of this invention can further refine the training sample data in the reinforcement learning process.
[0046] Studies have shown that reinforcement learning is highly effective in selecting the optimal exploration path during guided training; however, the training sample data in this invention is filtered solely based on the correctness of the answers, resulting in a large amount of redundancy and low efficiency. To overcome this limitation, the training sample data can be refined using the Shortest Path Refinement technique. Specifically, for each question instance in the training sample data, the most efficient execution path can be generated; this pruning mechanism removes redundant exploration steps from the original trajectory, making the resulting dataset more consistent with the "minimum principle" required for reinforcement learning.
[0047] Furthermore, reinforcement learning can be applied to fine-tuned large language models based on refined data and group-based relative policy optimization algorithms.
[0048] In the above embodiments, shortest path refinement retains only the simplest and most efficient inference path in the correct trajectory, thereby improving the data quality and practicality for policy learning.
[0049] In one embodiment, the training sample data includes multiple graph exploration trajectories; The process of refining the training sample data using the shortest path method to obtain refined data includes: For each of the graph exploration trajectories, starting from the initial state of the graph exploration trajectory, after multiple second actions, the target graph exploration trajectory in the final state is obtained; Refined data is determined based on the exploration trajectories of all the aforementioned target maps.
[0050] Specifically, the training sample data includes multiple graph exploration trajectories, and the training sample data can be represented as follows: Each map exploration trajectory From the initial state of the graph exploration trajectory Departure, followed by several second actions Transitioning to the next state, we obtain the final state. The target map exploration trajectory, among which... Representation of the exploration trajectory The length.
[0051] Furthermore, refined data can be determined based on the exploration trajectories of all target maps. Refined data can also be represented by the following formula (4). : (4) in, This indicates a refined operator.
[0052] For refined data Each trajectory in , Final state and original graph exploration trajectory The final state is semantically equivalent. It is the shortest of all correct trajectories that lead to the same answer. Formally, each The refining process is shown in formula (5): (5) in, Indicates and The set of feasible trajectories with the same final answer. This can be expressed by the following formula: Therefore, refine the data Only the simplest and most efficient reasoning path is retained.
[0053] In the above embodiments, since the refined data retains only the simplest and most efficient reasoning path and explicitly eliminates exploration redundancy, it is more in line with the minimum principle required for reinforcement learning.
[0054] In one embodiment, obtaining training sample data includes: Input the graph training data, training question, predefined instructions and action description into the general large language model to obtain the third action output by the general large language model; The training sample data is determined based on the third action.
[0055] Specifically, graph training data, training questions, predefined instructions, and action descriptions can be pre-set. The action descriptions include descriptions of exploration actions and relation selection actions. Then, the graph training data, training questions, predefined instructions, and action descriptions can be input into a general large language model to obtain a third action output by the model. This third action is identical to the first action, also including exploration and relation selection actions. Further, training sample data can be determined based on this third action.
[0056] The current pre-training data for LLMs lacks a large amount of graph structure data, which severely impacts their performance on graph-related tasks. To cultivate the necessary graph understanding capabilities of the model, extensive fine-tuning with high-quality graph datasets is required. However, existing research indicates that due to the complexity of graph dataset construction and its heavy reliance on manual annotation by domain experts, both academia and industry have long lacked high-quality graph structure data. To address this issue, this invention innovatively designs a graph reasoning data synthesis process, effectively alleviating the shortage of high-quality graph datasets. Specifically, it first defines the types of actions on the graph; then uses closed-source LLMs to interact with the graph based on these actions; and finally, retains the correct responses as training sample data.
[0057] In the above embodiments, the technical solution of the present invention constructs high-quality graph structure training sample data through the interaction of actions and graphs, without relying on manual annotation by experts.
[0058] In one embodiment, determining the training sample data based on the third action includes: N1. Determine the graph exploration trajectory corresponding to the third action; N2. Input the graph exploration trajectory into the general large language model to obtain the new third action output by the general large language model. Repeat steps N1 and N2 until the maximum number of iterations is reached. Then, determine the training sample data based on the graph exploration trajectories corresponding to all the third actions.
[0059] Specifically, in step N1, the graph exploration trajectory corresponding to the third action can be determined, and the graph exploration trajectory is the same in form as the graph retrieval information in step S1.
[0060] In step N2, the graph exploration trajectory can be input into the general large language model to obtain a new third action output by the general large language model. Steps N1 and N2 are repeated, and the model will generate action selection and corresponding reasoning processes. Based on the third action output by the general large language model, this invention can also call the corresponding graph API to obtain results and update the knowledge graph. Until the maximum number of iterations is reached, training sample data can be determined based on the graph exploration trajectories corresponding to all third actions.
[0061] In the above embodiments, high-quality training sample data with inference process is obtained through multiple iterations of steps N1 and N2.
[0062] The graph retrieval-enhanced interactive model question answering device provided by the present invention will be described below. The graph retrieval-enhanced interactive model question answering device described below can be referred to in correspondence with the graph retrieval-enhanced interactive model question answering method described above.
[0063] Figure 2 This is a schematic diagram of the interactive model question-answering device based on graph retrieval enhancement provided by the present invention, as shown below. Figure 2 As shown, the graph retrieval-enhanced interactive model question-answering device 200 includes the following modules: Interaction module 210 is used to input the user's target question into the graph retrieval enhanced interactive large language model and obtain the first action output by the graph retrieval enhanced interactive large language model; the graph retrieval enhanced interactive large language model is trained based on training sample data; The determining module 220 is used to determine the target graph retrieval information corresponding to the user's target question based on the first action; Answer module 230 is used to determine the target answer corresponding to the user's target question based on the target graph retrieval information.
[0064] In one embodiment, the determining module 220 is specifically used for: S1. Determine the graph retrieval information corresponding to the first action; S2. Input the graph retrieval information into the graph retrieval enhanced interactive large language model to obtain a new first action output by the graph retrieval enhanced interactive large language model. Repeat steps S1 and S2 until the graph retrieval information corresponding to the first action satisfies the answer requirements corresponding to the user's target question. The graph retrieval information that satisfies the answer requirements is determined as the target graph retrieval information.
[0065] In one embodiment, the graph retrieval-enhanced interactive model question answering device further includes a model training module, which is specifically used for: Obtain training sample data; Based on the training sample data, the general large language model is supervised and fine-tuned to obtain the fine-tuned large language model corresponding to the general large language model. Based on the training sample data and the group relative policy optimization algorithm, reinforcement learning is performed on the fine-tuned large language model to obtain the graph retrieval enhanced interactive large language model corresponding to the fine-tuned large language model.
[0066] In one embodiment, the model training module is further used for: The training sample data is refined using the shortest path method to obtain refined data. The fine-tuned large language model is subjected to reinforcement learning based on the refined data and the group relative policy optimization algorithm.
[0067] In one embodiment, the training sample data includes multiple graph exploration trajectories; the model training module is further specifically used for: For each of the graph exploration trajectories, starting from the initial state of the graph exploration trajectory, after multiple second actions, the target graph exploration trajectory in the final state is obtained; Refined data is determined based on the exploration trajectories of all the aforementioned target maps.
[0068] In one embodiment, the model training module is further used for: Input the graph training data, training question, predefined instructions and action description into the general large language model to obtain the third action output by the general large language model; The training sample data is determined based on the third action.
[0069] In one embodiment, the model training module is further used for: N1. Determine the graph exploration trajectory corresponding to the third action; N2. Input the graph exploration trajectory into the general large language model to obtain the new third action output by the general large language model. Repeat steps N1 and N2 until the maximum number of iterations is reached. Then, determine the training sample data based on the graph exploration trajectories corresponding to all the third actions.
[0070] In one embodiment, the first action includes: an exploration action and a relationship selection action; The exploration action is used to determine the context entity of a specific entity in the user's target question; The selection relationship action is used to determine whether the relationship between entities is relevant to the user's objective problem.
[0071] The interactive question-answering device based on graph retrieval enhancement provided by this invention inputs a user's target question into a graph retrieval enhancement interactive large language model, obtaining a first action output by the model. The graph retrieval enhancement interactive large language model is trained based on training sample data. Based on the first action, target graph retrieval information corresponding to the user's target question is determined. Based on the target graph retrieval information, the target answer corresponding to the user's target question is determined. This invention's technical solution, through the interactive combination of actions and graph retrieval information, achieves comprehensive retrieval coverage, significantly reducing retrieval volume while maintaining higher accuracy. The graph retrieval enhancement interactive large language model also does not rely on similarity data and is less limited by the context window size.
[0072] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communications interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute a graph retrieval-enhanced interactive model question-answering method, which includes: The user's target question is input into the graph retrieval enhanced interactive large language model, and the first action output by the graph retrieval enhanced interactive large language model is obtained; the graph retrieval enhanced interactive large language model is trained based on training sample data; Based on the first action, determine the target graph retrieval information corresponding to the user's target question; The target answer corresponding to the user's target question is determined based on the target graph retrieval information.
[0073] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0074] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the graph retrieval-enhanced interactive model question-answering method provided by the above methods, the method comprising: The user's target question is input into the graph retrieval enhanced interactive large language model, and the first action output by the graph retrieval enhanced interactive large language model is obtained; the graph retrieval enhanced interactive large language model is trained based on training sample data; Based on the first action, determine the target graph retrieval information corresponding to the user's target question; Based on the target graph retrieval information, the target answer corresponding to the user's target question is determined.
[0075] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the graph retrieval-enhanced interactive model question-answering method provided by the methods described above, the method comprising: The user's target question is input into the graph retrieval enhanced interactive large language model, and the first action output by the graph retrieval enhanced interactive large language model is obtained; the graph retrieval enhanced interactive large language model is trained based on training sample data; Based on the first action, determine the target graph retrieval information corresponding to the user's target question; Based on the target graph retrieval information, the target answer corresponding to the user's target question is determined.
[0076] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0077] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention 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; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interactive model question-answering method based on graph retrieval enhancement, characterized in that, include: The user's target question is input into the graph retrieval enhanced interactive large language model, and the first action output by the graph retrieval enhanced interactive large language model is obtained. The graph retrieval enhanced interactive large language model is trained based on training sample data; Based on the first action, determine the target graph retrieval information corresponding to the user's target question; The target answer corresponding to the user's target question is determined based on the target graph retrieval information.
2. The interactive model question-answering method based on graph retrieval enhancement according to claim 1, characterized in that, The step of determining the target graph retrieval information corresponding to the user's target question based on the first action includes: S1. Determine the graph retrieval information corresponding to the first action; S2. Input the graph retrieval information into the graph retrieval enhanced interactive large language model to obtain a new first action output by the graph retrieval enhanced interactive large language model. Repeat steps S1 and S2 until the graph retrieval information corresponding to the first action satisfies the answer requirements corresponding to the user's target question. The graph retrieval information that satisfies the answer requirements is determined as the target graph retrieval information.
3. The interactive model question-answering method based on graph retrieval enhancement according to claim 1, characterized in that, The graph retrieval-enhanced interactive large language model is trained based on the following steps: Obtain training sample data; Based on the training sample data, the general large language model is supervised and fine-tuned to obtain the fine-tuned large language model corresponding to the general large language model. Based on the training sample data and the group relative policy optimization algorithm, reinforcement learning is performed on the fine-tuned large language model to obtain the graph retrieval enhanced interactive large language model corresponding to the fine-tuned large language model.
4. The interactive model question-answering method based on graph retrieval enhancement according to claim 3, characterized in that, The reinforcement learning of the fine-tuned large language model based on the training sample data and the group relative policy optimization algorithm includes: The training sample data is refined using the shortest path method to obtain refined data. The fine-tuned large language model is subjected to reinforcement learning based on the refined data and the group relative policy optimization algorithm.
5. The interactive model question-answering method based on graph retrieval enhancement according to claim 4, characterized in that, The training sample data includes multiple graph exploration trajectories; The process of refining the training sample data using the shortest path method to obtain refined data includes: For each of the graph exploration trajectories, starting from the initial state of the graph exploration trajectory, after multiple second actions, the target graph exploration trajectory in the final state is obtained; Refined data is determined based on the exploration trajectories of all the aforementioned target maps.
6. The interactive model question answering method based on graph retrieval enhancement according to claim 3, characterized in that, The acquisition of training sample data includes: Input the graph training data, training question, predefined instructions and action description into the general large language model to obtain the third action output by the general large language model; The training sample data is determined based on the third action.
7. The interactive model question-answering method based on graph retrieval enhancement according to claim 6, characterized in that, Determining the training sample data based on the third action includes: N1. Determine the graph exploration trajectory corresponding to the third action; N2. Input the graph exploration trajectory into the general large language model to obtain the new third action output by the general large language model. Repeat steps N1 and N2 until the maximum number of iterations is reached. Then, determine the training sample data based on the graph exploration trajectories corresponding to all the third actions.
8. The interactive model question-answering method based on graph retrieval enhancement according to any one of claims 1 to 7, characterized in that, The first action includes: exploration action and relationship selection action; The exploration action is used to determine the context entity of a specific entity in the user's target question; The selection relationship action is used to determine whether the relationship between entities is relevant to the user's objective problem.
9. An interactive model question-answering device based on graph retrieval enhancement, characterized in that, include: The interaction module is used to input the user's target question into the graph retrieval enhanced interactive large language model and obtain the first action output by the graph retrieval enhanced interactive large language model; The graph retrieval enhanced interactive large language model is trained based on training sample data; The determination module is used to determine the target graph retrieval information corresponding to the user's target question based on the first action; The answer module is used to determine the target answer corresponding to the user's target question based on the target graph retrieval information.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the graph retrieval-enhanced interactive model question answering method as described in any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the graph retrieval-enhanced interactive model question answering method as described in any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the graph retrieval-enhanced interactive model question answering method as described in any one of claims 1 to 8.