Knowledge query reasoning method and device and knowledge base system

By fusing the text information associated with nodes and large language models in the knowledge graph to generate query results, the problems of large language model inference bias and lack of knowledge graph context are solved, and the performance improvement of the knowledge base is achieved.

CN118940845AInactive Publication Date: 2024-11-12ALIPAY (HANGZHOU) INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411419984.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The reasoning results caused by the lack of factual knowledge during reasoning in large language models are biased from facts, and the structured knowledge of the knowledge graph lacks contextual representation, resulting in poor generalization performance.

Method used

By combining the text information associated with nodes with user query phrases in the knowledge graph, query results are generated using a large language model to realize the fusion representation of structured knowledge and text knowledge, and improve the performance of knowledge query.

Benefits of technology

Avoid dimensional disasters and difficult maintenance problems caused by knowledge graph structure, reduce costs and complexity, and quickly generate query results using the text understanding ability of large language models, make up for the lack of context information of structured knowledge, and improve knowledge The library's text knowledge retrieval efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940845A_ABST
    Figure CN118940845A_ABST
Patent Text Reader

Abstract

The invention provides a knowledge query reasoning method and device and a knowledge base system.The method comprises the steps that associated nodes on a knowledge graph are retrieved according to user query phrases, and text information corresponding to the associated nodes is obtained from the knowledge graph under the condition that query results are not retrieved according to the associated nodes, the text information is used for describing fact knowledge corresponding to the nodes, and calling a large language model to generate a query result according to the text information and user query phrases. Through fusion representation of structured knowledge and text knowledge in the knowledge graph, the problems of dimension disasters and difficult maintenance caused by transition structuring of the knowledge graph can be avoided, the cost and the graph complexity are reduced, and the text knowledge can make up for the context information missing problem of the structured knowledge; and the text knowledge in the knowledge graph can also make up for the fact knowledge deficiency problem of the large language model, and bidirectional enhancement of the large language model and the knowledge graph performance is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of artificial intelligence technology, and in particular, to a knowledge query and reasoning method and device, and a knowledge base system. Background Art

[0002] With the continuous deepening of the application of large language model (LLM) technology, the "hallucination problem" of large language models in solving complex decision-making in real scenarios has become increasingly prominent. The hallucination problem refers to the phenomenon that the reasoning results deviate from the facts due to the lack of factual knowledge of the large language model, that is, the generation of incorrect factual statements.

[0003] Knowledge Graph (KG) is a form of data expression that can store massive amounts of factual knowledge in a structured form. However, compared to textual knowledge, structured knowledge lacks rich contextual representation, resulting in poor generalization performance of knowledge graphs. Understanding and generating contextual knowledge happens to be what large language models excel at.

[0004] Therefore, how to fuse structured factual knowledge with contextual text knowledge is a key problem that must be overcome in the bidirectional enhancement of knowledge graphs and large language models. Summary of the invention

[0005] In view of this, the embodiments of this specification provide a knowledge query reasoning method, a knowledge base system, a knowledge query reasoning device, a storage medium and a computer program, aiming to achieve the fusion representation of structured knowledge and text knowledge and improve the knowledge query performance.

[0006] In a first aspect, this specification provides a knowledge query reasoning method, which is applied to a knowledge graph, wherein a node in the knowledge graph is associated with text information, and the text information is used to describe the factual knowledge corresponding to the node, and the method includes: Acquire a user query phrase, and retrieve associated nodes on the knowledge graph based on the user query phrase, wherein the associated nodes represent nodes associated with the query entity included in the user query phrase; In response to not retrieving a query result according to the associated node, acquiring text information corresponding to the associated node; Based on the text information and the user query phrase, a large language model is called to generate a query result.

[0007] In some implementations, the retrieving associated nodes on the knowledge graph based on the user query phrase includes: Generate a query list of the knowledge graph based on the user query phrase, wherein the query list includes at least one query sub-question, and the query sub-question includes one or more of the query entities and query relations; According to the query entity and the query relationship, retrieve the associated node in the knowledge graph; It is determined whether the query result is retrieved according to the attribute of the associated node.

[0008] In some implementations, the knowledge graph includes an instance layer and a concept layer, and the retrieving the associated node in the knowledge graph according to the query entity and the query relationship includes: According to the query entity and the query relationship, the entity type node, concept type node and concept node associated with the query entity are determined at the concept layer, and the entity node and event node associated with the query entity are determined at the instance layer, and the associated nodes include the entity type node, the concept type node, the concept node, the entity node and the event node.

[0009] In some implementations, in response to not retrieving a query result according to the associated node, obtaining text information corresponding to the associated node includes: In response to the query result not being retrieved according to the attribute of the associated node, the text description information corresponding to the entity type node, the concept type node, and the concept node, as well as the text description information and text knowledge information corresponding to the entity node and the event node are obtained, and the text information includes the text description information and the text knowledge information; wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

