Intelligent question answering method and apparatus
By combining a two-layer knowledge graph with RAG technology, and utilizing community summaries and subgraph text descriptions, a global answer is generated, which solves the problem of traditional RAG technology lacking a global perspective in intelligent question answering, and achieves higher accuracy and comprehensiveness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NUCTECH JIANGSU CO LTD
- Filing Date
- 2024-12-30
- Publication Date
- 2026-07-07
AI Technical Summary
Traditional RAG technology lacks a global perspective in the field of intelligent question answering, making it difficult to answer complex relationship questions and resulting in insufficient depth of knowledge understanding.
A two-layer knowledge graph is adopted. The most similar entities are obtained from the vector knowledge base through the intelligent question-answering big language model to generate community summaries. The text descriptions of the subgraphs are obtained from the underlying knowledge graph and combined with the input text to generate global answers.
It improves the accuracy and comprehensiveness of intelligent question answering, makes up for the shortcomings of traditional RAG technology in global query-focused question answering, and provides a more comprehensive understanding of knowledge.
Smart Images

Figure CN119917622B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of large language model technology, and more specifically, to intelligent question answering methods and apparatus. Background Technology
[0002] Intelligent question answering is one of the important application areas of Large Language Models (LLM). Training large language models with hundreds of billions of parameters on massive datasets allows them to fully learn the semantic information and contextual relationships of text, enabling a deeper understanding and processing of natural language text. However, due to limitations in the training dataset, large language models have certain limitations in terms of timeliness and accuracy.
[0003] Therefore, a new intelligent question-answering method and device are needed. Summary of the Invention
[0004] Embodiments of this application provide an intelligent question-answering method and apparatus that can provide a global perspective on community summaries through a two-layer knowledge graph, thereby improving the accuracy and comprehensiveness of RAG technology.
[0005] According to a first aspect of this application, an intelligent question answering method is provided, comprising: receiving input text; obtaining the top N entities with the highest similarity from a vector knowledge base based on the input text, wherein N is an integer greater than or equal to 1; obtaining N corresponding communities from the top-level knowledge graph of a two-layer knowledge graph based on the top N entities; generating multiple intermediate input texts by an intelligent question answering large language model based on the input text and community summaries of the N communities; obtaining N corresponding subgraphs from the bottom-level knowledge graph of the two-layer knowledge graph based on the top N entities; generating text descriptions of the N subgraphs by the intelligent question answering large language model; and generating a global answer by the intelligent question answering large language model based on the input text, the multiple intermediate input texts, and the text descriptions of the N subgraphs.
[0006] According to an embodiment of the first aspect of this application, obtaining the top N entities with the highest similarity from a vector knowledge base based on the input text includes: vectorizing the input text to obtain vectorized input text; and performing similarity calculation on the vectorized input text in the vector knowledge base to obtain the top N entities with the highest similarity.
[0007] According to an embodiment of the first aspect of this application, generating multiple intermediate input texts from an intelligent question-answering large language model based on the input text and the community summaries of the N communities includes: generating N corresponding intermediate answers and usefulness scores from the intelligent question-answering large language model based on the input text and the community summaries of the N communities; obtaining the top K intermediate answers from the N intermediate answers based on the usefulness scores, and concatenating the top K intermediate answers in descending order of usefulness scores and dividing them into the multiple intermediate input texts according to a fixed string length.
[0008] According to an embodiment of the first aspect of this application, generating text descriptions of the N subgraphs from the intelligent question-answering large language model includes: generating text descriptions of the N subgraphs from the intelligent question-answering large language model based on entities and relationships in each subgraph.
[0009] According to an embodiment of the first aspect of this application, the two-layer knowledge graph is automatically created by the intelligent question-answering large language model using a first prompt template, wherein the first prompt template includes a task objective, execution steps, and contextual examples.
[0010] According to an embodiment of the first aspect of this application, the top-level knowledge graph is automatically created by the intelligent question-answering large language model using the first prompt template based on a user-predefined dataset, and wherein the bottom-level knowledge graph is automatically created by the intelligent question-answering large language model using the first prompt template based on a professional standard dataset.
[0011] According to an embodiment of the first aspect of this application, the top-level knowledge graph includes entities, relations, and communities, the bottom-level knowledge graph includes entities and relations, and wherein entities in the top-level knowledge graph are linked to entities in the bottom-level knowledge graph by the intelligent question-answering big language model based on similarity calculation.
[0012] According to an embodiment of the first aspect of this application, the entity includes an entity name, an entity type, and an entity description; the relationship includes a source entity, a target entity, a relationship description, and a relationship weight; and the community is a set of entities and relationships obtained by aggregating entities and relationships in the top-level knowledge graph based on a community clustering algorithm.
[0013] According to an embodiment of the first aspect of this application, the community summary of each community in the top-level knowledge graph is automatically created by the intelligent question-answering big language model using a second prompt template, wherein the second prompt template includes a task objective and a community summary format.
[0014] According to an embodiment of the first aspect of this application, the vector knowledge base is created by: vectorizing entities, relations, and communities in the top-level knowledge graph to obtain vectorized entities, vectorized relations, and vectorized communities, wherein the vector knowledge base includes the entities, the relations, the communities, the vectorized entities, the vectorized relations, and the vectorized communities.
[0015] According to a second aspect of this application, an intelligent question-answering device is provided, comprising: a processor and a memory storing instructions that, when executed by the processor, cause the processor to perform the method of the first aspect of this application.
[0016] According to a third aspect of this application, a computer-readable storage medium is provided having instructions stored thereon that, when executed by a computer, cause the computer to perform the method of the first aspect of this application.
[0017] According to embodiments of this application, the intelligent question-answering method and apparatus, by obtaining the top N entities with the highest similarity to the input text from a vector knowledge base, can obtain the corresponding N communities from the top-level knowledge graph in a two-layer knowledge graph, and can generate multiple intermediate input texts based on the input text and community summaries of the N communities. Furthermore, it can obtain N subgraphs corresponding to the top N entities from the bottom-level knowledge graph in the two-layer knowledge graph, and can generate text descriptions of these N subgraphs. Based on this, a global answer can be generated based on the input text, multiple intermediate input texts, and the text descriptions of the N subgraphs. By combining a two-layer knowledge graph with RAG technology, utilizing the complex relationship query capabilities of the two-layer knowledge graph and the global perspective of community summaries, the shortcomings of traditional RAG technology in global query-focused question answering in the field of intelligent question answering can be overcome, and the accuracy and comprehensiveness of intelligent question answering using RAG technology can be improved. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on the drawings without creative effort.
[0019] Figure 1 This is a flowchart of an intelligent question-answering method according to an embodiment of this application; and
[0020] Figure 2 This is a schematic diagram of the hardware structure of an intelligent question-answering device according to an embodiment of this application. Detailed Implementation
[0021] The features and exemplary embodiments of various aspects of this application will now be described in detail. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain this application and are not configured to limit this application. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples of this application.
[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0023] The features and exemplary embodiments of various aspects of this application will now be described in detail. Furthermore, the features, structures, or characteristics described below may be combined in any suitable manner in one or more embodiments.
[0024] Intelligent question answering is one of the important application areas of Large Language Models (LLM). By training large language models with hundreds of billions of parameters on massive amounts of data, they can fully learn the semantic information and contextual relationships of text, and deeply understand and process natural language text.
[0025] Retrieval-Augmented Generation (RAG) technology transforms input text into vectorized input text, retrieves text blocks related to the input text from a vector knowledge base, combines them with the input text, and inputs them into a large language model to generate a response.
[0026] However, traditional RAG technology has the following shortcomings: (1) it focuses more on local text retrieval and is still insufficient in the whole document query-focused summarization (QFS) task, lacking a global perspective for answering questions; (2) it is difficult to answer complex relational questions and the depth of knowledge understanding is insufficient.
[0027] Knowledge graphs can extract and integrate knowledge text into a graph, and can apply graph theory algorithms to provide a global understanding of knowledge and complex multi-hop relationship queries. Therefore, the inventors of this application conceived of combining knowledge graphs with RAG technology to compensate for the shortcomings of traditional RAG technology in global query-focused question answering in the field of intelligent question answering.
[0028] Embodiments of this application provide an intelligent question-answering method and apparatus that can provide a global perspective on community summaries through a two-layer knowledge graph, thereby improving the accuracy and comprehensiveness of RAG technology.
[0029] Figure 1 This is a flowchart of an intelligent question-answering method according to an embodiment of this application. Figure 1 As shown, the intelligent question-answering method according to an embodiment of this application includes the following steps S110 to S170.
[0030] S110: Receive input text.
[0031] In one embodiment, the input text can be the user's question text.
[0032] S120: Based on the input text, obtain the top N entities with the highest similarity from the vector knowledge base, where N is an integer greater than or equal to 1.
[0033] In one embodiment, step S120 may include: vectorizing the input text to obtain vectorized input text; and calculating similarity in a vector knowledge base based on the vectorized input text to obtain the top N entities with the highest similarity.
[0034] For example, text vector representation models can be used to vectorize the input text, thereby obtaining vectorized input text. These models could be BGE-M3, BGE-small, BGE-large, TFIDF, word-to-vector, etc. This application does not impose any limitations on this.
[0035] Furthermore, the vectorized input text can be compared with entities in a vector knowledge base (e.g., similarity calculation) to obtain the top N entities in the vector knowledge base that are most similar to the vectorized input text. Here, N can be an integer greater than or equal to 1, such as 2, 4, 6, etc. In addition, similarity calculation can include, for example, calculating cosine similarity, Euclidean similarity, Euclidean distance, Manhattan distance, etc. This application does not impose any limitations on this.
[0036] S130: Based on the first N entities, obtain the corresponding N communities from the top-level knowledge graph in the two-layer knowledge graph.
[0037] In one embodiment, the two-layer knowledge graph includes a top-level knowledge graph and a bottom-level knowledge graph. In one embodiment, the top-level knowledge graph includes entities, relationships, and communities, and the bottom-level knowledge graph includes entities and relationships.
[0038] In one embodiment, an entity includes an entity name, an entity type, and an entity description. For example, the format of an entity can be: ("entity"<|><entity_name> <|><entity_type> <|><entity_description> ).
[0039] In one embodiment, a relationship includes a source entity, a target entity, a relationship description, and a relationship weight. For example, the format of a relationship can be: ("relationship"<|><source_entity> <|><target_entity> <|><relationship_description> <|><relationship_strength> ).
[0040] In one embodiment, the two-layer knowledge graph is automatically created by an intelligent question-answering large language model using a first prompt template, wherein the first prompt template includes a task objective, execution steps, and contextual examples.
[0041] For example, the intelligent question-answering large language model can be a general large language model, which may include, for example, GLM1, GLM2, GLM3, GLM4, QWEN, etc. This application does not impose any restrictions on this.
[0042] For example, the first prompt template can include a goal, which tells the intelligent question-answering language model what task to perform. For instance, the goal of the first prompt template could be to extract different types of entities from the text, and the relationships between those entities. The pseudocode for the goal is shown below:
[0043] -Goal-
[0044] Given a text document that is potentially relevant to this activity and a list of entity types, identify all entities of those types from the text and all relationships among the identified entities.
[0045] For example, the first prompt template may include execution steps to inform the intelligent question-answering large language model of the canonical steps for extracting entities and relations. The pseudocode for the execution steps is shown below:
[0046] -Steps-
[0047] 1.Identify all entities.For each identified entity, extract the following information:
[0048] -entity_name: Name of the entity, capitalized
[0049] -entity_type: One of the following types: [hs_code, goods, character]
[0050] -entity_description:Comprehensive description of the entity′sattributes and activities Format each entity as(″entity″<|> <entity-name><|><entity_type><|> <entity-description>
[0051] 2.From the entities identified in step 1,identify allpairs of(source_entity,target_entity)that are*clearly related*to each other.
[0052] For each pair of related entities,extract the following information:
[0053] -source_entity:name of the source entity,as identified in step 1
[0054] -target_entity:name of the target entity,as identified in step 1
[0055] -relationship_description:explanation as to why you think the sourceentity and the target entity are related to each other
[0056] -relationship_strength:a numeric score indicating strength of therelationship between the source entity and target entity
[0057] Format each relationship as(″relationship″<|><source_entity><|><target_entity><|><relationship_description><|><relationship_strength>)
[0058] 3.Return output as a single list of all the entities and relationships identified in steps 1 and 2.Use**##**as the list delimiter.
[0059] 4.when finished, output<|COMPLETE|>|
[0060] For example, the first prompt template can include contextual examples to inform the intelligent question-answering large language model of entities and relationships. The pseudocode for the contextual example is shown below:
[0061] Example 1:
[0062] Entity_types: [hs_code, goods, character]
[0063] Text: Fresh coconuts with the inner shell (inner husk) are classified as coconuts, specifically under subheading 08011. Because they are stored fresh and processed by removing the inner shell, this product should be classified under subheading 0801120000.
[0064] #############
[0065] Output:
[0066] ("entity"<|>"08011"<|>"hscode"<|>"08011 is a first-level subheading, corresponding to coconut, belonging to the tissue classification.")##
[0067] ("entity"<|>"0801120000"<|>"hs_code"<|>"0801120000 is a second-level subheading under the first-level subheading 08011, belonging to the tissue classification. Coconuts stored fresh and processed by removing the inner shell belong to this category.")##
[0068] ("entity"<|>"coconut"<|>"goods"<|>"coconut is a type of goods under subheading 08011, and is an example of goods.")##
[0069] ("entity"<|>"fresh"<|>"character"<|>"Coconuts can be preserved fresh, which is a characteristic of coconuts.")##
[0070] ("entity"<|>"Fresh, unshelled (inner husk) coconut"<|>"goods"<|>"Coconuts that are stored fresh and processed with the inner husk (inner husk) intact. This is a more detailed description of the coconut product.")##
[0071] ("entity"<|>"Removing the inner shell (inner pericarp)"<|>"character"<|>"The processing method for coconuts can be removing the inner shell; this is a characteristic of coconuts.")##
[0072] ("relationship" <|> "0801120000" <|> "08011" <|> "Subheading 08011100 is a specific subheading under heading 08011, indicating the hierarchical inclusion relationship between them." <|> 7)##
[0073] ("relationship"<|>"Coconut"<|>"08011"<|>"Coconut is a commodity name under subheading 08011, illustrating the illustrative relationship between them."<|>8)##
[0074] ("relationship"<|>"fresh"<|>"coconut"<|>"This is a way of preserving coconuts, a characteristic of coconuts"<|>8)##
[0075] ("relationship"<|>"Dried"<|>"Coconut"<|>"This is a way of preserving coconuts, a characteristic of coconuts"<|>8)##
[0076] ("relationship"<|>"Fresh coconuts with unremoved inner shells"<|>"0801120000"<|>"Coconuts with unremoved inner shells are a type of goods under subheading 08011200, illustrating the illustrative relationship between them."<|>8)<|COMPLETE|>
[0077] As an example, by concatenating the first prompt template mentioned above with the dataset used to extract the knowledge graph, and inputting it into the intelligent question-answering large language model, the automatic extraction of entities and relationships can be achieved.
[0078] In one embodiment, the text in the dataset used to extract the knowledge graph can be segmented to obtain multiple text units (tokens). For example, any suitable tokenizer (e.g., GLM, LLAMAINDEX, etc.) can be used to segment the text. Further, the first prompt template and the text units can be concatenated and input into the intelligent question-answering large language model to generate entities and relations. Furthermore, semantic disambiguation can be performed on the generated entities and relations. For example, different texts pointing to the same entity from multiple text units can be merged. In this way, the final entities and relations can be formed.
[0079] In one embodiment, the top-level knowledge graph is automatically created by an intelligent question-answering large language model using a first-prompt template based on a user-predefined dataset. For example, the user-predefined dataset could be documents provided by the user. For instance, using a commodity tariff code knowledge graph as an example, the user-predefined dataset could include declaration data from the customs clearance system, manual inspection data, etc., as well as administrative rulings, classification Q&A articles, and classification professional certification articles from the General Administration of Customs website, etc. As another example, using a medical knowledge graph as an example, the user-predefined dataset could include hospital outpatient records, prescription records, medical papers, etc.
[0080] In one embodiment, the underlying knowledge graph is automatically created by the intelligent question-answering large language model using a first prompt template based on a professional standard dataset. For example, the professional standard dataset can be industry-standard data. For instance, using a commodity tariff code knowledge graph as an example, the professional standard dataset could include the *Customs Tariff*, *Notes to the Customs Tariff*, *Notes to the Domestic Subheadings of the Customs Tariff*, etc. As another example, using a medical knowledge graph as an example, the professional standard dataset could include medical dictionaries, medical textbooks, etc.
[0081] In one embodiment, entities in the top-level knowledge graph are linked to entities in the bottom-level knowledge graph by an intelligent question-answering large language model based on similarity calculations. For example, entities in both the top-level and bottom-level knowledge graphs can be vectorized separately, and then similarity calculations can be performed to obtain the relevance between them. As an example, cosine similarity can be calculated, defined as: highly relevant (>0.95), somewhat relevant (>0.9), moderately relevant (≥0.8), and irrelevant (<0.8). Thus, entities in the top-level and bottom-level knowledge graphs can be linked using an intelligent question-answering large language model to form a two-layer knowledge graph.
[0082] In one embodiment, a community is a set of entities and relationships obtained by aggregating entities and relationships in the top-level knowledge graph based on a community clustering algorithm. For example, a community clustering algorithm can be applied to the top-level knowledge graph to divide it into multiple communities at different levels. It should be noted that the lower-level knowledge graph provides dictionary-like professional knowledge and legal and regulatory knowledge, which is used for retrieving linked subgraphs of entities in the top-level knowledge graph. Therefore, it does not need to be clustered in the lower-level knowledge graph; that is, the lower-level knowledge graph does not include communities.
[0083] In one embodiment, the top-level knowledge graph can have four levels of communities, such as c0 community, c1 community, c2 community, and c3 community, where c0 community is the highest level community, c3 community is the lowest level community, and a lower-level community is a sub-community of a higher-level community; for example, c2 community is a sub-community of c1 community. It is worth noting that the top-level knowledge graph can have any number of community levels, and this application does not impose any limitation on this.
[0084] In one embodiment, the input text may include information specifying the community level. For example, a user can specify the community level of the top-level knowledge graph in the question text, such as community c1. In this case, the corresponding N communities obtained in step S120 are communities at the specified level, such as community c1. Alternatively, the input text may not include information specifying the community level; in this case, the corresponding N communities obtained in step S120 are the default highest-level communities, such as community c0.
[0085] In one embodiment, the community clustering algorithm can be any suitable algorithm for community clustering in knowledge graphs, and this application does not impose any restrictions on it. For example, the community clustering algorithm can be the Louvain algorithm, which divides communities based on the principle of maximizing modularity. For example, the modularity calculation formula is as follows:
[0086]
[0087] Where Q is the modularity value, m is the number of edges, and k i Let k be the degree of node i. j Let be the degree of node j, A be the adjacency matrix, and c be the community. When the communities of nodes i and j are the same, δ(c) = ... i ,c j ) = 1, otherwise, δ(c) = 1. i ,c j ) = 0.
[0088] In one embodiment, the community summary for each community in the top-level knowledge graph is automatically created by the intelligent question-answering big language model using a second prompt template, wherein the second prompt template includes a task objective and a community summary format.
[0089] For example, the second prompt template can include a goal, which informs the intelligent question-answering language model of the task to be performed. For instance, the task goal of the first prompt template could be generating a community summary. The pseudocode for the task goal is shown below:
[0090] #Goal
[0091] Write a comprehensive report of a community, given a list of entities that belong to the community as well as their relationships and optional associated claims. The report will be used to inform decision-makers aboutinformation associated with the community and their potential impact. The content of this report includes an overview of the community's key entities, their legal compliance, technical capabilities, reputation, and noteworthy claims.
[0092] For example, the second prompt template may include a community summary format, used to inform the intelligent question-answering large language model of the community summary format to be output. The community summary format includes a community title, a community introduction, and key point descriptions. For example, the community summary may include: (1) a community title (TITLE), which should be as concise as possible; (2) a community introduction (SUMMARY), which provides a general summary of the overall structure of the community, explaining the relevant important information of the entities and the relationships between them; and (3) key point descriptions (DETAILED FINDINGS), which details 5-10 key points of the community, with a brief description for each key point. The pseudocode for the community summary format is shown below:
[0093]
[0094] As an example, by concatenating the second prompt template mentioned above with the entities and relationships within the community, and inputting this text into the intelligent question-answering large language model, a community summary can be automatically generated. The community summary can provide complete coverage of the input document it represents and can also provide an index to the underlying knowledge graph. Therefore, community clustering can abstract and summarize textual information, providing a global perspective on knowledge understanding.
[0095] In one embodiment, the vector knowledge base is created by vectorizing entities, relations, and communities in the top-level knowledge graph to obtain vectorized entities, vectorized relations, and vectorized communities, wherein the vector knowledge base includes entities, relations, communities, vectorized entities, vectorized relations, and vectorized communities.
[0096] For example, text vector representation models can be used to vectorize entities, relations, and communities in a top-level knowledge graph, thereby obtaining vectorized entities, vectorized relations, and vectorized communities. For example, text vector representation models could be BGE-M3, BGE-small, BGE-large, TFIDF, word-to-vector, etc. This application does not impose any limitations on this.
[0097] In one embodiment, the vector knowledge base can use any suitable database. This application does not impose any restrictions on this. For example, the Lucene database can be used as the vector storage database, which can provide efficient similar vector retrieval capabilities, and so on.
[0098] S140: Community summaries based on input text and N communities are generated by an intelligent question-answering large language model, which generates multiple intermediate input texts.
[0099] In one embodiment, step S140 may include: generating N intermediate answers and usefulness scores from the community summaries of N communities using an intelligent question-answering large language model based on the input text and the community summaries of N communities; obtaining the top K intermediate answers from the N intermediate answers based on the usefulness scores, and concatenating the top K intermediate answers in descending order of usefulness scores and dividing them into multiple intermediate input texts of a fixed length.
[0100] For example, the community summary of each of N communities can be concatenated with the input text and fed into a large language model for intelligent question answering to generate corresponding intermediate answers and usefulness scores. In one embodiment, the usefulness score can be a rating given by the large language model for evaluating the intermediate answer. For example, the usefulness score can include 1-10 points, where 10 points indicates that the intermediate answer is the most useful and 1 point indicates that the intermediate answer is not useful.
[0101] For example, the usefulness scores of N intermediate answers can be sorted in descending order to obtain the top K intermediate answers with the highest scores. Then, these top K intermediate answers can be concatenated in descending order of score and divided into multiple intermediate input texts of a fixed length. For instance, when the segment length is set to 300 tokens (a token is the basic unit of input for a large language model, representing the smallest unit into which text data is segmented), each intermediate input text is a string consisting of 300 tokens.
[0102] S150: Based on the first N entities, obtain the corresponding N subgraphs from the lower-level knowledge graph in the two-layer knowledge graph.
[0103] In one embodiment, the underlying knowledge graph subgraph corresponding to each of the first N entities can be obtained based on the link relationships between entities in the top-level knowledge graph and entities in the bottom-level knowledge graph. In another embodiment, given entity A in the top-level knowledge graph, the links to entity A in the bottom-level knowledge graph are calculated based on similarity. ′ Assuming the subgraph is a three-hop subgraph, then the underlying knowledge graph subgraph of entity A is: Entity A ′ The subgraph consists of four entities: B → C → D, and three relations. Furthermore, the subgraph can be any number of hops; this application does not impose any restrictions on this.
[0104] S160: Text descriptions of N subgraphs generated by an intelligent question-answering large language model.
[0105] In one embodiment, for each of the N subgraphs, the entities and relations in that subgraph can be input into the intelligent question-answering large language model to generate a text description of that subgraph. For example, the text description can be a concatenation of the entity names and entity descriptions of the entities in the subgraph, as well as the source entity, target entity, and relation descriptions of the relations.
[0106] S170: Based on the text description of the input text, multiple intermediate input texts, and N subgraphs, a global answer is generated by an intelligent question-answering large language model.
[0107] In one embodiment, the input text, multiple intermediate input texts, and corresponding text descriptions of N subgraphs can be fed together into the intelligent question-answering large language model to generate a global answer. For example, based on the linked subgraphs of a two-layer knowledge graph and the community summary of the top-level knowledge graph, this global answer can have a global perspective and therefore can have high accuracy and comprehensiveness.
[0108] According to the intelligent question-answering method of embodiments of this application, by obtaining the top N entities with the highest similarity to the input text from a vector knowledge base, N corresponding communities can be obtained from the top-level knowledge graph in a two-layer knowledge graph, and multiple intermediate input texts can be generated based on the input text and community summaries of the N communities. Furthermore, N subgraphs corresponding to the top N entities can be obtained from the bottom-level knowledge graph in the two-layer knowledge graph, and text descriptions of these N subgraphs can be generated. Based on this, a global answer can be generated based on the input text, multiple intermediate input texts, and the text descriptions of the N subgraphs. By combining a two-layer knowledge graph with RAG technology, utilizing the complex relationship query capabilities of the two-layer knowledge graph and the global perspective of community summaries, the shortcomings of traditional RAG technology in global query-focused question answering in the field of intelligent question answering can be overcome, and the accuracy and comprehensiveness of intelligent question answering using RAG technology can be improved.
[0109] This application also provides an intelligent question-answering device, including: a processor and a memory storing instructions, which, when executed by the processor, cause the processor to perform the above-described intelligent question-answering method.
[0110] Figure 2 This is a schematic diagram of the hardware structure of an intelligent question-answering device according to an embodiment of this application. Figure 2 The intelligent question-answering device shown may include a processor 21 and a memory 22 storing computer program instructions.
[0111] Specifically, the processor 21 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0112] Memory 22 may include a large-capacity memory for data or instructions. Where appropriate, memory 22 may include removable or non-removable (or fixed) media. In a particular embodiment, memory 22 is a non-volatile solid-state memory. Memory 22 may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical / tangible memory storage devices. Thus, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the intelligent question-answering method described above.
[0113] The processor 21 implements the intelligent question-answering method in the above embodiments by reading and executing computer program instructions stored in the memory 22.
[0114] In one example, the intelligent question-answering device may also include a communication interface 23 and a bus 24. For example, Figure 2 As shown, processor 21, memory 22, and communication interface 23 are connected via bus 24 and communicate with each other. (Tax number)
[0115] Bus 24 includes hardware, software, or both, that couples components of the intelligent question-and-answer device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 24 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0116] This application also provides a computer-readable storage medium having instructions stored thereon, which, when executed by a computer, cause the computer to perform the above-described intelligent question-answering method.
[0117] Examples of computer-readable storage media include non-transitory computer-readable storage media such as portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0118] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0119] The above description is merely a specific embodiment of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. An intelligent question-answering method, comprising: Receive input text; Based on the input text, obtain the top N entities with the highest similarity from the vector knowledge base, where N is an integer greater than or equal to 1; Based on the first N entities, obtain the corresponding N communities from the top-level knowledge graph in the two-layer knowledge graph; Based on the input text and the community summaries of the N communities, multiple intermediate input texts are generated by the intelligent question-answering big language model; Based on the first N entities, obtain the corresponding N subgraphs from the bottom-level knowledge graph in the two-layer knowledge graph; The intelligent question-answering large language model generates text descriptions for the N subgraphs; Based on the input text, the multiple intermediate input texts, and the text descriptions of the N subgraphs, the global answer is generated by the intelligent question-answering large language model.
2. The intelligent question-answering method according to claim 1, wherein, Based on the input text, the top N entities with the highest similarity are obtained from the vector knowledge base, including: The input text is vectorized to obtain vectorized input text; Based on the vectorized input text, a similarity calculation is performed in the vector knowledge base to obtain the top N entities with the highest similarity.
3. The intelligent question-answering method according to claim 1, wherein, Based on the input text and the community summaries of the N communities, a large language model generates multiple intermediate input texts, including: Based on the input text and the community summaries of the N communities, the intelligent question-answering big language model generates N intermediate answers and a usefulness score. Based on the usefulness score, the top K intermediate answers from the N intermediate answers are obtained, and the top K intermediate answers are concatenated in descending order of usefulness score and divided into multiple intermediate input texts according to a fixed string length.
4. The intelligent question-answering method according to claim 1, wherein, The text descriptions of the N subgraphs generated by the intelligent question-answering large language model include: The intelligent question-answering big language model generates text descriptions of the N subgraphs based on the entities and relationships in each subgraph.
5. The intelligent question-answering method according to claim 1, wherein, The two-layer knowledge graph is automatically created by the intelligent question-answering large language model using a first prompt template, wherein the first prompt template includes a task objective, execution steps, and contextual examples.
6. The intelligent question-answering method according to claim 5, wherein, The top-level knowledge graph is automatically created by the intelligent question-answering large language model using the first prompt template based on a user-predefined dataset, and the bottom-level knowledge graph is automatically created by the intelligent question-answering large language model using the first prompt template based on a professional standard dataset.
7. The intelligent question-answering method according to claim 1, wherein, The top-level knowledge graph includes entities, relationships, and communities, and the bottom-level knowledge graph includes entities and relationships. The entities in the top-level knowledge graph are linked to the entities in the bottom-level knowledge graph by the intelligent question-answering big language model based on similarity calculation.
8. The intelligent question-answering method according to claim 7, wherein, The entity includes entity name, entity type and entity description, the relationship includes source entity, target entity, relationship description and relationship weight, and the community is a set of entities and relationships obtained by aggregating entities and relationships in the top-level knowledge graph based on a community clustering algorithm.
9. The intelligent question-answering method according to claim 1, wherein, The community summary for each community in the top-level knowledge graph is automatically created by the intelligent question-answering big language model using a second prompt template, wherein the second prompt template includes a task objective and a community summary format.
10. The intelligent question-answering method according to claim 1, wherein, The vector knowledge base was created in the following way: The entities, relations, and communities in the top-level knowledge graph are vectorized to obtain vectorized entities, vectorized relations, and vectorized communities. The vector knowledge base includes the entities, relations, communities, vectorized entities, vectorized relations, and vectorized communities.
11. An intelligent question-answering device, comprising: processor, and A memory storing instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1-10.
12. A computer-readable storage medium having instructions stored thereon, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1-10.