Data processing method, device and equipment
By inputting the problem data input by users into the large language model, generating thinking chains and constructing query data, combining knowledge graph search models and converting natural language data, the hallucination problem of large language models in the field of high reliability is solved and The problem of difficult to utilize structured knowledge has achieved higher application credibility and knowledge understanding ability.
Patent Information
- Application Number
- CN202411412538.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-14
AI Technical Summary
The application of large language models in the fields of privacy protection processing, health care, law and science is limited by its reasoning unreliability and possible hallucinations, and knowledge of structured knowledge graphs is difficult to be understood and integrated by large language models.
By receiving the problem data input by the user, input it into a pre-trained large language model, a thinking chain is generated, and query data is constructed based on the thinking chain. Then, the matching knowledge graph is retrieved from the knowledge database through the pre-trained knowledge graph search model, the target knowledge graph is constructed, and converted into natural language data, and the answer data is finally determined through the large language model.
This method effectively alleviates the hallucination problem in the inference process of large language model, improves the credibility of application in the field of high reliability requirements, and enhances the understanding and utilization of structured knowledge by large language model.
Smart Images

Figure CN119441421A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computer technology, and in particular to a data processing method, device and equipment. Background Art
[0002] In recent years, the emergence of large language models has attracted widespread attention. Large language models can solve a variety of problems through step-by-step thinking and planning. However, the reasoning of large language models is not always reliable and may conflict with facts (i.e., hallucinations), which will limit the application of large language models in fields that require high reliability, such as privacy protection processing, healthcare, law, and science.
[0003] Combining knowledge graphs with large language models is a way to alleviate the large language model hallucination. However, for large language models, the knowledge of structured knowledge graphs is difficult to use. How to make large language models understand and integrate knowledge graphs is a challenging topic. To this end, it is necessary to provide a technical solution that can combine knowledge graphs with large language model reasoning to alleviate the large language model hallucination. Summary of the invention
[0004] The purpose of the embodiments of this specification is to provide a technical solution that can combine knowledge graphs with large language model reasoning to alleviate large language model hallucinations.
[0005] In order to implement the above technical solution, the embodiments of this specification are implemented as follows: A data processing method provided in an embodiment of the present specification comprises: receiving question data input by a user. Inputting the question data into a pre-trained large language model to obtain a chain of thoughts corresponding to the question data, and constructing query data based on the chain of thoughts corresponding to the question data. Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph. Converting the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determining the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format.
[0006] A data processing device provided in an embodiment of the present specification comprises: a question receiving module for receiving question data input by a user; a query data determination module for inputting the question data into a pre-trained large language model to obtain a chain of thoughts corresponding to the question data, and constructing query data based on the chain of thoughts corresponding to the question data; a retrieval module for retrieving a knowledge graph matching the query data from a preset knowledge database through a pre-trained knowledge graph retrieval model based on the query data, and constructing a target knowledge graph corresponding to the query data based on the retrieved knowledge graph; an answer prediction module for converting the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determining the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format.
[0007] A data processing device provided in an embodiment of the present specification comprises: a processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor: receives question data input by a user. The question data is input into a pre-trained large language model to obtain a chain of thoughts corresponding to the question data, and query data is constructed based on the chain of thoughts corresponding to the question data. Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph. The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
[0008] The embodiments of this specification also provide a storage medium for storing computer executable instructions, which implement the following process when executed by a processor: Receive question data input by a user. Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data. Based on the query data, retrieve a knowledge graph matching the query data from a preset knowledge database through a pre-trained knowledge graph retrieval model, and construct a target knowledge graph corresponding to the query data based on the retrieved knowledge graph. Convert the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determine the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format.
[0009] The embodiments of this specification also provide a computer program product, including a computer program, which implements the following process when executed by a processor: receiving question data input by a user. Inputting the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructing query data based on the thought chain corresponding to the question data. Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph. Convert the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determine the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 This is an embodiment of a data processing method of this specification; Figure 2 This is a schematic diagram of the interface of a question-answering system based on a knowledge graph in this manual; Figure 3 This is a schematic diagram of YAML format data for this specification; Figure 4 Another data processing method embodiment of this specification; Figure 5 A schematic diagram of a data processing process of this specification; Figure 6 This is another data processing method embodiment of the present specification; Figure 7 A schematic diagram of a data processing process of this specification; Figure 8 This is an embodiment of a data processing device of the present specification; Fig. 9 This is an embodiment of a data processing device in this specification. DETAILED DESCRIPTION
[0011] The embodiments of this specification provide a data processing method, device and equipment.
[0012] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0013] The embodiment of this specification provides a large model question answering system based on knowledge graph. In recent years, the emergence of large language models has attracted widespread attention. Large language models can solve a variety of problems through step-by-step thinking and planning. However, the reasoning of large language models is not always reliable, and there may be conflicts with facts (i.e., hallucinations), which will limit the application of large language models in fields that require high reliability, such as healthcare, law, and science.
[0014] Knowledge graphs store high-quality common sense or domain-specific knowledge data in the form of structured triple data (i.e., data of two nodes and the edge between the two nodes). Due to the reliability and interpretability of knowledge graphs, integrating knowledge data in knowledge graphs into large language models is considered a promising approach to alleviate the illusion of reasoning in large language models. Among them, knowledge graph question answering (KGQA) is a key task, which faces two challenges: one is how to accurately retrieve specific knowledge data (i.e., structured triple data) from knowledge graphs, and the other is to enable large language models to understand and utilize the above specific knowledge data. For the first challenge, some studies have adopted a direct retrieval approach, that is, using question data as query data, structured triple data in the knowledge graph as retrieval candidates, and using sparse or dense retrieval mechanisms to identify the retrieval candidates most relevant to the query. However, the above approach makes it difficult to process the semantic relevance between structured triple data and unstructured query data. In addition, structured triple data with weak semantic relevance to unstructured query data may be important intermediate knowledge data, especially in multi-hop question-answering (i.e., when answering a question, you need to jump to multiple different objects to get the final answer). Another study converts question data into executable structured query statements (such as SPARQL statements) and performs query retrieval processing in the knowledge graph, but this approach has the problem of generating unexecutable or incorrectly executed query statements. For the second challenge, since large language models are mainly pre-trained on unstructured text, they may not be able to effectively understand and utilize knowledge data in structured form. Therefore, the content of the knowledge graph can be converted into natural language data or linearized triple data. However, the form of natural language data adds redundant tags, while the form of linearized triple data destroys the inherent structural information in the knowledge graph.
[0015] The knowledge graph question answering task enables large language models to answer questions by integrating common sense or domain-specific knowledge from the knowledge graph. The current knowledge graph question answering methods can be divided into three categories: knowledge graph question answering based on embedding, semantic parsing, and enhanced retrieval. The embedding-based method can be to project entities and associations from the knowledge graph into the embedding space, and use key-value memory networks, sequence modeling, or graph neural networks to learn the reasoning process between questions and entities and associations. The semantic parsing-based method is to use the semantic parsing model to convert the question into a structured query language (such as SPARQL) for the knowledge base, and then execute it to search for answers from the knowledge base. However, the semantic parsing-based method relies on retrieving answers from the knowledge base, ignoring the reasoning ability of the large language model. The retrieval-enhanced method combines the knowledge graph with the intrinsic reasoning ability of the model, first retrieving knowledge triples (i.e., structured triple data) or subgraphs related to the question from the knowledge base, and then using the retrieved knowledge to enhance the authenticity of the reasoning. At present, natural language processing has entered the era of large language models, in which retrieval-augmented generation (RAG) enables these models to effectively use external knowledge to complete various tasks. The corresponding knowledge can be retrieved from the knowledge graph to verify and correct the facts in the thought chain CoT, thereby generating a more accurate response. A large-scale retriever can be used to improve the retrieval performance, and semantic parsing expressions and reasoning results can be generated in the generation stage, and the above two methods are integrated to make up for their respective shortcomings. To this end, the embodiment of this specification provides a new retrieval enhancement method based on the knowledge graph, which constructs a series of knowledge subgraphs through the thought chain (CoT, Chain-of-Thought), wherein the knowledge subgraph enriches the semantic information of the candidate knowledge, and the thought chain provides the intermediate reasoning steps involved in multi-hop question and answer, helping the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge, and then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy, and this organization method will not destroy the internal structure of the knowledge graph. In addition, three knowledge graph-level tasks can also be set for instruction tuning and pre-training of knowledge graph data to enhance the understanding of the knowledge graph by the large language model. To further enhance the reasoning capabilities of large language models using knowledge graphs, we can use larger open source large language models to generate explicit reasoning process data and train the reasoning model with these synthetic datasets.
[0016] The embodiment of this specification provides a knowledge graph question-answering method, which utilizes the subgraph-based retrieval enhancement generation paradigm. First, the overall reasoning process of the embodiment of this specification includes a knowledge graph retrieval module and a knowledge graph reasoning module. For specific processing, please refer to the specific content in the following embodiment.
[0017] like Figure 1As shown, an embodiment of this specification provides a data processing method, and the execution subject of the method can be a terminal device or a server, etc., wherein the terminal device can be a mobile terminal device such as a mobile phone, a tablet computer, or a computer device such as a laptop or a desktop computer, or an IoT device (specifically such as a smart watch, a car-mounted device, etc.), etc., wherein the server can be an independent server, or a server cluster composed of multiple servers, etc., and the server can be a background server for financial services or online shopping services, or a background server for an application, etc. In this embodiment, the execution subject is taken as an example for detailed description. For the case where the execution subject is a terminal device, please refer to the following server situation processing, which will not be repeated here. The method can specifically include the following steps: In step S102, question data input by a user is received.
[0018] Among them, the question data can be the data of any question. For example, the question data can be "What is the agenda of the meeting of institution A with the greatest voting differences in the past twelve months, who voted against it, and how many votes passed or failed the meeting?", or the question data can be "What film and television works has the director of B Art Theater starred in?", etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this.
[0019] In implementation, when a user needs to know the answer data corresponding to a question data, the user can obtain the question and answer page through the terminal device, such as Figure 2 As shown, the question and answer page may include an input box for question data, an output box for answer data, a confirmation button, a cancel button, etc. The user can enter the question data to be queried in the input box for question data in the question and answer page. After the input is completed, the user can click the confirmation button. At this time, the user's terminal device can obtain the question data in the input box for question data and can send the question data to the server. The server can receive the question data entered by the user.
[0020] It should be noted that the question data input by the user in the embodiments of this specification may be data of a relatively simple question. For example, the question data may be the answer data corresponding to the question data that can be obtained after a single jump. The question data may be data of a relatively complex question. For complex questions, it is difficult for a large language model to directly give the correct answer, so step-by-step reasoning (which may include arithmetic reasoning, common sense reasoning, symbolic reasoning, etc.) is required to obtain the correct answer. Based on this, the question data of a relatively complex question may be data that can obtain the answer data corresponding to the question data after multiple jumps (such as 2 jumps, 3 jumps, etc.) (specifically, if the question data is "What film and television works has the dean of B Art Theater starred in?", then to answer the question corresponding to the question data, it is necessary to first determine who is the dean of B Art Theater? Then, determine what film and television works he has starred in? In this way, answering the above question requires 2 jumps to obtain the answer data corresponding to the question data). In actual applications, the question data input by the user may be data of a relatively complex question.
[0021] In step S104, the above question data is input into a pre-trained large language model to obtain a thought chain corresponding to the question data, and query data is constructed based on the thought chain corresponding to the question data.
[0022] Among them, the large language model can be a model composed of hundreds of millions of parameters, based on a deep learning algorithm, and pre-trained using a large corpus. For example, the large language model can be a model built by LLM, a large model built based on BERT, or a large model based on the Transformer architecture, etc. Specifically, the large language model can include GPT-3, ERNIE Bot, etc., which can be set according to actual conditions. The thinking chain can be a series of intermediate reasoning steps that enhance the arithmetic, common sense, and reasoning capabilities of the large language model by requiring the large language model to display the intermediate step-by-step reasoning steps before outputting the final answer data. The thinking chain significantly improves the performance of the large language model by allowing the large language model to gradually participate in the process of decomposing a complex problem data into step-by-step sub-problem data and solving them in sequence.
[0023] In implementation, the model architecture of the large language model can be constructed according to actual conditions (for example, the model architecture of the large language model can be constructed based on the Transformer module, etc.), and then a large number of training samples can be obtained, and the large language model can be trained using the training samples to obtain the trained large language model. In another embodiment, a pre-trained large language model can also be directly obtained, and then a certain amount of sample data can be obtained, and the pre-trained large language model can be fine-tuned using the sample data, and finally, a fine-tuned large language model can be obtained.
[0024] After obtaining the question data in the above manner, the question data can be input into the above large language model as prompt information for the thinking chain corresponding to the question data, or prompt information for the thinking chain corresponding to the question data can be generated through the above question data (such as "What film and television works has the dean of B Art Theater starred in?" This is a question, please provide the corresponding reasoning process), and the prompt information is input into the large language model, and the question data is analyzed by the large language model to gradually participate in decomposing a complex question data into step-by-step sub-question data, so as to obtain the reasoning process determined to determine the answer data of the question data, that is, the thinking chain corresponding to the question data. For example, the question data is "What film and television works has the dean of B Art Theater starred in?" The thinking chain corresponding to the question data can be "1. Please query: Who is the dean of B Art Theater? 2. Please query: What are the film and television works starred in the query result of step 1?". A query data can be constructed based on the data of each step (i.e., each sub-question) in the reasoning process provided in the thinking chain corresponding to the question data, and then the query question corresponding to the data of each sub-question corresponding to the question data can be obtained, so as to obtain the query data constructed based on the thinking chain corresponding to the question data.
[0025] In step S106, based on the above query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph.
[0026] Among them, the knowledge graph can be a graph constructed by nodes and edges, in which the node represents an entity in reality (such as a person, place, thing, concept, etc.), and the edge represents the relationship between two different entities. The basic component unit of the knowledge graph is the "entity-association-entity" structured triple data, as well as the data pairs composed of entities and their related attributes-values. The entities are connected to each other through associations to form a network knowledge structure. The knowledge database can be a database for storing a variety of different knowledge graphs. The knowledge database can be a database constructed by a specified data source (such as a data source outside the current institution or a data source composed of large-scale data pre-built by the current institution, or a data source composed of a combination of data sources outside the current institution and large-scale data pre-built by the current institution, etc.). The knowledge graph retrieval model can be constructed in a variety of different ways. For example, the knowledge graph retrieval model can be constructed by specifying an algorithm or model. Specifically, the knowledge graph retrieval model can be based on a vector similarity retrieval algorithm, a keyword retrieval algorithm, a retrieval algorithm that is a mixture of a vector similarity-based retrieval algorithm and a keyword-based retrieval algorithm, an algorithm that constructs a vector query engine from a vector index based on a constructed knowledge graph, etc. Alternatively, the knowledge graph retrieval model can be constructed through a neural network model, a large model, etc. The specific setting can be based on actual conditions, and the embodiments of this specification do not limit this.
[0027] In implementation, the vector corresponding to each query data can be calculated, and then the vector corresponding to each query data can be input into the knowledge graph retrieval model respectively. Through the knowledge graph retrieval model, the similarity between the vector corresponding to each query data and the vector corresponding to the knowledge graph in the knowledge database can be calculated, and the calculated similarity is compared with a preset threshold, so that the knowledge graph matching the query data can be retrieved from the knowledge database. In actual applications, through each query data, one or more different structured triple data matching the query data can be retrieved from the knowledge database respectively, and the one or more different structured triple data obtained through each query data can be converted into a corresponding knowledge graph. The knowledge graphs obtained above can be combined to obtain a larger knowledge graph, which can be used as the target knowledge graph corresponding to the query data constructed based on the retrieved knowledge graph.
[0028] In step S108, the target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through a large language model.
[0029] Among them, the preset format may include multiple types, for example, a text format or a pre-set specified format, etc., which can be set according to actual conditions, and the embodiments of this specification do not limit this.
[0030] In implementation, considering that a large language model may usually not be able to directly process the knowledge graph, a data conversion mechanism may be pre-set, through which the target knowledge graph corresponding to the query data may be converted into natural language data in a preset format with the same semantics. For example, through this data conversion mechanism, the target knowledge graph corresponding to the query data may be converted into data in a text format with the same semantics as the target knowledge graph, i.e., natural language data.
[0031] A corresponding large language model can be constructed based on natural language data, so that a trained large language model can be obtained. A corresponding prompt information Prompt can be constructed based on the converted natural language data in a preset format, and the prompt information Prompt can be input into the large language model. The prompt information Prompt is analyzed and processed by the large language model, and finally a corresponding result can be output, which is the answer data corresponding to the above question data.
[0032] The embodiment of the present specification provides a data processing method, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine whether the question data corresponds to the target knowledge graph. The corresponding answer data is obtained through the thinking chain, and the data processing method provides a new retrieval enhancement method based on the knowledge graph. A series of knowledge subgraphs (i.e., the retrieved knowledge graphs) are constructed through the thinking chain, in which the knowledge subgraphs enrich the semantic information of the candidate knowledge. The thinking chain provides the intermediate reasoning steps involved in the multi-hop question and answer, which helps the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0033] In practical applications, the above preset format may be a YAML format, and the YAML format uses indentation to indicate relationships at different levels.
[0034] In practice, knowledge graphs are essentially structured data, while big language models are usually pre-trained on unstructured data. In order to bridge this gap and enable big language models to better understand and utilize structured data, a simplified big language model representation is proposed. In addition, parameter adjustment and continuous pre-training are adopted to ensure that both types of knowledge are internalized in the big language model. Typically, the retrieved structured triple data may show many similarities in text data, for example, having the same node entities or association relationships in multiple structured triple data. If the data obtained after directly linearizing the above structured triple data is used as the input data of the big language model, it will lead to significant token redundancy, thereby affecting the efficiency of the big language model reasoning. Therefore, one can try to represent the knowledge graph in a more efficient format. The YAML format can be used, which is a data serialization language with simple syntax. For example Figure 3 As shown in the figure, the left side is the original structured triple data, and the right side is the natural language data in YAML format. YAML uses indentation to represent different levels of relationships, and different node entities (such as Figure 3 "Justin Bieber" in the first-level relationship, and treat the same node entity (such as Figure 3 The different relationships under the same head node entity and the different tail node entities under the association relationship (such as Figure 3 , "Musician", "Record producer", "Allbad", and "Believe Acoustic" in the example are considered the last level of relationships.
[0035] The YAML format is a novel and efficient representation of knowledge graphs. Compared with the commonly used format of structured triple data, the YAML format can reduce the redundancy of tokens by about 25%. Combined with the subsequent fine-tuning related to knowledge graph tasks, the large language model can understand and utilize the knowledge of the knowledge graph in the YAML format to complete complex reasoning tasks.
[0036] In practical applications, the thought chain corresponding to the above question data may include a sequence of multiple reasoning steps. The specific processing method for constructing the query data based on the thought chain corresponding to the question data in the above step S104 can be varied. An optional processing method is provided below, such as Figure 4 As shown, the processing may specifically include the following steps S1042 to S1046.
[0037] In step S1042, first sub-query data is constructed based on the above question data.
[0038] In implementation, the sequence of multiple reasoning steps included in the thinking chain corresponding to the above question data may be step 1-step 2-step 3-…-step n. Figure 5 As shown, the above-mentioned question data can be used as the first sub-query data, or the question data can be processed (such as extracting information about entities in the question data and information about the association relationships between different entities to construct corresponding structured triple data or extract keywords in the question data, etc.), and the data obtained after processing can be used as the first sub-query data, etc.
[0039] In step S1044, based on the first sub-query data, one or more second sub-query data are constructed by splicing the data of the reasoning steps in the sequence composed of multiple reasoning steps in the thinking chain corresponding to the question data once or multiple times.
[0040] In implementation, based on the first sub-query data, one or more reasoning steps in the thinking chain can be spliced with the question data (or the processed data corresponding to the question data) in the first sub-query data to obtain one or more second sub-query data, for example, Figure 5As shown, the above-mentioned question data is used as the first sub-query data, and then, the above-mentioned question data can be spliced with the first reasoning step in the thinking chain, that is, question data + step 1, to obtain the first second sub-query data, and then, the above-mentioned question data can be spliced with the first reasoning step and the second reasoning step in the thinking chain, that is, question data + step 1 + step 2, to obtain the second second sub-query data, and then, the above-mentioned question data can be spliced with the first reasoning step, the second reasoning step and the third reasoning step in the thinking chain, that is, question data + step 1 + step 2 + step 3, to obtain the third second sub-query data, and so on, to obtain the nth second sub-query data of question data + step 1 + step 2 + step 3 +… + step n; or, the above-mentioned question data can be spliced with the thinking chain. The first to third reasoning steps, i.e., question data + step 1 + step 2 + step 3, are used to obtain the first second sub-query data. After that, the above question data can be spliced with the first to sixth reasoning steps in the thinking chain, i.e., question data + step 1 + step 2 + step 3 + step 4 + step 5 + step 6, to obtain the second second sub-query data. After that, the above question data can be spliced with the first to ninth reasoning steps in the thinking chain, i.e., question data + step 1 + step 2 + step 3 + step 4 + step 5 + step 6 + step 7 + step 8 + step 9, to obtain the third second sub-query data. And so on, the second sub-query data of question data + step 1 + step 2 + step 3 +… + step n is obtained. One or more second sub-query data can be obtained in the above manner.
[0041] In step S1046 , query data is determined based on the first sub-query data and one or more second sub-query data.
[0042] In practical applications, the specific processing methods of the above step S1044 can be varied. An optional processing method is provided below, such as Figure 6 As shown, the processing may specifically include the following steps S10442 to S10446.
[0043] In step S10442, the question data is spliced with the data of the first preset number of reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the question data to obtain the second sub-query data of the first splicing.
[0044] In step S10444, based on the second sub-query data obtained by the first splicing, the data of the second preset number of reasoning steps after the first preset number of reasoning steps in the sequence composed of multiple reasoning steps in the thinking chain corresponding to the question data are spliced to obtain the second sub-query data of the second splicing.
[0045] Among them, the first preset number and the second preset number can be the same or different. For example, the first preset number and the second preset number are 1, or the first preset number is 1 and the second preset number is 3, etc., which can be set according to actual conditions.
[0046] In step S10446, through the above-mentioned splicing processing, in each splicing, based on the previous sub-query data, the data of a preset number of reasoning steps after the spliced reasoning steps in the previous sub-query data in the sequence composed of multiple reasoning steps in the thinking chain corresponding to the problem data are spliced to obtain multiple second sub-query data.
[0047] Among them, in each splicing, the preset number of splicing can be the same as described above, or different (such as the preset number of splicing in each splicing can be randomly set), and can be specifically set according to actual conditions.
[0048] In actual applications, the specific processing method of the above step S108 can be varied. An optional processing method is provided below, which may specifically include the following: constructing a first prompt information based on the converted natural language data in a preset format, the thinking chain corresponding to the above question data, and the question data, inputting the first prompt information into the large language model, and obtaining the answer data corresponding to the question data.
[0049] In implementation, Figure 5 As shown, the first prompt information can be constructed based on the converted natural language data in a preset format, the thought chain corresponding to the above-mentioned question data, and the question data. For example, the converted natural language data in a preset format can be used as a prompt, and the question data can be used as input data. The first prompt information obtained can be: Please think step by step according to the thought chain corresponding to the question data, and then answer the question. Please answer as simply as possible and return all possible answers in a list. If there is a prompt (i.e., the converted natural language data in a preset format (i.e., the target knowledge graph)), please answer in combination with this information. Then, the first prompt information is input into the large language model to obtain the answer data corresponding to the question data.
[0050] In practical applications, the large language model can be obtained by training the model in the following manner, which can specifically include the following steps A2 to A6.
[0051] In step A2, sample question data and sample answer data corresponding to the sample question data are obtained.
[0052] In step A4, second prompt information is constructed based on the question sample data and the answer sample data corresponding to the question sample data, and the second prompt information is input into the large language model to obtain a predicted thinking chain corresponding to the question sample data.
[0053] Among them, in the second prompt information, the question sample data can be used as the input question, and the answer sample data corresponding to the question sample data can be used as the corresponding answer. The second prompt information can also include: This is a question, and its answer, please provide the corresponding reasoning process, etc., which can be set specifically according to actual conditions.
[0054] In step A6, based on the predicted thought chain corresponding to the question sample data and the preset first loss function, the large language model is iteratively trained to obtain a trained large language model.
[0055] Among them, the first loss function may include multiple types. For example, the first loss function may be a mean square error loss function or a mean absolute error loss function, etc., which can be specifically set according to actual conditions.
[0056] In implementation, the question sample data may also correspond to a thought chain label. Through the thought chain label and the predicted thought chain corresponding to the question sample data, the loss information between the two is calculated through the first loss function. The model parameters of the large language model are adjusted based on the loss information. If the first loss function converges, the trained large language model is obtained. If the first loss function does not converge, the above steps A2 to A6 are repeated to iteratively train the large language model until the first loss function converges to obtain the trained large language model. The trained large language model can realize the thought chain prediction of the input question data to obtain the reasoning process required from the question data to the corresponding answer data.
[0057] In practical applications, there may be various processing methods for constructing the second prompt information in the above step A4. An optional processing method is provided below, which may specifically include the following: obtaining a knowledge graph sample related to the thinking chain corresponding to the question sample data and set for the question sample data.
[0058] Based on the above processing, the specific processing method for constructing the second prompt information based on the question sample data and the answer sample data corresponding to the question sample data in the above step A4 can be varied. An optional processing method is provided below, which may specifically include the following: constructing the second prompt information based on the question sample data, the knowledge graph sample and the answer sample data corresponding to the question sample data.
[0059] In implementation, in order to solve the inconsistency of the quality of the thinking chain during the model training and reasoning process of the large language model, reasonable prompt information (i.e., the second prompt information) is used in the process of model training, and the answer data (i.e., the answer sample data corresponding to the question sample data) and the knowledge graph samples that can be used as clues are provided in the prompt information, so that the large language model can generate a reasonable reasoning process based on the answer data (i.e., the answer sample data corresponding to the question sample data). The second prompt information may include: question sample data, knowledge graph samples (which can be converted into natural language data in YAML format when used) and answer sample data corresponding to the question sample data, as well as this is a question, as well as clues and answers from the knowledge graph samples, please provide the corresponding reasoning process, etc., which can be set specifically according to actual conditions.
[0060] In practical applications, retrieving relevant and useful knowledge from knowledge databases is crucial for knowledge graph question answering tasks. Benefiting from increasingly advanced dense retrieval, relevant knowledge can be obtained through direct retrieval without the need for complex technologies such as semantic parsing and entity linking. However, the semantic expression of individual knowledge in the knowledge graph is limited. In multi-hop question answering, the semantic relationship between knowledge and question data is not directly related. Therefore, it is possible to consider combining adjacent knowledge information and reasoning processes when retrieving knowledge. Contrastive learning can be used to train the knowledge graph retrieval model, which can specifically include the processing of the following steps B2 to B10.
[0061] In step B2, query sample data, as well as positive sample data corresponding to the query sample data and negative sample data corresponding to the query sample data are obtained. The positive sample data is the data related to the path between the entity of the target question data corresponding to the query sample data and the entity of the target answer data corresponding to the target question data. The negative sample data is constructed based on the remaining sample data in the sample set to which the positive sample data belongs.
[0062] In implementation, query sample data can be obtained in a variety of different ways, for example, relevant data can be obtained from a specified database, and the obtained data can be used as query sample data, or relevant data recorded in the process of different users performing specified services pre-stored in a specified business server can be obtained, and the query sample data can be determined based on the obtained relevant data, etc., which can be set specifically according to actual conditions. In addition, the query sample data can correspond to positive sample data and negative sample data. The positive sample data can be the relevant data on the path between the entity of the target question data corresponding to the query sample data and the entity of the target answer data corresponding to the target question data (it can be all the structured triple data on the above path, or it can be the number of some structured triples selected according to specified conditions from all the structured triple data on the above path, etc.), and the negative sample data can be constructed based on the remaining sample data in the sample set to which the positive sample data belongs (it can be constructed by randomly selecting some sample data from the remaining sample data in the sample set to which the positive sample data belongs, or it can be constructed by selecting some sample data that meets the preset selection conditions from the remaining sample data in the sample set to which the positive sample data belongs, etc.).
[0063] In step B4, based on the query sample data, a first knowledge graph matching the query sample data is retrieved from a preset knowledge database through a knowledge graph retrieval model.
[0064] In step B6, based on the positive sample data, a second knowledge graph matching the positive sample data is retrieved from a preset knowledge database through a knowledge graph retrieval model.
[0065] In step B8, based on the negative sample data, a third knowledge graph matching the negative sample data is retrieved from a preset knowledge database through a knowledge graph retrieval model.
[0066] The specific processing process of the above steps B4 to B8 can refer to the relevant content in the above step S106, which will not be repeated here.
[0067] In step B10, based on the similarity between the first knowledge graph and the second knowledge graph, and the similarity between the first knowledge graph and the third knowledge graph, the knowledge graph retrieval model is iteratively trained through a preset second loss function to obtain a trained knowledge graph retrieval model.
[0068] Among them, the second loss function can be a commonly used contrastive learning loss function, such as a noise contrast estimation (Noise Contrastive Estimation, NCE) loss function, an Info NCE loss function or a cross entropy loss function, etc., which can be set according to actual conditions. The similarity between different knowledge graphs can be determined in a variety of ways. For example, the similarity between different knowledge graphs can be calculated by a cosine similarity algorithm, or the similarity between different knowledge graphs can be calculated by a dot product similarity algorithm, or the similarity between different knowledge graphs can be calculated by a Euclidean distance algorithm, etc. It can be set according to actual conditions, and the embodiments of this specification do not limit this.
[0069] In implementation, the similarity between the first knowledge graph and the second knowledge graph, and the similarity between the first knowledge graph and the third knowledge graph, can be substituted into the following second loss function:
[0070] Get the corresponding loss information, where represents the second loss function, Indicates j query sample data, represents positive sample data, t represents negative sample data, Represents the sub-graph data around (or adjacent to) the positive sample data, Represents the sub-graph data around the negative sample data, represents the knowledge graph retrieval model, f represents the similarity, and τ represents the sample set.
[0071] Based on the above loss information, the model parameters of the knowledge graph retrieval model are adjusted. If the above second loss function converges, the trained knowledge graph retrieval model is obtained. If the above second loss function does not converge, the above steps B2 to B10 are repeated to iteratively train the knowledge graph retrieval model until the above second loss function converges to obtain the trained knowledge graph retrieval model. The trained knowledge graph retrieval model can retrieve a knowledge graph that matches the input query data from a preset knowledge database.
[0072] In practical applications, for general large language models, it is unfamiliar to represent knowledge graphs with natural language data in YAML format, and the above data is rarely encountered in the pre-trained corpus of large language models. Therefore, in order to enable the large language model to understand the natural language data in YAML format after the knowledge graph is converted, instruction tuning tasks related to the knowledge graph can be designed. For details, please refer to the processing of steps C2 to C10 below.
[0073] In step C2, a knowledge graph sample and text description information corresponding to the knowledge graph sample are obtained. The knowledge graph sample includes nodes and edges. The edge is used to represent the association relationship between two connected nodes. The text description information is information converted into natural language based on the semantics of the knowledge graph sample.
[0074] The text description information may be natural language data in YAML format.
[0075] In implementation, the knowledge graph samples and the text description information corresponding to the knowledge graph samples can be obtained in a variety of different ways. For example, the knowledge graph samples and the text description information corresponding to the knowledge graph samples can be obtained from a specified database, or relevant data recorded in the process of different users performing specified businesses pre-stored in a specified business server can be obtained. The corresponding knowledge graph samples and the text description information corresponding to the knowledge graph samples can be determined based on the obtained relevant data, etc. The specific settings can be based on actual conditions.
[0076] In step C4, an entity-level instruction tuning task for a large language model is constructed based on the information of the nodes contained in the knowledge graph sample.
[0077] In implementation, in the entity-level instruction fine-tuning task, the large language model needs to reason or predict the entity based on the surrounding (or adjacent) sub-graph data.
[0078] In step C6, a relation-level instruction tuning task for a large language model is constructed based on the edge information contained in the knowledge graph sample.
[0079] Among them, the relation-level instruction tuning task is the instruction tuning task of reasoning about the association relationship between entities.
[0080] In step C8, a graph-level instruction tuning task for a large language model is constructed based on the knowledge graph samples and text description information.
[0081] In implementation, in graph-level instruction tuning tasks, a large language model needs to understand the semantics of the knowledge graph and convert it into natural language data.
[0082] In addition, for each type of instruction tuning task, you can set a variety of different instructions. For example, the entity-level instruction tuning task can set the following instructions: Please predict the entity represented by <mask>based on the one-hop relationships in the knowledge graph <mask>The entity represented). Input: {Input}, Output: {Output}; Based on the one-hop relationships in the knowledge graph, infer the entity represented by <mask>(Based on the one-hop relationship in the knowledge graph, infer that <mask>Entity represented). Input: {Input},Output: {Output};Make a prediction about the masked entity, using the one-hop relationships in the knowledge graph as a reference (Use the one-hop relationship in the knowledge graph as a reference to predict the masked entity). Input: {Input},Output: {Output}. The following instructions can be set for the relationship-level instruction tuning task: Please recognize the relationship between the two entities. Knowledge Graph: {KG}, Input: {Input}, Output: {Output}; Please predict the relationship between the two entities. There are some one-hop information of these entities: {KG}, Input: {Input}, Output: {Output}; Make a prediction about the relationship, using the one-hop relationships in the knowledge graph as a reference. {KG}, Input: {Input}, Output: {Output}.The graph-level instruction tuning task can set the following instructions: For the case of knowledge graph to text data, Please deeply understand the following knowledge graph, and then convert them into a coherent sentence. Input: {Input},Output:{Output};Given these knowledge graph, please deeply write a paragraph thatintegrates the information contained in them. Input: {Input},Output: {Output};Compose aninformative report using the information from these knowledge graphs. Input: {Input},Output: {Output};For the case of text data to knowledge graph, Please extract all entities and relationships in thesentence.Input: {Input},Output: {Output};Given the sentence, please extract a knowledge graph that integrates theinformation contained in them (Given a sentence, please extract a knowledge graph that integrates the information contained in it). Input: {Input}, Output: {Output}; Please deeply understand the followingsentence, and then generate a knowledge graph (Please deeply understand the following sentence, and then generate a knowledge graph). Input: {Input}, Output: {Output}.
[0083] In step C10, based on one or more instruction tuning tasks among entity-level instruction tuning tasks, relation-level instruction tuning tasks and graphic-level instruction tuning tasks, the large language model is fine-tuned by using a preset third loss function to obtain a large language model after instruction fine-tuning.
[0084] In the implementation, entity-level instruction tuning tasks and relation-level instruction tuning tasks can be automatically constructed based on the data in the knowledge graph without the need for additional manual annotation. For graph-level instruction tuning tasks, existing high-quality knowledge graph-to-text datasets can be used to construct them. As mentioned above, entity-level instruction tuning tasks, relation-level instruction tuning tasks, and graph-level instruction tuning tasks can be set in a masked manner, and the following third loss function can be used:
[0085] Calculate the corresponding loss information, where ( x , y ) describes the input data-output data pair, L express y Length, Indicates l Tokens, Indicates l The token before the mark, The predicted l symbol. Represents the third loss function.
[0086] Adjust the model parameters of the large language model based on the above loss information. If the above third loss function converges, the large language model after instruction fine-tuning is obtained. If the above third loss function does not converge, repeat the above steps C2 to C10 to perform instruction fine-tuning on the large language model until the above third loss function converges to obtain the large language model after instruction fine-tuning. Through instruction fine-tuning, combined with the provided YAML format data example (such as Figure 7 As shown in the figure, the large language model can be equipped with the ability to convert the knowledge graph into natural language data in YAML format with the same semantics.
[0087] Based on the above instruction fine-tuning, the large language model can be further pre-trained. For details, please refer to the processing of the following steps D2 and D4.
[0088] In step D2, a natural language data sample converted from the target knowledge graph into a preset format with the same semantics is obtained.
[0089] In step D4, the large language model is pre-trained based on the acquired natural language data samples and a preset fourth loss function to obtain a pre-trained large language model.
[0090] Among them, the fourth loss function may include multiple types, for example, the fourth loss function may be a mean square error loss function or a mean absolute error loss function, etc., which may be specifically set according to actual conditions. In this embodiment, the fourth loss function may be as follows:
[0091] in, L express x Length, Indicates l A sample of natural language data in a pre-set format, Indicates l A sample of natural language data in a pre-formatted format before being marked. The predicted l A sample of natural language data in a pre-set format. Represents the fourth loss function.
[0092] In order to verify the effectiveness of the above process, the following experiment can be set up: The experimental setup is as follows: Data: KGQA datasets: WebQSP, CWQ Model: Large language model: Meta open source LLaMA2-7b-Chat; reasoning data generation model: LLaMA2-70b-Chat; knowledge graph retrieval model: open source BGE-1.5-en-base.
[0093] The experimental results are as follows: Main experiment As shown in Table 1 Table 1
[0094] As shown in Table 1, the method proposed in this embodiment outperforms other models in Hits@1 on both KGQA datasets.
[0095] Ablation experiment As shown in Table 2 Table 2
[0096] The ablation experiments provided above prove that the strategies mentioned in the method of this embodiment are beneficial for large language models.
[0097] The embodiment of the present specification provides a data processing method, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine whether the question data corresponds to the target knowledge graph. The corresponding answer data is obtained through the thinking chain, and the data processing method provides a new retrieval enhancement method based on the knowledge graph. A series of knowledge subgraphs (i.e., the retrieved knowledge graphs) are constructed through the thinking chain, in which the knowledge subgraphs enrich the semantic information of the candidate knowledge. The thinking chain provides the intermediate reasoning steps involved in the multi-hop question and answer, which helps the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0098] In addition, three knowledge graph-level tasks are set up for instruction tuning and pre-training of knowledge graph data to enhance the large language model's understanding of the knowledge graph. In order to further enhance the reasoning ability of the large language model using the knowledge graph, a larger open source large language model can be used to generate explicit reasoning process data, and the reasoning model can be trained with these synthetic datasets, thereby improving the generalization ability of the large language model. Moreover, the YAML format is a novel and efficient knowledge graph representation that can effectively reduce token redundancy, and combined with the subsequent proposed fine-tuning related to the knowledge graph task, the large language model can understand and utilize the knowledge of the knowledge graph in the YAML format to complete complex reasoning tasks, thereby improving the performance and credibility of the large language model.
[0099] The above is a data processing method provided in the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide a data processing device, such as Figure 8 shown.
[0100] The data processing device comprises: a question receiving module 801, a query data determining module 802, a retrieval module 803 and an answer prediction module 804, wherein: The question receiving module 801 receives question data input by the user; The query data determination module 802 inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data; A retrieval module 803 retrieves a knowledge graph matching the query data from a preset knowledge database through a pre-trained knowledge graph retrieval model based on the query data, and constructs a target knowledge graph corresponding to the query data based on the retrieved knowledge graph; The answer prediction module 804 converts the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determines the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format.
[0101] In the embodiment of this specification, the preset format is the YAML format, and the YAML format uses indentation to represent the relationship between different levels.
[0102] In the embodiment of this specification, the thought chain corresponding to the question data includes a sequence of multiple reasoning steps, and the query data determination module 802 includes: A first sub-query unit, constructing first sub-query data based on the question data; A second sub-query unit, based on the first sub-query data, constructs one or more second sub-query data by splicing the data of the reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the question data once or multiple times; A query data determining unit determines the query data based on the first sub-query data and one or more of the second sub-query data.
[0103] In an embodiment of the present specification, the second sub-query unit splices the problem data with the data of the first preset number of reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the problem data to obtain the second sub-query data of the first splicing; on the basis of the second sub-query data of the first splicing obtained, splices the data of the second preset number of reasoning steps after the first preset number of reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the problem data to obtain the second sub-query data of the second splicing; through the above-mentioned splicing processing, in each splicing, on the basis of the previous sub-query data, splices the data of the preset number of reasoning steps after the spliced reasoning steps in the previous sub-query data in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the problem data to obtain multiple second sub-query data.
[0104] In the embodiment of the present specification, the answer prediction module 804 constructs first prompt information based on the converted natural language data in a preset format, the thought chain corresponding to the question data and the question data, inputs the first prompt information into the large language model, and obtains answer data corresponding to the question data.
[0105] In the embodiment of this specification, the device further includes: A first sample acquisition module, acquiring question sample data and answer sample data corresponding to the question sample data; A thought chain prediction module constructs second prompt information based on the question sample data and the answer sample data corresponding to the question sample data, and inputs the second prompt information into the large language model to obtain a predicted thought chain corresponding to the question sample data; The first training module iteratively trains the large language model based on the predicted thinking chain corresponding to the problem sample data and a preset first loss function to obtain a trained large language model.
[0106] In the embodiment of this specification, the device further includes: A graph sample acquisition module, which acquires a knowledge graph sample related to the thought chain corresponding to the question sample data and set for the question sample data; The thought chain prediction module constructs second prompt information based on the question sample data, the knowledge graph sample and the answer sample data corresponding to the question sample data.
[0107] In the embodiment of this specification, the device further includes: A second sample acquisition module is configured to acquire query sample data, as well as positive sample data corresponding to the query sample data and negative sample data corresponding to the query sample data, wherein the positive sample data is data related to a path between an entity of target question data corresponding to the query sample data and an entity of target answer data corresponding to the target question data, and the negative sample data is constructed based on the remaining sample data in the sample set to which the positive sample data belongs; A first query module, based on the query sample data, retrieves a first knowledge graph matching the query sample data from a preset knowledge database through the knowledge graph retrieval model; A second query module, based on the positive sample data, retrieves a second knowledge graph matching the positive sample data from a preset knowledge database through the knowledge graph retrieval model; A third query module, based on the negative sample data, retrieves a third knowledge graph matching the negative sample data from a preset knowledge database through the knowledge graph retrieval model; The second training module iteratively trains the knowledge graph retrieval model based on the similarity between the first knowledge graph and the second knowledge graph, and the similarity between the first knowledge graph and the third knowledge graph through a preset second loss function to obtain a trained knowledge graph retrieval model.
[0108] In the embodiment of this specification, the device further includes: A data acquisition module, which acquires a knowledge graph sample and text description information corresponding to the knowledge graph sample, wherein the knowledge graph sample includes nodes and edges, wherein the edge is used to represent the association relationship between two connected nodes, and the text description information is information converted into natural language based on the semantics of the knowledge graph sample; An entity instruction construction module, which constructs an entity-level instruction tuning task for the large language model based on the information of the nodes contained in the knowledge graph sample; A relational instruction construction module, which constructs a relational level instruction tuning task for the large language model based on the edge information contained in the knowledge graph sample; A graphics instruction construction module, which constructs a graphics-level instruction tuning task for the large language model based on the knowledge graph sample and the text description information; The instruction fine-tuning module performs instruction fine-tuning processing on the large language model through a preset third loss function based on one or more instruction tuning tasks among the entity-level instruction tuning tasks, the relation-level instruction tuning tasks and the graphic-level instruction tuning tasks, to obtain the large language model after instruction fine-tuning.
[0109] In the embodiment of this specification, the device further includes: A natural language sample acquisition module, which acquires natural language data samples converted from the target knowledge graph into a preset format with the same semantics; The pre-training module pre-trains the large language model based on the acquired natural language data sample and a preset fourth loss function to obtain a pre-trained large language model.
[0110] The embodiment of the present specification provides a data processing device, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine whether the question data corresponds to the target knowledge graph. The corresponding answer data is obtained through the thinking chain, and the data processing method provides a new retrieval enhancement method based on the knowledge graph. A series of knowledge subgraphs (i.e., the retrieved knowledge graphs) are constructed through the thinking chain, in which the knowledge subgraphs enrich the semantic information of the candidate knowledge. The thinking chain provides the intermediate reasoning steps involved in the multi-hop question and answer, which helps the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0111] In addition, three knowledge graph-level tasks are set up for instruction tuning and pre-training of knowledge graph data to enhance the large language model's understanding of the knowledge graph. In order to further enhance the reasoning ability of the large language model using the knowledge graph, a larger open source large language model can be used to generate explicit reasoning process data, and the reasoning model can be trained with these synthetic datasets, thereby improving the generalization ability of the large language model. Moreover, the YAML format is a novel and efficient knowledge graph representation that can effectively reduce token redundancy, and combined with the subsequent proposed fine-tuning related to the knowledge graph task, the large language model can understand and utilize the knowledge of the knowledge graph in the YAML format to complete complex reasoning tasks, thereby improving the performance and credibility of the large language model.
[0112] The above is a data processing device provided in the embodiment of this specification. Based on the same idea, the embodiment of this specification also provides a data processing device, such as Fig. 9 shown.
[0113] The data processing device may provide a terminal device or a server, etc. for the above-mentioned embodiments.
[0114] The data processing device may have relatively large differences due to different configurations or performances, and may include one or more processors 901 and memory 902, and the memory 902 may store one or more storage applications or data. Among them, the memory 902 may be a short-term storage or a persistent storage. The application stored in the memory 902 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the data processing device. Furthermore, the processor 901 may be configured to communicate with the memory 902 and execute a series of computer executable instructions in the memory 902 on the data processing device. The data processing device may also include one or more power supplies 903, one or more wired or wireless network interfaces 904, one or more input and output interfaces 905, and one or more keyboards 906.
[0115] Specifically in this embodiment, the data processing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the data processing device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following: Receive question data input by the user; Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data; Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph; The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
[0116] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0117] The embodiment of the present specification provides a data processing device, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine whether the question data corresponds to the target knowledge graph. The corresponding answer data is obtained through the thinking chain, and the data processing method provides a new retrieval enhancement method based on the knowledge graph. A series of knowledge subgraphs (i.e., the retrieved knowledge graphs) are constructed through the thinking chain, in which the knowledge subgraphs enrich the semantic information of the candidate knowledge. The thinking chain provides the intermediate reasoning steps involved in the multi-hop question and answer, which helps the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0118] Furthermore, based on the above Figures 1 to 7 In one embodiment, the present specification further provides a storage medium for storing computer executable instruction information. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instruction information stored in the storage medium is executed by the processor, the following process can be implemented: Receive question data input by the user; Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data; Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph; The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
[0119] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the above-mentioned storage medium embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0120] The embodiment of the present specification provides a storage medium, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine the knowledge graph corresponding to the question data. answer data, thus, this data processing method provides a new retrieval enhancement method based on knowledge graph, and constructs a series of knowledge subgraphs (i.e., retrieved knowledge graphs) through thinking chains, where the knowledge subgraphs enrich the semantic information of candidate knowledge, and the thinking chains provide the intermediate reasoning steps involved in multi-hop question and answer, helping the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0121] Furthermore, based on the above Figures 1 to 7 In one or more embodiments of the present specification, a computer program product is provided, including a computer program. When the computer program in the computer program product is executed by a processor, the following process can be implemented: Receive question data input by the user; Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data; Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph; The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
[0122] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the above-mentioned computer program product embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0123] The embodiment of the present specification provides a computer program product, which receives question data input by a user, and then inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data. After that, based on the query data, a knowledge graph matching the query data can be retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data can be constructed based on the retrieved knowledge graph. Finally, the target knowledge graph corresponding to the query data can be converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the large language model can be used to determine whether the question data corresponds to the target knowledge graph. The corresponding answer data is obtained through the thinking chain, and the data processing method provides a new retrieval enhancement method based on the knowledge graph. A series of knowledge subgraphs (i.e., the retrieved knowledge graphs) are constructed through the thinking chain, in which the knowledge subgraphs enrich the semantic information of the candidate knowledge. The thinking chain provides the intermediate reasoning steps involved in the multi-hop question and answer, which helps the knowledge graph retrieval model to recall useful intermediate knowledge graph knowledge. Then, an efficient knowledge graph representation can be designed using a preset format to reduce input redundancy. This organization method will not destroy the internal structure of the knowledge graph, thereby improving the generalization ability and inherent performance of the large language model, and improving the credibility of the large language model in complex reasoning, which can effectively alleviate the hallucination problem in the reasoning process of the large language model.
[0124] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0125] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0126] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0127] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0128] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0129] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0130] The embodiments of this specification are described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable fraud case serial and parallel device to produce a machine, so that the instructions executed by the processor of the computer or other programmable fraud case serial and parallel device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0131] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable fraud case serial and parallel device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0132] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0133] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0134] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0135] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0136] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0137] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, one or more embodiments of this specification may be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0138] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0139] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0140] The above description is only an embodiment of this specification and is not intended to limit this document. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this specification.< / mask> < / mask> < / mask> < / mask>
Claims
1. A data processing method, the method comprising: Receive question data input by the user; Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data; Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph; The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
2. According to the method of claim 1, the preset format is a YAML format, and the YAML format uses indentation to represent relationships at different levels.
3. According to the method of claim 2, the thought chain corresponding to the question data includes a sequence of multiple reasoning steps, and the step of constructing the query data based on the thought chain corresponding to the question data includes: Constructing first sub-query data based on the question data; On the basis of the first sub-query data, one or more second sub-query data are constructed by splicing the data of the reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the question data once or multiple times; The query data is determined based on the first sub-query data and one or more of the second sub-query data.
4. The method according to claim 3, wherein, based on the first sub-query data, multiple second sub-query data are constructed by splicing multiple inference step data in a sequence consisting of multiple inference steps in a thinking chain corresponding to the question data, including: splicing the question data with data of a first preset number of reasoning steps in a sequence consisting of a plurality of reasoning steps in a thinking chain corresponding to the question data, to obtain second sub-query data of the first splicing; On the basis of the obtained second sub-query data of the first splicing, splicing the data of the second preset number of reasoning steps after the first preset number of reasoning steps in the sequence consisting of multiple reasoning steps in the thinking chain corresponding to the question data, to obtain the second sub-query data of the second splicing; Through the above-mentioned splicing processing, in each splicing, on the basis of the previous sub-query data, the data of a preset number of reasoning steps after the spliced reasoning steps in the previous sub-query data in the sequence composed of multiple reasoning steps in the thinking chain corresponding to the problem data are spliced to obtain multiple second sub-query data.
5. The method according to any one of claims 1 to 3, wherein the determining the answer data corresponding to the question data by using the large language model based on the converted natural language data in a preset format comprises: Based on the converted natural language data in a preset format, the thought chain corresponding to the question data and the question data, first prompt information is constructed, and the first prompt information is input into the large language model to obtain answer data corresponding to the question data.
6. The method according to claim 1, further comprising: Obtaining question sample data and answer sample data corresponding to the question sample data; constructing second prompt information based on the question sample data and the answer sample data corresponding to the question sample data, inputting the second prompt information into the large language model, and obtaining a predicted thought chain corresponding to the question sample data; Based on the predicted thinking chain corresponding to the problem sample data and a preset first loss function, the large language model is iteratively trained to obtain a trained large language model.
7. The method according to claim 6, further comprising: Acquire a knowledge graph sample related to the thought chain corresponding to the question sample data and set for the question sample data; The constructing the second prompt information based on the question sample data and the answer sample data corresponding to the question sample data includes: The second prompt information is constructed based on the question sample data, the knowledge graph sample and the answer sample data corresponding to the question sample data.
8. The method according to claim 1, further comprising: Acquire query sample data, as well as positive sample data corresponding to the query sample data and negative sample data corresponding to the query sample data, wherein the positive sample data is data related to a path between an entity of target question data corresponding to the query sample data and an entity of target answer data corresponding to the target question data, and the negative sample data is constructed based on the remaining sample data in the sample set to which the positive sample data belongs; Based on the query sample data, a first knowledge graph matching the query sample data is retrieved from a preset knowledge database through the knowledge graph retrieval model; Based on the positive sample data, a second knowledge graph matching the positive sample data is retrieved from a preset knowledge database through the knowledge graph retrieval model; Based on the negative sample data, a third knowledge graph matching the negative sample data is retrieved from a preset knowledge database through the knowledge graph retrieval model; Based on the similarity between the first knowledge graph and the second knowledge graph, and the similarity between the first knowledge graph and the third knowledge graph, the knowledge graph retrieval model is iteratively trained through a preset second loss function to obtain a trained knowledge graph retrieval model.
9. The method according to claim 2, further comprising: Obtain a knowledge graph sample and text description information corresponding to the knowledge graph sample, wherein the knowledge graph sample includes nodes and edges, the edge is used to represent the association relationship between two connected nodes, and the text description information is information converted into natural language based on the semantics of the knowledge graph sample; Constructing an entity-level instruction tuning task for the large language model based on information of nodes included in the knowledge graph sample; Constructing a relation-level instruction tuning task for the large language model based on edge information contained in the knowledge graph sample; Constructing a graph-level instruction tuning task for the large language model based on the knowledge graph sample and the text description information; Based on one or more of the entity-level instruction tuning tasks, the relation-level instruction tuning tasks, and the graphic-level instruction tuning tasks, the large language model is fine-tuned by instructions using a preset third loss function to obtain a large language model after instruction fine-tuning.
10. The method according to claim 9, further comprising: Obtain natural language data samples converted from the target knowledge graph into a preset format with the same semantics; The large language model is pre-trained based on the acquired natural language data sample and a preset fourth loss function to obtain a pre-trained large language model.
11. A data processing device, comprising: A question receiving module receives question data input by the user; A query data determination module inputs the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and constructs query data based on the thought chain corresponding to the question data; A retrieval module, based on the query data, retrieves a knowledge graph matching the query data from a preset knowledge database through a pre-trained knowledge graph retrieval model, and constructs a target knowledge graph corresponding to the query data based on the retrieved knowledge graph; The answer prediction module converts the target knowledge graph corresponding to the query data into natural language data in a preset format with the same semantics, and determines the answer data corresponding to the question data through the large language model based on the converted natural language data in the preset format.
12. A data processing device, comprising: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: Receive question data input by the user; Input the question data into a pre-trained large language model to obtain a thought chain corresponding to the question data, and construct query data based on the thought chain corresponding to the question data; Based on the query data, a knowledge graph matching the query data is retrieved from a preset knowledge database through a pre-trained knowledge graph retrieval model, and a target knowledge graph corresponding to the query data is constructed based on the retrieved knowledge graph; The target knowledge graph corresponding to the query data is converted into natural language data in a preset format with the same semantics, and based on the converted natural language data in the preset format, the answer data corresponding to the question data is determined through the large language model.
Citation Information
Cited By
Intelligent table question and answer method and system based on knowledge graph and large model
CN120950659A