[0010] In some implementations, the acquiring of the text description information corresponding to the entity type node, the concept type node, and the concept node, and the text description information and text knowledge information corresponding to the entity node and the event node includes: For each node, the text description information and / or text knowledge information associated with the node is obtained according to the node identification and text support relationship of the node.

[0011] In some implementations, the calling of a large language model to generate a query result based on the text information and the user query phrase includes: Generate a model prompt word based on the text information and the user query phrase; The model prompt word is input into the large language model, so that the large language model generates a query result corresponding to the user query phrase based on the text information.

[0012] In a second aspect, this specification provides a knowledge base system, including: Large language model; A knowledge graph includes nodes and edges connecting the nodes, wherein the nodes are associated with text information, and the text information is used to describe the factual knowledge corresponding to the nodes; The inference engine is configured to retrieve associated nodes on the knowledge graph based on a user query phrase, and if no query result is retrieved, call the large language model to generate a query result based on text information corresponding to the associated nodes and the user query phrase, wherein the associated nodes represent nodes associated with the query entities included in the user query phrase.

[0013] In some embodiments, the knowledge graph includes an instance layer and a concept layer, the concept layer includes entity type nodes, concept type nodes and concept nodes, and the instance layer includes entity nodes and event nodes; The text information includes text description information corresponding to the entity type node, the concept type node, the concept node, the entity node, and the event node, as well as text knowledge information corresponding to the entity node and the event node, wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

[0014] In some embodiments, the inference engine is configured to generate model prompt words based on the text information and the user query phrase, input the model prompt words into the large language model, and the large language model generates a query result corresponding to the user query phrase based on the text information.

[0015] In a third aspect, an embodiment of the present specification provides a knowledge query reasoning device, which is applied to a knowledge graph, wherein a node in the knowledge graph is associated with text information, and the text information is used to describe the factual knowledge corresponding to the node, and the device includes: An input acquisition module is configured to acquire a user query phrase and retrieve associated nodes on the knowledge graph based on the user query phrase, wherein the associated nodes represent nodes associated with a query entity included in the user query phrase; a text acquisition module, configured to acquire text information corresponding to the associated node in response to no query result being retrieved according to the associated node; The model calling module is configured to call a large language model to generate a query result based on the text information and the user query phrase.

[0016] In some implementations, the input acquisition module is configured to: Generate a query list of the knowledge graph based on the user query phrase, wherein the query list includes at least one query sub-question, and the query sub-question includes one or more of the query entities and query relations; According to the query entity and the query relationship, retrieve the associated node in the knowledge graph; It is determined whether the query result is retrieved according to the attribute of the associated node.

[0017] In some implementations, the knowledge graph includes an instance layer and a concept layer, and the input acquisition module is configured to: According to the query entity and the query relationship, the entity type node, concept type node and concept node associated with the query entity are determined at the concept layer, and the entity node and event node associated with the query entity are determined at the instance layer, and the associated nodes include the entity type node, the concept type node, the concept node, the entity node and the event node.

[0018] In some implementations, the text acquisition module is configured to: In response to the query result not being retrieved according to the attribute of the associated node, the text description information corresponding to the entity type node, the concept type node, and the concept node, as well as the text description information and text knowledge information corresponding to the entity node and the event node are obtained, and the text information includes the text description information and the text knowledge information; wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

[0019] In some implementations, the text acquisition module is configured to: For each node, the text description information and / or text knowledge information associated with the node is obtained according to the node identification and text support relationship of the node.

[0020] In some implementations, the model calling module is configured to: Generate a model prompt word based on the text information and the user query phrase; The model prompt word is input into the large language model, so that the large language model generates a query result corresponding to the user query phrase based on the text information.

[0021] In a fourth aspect, an embodiment of this specification provides a storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in any of the above embodiments.

[0022] In a fifth aspect, an embodiment of this specification provides a computer program product, and the computer program product is used to implement the method described in any of the above embodiments.

[0023] The knowledge query reasoning method of the implementation mode of this specification includes searching the associated nodes on the knowledge graph according to the user query phrase, and obtaining the text information corresponding to the associated nodes from the knowledge graph when the query result is not retrieved according to the associated nodes, and the text information is used to describe the factual knowledge corresponding to the node, and the large language model is called according to the text information and the user query phrase to generate the query result. Through the fusion representation of structured knowledge and text knowledge in the knowledge graph, on the one hand, the dimensional disaster and difficult maintenance problems caused by the transitional structuring of the knowledge graph can be avoided, and the knowledge graph only needs a simple structure to reduce the cost and complexity of the graph. At the same time, the text knowledge can make up for the lack of contextual information of the structured knowledge; on the other hand, by using the text understanding and summarization and summarization capabilities of the large language model, the query results can be quickly generated from the text knowledge, and the retrieval efficiency of the knowledge base for text knowledge can be improved. Moreover, the text knowledge in the knowledge graph can also make up for the lack of factual knowledge of the large language model, and realize the two-way enhancement of the performance of the large language model and the knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a structural block diagram of a knowledge base system in an exemplary embodiment of this specification.

