A large model and knowledge graph fusion method, application method and system
By embedding and entity relationship learning of the knowledge graph, the target reasoning model is generated, and the problem of insufficient depth and interpretability in the fusion of knowledge graphs and large language models is solved, and efficient and accurate intelligent reasoning and question-and-answer capabilities are achieved.
Patent Information
- Application Number
- CN202411288306.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2044-09-14
AI Technical Summary
In the prior art, the integration depth of knowledge graphs and large language models is insufficient, dynamic updates and adaptability are not strong, cross-domain applications are limited, and interpretability is insufficient, making it difficult to meet the needs of intelligent question-and-answer systems.
By obtaining knowledge graphs for embedding and generating knowledge graph embedding information, combining entity relationship learning models, extracting entity and relationship representations of natural language questions, generating target reasoning models, realizing the integration of knowledge graphs and large models, and enhancing language generation and reasoning capabilities.
It improves the model's inference ability and clarity of output content when dealing with complex problems, enhances the interpretability of the system, and improves the efficiency and accuracy of the intelligent question-and-answer system.
Smart Images

Figure CN119226529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graphs, and specifically to a method and system for fusing a large model with a knowledge graph. Background Art
[0002] Currently, various fields have provided scenarios and applications that combine big models with knowledge graphs. This combination has brought new perspectives and possibilities to the field of artificial intelligence.
[0003] The "Wen Xin Yi Yan" model, pre-trained on a large-scale corpus, possesses powerful natural language processing and logical reasoning capabilities. In terms of knowledge reasoning, the "Wen Xin Yi Yan" model utilizes deep learning technologies such as attention mechanisms and feedforward neural networks, enabling efficient semantic analysis and reasoning. Furthermore, a knowledge-enhanced deep question-answering system, "ERNIE Bot," has been launched. This system utilizes natural language processing and deep learning technologies to analyze and reason questions, retrieving and extracting relevant information from a vast knowledge base to arrive at the correct answer.
[0004] Spark's cognitive model, centered around natural language understanding and combining multimodal perception with cognitive computing capabilities, can deeply understand and interpret human language behavior. In terms of knowledge reasoning, the Spark cognitive model utilizes deep learning techniques such as recurrent neural networks and attention mechanisms to analyze, understand, and reason about problems, retrieving and extracting relevant information from vast knowledge bases to arrive at the correct answer.
[0005] The LaMDA model, pre-trained on a large-scale corpus, possesses powerful natural language processing and logical reasoning capabilities. In terms of knowledge reasoning, the LaMDA model utilizes deep learning technologies such as the Transformer and attention mechanisms to analyze, understand, and reason about questions, retrieving and extracting relevant information from a vast knowledge base to arrive at the correct answer.
[0006] In addition, an intelligent reasoning technology based on the BERT model uses technologies such as Transformer and bidirectional pre-training in natural language processing and deep learning technologies to analyze, understand and reason about questions, retrieve and extract relevant information from a large knowledge base to obtain the correct answer.
[0007] Technology companies and research institutions both domestically and internationally are exploring intelligent reasoning technologies that integrate large models with knowledge graphs, and are employing various deep learning and natural language processing techniques to improve the capabilities and efficiency of intelligent reasoning. The continued development of these technologies will further promote the development and application of intelligent reasoning technology.
[0008] Although some companies are trying to combine knowledge graphs with large language models to improve the understanding and reasoning capabilities of intelligent systems, their exploration of how to better enable knowledge graphs to provide knowledge to large language models is still in its early stages. Their approaches have the following shortcomings:
[0009] 1. Insufficient depth of knowledge fusion: Existing technologies may not fully achieve deep fusion between knowledge graphs and large language models, resulting in limited knowledge application and reasoning capabilities.
[0010] 2. Poor dynamic updating and adaptability: Existing technologies may perform poorly in terms of dynamic updating of knowledge graphs and real-time adaptability of intelligent systems, making it difficult to quickly respond to changes in the information environment.
[0011] 3. Low explainability: Existing technologies may have deficiencies in the explainability of intelligent question-answering systems, making it difficult for users to understand the system’s reasoning process and the basis of its results.
[0012] 4. Limitations in cross-domain applications: Existing technologies may have limitations in cross-domain applications and may be difficult to adapt to the specific needs and knowledge structures of different fields. Summary of the Invention
[0013] To address the problem of the lack of understanding and reasoning capabilities of existing technologies that fuse large models and knowledge graphs, the present invention proposes a method and system for fusing large models with knowledge graphs, and an application method and system for a target reasoning model based on knowledge graph fusion, including:
[0014] First, a method for integrating a large model with a knowledge graph is provided, including:
[0015] Obtain a knowledge graph and an entity relationship learning model, and perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information;
[0016] Generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output the entity representation and relationship representation corresponding to the natural language question;
[0017] Extracting a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation;
[0018] The subgraph is converted into natural language and combined with the entity relationship learning model and the knowledge graph embedding information into the big model to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the big model.
[0019] Preferably, extracting a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation includes:
[0020] Extracting output information corresponding to the natural language question from the knowledge graph embedding information based on the context of the natural language question;
[0021] Determining extended information corresponding to the output information based on the relationship representation and the entity representation;
[0022] A subgraph is generated based on the output information and the extended information.
[0023] Preferably, the step of embedding the knowledge graph into the knowledge graph to generate knowledge graph embedding information includes:
[0024] Constructing a relation embedding space by using the TransR method, and mapping the entities of the knowledge graph to the relation embedding space;
[0025] Establishing a projection matrix based on the relationship between the triples of the knowledge graph;
[0026] Calculating the distance between the head entity and the tail entity in the triplet by a scoring formula;
[0027] Based on the triples in the knowledge graph, replacing the original head entity or tail entity with a random entity to construct a negative example set of triples;
[0028] Knowledge graph embedding information is generated according to the relation embedding space, the projection matrix, the distance between the head entity and the tail entity, and the negative example set of the triples.
[0029] Preferably, the step of inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model and outputting the entity representation and relationship representation corresponding to the natural language question includes:
[0030] Inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, and learning the entity relationship representation in the knowledge graph embedding information through the entity relationship learning model;
[0031] Based on the natural language question, the entity representation and relationship representation corresponding to the natural language question are determined from the knowledge graph embedding information through the entity relationship learning model and output.
[0032] Secondly, a large model and knowledge graph fusion system is provided, including:
[0033] An embedding module is used to obtain a knowledge graph and an entity relationship learning model, and to perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information;
[0034] An output module, configured to generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output an entity representation and a relationship representation corresponding to the natural language question;
[0035] an extraction module, configured to extract a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation;
[0036] A fusion module is used to convert the subgraph into natural language and integrate it into the large model by combining the entity relationship learning model and the knowledge graph embedding information to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the large model.
[0037] Preferably, the extraction module is further configured to:
[0038] Extracting output information corresponding to the natural language question from the knowledge graph embedding information based on the context of the natural language question;
[0039] Determining extended information corresponding to the output information based on the relationship representation and the entity representation;
[0040] A subgraph is generated based on the output information and the extended information.
[0041] Preferably, the embedded module is further configured to:
[0042] Constructing a relation embedding space by using the TransR method, and mapping the entities of the knowledge graph to the relation embedding space;
[0043] Establishing a projection matrix based on the relationship between the triples of the knowledge graph;
[0044] Calculating the distance between the head entity and the tail entity in the triplet by a scoring formula;
[0045] Based on the triples in the knowledge graph, replacing the original head entity or tail entity with a random entity to construct a negative example set of triples;
[0046] Knowledge graph embedding information is generated according to the relation embedding space, the projection matrix, the distance between the head entity and the tail entity, and the negative example set of the triples.
[0047] Preferably, the fusion module is further configured to:
[0048] Inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, and learning the entity relationship representation in the knowledge graph embedding information through the entity relationship learning model;
[0049] Based on the natural language question, the entity representation and relationship representation corresponding to the natural language question are determined from the knowledge graph embedding information through the entity relationship learning model and output.
[0050] Thirdly, an application method of a target reasoning model based on knowledge graph fusion is provided, including:
[0051] Obtaining the context corresponding to the user question and answer information, and extracting question and answer keywords from the user question and answer information;
[0052] Substitute the question-answer keywords into the pre-built target reasoning model to obtain the user question-answer output information corresponding to the user question-answer information
[0053] Wherein, the target reasoning model is constructed by a large model and knowledge graph fusion method as described in any of the above.
[0054] Preferably, the step of substituting the question-and-answer keywords into a pre-built target reasoning model to obtain user question-and-answer output information corresponding to the user question-and-answer information includes:
[0055] Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model;
[0056] Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information;
[0057] User question and answer output information corresponding to the user question and answer information is generated based on the first question and answer subgraph.
[0058] Preferably, after generating the user question and answer output information corresponding to the user question and answer information based on the first question and answer subgraph, the method further includes:
[0059] After receiving the user updated question and answer information, extracting user updated keywords from the user updated question and answer information according to the similarity between the user question and answer information and the user updated question and answer information;
[0060] Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph;
[0061] Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
[0062] Preferably, obtaining the context corresponding to the user question and answer information includes:
[0063] The knowledge graph corresponding to the user question and answer information is retrieved in a search enhancement manner to obtain question and answer extension information, and the question and answer extension information is used as the context corresponding to the user question and answer information.
[0064] Fourthly, an application system of a target reasoning model based on knowledge graph fusion is provided, including:
[0065] An information extraction module is used to obtain the context corresponding to the user question and answer information and extract question and answer keywords from the user question and answer information;
[0066] An output information module, configured to substitute the question-and-answer keywords into a pre-built target reasoning model to obtain user question-and-answer output information corresponding to the user question-and-answer information;
[0067] Wherein, the target reasoning model is constructed by a large model and knowledge graph fusion method as described in any of the above.
[0068] Preferably, the output information module is further configured to:
[0069] Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model;
[0070] Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information;
[0071] User question and answer output information corresponding to the user question and answer information is generated based on the first question and answer subgraph.
[0072] Preferably, the system further comprises:
[0073] a subgraph updating module configured to extract user updated keywords from the user updated question and answer information based on a similarity between the user updated question and answer information and the user updated question and answer information after receiving the user updated question and answer information;
[0074] Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph;
[0075] Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
[0076] Preferably, the information extraction module is further used to:
[0077] The knowledge graph corresponding to the user question and answer information is retrieved in a search enhancement manner to obtain question and answer extension information, and the question and answer extension information is used as the context corresponding to the user question and answer information.
[0078] In a fifth aspect, the present application further provides an electronic device, comprising: at least one processor and a memory; the memory and the processor are connected via a bus;
[0079] The memory is used to store one or more programs;
[0080] When the one or more programs are executed by the at least one processor, the large model and knowledge graph fusion method as described above and the application method of the target reasoning model based on knowledge graph fusion are implemented.
[0081] In the sixth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed, it implements the method of fusing the large model with the knowledge graph as described above and the application method of the target reasoning model based on knowledge graph fusion.
[0082] Compared with the prior art, the present invention has the following beneficial effects:
[0083] The present invention provides a method for fusing a large model with a knowledge graph, by embedding the acquired knowledge graph into a knowledge graph to generate knowledge graph embedding information, and then generating a natural language question based on the knowledge graph embedding information, and inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, outputting the entity representation and relationship representation corresponding to the natural language question, and then extracting the subgraph corresponding to the natural language question based on the natural language question, entity representation, and relationship representation, and then converting the subgraph into natural language, and then combining the entity relationship learning model and the knowledge graph embedding information into the large model to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the large model. By combining the language generation capability of the large model with the structure and semantic information of the knowledge graph, the model can extract key information and conduct in-depth understanding and reasoning, thereby enhancing the reasoning capability of the model when dealing with complex problems, and further improving the clarity and interpretability of the subsequent output content of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] Figure 1 This is a flow chart of the method for fusing a large model with a knowledge graph of the present invention;
[0085] Figure 2 TransR schematic diagram of the method for fusing a large model with a knowledge graph according to the present invention;
[0086] Figure 3Schematic diagram of the entity relationship learning model structure of the large model and knowledge graph fusion method of the present invention;
[0087] Figure 4 It is a structural diagram of the large model and knowledge graph fusion system of the present invention;
[0088] Figure 5 This is a flow chart of the application method of the target reasoning model based on knowledge graph fusion of the present invention;
[0089] Figure 6 This is a schematic diagram of the structure of the application system of the target reasoning model based on knowledge graph fusion of the present invention;
[0090] Figure 7 The figure is a schematic structural diagram of an electronic device of the present invention. DETAILED DESCRIPTION
[0091] In order to solve the technical problem of the lack of understanding and reasoning capabilities in the fusion of large models and knowledge graphs, the present invention combines the advanced language understanding and reasoning capabilities of the large language model (LLM) with the structured knowledge of the knowledge graph (KG) to significantly improve the intelligence level of enterprise knowledge services. Its core principle is to utilize the deep semantic analysis and knowledge generation capabilities of LLM, supplemented by the rich structured information of KG, to achieve efficient and accurate intelligent reasoning, and enhance the interpretability of the KG-based question-answering system. By constructing advanced intelligent question-answering system tools, the present invention is not only committed to improving the efficiency and quality of enterprise knowledge services, but also further strengthening the innovation capabilities and knowledge management of enterprises through verification in actual application scenarios. In addition, through data-driven decision support, this project also aims to promote enterprises to achieve more efficient knowledge utilization and more accurate business insights.
[0092] In order to better understand the present invention, the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0093] Example 1:
[0094] A method for integrating large models with knowledge graphs, such as Figure 1 As shown, including:
[0095] Step 1: Obtain a knowledge graph and an entity relationship learning model, and perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information;
[0096] Step 2: Generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output the entity representation and relationship representation corresponding to the natural language question;
[0097] Step 3: extracting a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation;
[0098] Step 4: Convert the subgraph into natural language and integrate it into the big model by combining the entity relationship learning model and the knowledge graph embedding information to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the big model.
[0099] In this embodiment, in the process of embedding the acquired knowledge graph into the knowledge graph to generate knowledge graph embedding information in step 1, a relation embedding space is constructed by the TransR method, and the entities of the knowledge graph are mapped to the relation embedding space;
[0100] Establishing a projection matrix based on the relationship between the triples of the knowledge graph;
[0101] Calculating the distance between the head entity and the tail entity in the triplet by a scoring formula;
[0102] Based on the triples in the knowledge graph, replacing the original head entity or tail entity with a random entity to construct a negative example set of triples;
[0103] Knowledge graph embedding information is generated according to the relation embedding space, the projection matrix, the distance between the head entity and the tail entity, and the negative example set of the triples.
[0104] In one embodiment,
[0105] Among them, knowledge graph embedding is the product of knowledge graph representation learning. Its purpose is to convert text data in the knowledge graph into vectors that are easy to calculate and understand. These vectors store the structured relationships of knowledge in the knowledge graph and can be used in downstream tasks of the knowledge graph.
[0106] In a knowledge graph, an entity may have multiple attributes, and different relationships correspond to different attributes of that entity. For example, "Mr. A" is both a woman's husband and an American born in Hawaii. The relationships "husband" and "age" correspond to different attributes. Intuitively similar entities in the same semantic space should be closer in space. In different semantic spaces, based on the different aspects of the entities, their distance should be greater.
[0107] like Figure 2 As shown, Figure 2 This is a TransR diagram of the method for integrating the large model with the knowledge graph of the present invention, based on Figure 2 Introduce knowledge graph embedding.
[0108] TransR establishes an independent relational space and maps entities into it, allowing the semantics of entities in each relation to be interpreted. A triple consists of the head entity embedding h, the tail entity embedding t, and the relation embedding r. A projection matrix Mr is created based on the existing relations. The mapping formula is as follows:
[0109] h r =hM r ,t r =tM r
[0110] In order to make the head entity and tail entity with the same relationship closer, the scoring formula is as follows:
[0111]
[0112] In addition, knowledge graph embedding also needs to construct negative examples during the training process. For a given triple in the knowledge graph, a random entity is used to replace the original head entity or tail entity to construct a negative example set of the triple; and then knowledge graph embedding is performed based on the above content.
[0113] In this embodiment, in step 2, the process of inputting the knowledge graph embedding information and the natural language question into the entity relationship learning model to output the entity representation and relationship representation corresponding to the natural language question includes:
[0114] Inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, and learning the entity relationship representation in the knowledge graph embedding information through the entity relationship learning model;
[0115] Based on the natural language question, the entity representation and relationship representation corresponding to the natural language question are determined from the knowledge graph embedding information through the entity relationship learning model and output.
[0116] In one embodiment, the vector modeling-based method often performs sorting by calculating the score between the question vector and the triple vector. In order to give full play to the role of knowledge graph embedding, the proposed knowledge graph question answering method based on knowledge graph embedding inputs the question into the entity relationship learning model. After the model learns the information in the knowledge graph embedding space, it predicts the entity representation and relationship representation respectively, connects the question semantic space and the knowledge graph embedding space, and bridges the semantic gap between the question and the knowledge graph.
[0117] The purpose of the entity relationship learning model is to find the head entity representation in the entity embedding space and the relationship representation in the relationship embedding space. Input a natural language question. Assuming that the answer to the question exists in the knowledge graph, then the relationship and entity implied in the question must exist in the knowledge graph, that is, the representation of the relationship and entity must exist in the knowledge graph relationship embedding space. Therefore, an entity relationship learning model is designed to learn the entity representation and relationship representation by inputting natural language questions into the model. In addition, the entity relationship learning model uses the same model structure when learning entity and relationship representations, and completes the results of two sets of parameters for one model through different inputs and objective functions. This allows models with the same structure to predict two different representation outputs. The structure of the entity relationship learning model is as follows: Figure 3 As shown in the figure, BERT can be understood as a language representation model, Attention can be understood as the attention mechanism layer, c1, c2, c3…c n It can be understood as the input layer of the model.
[0118] In this embodiment, in step 3, in the process of representing the subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation ellipsoid, the output information corresponding to the natural language question is extracted from the knowledge graph embedding information based on the context of the natural language question;
[0119] Determining extended information corresponding to the output information based on the relationship representation and the entity representation;
[0120] A subgraph is generated based on the output information and the extended information.
[0121] In one embodiment, in the process of extracting subgraphs related to the input text, a graph traversal algorithm can be used to extract subgraphs related to the input text. For example, a depth-first search (DFS) or breadth-first search (BFS) is used to traverse the knowledge graph starting from a starting node according to certain rules and constraints. During the traversal process, entity, relationship, or attribute nodes related to the input text are selected based on the context and task requirements and added to the subgraph.
[0122] Based on the context of the input text, similarity matching or keyword matching is used to filter out nodes and edges related to the text. For example, word vectors or text feature representations can be used to calculate the similarity between nodes and the input text, and nodes with high similarity are selected as part of the subgraph.
[0123] During graph traversal, the scope of the subgraph can be expanded by defining path constraints and restrictions. For example, based on the relationships between entities in the input text, the subgraph can be expanded to include additional entities and relationship nodes along these relationship paths. This increases the richness of the subgraph and provides a more comprehensive knowledge context.
[0124] In one embodiment, after knowledge embedding and subgraph extraction, the knowledge graph information needs to be integrated into the model input to provide richer context and semantic knowledge, thereby improving the model's reasoning and generation capabilities. The following methods can be used to integrate subgraph information and guide the large model to focus on specific knowledge points.
[0125] Based on the entities and relationships in the subgraph, they can be described in natural language in prompts. For example, if the subgraph involves relationships between people, descriptions like "X is Y's parent" or "X and Y are siblings" can be used to guide the large model to focus on family relationships.
[0126] In addition, special markers can be used to represent subgraph information. For example, using entity markers (such as [ENTITY]) and relationship markers (such as [RELATION]) to mark entities and relationships in a subgraph in prompts can clearly indicate to the large model to focus on the important information in the subgraph. If the subgraph contains attribute information, these attributes can be mentioned in the prompt, or question-guided prompts can be designed to integrate the information in the subgraph into the question. For example, questions like "Based on the information in the subgraph, what relationship do you think X is?" or "What is the relationship between entities X and Y in the subgraph?" can be used to guide the large model to focus on the entities and relationships in the subgraph.
[0127] In one embodiment, since much information in real life is constantly changing, it is possible to separate the knowledge space from the language space and inject knowledge information into the reasoning phase. Since the acquisition, updating, and application of knowledge during information processing vary based on context and needs, dynamic knowledge fusion is necessary. For example, a dual-tower architecture is employed, with one processing input text and the other processing the input of related knowledge graphs. To enhance interaction between the two, direct splicing or the addition of an attention mechanism module can also be employed.
[0128] In another embodiment, retrieval-augmented knowledge fusion is a method for processing external knowledge, which combines non-parametric and parametric modules to better process external knowledge. Taking RAG (Retrieval-Augmented Generation) as an example, the knowledge graph related to the input text is first retrieved in the non-parametric module through maximum inner product search (MIPS) to obtain some documents. Then, using Seq2Seq LLMs, these documents are used as hidden variables z and provided to the output generator as additional context information. By using different retrieval documents as conditions in different generation steps, rather than just using a single document to guide the entire generation process. Retrieval-augmented knowledge fusion can better utilize external knowledge and improve the quality and diversity of generated text.
[0129] The differences between the present invention and the prior art and the corresponding beneficial effects include:
[0130] (1) Entity / relationship-based representation learning methods: Traditional knowledge graphs often rely on triple embedding representations when processing user queries, which may lead to incomplete matches with user input. User queries usually contain target entities and their related question expressions, rather than just the entities themselves. This difference may affect the accuracy and efficiency of queries. Therefore, this paper generates question embeddings by simulating user questions, and then fuses these embeddings with triple embeddings to narrow the semantic gap between user input and knowledge graph nodes.
[0131] (2) Subgraph-enhanced hinting method: In current knowledge graph applications, triples are directly input into large language models as prior knowledge. However, large language models have limited understanding of the logical relationships and semantic structures between triples, which directly affects the model's ability to generate accurate answers based on this prior knowledge. Therefore, this paper converts the retrieved triple information base into natural language text through methods such as triple parsing and natural language template design to improve its understanding and application of prior knowledge.
[0132] Example 2:
[0133] The present invention based on the same inventive concept also provides a large model and knowledge graph fusion system, such as Figure 4 As shown, including:
[0134] An embedding module is configured to obtain a knowledge graph and an entity relationship learning model, and perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information;
[0135] an output module configured to generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output an entity representation and a relationship representation corresponding to the natural language question;
[0136] an extraction module configured to extract a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation;
[0137] The fusion module is configured to convert the subgraph into natural language and integrate it into the large model by combining the entity relationship learning model and the knowledge graph embedding information to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the large model.
[0138] The extraction module is further configured to:
[0139] Extracting output information corresponding to the natural language question from the knowledge graph embedding information based on the context of the natural language question;
[0140] Determining extended information corresponding to the output information based on the relationship representation and the entity representation;
[0141] A subgraph is generated based on the output information and the extended information.
[0142] The embedded module is further configured to:
[0143] Constructing a relation embedding space by using the TransR method, and mapping the entities of the knowledge graph to the relation embedding space;
[0144] Establishing a projection matrix based on the relationship between the triples of the knowledge graph;
[0145] Calculating the distance between the head entity and the tail entity in the triplet by a scoring formula;
[0146] Based on the triples in the knowledge graph, replacing the original head entity or tail entity with a random entity to construct a negative example set of triples;
[0147] Knowledge graph embedding information is generated according to the relation embedding space, the projection matrix, the distance between the head entity and the tail entity, and the negative example set of the triples.
[0148] The fusion module is further configured to:
[0149] Inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, and learning the entity relationship representation in the knowledge graph embedding information through the entity relationship learning model;
[0150] Based on the natural language question, the entity representation and relationship representation corresponding to the natural language question are determined from the knowledge graph embedding information through the entity relationship learning model and output.
[0151] Example 3:
[0152] The present invention based on the same inventive concept also provides an application method of a target reasoning model based on knowledge graph fusion, such as Figure 5 As shown, including:
[0153] Step 1: Obtain the context corresponding to the user question and answer information, and extract question and answer keywords from the user question and answer information;
[0154] Step 2: Substitute the question-answer keywords into the pre-built target reasoning model to obtain the user question-answer output information corresponding to the user question-answer information
[0155] Wherein, the target reasoning model is constructed by a large model and knowledge graph fusion method as described in any of the above.
[0156] In this embodiment, the process of obtaining the context corresponding to the user question and answer information in step 1 includes:
[0157] The knowledge graph corresponding to the user question and answer information is retrieved in a search enhancement manner to obtain question and answer extension information, and the question and answer extension information is used as the context corresponding to the user question and answer information.
[0158] In this embodiment, in step 2, the process of substituting the question-and-answer keywords into the pre-built target reasoning model to obtain the user question-and-answer output information corresponding to the user question-and-answer information includes:
[0159] Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model;
[0160] Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information;
[0161] User question and answer output information corresponding to the user question and answer information is generated based on the first question and answer subgraph.
[0162] In this embodiment, after step 2 generates user question and answer output information corresponding to the user question and answer information based on the first question and answer subgraph, the method further includes:
[0163] After receiving the user updated question and answer information, extracting user updated keywords from the user updated question and answer information according to the similarity between the user question and answer information and the user updated question and answer information;
[0164] Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph;
[0165] Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
[0166] In one embodiment, subgraphs are dynamically updated based on task requirements and changes in the input text. When the input text changes, the graph traversal and subgraph extraction can be re-performed to maintain consistency and real-time performance between the subgraph and the input text. Furthermore, to ensure that the generated new subgraph more closely matches the output text corresponding to the user input text, a second question-and-answer subgraph can be extracted and generated based on the previous user question-and-answer information and the generated first question-and-answer subgraph.
[0167] This invention combines the language description generated by the large model with the structural information of the knowledge graph, which improves the interpretability of the system, makes the reasoning process more transparent, and improves the accuracy of the reasoning results.
[0168] Example 4:
[0169] The present invention based on the same inventive concept also provides an application system of a target reasoning model based on knowledge graph fusion, such as Figure 6 As shown, including:
[0170] An information extraction module is used to obtain the context corresponding to the user question and answer information and extract question and answer keywords from the user question and answer information;
[0171] An output information module, configured to substitute the question-and-answer keywords into a pre-built target reasoning model to obtain user question-and-answer output information corresponding to the user question-and-answer information;
[0172] Wherein, the target reasoning model is constructed by a large model and knowledge graph fusion method as described in any of the above.
[0173] Preferably, the output information module is further configured to:
[0174] Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model;
[0175] Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information;
[0176] User question and answer output information corresponding to the user question and answer information is generated based on the first question and answer subgraph.
[0177] Preferably, the system further comprises:
[0178] a subgraph updating module configured to extract user updated keywords from the user updated question and answer information based on a similarity between the user updated question and answer information and the user updated question and answer information after receiving the user updated question and answer information;
[0179] Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph;
[0180] Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
[0181] Preferably, the information extraction module is further used to:
[0182] The knowledge graph corresponding to the user question and answer information is retrieved in a search enhancement manner to obtain question and answer extension information, and the question and answer extension information is used as the context corresponding to the user question and answer information.
[0183] Example 5
[0184] like Figure 7 As shown, the present invention also provides an electronic device, which may be a computer, a single-chip microcomputer, a smart mobile device, or the like. The electronic device in this embodiment may include a processor, a memory, a transceiver component, and the like. The memory, processor, and transceiver component are connected via a bus; the memory may be used to store an execution program, which may include instructions; and the processor may be used to execute the instructions stored in the memory. The memory may also be used to store data, which may be accessed and / or modified during the execution of the instructions.
[0185] The processor may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in the storage medium to implement the corresponding method flow or corresponding function, so as to realize the steps of a large model and knowledge graph fusion method and a target reasoning model based on knowledge graph fusion in the above embodiment.
[0186] Example 6
[0187] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the storage medium here can include both built-in storage media in the electronic device and, of course, extended storage media supported by the electronic device. The storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space. These instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage. The processor loads and executes one or more instructions stored in the storage medium, which can implement the steps of a large model and knowledge graph fusion method and a target reasoning model application method based on knowledge graph fusion in the above embodiment.
[0188] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0189] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, 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 data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. 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.
[0190] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0191] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0192] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the scope of the claims of the present invention to be approved.
Claims
1. An application method of a target reasoning model based on knowledge graph fusion, characterized in that: include: Obtaining the context corresponding to the user question and answer information, and extracting question and answer keywords from the user question and answer information; Substituting the question-answer keywords into a pre-built target reasoning model to obtain user question-answer output information corresponding to the user question-answer information; Wherein, the target reasoning model is constructed by integrating a large model with a knowledge graph; Substituting the question-answer keywords into a pre-built target reasoning model to obtain user question-answer output information corresponding to the user question-answer information includes: Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model; Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information; Generating user question and answer output information corresponding to the user question and answer information based on the first question and answer subgraph; After generating the user question and answer output information corresponding to the user question and answer information based on the first question and answer subgraph, the method further includes: After receiving the user updated question and answer information, extracting user updated keywords from the user updated question and answer information according to the similarity between the user question and answer information and the user updated question and answer information; Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph; Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
2. The method according to claim 1, characterized in that The method for fusing the large model with the knowledge graph includes: Obtain a knowledge graph and an entity relationship learning model, and perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information; Generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output the entity representation and relationship representation corresponding to the natural language question; Extracting a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation; The subgraph is converted into natural language and combined with the entity relationship learning model and the knowledge graph embedding information into the big model to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the big model.
3. The method according to claim 2, characterized in that The extracting a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation includes: Extracting output information corresponding to the natural language question from the knowledge graph embedding information based on the context of the natural language question; Determining extended information corresponding to the output information based on the relationship representation and the entity representation; A subgraph is generated based on the output information and the extended information.
4. The method according to claim 2, characterized in that The step of inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model and outputting entity representation and relationship representation corresponding to the natural language question includes: Inputting the knowledge graph embedding information and the natural language question into an entity relationship learning model, and learning the entity relationship representation in the knowledge graph embedding information through the entity relationship learning model; Based on the natural language question, the entity representation and relationship representation corresponding to the natural language question are determined from the knowledge graph embedding information through the entity relationship learning model and output.
5. An application system of target reasoning model based on knowledge graph fusion, characterized in that: include: An information extraction module is used to obtain the context corresponding to the user question and answer information and extract question and answer keywords from the user question and answer information; An output information module, configured to substitute the question-and-answer keywords into a pre-built target reasoning model to obtain user question-and-answer output information corresponding to the user question-and-answer information; Wherein, the target reasoning model is constructed by integrating a large model with a knowledge graph; The output information module is specifically used to: Outputting entity representations and relationship representations corresponding to the user question and answer information based on the question and answer keywords through an entity relationship learning model in a pre-built target reasoning model; Extracting a first question-answer subgraph corresponding to the user question-answer information based on the entity representation, the relationship representation, and the context of the user question-answer information; Generating user question and answer output information corresponding to the user question and answer information based on the first question and answer subgraph; The output information module further includes: Subgraph update module: After receiving the user updated question and answer information, extracting user updated keywords from the user updated question and answer information according to the similarity between the user question and answer information and the user updated question and answer information; Extracting a second question-answer subgraph corresponding to the user-updated question-answer information based on the user-updated keyword and the first question-answer subgraph; Output user question and answer output information corresponding to the user updated question and answer information based on the second question and answer subgraph.
6. The system according to claim 5, characterized in that The system further comprises: An embedding module is used to obtain a knowledge graph and an entity relationship learning model, and to perform knowledge graph embedding on the knowledge graph to generate knowledge graph embedding information; An output module, configured to generate a natural language question based on the knowledge graph embedding information, input the knowledge graph embedding information and the natural language question into an entity relationship learning model, and output an entity representation and a relationship representation corresponding to the natural language question; an extraction module, configured to extract a subgraph corresponding to the natural language question based on the natural language question, the entity representation, and the relationship representation; A fusion module is used to convert the subgraph into natural language and integrate it into the large model by combining the entity relationship learning model and the knowledge graph embedding information to generate a target reasoning model, thereby realizing the fusion of the knowledge graph and the large model.
7. An electronic device, characterized in that: include: at least one processor and memory; The memory and the processor are connected via a bus; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the application method of the target reasoning model based on knowledge graph fusion as described in any one of claims 1 to 4 is implemented.
8. A readable storage medium, characterized in that: An execution program is stored thereon, and when the execution program is executed, the application method of the target reasoning model based on knowledge graph fusion as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Domain robot question answering system based on big data model and knowledge graph fusion
CN117112765A
Intelligent query reasoning method and device based on knowledge graph and large language model collaboration
CN117743531A