[0025] Figure 2 It is a schematic diagram of the structure of the knowledge graph in the knowledge base system in an exemplary embodiment of this specification.

[0026] Figure 3 It is a flowchart of a knowledge query reasoning method in an exemplary embodiment of this specification.

[0027] Figure 4 is a flowchart of a knowledge query reasoning method in another exemplary embodiment of the present specification.

[0028] Figure 5 is a flowchart of a knowledge query reasoning method in another exemplary embodiment of the present specification.

[0029] Figure 6 It is a structural block diagram of a knowledge query and reasoning device in an exemplary embodiment of this specification.

[0030] Figure 7 It is a structural block diagram of a knowledge base system in an exemplary embodiment of this specification. DETAILED DESCRIPTION

[0031] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0032] Nowadays, the technical application of Large Language Model (LLM) is increasing. The training text data of LLM is accumulated from multiple sources, such as books, articles, public websites, social media, research papers, etc. The knowledge within LLM mainly relies on deep neural networks to capture the relationship between texts. Therefore, LLM has strong generalization and good context understanding and induction capabilities.

[0033] However, since LLM lacks factual knowledge of the real world, it may encounter "illusion problems" when reasoning, that is, generating incorrect factual statements. For example, if a user asks "In which year did Kepler discover gravity", LLM may incorrectly answer "Kepler discovered gravity in 1687", but in fact, it was Newton who discovered the theory of gravity.

[0034] Knowledge Graph (KG) is a symbolic data expression that can store a huge amount of factual knowledge in a structured form. For example, the knowledge graph constructs a huge semantic network graph in the form of triples of subject, predicate, and object. Each node in the graph can represent an entity or concept, and the edge connecting the nodes can represent the relationship between two nodes.

[0035] Knowledge graphs use logical symbols and graph structures to express knowledge, and use a unified knowledge reasoning engine to support symbolic query and reasoning, which has good stability and interpretability. However, compared with textual knowledge, structured knowledge lacks rich contextual representation, which leads to problems such as poor generalization performance and missing key information in knowledge graphs.

[0036] For example, taking the factual knowledge "Liu XX won the Best Actor Award at the Academy Awards", the knowledge graph can be modeled as a triple <Liu XX, won the honor, Best Actor Award at the Academy Awards>, that is, the subject is "Liu XX", the predicate is "won the honor", and the object is "Best Actor Award at the Academy Awards". In this factual knowledge, contextual information such as time, place, award-winning works, and award presenters is missing. If the user's question is "What work did Liu XX win the Best Actor Award at the Academy Awards in 2004?", no query results can be given.

[0037] In related technologies, in order to further complete the context information, factual knowledge can be modeled as an event model based on OpenSPG (Sematic-enhanced Programmable Graph, property graph semantically enhanced programmable knowledge graph), which can be expressed as: Award Winning Event: EventType subject: Actor, Person object: AwardType occurTime(occurrence time): Timestamp occurPlace(occurrence location): POI awardWinningWork(award-winning work): Work(work) The event model further includes some contextual information, but if the user asks "What activities did Liu XX attend when he won the Best Actor Award at the 2004 Academy Awards?", no query results can be given.

[0038] It can be seen that although the event model in the above example can contain some contextual information, the contextual information of spatiotemporal multi-time is extremely rich, and the infinitely fine-grained structured extraction will make graph modeling more complicated, and the modeling methods are difficult to enumerate.

[0039] As mentioned above, LLM has strong inductive learning ability and can summarize the relationship between knowledge from massive texts, so it can understand and summarize contextual text information well. If the text understanding ability of LLM can be integrated with the structured factual knowledge expression of knowledge graph, on the one hand, it can greatly alleviate the illusion problem of LLM, and on the other hand, it can alleviate the problem of lack of contextual information in the structured knowledge of knowledge graph.

[0040] Based on this, the embodiments of this specification provide a knowledge query reasoning method, a knowledge base system, a knowledge query reasoning device, a storage medium and a computer program product, aiming to achieve the fusion representation of structured knowledge and text knowledge and improve the knowledge query performance of the knowledge base.

[0041] In some embodiments, this specification provides a knowledge base system that fuses structured knowledge and textual knowledge, and through the combination of the knowledge graph's reasoning engine and the large language model, calls the large language model when query results cannot be obtained based on structured knowledge, and generates query results using the large language model's textual knowledge understanding and common sense induction capabilities. This can alleviate both the problem of missing contextual information of structured knowledge and the problem of insufficient factual knowledge of the large language model, thereby achieving two-way enhancement of the large language model and the knowledge graph.

[0042] See also Figure 1 As shown, in the implementation manner of this specification, the knowledge base system includes a large language model, a knowledge graph and an inference engine.

[0043] A large language model is a natural language processing model based on deep learning technology. It is trained with a large amount of text data and has a good ability to understand and generate natural language. Large language models usually have parameters ranging from billions to hundreds of billions, and can capture rich semantic information. Large language models are often pre-trained on large-scale general data sets, and only need to be fine-tuned with a small amount of data to support tasks in various scenarios. At present, large language models are widely used in various industries, and major manufacturers have deployed their own large models, such as ChatGPT, Tongyi Qianwen, Xingchen, ChatGLM, etc. This manual does not limit the type of large language models, and technicians in this field can understand and fully implement them by referring to relevant technologies.

[0044] A knowledge graph refers to a graph data structure that stores knowledge in a structured form. The knowledge graph includes nodes and edges. Each node can represent, for example, a concept, an entity, an event, etc. The edges connecting the nodes represent the relationship between the nodes. In the embodiments of this specification, in addition to the structured knowledge expression, the knowledge graph also incorporates the text information corresponding to the node. The text information refers to the original text corresponding to the node.

[0045] For example, taking a knowledge graph in the field of movies as an example, a node represents the instance of the movie "Wu X Dao". The text information corresponding to the node can be an introduction to the movie, such as "'Wu X Dao' is a police and gangster film produced by XX Film Distribution Company, directed by Liu XX and Mai XX, and starred by Liu XX, Liang XX, Huang XX, etc. It premiered in Hong Kong on December 12, 2002. The film tells the story of two men with confused identities who are undercover agents for the police and a criminal group respectively. After a fierce duel, they are determined to find their own stories..."

[0046] It can be seen that the text information is the original text used to describe the instance corresponding to the node. In the implementation of this specification, these text information can be stored in the form of text documents, and then the association relationship between the entity node and the text document can be established in the knowledge graph in the form of triple data.

[0047] Figure 2 The knowledge semantic framework of the knowledge graph in some embodiments of this specification is shown. In this example, the framework structure of the knowledge graph can be divided into a concept layer and an instance layer. The concept layer refers to the stratification of conceptual knowledge. The nodes of the concept layer represent the abstraction and representation of various concepts, categories, levels and the relationships between them in the objective world. The instance layer refers to the stratification of instances such as specific entities and events. The nodes of the instance layer represent specific instances, such as a specific person, a specific object, etc.

[0048] In the implementation of this specification, the concept layer includes entity type nodes, concept type nodes, and concept nodes. The entity type node represents the top-level type structure, which is expressed as an entity type with multiple attributes, such as Figure 2 In the example, the green nodes "Person" and "Institute" represent entity type nodes. Concept types represent top-level concepts, which express the classification of a class of entities. They are connected to associated entity types using the bindTo predicate, for example Figure 2 In the example, the blue nodes "TaxoOfPerson" and "TaxoOfInstitute" represent concept type nodes, which form the following with the associated entity type nodes:<TaxoOfPerson,bindTo,Person> A concept node represents an independent concept instance. A concept node is associated with a concept type, for example Figure 2In the example, the gray nodes "Teacher", "Actor" and "Director" represent concept nodes associated with the concept type "TaxoOfPerson", and the node "School" represents the concept node associated with the concept type "TaxoOfInstitute". The concept nodes and concept type nodes are connected by the isA predicate, for example<Teacher,isA,TaxoOfPerson> fixed expression.

[0049] At the concept level, in addition to the above expression structures, some concept nodes can also be associated with each other through predicates such as hasProperty, synonym, isA, etc., for example Figure 2 In the example, the concept node "Professor" is associated with other nodes through the predicate hasProperty, and these other associated nodes are the property nodes related to the "Professor" node.

[0050] The instance layer represents the specific entity or event instance of the bottom layer. In the implementation mode of this specification, the instance layer may include entity nodes and event nodes. The entity node represents a specific entity instance, such as a specific person, a specific object, etc., and the event node represents a specific event instance, such as a specific event. The entity node or event node of the instance layer is associated with the concept node of the concept layer. For ease of understanding, taking the query of "Liu XX" of a certain actor as an example, the associated entity type may be "Person", indicating that the entity is classified as a person, and the concept type associated with the entity type "Person" may be "TaxoOfPerson", indicating that the concept is classified as a person, or more specifically, a celebrity, and the concept node associated with the concept type "TaxoOfPerson" may be "Actor", indicating that the concept node is an actor, and the instance layer node associated with the concept node "Actor" is "Liu XX", and the "Liu XX" node is the entity node to be queried.

[0051] It is worth noting that the knowledge graph in the implementation mode of this specification, in addition to the above-mentioned structured knowledge expression, also includes text information, which is used to represent the factual knowledge corresponding to the node. In some implementation modes, the text information includes text description information (description) and text knowledge information (Chunk).

[0052] In the implementation of this specification, each node in the knowledge graph may have a corresponding text description, which can be understood as explanatory information used to describe the node. Figure 2 In the example, taking the concept node "School" as an example, its corresponding text description information can be "School is an educational institution used to provide learning resources..." It can be seen that the text description information is the information used to describe the node. In the implementation manner of this specification, both the concept layer node and the instance layer node can have their own corresponding text description information to explain the node, that is, entity type nodes, concept type nodes, concept nodes, entity nodes, event nodes, etc., all have corresponding text description information. In some implementations, in the knowledge graph, the text description information can be established with the associated node through the describe predicate such as <School, describe, school is an educational institution used to provide learning resources...> in a fixed expression form.

[0053] See also Figure 2 As shown in the figure, in the knowledge graph, each node of the instance layer can have corresponding text knowledge information (Chunk). Text knowledge information refers to the original text knowledge used to record entities or events. It does not need to consider the structured form and has rich and complete semantic representation. For example, taking the event node "Liu XX won the Best Actor Award at the Academy Awards" as an example, its corresponding text knowledge information can be "Liu XX (English name Andy Liu), born on September 27, 1961 in Hong Kong, China, is a Chinese film and television actor, pop singer, and film producer. In 1981, he entered the entertainment industry for starring in his first film "Colorful Song". In January 2004, he won the Best Actor Award at the 10th Hong Kong Film Critics Society Awards for the feature film "XXX Has Great Wisdom". In June of the same year, he was shortlisted for the Best Actor Award at the 28th Popular Film Hundred Flowers Awards for the feature film "No X in the World". In addition, he also won the Best Actor Award at the 23rd Hong Kong Film Awards for the feature film "XXX Has Great Wisdom". It can be seen that the textual knowledge information contains a large amount of natural language text content, including not only the description of the event instance, but also other rich contextual text information related to the actor "Liu XX".

[0054] It can be understood that the knowledge graph needs to construct a structured knowledge expression consisting of nodes and edges based on the property graph. Therefore, for textual knowledge information, a text document can be established, and the entity node or event node and the associated text document can be linked as follows:<instanceID,supporting_chunks,chunks> The fixed data structure is established by the expression method, where instanceID represents the node identifier, supporting_chunks represents the text support relationship, and chunks represents the text document, that is, the triple<instanceID,supporting_chunks,chunks> It can be understood that: for a node instance whose node identifier is instanceID, the text knowledge information associated with it is chunks.

[0055] It is worth noting that in the implementation of this specification, a node can be associated with one text knowledge information or multiple text knowledge information, and this specification does not limit this. In the implementation of this specification, in the knowledge graph expression structure, by hierarchically representing the concept layer and the instance layer, the separation of conceptual knowledge and factual knowledge can be achieved, effectively reducing the complexity of constructing factual knowledge. At the same time, through the representation structure that integrates structured knowledge and text information, the answer can be queried from the text information in real time in combination with the user query phrase, which is explained in the query reasoning method below this specification.

[0056] Combination Figure 1 As shown, the knowledge base system also includes an inference engine, which refers to a functional module in the system used to process data. The inference engine usually analyzes the data structure in the knowledge base based on a series of predefined rules and execution logic to obtain results or infer implicit relationships.

[0057] In the implementation manner of this specification, the reasoning engine can perform knowledge retrieval based on the knowledge graph, and support the mutual index retrieval of structured knowledge and text knowledge in the knowledge graph, for example Figure 2 In the knowledge graph structure of the example, the reasoning engine can not only perform knowledge retrieval at each node in the concept layer and the instance layer, but also obtain the text information associated with the node based on the text knowledge information and text description information corresponding to the node relationship index.

[0058] In the implementation manner of this specification, when performing knowledge query reasoning, the reasoning engine can first search and reason in the structured knowledge of the knowledge graph. If the query result cannot be retrieved based on the structured knowledge alone, the associated text information can be indexed and the large language model can be called, so that the large language model can understand and summarize based on the text information and obtain the query result from the rich contextual information contained in the text information.

[0059] Based on the understanding of the knowledge semantic expression architecture of the above-mentioned knowledge base, the knowledge query reasoning method provided in the implementation mode of this specification is described below. The method can be executed and processed by the reasoning engine of the knowledge base.

[0060] like Figure 3 As shown, in some embodiments, the knowledge query reasoning method exemplified in this specification includes: S310: Obtain a user query phrase.

[0061] In the implementation manner of this specification, the user query phrase is also called a user query, which can be a query sentence obtained by the user through text input, or a query sentence converted into text after being input through voice, image or other forms.

[0062] For example, in one example, the knowledge base system of this manual can be deployed in a human-computer interaction system. On the user-end device, user input information can be obtained through text input, voice input, gesture input, image input, etc., and combined with methods such as query rewriting, voice-to-text, OCR (Optical Character Recognition), etc., the user input information can be converted into user query phrases.

[0063] In the implementation manner of this specification, the user query phrase includes query entities and query relationships. For example, in one example, the user query phrase is "What work did Liu XX win the 23rd Academy Awards for?", where "Liu XX", "Academic Awards for Films", etc. are query entities, and their corresponding query relationships are "received honors", "performed in works", etc.

[0064] S320: Retrieve the associated nodes on the knowledge graph based on the user query phrase.

[0065] In the implementation of this specification, the associated node refers to the node related to the query entity included in the user query phrase retrieved from the knowledge graph, that is, the node in the knowledge graph that matches the query condition. These associated nodes constitute a knowledge subgraph of a query process. The knowledge subgraph can be understood as a subset extracted from the entire knowledge graph, which contains all entities, relationships, and attributes related to the query. Combined with the above, it can be seen that the data structure in the knowledge graph is expressed in a certain hierarchy, so the associated nodes retrieved from the knowledge graph generally also include multiple nodes at different levels.

[0066] like Figure 4 As shown, in some embodiments, in the knowledge query reasoning method exemplified in this specification, the process of retrieving associated nodes on the knowledge graph based on the user query phrase includes: S321. Generate a query list of the knowledge graph based on the user query phrase.

[0067] S322. According to the query entity and the query relationship, the associated nodes are retrieved in the knowledge graph.

[0068] S323: Determine whether a query result is retrieved according to the attributes of the associated node.

[0069] In the implementation mode of this specification, after obtaining the user query phrase, the inference engine must first convert the user query phrase expressed in natural language into a graph query expression in computer logic language. The graph query expression can be in the form of a query list. Depending on the number of conditions in the user query phrase, the query list can include one or more expressions. Each expression in the query list can be regarded as a query sub-problem. A query sub-problem includes a corresponding query entity and a query relationship.

[0070] For example, in an example, the user query phrase is "What are the movies in which Liu XX and Liang XX co-starred, and in which of them did Liu XX win the Academy Award?" The inference engine can first identify the key entities "Liu XX" and "Liang XX" and the corresponding query relations "co-starred" and "obtained" from the user query phrase, and then the query list generated by the inference engine can include the following two sub-questions: Sub-question 1: {subject: Liu XX, predicate: co-starred, object: Liang XX}, which means the movies co-starred by Liu XX and Liang XX; Sub-question 2: {subject: Liu XX, predicate: won, object: Academy Award}, which means the movies in which Liu XX won the Academy Award.

[0071] Then, the inference engine can traverse the knowledge graph nodes to find the corresponding associated nodes according to each sub-question in the query list. Figure 2 The knowledge graph structure shown in the figure takes the query entity "Liu XX" as an example. By traversing the knowledge graph nodes, the entity type node "Person", the concept type node "TaxoOfPerson", and the concept node "Actor" at the concept layer can be retrieved, and then routed to the entity node "Liu XX" at the instance layer. After that, according to the query relationship "obtained", it can be further associated with the event node "Liu XX won the Academy Award". Similarly, for each query sub-question, the nodes of the knowledge graph are traversed and retrieved according to the query entity and query relationship in turn, and the associated nodes communicated by these nodes can be obtained.

[0072] In the above example, the inference engine can retrieve a list of movies in which Liu XX and Liang XX co-starred based on sub-question 1, and a list of all movies in which Liu XX won Academy Awards based on sub-question 2. The two movie lists are intersected, for example, the movie "AAA" is obtained after the intersection, and the query result "AAA" can be returned to the user.

[0073] S330: In response to not finding a query result according to the associated node, obtaining text information corresponding to the associated node.

[0074] In the above example, the inference engine can retrieve the query results based only on the structured knowledge on the knowledge graph. In some cases, the query results may not be retrieved based only on the structured knowledge of the graph. For example, in one example, suppose the user further asks "What other activities did Liu XX participate in at the Academy Awards?" Since the structured knowledge of the graph lacks contextual information, the query results cannot be retrieved based on the structured knowledge alone, and the corresponding text information needs to be indexed.

[0075] Combination Figure 2 As shown, the inference engine can extract the text information corresponding to these nodes based on the retrieved associated nodes. In combination with the above, it can be seen that in some embodiments, the text information may include the above-mentioned text description information (description) and text knowledge information (Chunk). For example, in an example, taking the concept node "Actor" as an example, based on the above-mentioned <actor, describe, actor refers to the profession of a performer who plays a specific role...>, the inference engine can extract the text description information corresponding to each associated node.

[0076] At the same time, for entity nodes or event nodes, in addition to extracting the corresponding text description information, the inference engine can also<instanceID,supporting_chunks,chunks> The triple structure of the node is used to find the text document associated with the node. The text document is the text knowledge information. For example, taking the event node "Liu XX won the Hong Kong Film Awards" as an example, the text knowledge information associated with the event node may include "Liu XX won the Best Actor Award at the xth Hong Kong Film Awards for the movie "AAA". Liu XX gave a speech at the award ceremony. ... After the award ceremony, Liu XX also participated in the on-site charity fundraising activities and donated to charity organizations. ... " Through the above process, the inference engine can extract the text description information and text knowledge information corresponding to all associated nodes, which is the text information corresponding to the associated nodes.

[0077] S340: Based on the text information and the user query phrase, a large language model is called to generate a query result.

[0078] In the implementation manner of this specification, after the inference engine extracts the text information of the associated node, it can call the large language model to generate the query result based on the associated information and the original user query phrase.

[0079] It can be understood that when the reasoning engine cannot retrieve the query results based only on the structured knowledge of the knowledge graph, the large language model can be called to use the text understanding and induction capabilities of the large language model to find the corresponding answers from the associated text information and generate query results. Figure 5 Provide explanation.

[0080] like Figure 5 As shown, in some embodiments, the knowledge query reasoning method exemplified in this specification, based on text information and user query phrases, calls a large language model to generate query results, including: S341. Generate model prompt words based on text information and user query phrases.

[0081] S342: input the model prompt word into the large language model, and the large language model generates a query result corresponding to the user query phrase based on the text information.

[0082] In the implementation manner of this specification, the model prompt word refers to the input text of the large language model. In order to enable the large language model to better understand the task intent, the search engine can rewrite the original user query phrase in combination with the text information to obtain the corresponding model prompt word.

[0083] Let’s use the previous example to illustrate. The original user query phrase is “What other activities did Liu XX participate in at the Academy Awards?” The rewritten model prompt words can be as follows: "The user's question now is 'What other activities did Liu XX participate in at the Academy Awards ceremony?' Please refer to the text information below and give the user the correct answer.

[0084] Text message 1: Liu XX won the Best Actor award at the xth Hong Kong Film Awards for his role in the movie "AAA". Liu XX gave a speech at the awards ceremony... Text information 2: The movie "AAA" is a police and gangster film directed by XXX and starring Liu XX, Liang XX, Huang XX, etc. Text message 3:…” It can be seen that in the rewritten model prompt word, the text information extracted previously is integrated into the prompt word, and then the inference engine can input the rewritten model prompt word into the large language model, and the large language model can understand and summarize the corresponding answer from the text information, thereby generating a query result. After the large language model generates the query result, the inference engine can return the query result generated by the large language model to the user end, and this manual will not go into details.

[0085] From the above, it can be seen that in the implementation mode of this specification, through the fusion representation of structured knowledge and text knowledge in the knowledge graph, on the one hand, the dimensionality disaster and difficult maintenance problems caused by the excessive structuring of the knowledge graph can be avoided. The knowledge graph only needs a simple structure to reduce the cost and complexity of the graph. At the same time, text knowledge can make up for the lack of contextual information of structured knowledge; on the other hand, by utilizing the text understanding and inductive summarization capabilities of the large language model, query results can be quickly generated from text knowledge, thereby improving the retrieval efficiency of the knowledge base for text knowledge. Moreover, the text knowledge in the knowledge graph can also make up for the lack of factual knowledge of the large language model, thereby achieving two-way enhancement of the performance of the large language model and the knowledge graph.

[0086] In some embodiments, this specification provides a knowledge query reasoning device, which can be applied to the knowledge base system or knowledge graph of any of the aforementioned embodiments, wherein the nodes in the knowledge graph are associated with text information, and the text information is used to describe the factual knowledge corresponding to the nodes.

[0087] like Figure 6 As shown, in some implementations, the knowledge query reasoning device exemplified in this specification includes: An input acquisition module 10 is configured to acquire a user query phrase and retrieve associated nodes on the knowledge graph based on the user query phrase, wherein the associated nodes represent nodes associated with a query entity included in the user query phrase; The text acquisition module 20 is configured to acquire text information corresponding to the associated node in response to not retrieving a query result according to the associated node; The model calling module 30 is configured to call a large language model to generate a query result based on the text information and the user query phrase.

[0088] In some implementations, the input acquisition module 10 is configured to: Generate a query list of the knowledge graph based on the user query phrase, wherein the query list includes at least one query sub-question, and the query sub-question includes one or more of the query entities and query relations; According to the query entity and the query relationship, retrieve the associated node in the knowledge graph; It is determined whether the query result is retrieved according to the attribute of the associated node.

[0089] In some implementations, the knowledge graph includes an instance layer and a concept layer, and the input acquisition module 10 is configured to: According to the query entity and the query relationship, the entity type node, concept type node and concept node associated with the query entity are determined at the concept layer, and the entity node and event node associated with the query entity are determined at the instance layer, and the associated nodes include the entity type node, the concept type node, the concept node, the entity node and the event node.

[0090] In some implementations, the text acquisition module 20 is configured to: In response to the query result not being retrieved according to the attribute of the associated node, the text description information corresponding to the entity type node, the concept type node, and the concept node, as well as the text description information and text knowledge information corresponding to the entity node and the event node are obtained, and the text information includes the text description information and the text knowledge information; wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

[0091] In some implementations, the text acquisition module 20 is configured to: For each node, the text description information and / or text knowledge information associated with the node is obtained according to the node identification and text support relationship of the node.

[0092] In some implementations, the model calling module 30 is configured to: Generate a model prompt word based on the text information and the user query phrase; The model prompt word is input into the large language model, so that the large language model generates a query result corresponding to the user query phrase based on the text information.

[0093] In some embodiments, the present specification provides a storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in any of the above embodiments.

[0094] In some embodiments, this specification provides a computer program product, which is used to implement the method described in any of the above embodiments.

[0095] Figure 7is a schematic structural diagram of a knowledge base system provided by an exemplary embodiment. Figure 7 The system shown can implement the functions of the aforementioned reasoning engine, storage medium and computer program product.

[0096] Please refer to Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

Claims

1. A knowledge query reasoning method, It is characterized in that Applied to a knowledge graph, a node in the knowledge graph is associated with text information, and the text information is used to describe the factual knowledge corresponding to the node. The method includes: Acquire a user query phrase, and retrieve associated nodes on the knowledge graph based on the user query phrase, wherein the associated nodes represent nodes associated with the query entity included in the user query phrase; In response to not retrieving a query result according to the associated node, acquiring text information corresponding to the associated node; Based on the text information and the user query phrase, a large language model is called to generate a query result.

2. The method according to claim 1, It is characterized in that The retrieving the associated nodes on the knowledge graph based on the user query phrase includes: Generate a query list of the knowledge graph based on the user query phrase, wherein the query list includes at least one query sub-question, and the query sub-question includes one or more of the query entities and query relations; According to the query entity and the query relationship, retrieve the associated node in the knowledge graph; It is determined whether the query result is retrieved according to the attribute of the associated node.

3. The method according to claim 2, It is characterized in that The knowledge graph includes an instance layer and a concept layer. The step of retrieving the associated node in the knowledge graph according to the query entity and the query relationship includes: According to the query entity and the query relationship, the entity type node, concept type node and concept node associated with the query entity are determined at the concept layer, and the entity node and event node associated with the query entity are determined at the instance layer, and the associated nodes include the entity type node, the concept type node, the concept node, the entity node and the event node.

4. The method according to claim 3, It is characterized in that In response to not finding a query result according to the associated node, obtaining text information corresponding to the associated node includes: In response to the query result not being retrieved according to the attribute of the associated node, the text description information corresponding to the entity type node, the concept type node, and the concept node, as well as the text description information and text knowledge information corresponding to the entity node and the event node are obtained, and the text information includes the text description information and the text knowledge information; wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

5. The method according to claim 3, It is characterized in that The obtaining of the text description information corresponding to the entity type node, the concept type node, and the concept node, as well as the text description information and text knowledge information corresponding to the entity node and the event node, includes: For each node, the text description information and / or text knowledge information associated with the node is obtained according to the node identifier and the text support relationship of the node.

6. The method according to any one of claims 1 to 5, It is characterized in that The step of calling a large language model to generate a query result based on the text information and the user query phrase includes: Generate a model prompt word based on the text information and the user query phrase; The model prompt word is input into the large language model, so that the large language model generates a query result corresponding to the user query phrase based on the text information.

7. A knowledge base system, It is characterized in that include: Large language model; A knowledge graph includes nodes and edges connecting the nodes, wherein the nodes are associated with text information, and the text information is used to describe the factual knowledge corresponding to the nodes; The inference engine is configured to retrieve associated nodes on the knowledge graph based on a user query phrase, and if no query result is retrieved, call the large language model to generate a query result based on text information corresponding to the associated nodes and the user query phrase, wherein the associated nodes represent nodes associated with the query entities included in the user query phrase.

8. The system according to claim 7, It is characterized in that The knowledge graph includes an instance layer and a concept layer, the concept layer includes entity type nodes, concept type nodes and concept nodes, and the instance layer includes entity nodes and event nodes; The text information includes text description information corresponding to the entity type node, the concept type node, the concept node, the entity node, and the event node, as well as text knowledge information corresponding to the entity node and the event node, wherein the text description information refers to information used to describe the node, and the text knowledge information refers to factual knowledge information associated with the node.

9. The system according to claim 7, It is characterized in that The inference engine is configured to generate a model prompt word based on the text information and the user query phrase, input the model prompt word into the large language model, and the large language model generates a query result corresponding to the user query phrase based on the text information.

10. A knowledge query reasoning device, It is characterized in that Applied to a knowledge graph, a node in the knowledge graph is associated with text information, and the text information is used to describe the factual knowledge corresponding to the node. The device includes: An input acquisition module is configured to acquire a user query phrase and retrieve associated nodes on the knowledge graph based on the user query phrase, wherein the associated nodes represent nodes associated with a query entity included in the user query phrase; a text acquisition module, configured to acquire text information corresponding to the associated node in response to no query result being retrieved according to the associated node; The model calling module is configured to call a large language model to generate a query result based on the text information and the user query phrase.

11. A storage medium, It is characterized in that Computer instructions are stored, and the computer instructions are used to make a computer execute the method according to any one of claims 1 to 6.

12. A computer program product, It is characterized in that The computer program product is used to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Medical examination knowledge graph construction method based on LIS

    CN110059195A

  • Knowledge graph construction method and device

    CN113268606A

  • Graph data semantic search method based on comparative learning and large language model

    CN116450867A

  • Knowledge question and answer method, device and equipment and storage medium

    CN116680384A

  • Intelligent medical question and answer method based on Chinese medical knowledge

    CN116881413A

Cited By

  • Generative knowledge graph completion method and system combined with dynamic narration

    CN121390244A

  • A generative knowledge graph completion method and system combining dynamic narrative.

    CN121390244B