A method and device for empowering a large model knowledge base with a knowledge graph

By introducing knowledge graph technology into the knowledge base system, combining the big model information retrieval enhancement technology, using vectorized document slices and triple graph data simultaneous recall, building prompt word input to the big model for reasoning, solving the problem of unstable accuracy and poor interpretability of the knowledge base output content, and realizing the stability, accuracy, interpretability and traceability of the knowledge base output content.

CN118733790BActive Publication Date: 2025-03-25INSPUR SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411215565.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-03-25
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

The existing knowledge base system has problems such as unstable accuracy, untraceable output and poor interpretability when feedbacking content, making it difficult to achieve the accuracy, fluency and interpretability of the content.

Method used

By introducing knowledge graph technology into the knowledge base system, combining big model information retrieval enhancement technology, using vectorized document slices and triple graph data simultaneous recall, we construct prompt word input to the big model for reasoning, so as to enhance the stability and accuracy of the knowledge base output content and improve the interpretability and traceability of knowledge.

Benefits of technology

The stability and accuracy of the content output from the knowledge base is realized, the interpretability and traceability of knowledge are improved, and the problems of unstable and poor interpretability of content in the prior art are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733790B_ABST
    Figure CN118733790B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of knowledge base, and specifically provides a method and device for empowering a large model knowledge base with a knowledge graph, S1, importing a file into a knowledge storage module, loading text information in the document, setting a similarity threshold, and completing document slicing; S2, loading an Embedding model; S3, loading an Extractor model; S4, inputting a question, and completing query preprocessing; S5, setting a Top-K value, recalling the Top-K text slices with the highest similarity for standby use; S6, setting a Top-N value, and extracting triple information for standby use; S7, fusing the recalled text slices and triple information to form a prompt word Prompt, and inputting it into a large model for reasoning; S8, after reasoning, the large model generates a reply. The present invention can enhance the stability and accuracy of the output content of the knowledge base, and improve the interpretability and traceability of knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge bases, and specifically provides a method and device for enabling a large model knowledge base with a knowledge graph. Background Art

[0002] A knowledge base is a way of organizing and storing information, aiming to collect, manage and distribute knowledge resources inside or outside an organization. A good knowledge base can bring many benefits to individuals, teams and even the entire organization. It can not only improve work efficiency, but also promote knowledge sharing and development within the organization, improve the quality of customer service, ensure the compliance and risk management of the organization, and promote collaboration between teams.

[0003] In addition, by effectively managing and protecting the company's important knowledge assets, the knowledge base helps maintain the organization's core competitiveness. With the rapid development of artificial intelligence technology, the application of knowledge bases is becoming more and more extensive. Knowledge bases can not only provide corpus for the training of artificial intelligence models, but also use artificial intelligence technology to efficiently build and update knowledge bases.

[0004] At present, there are two core technologies of mainstream knowledge base systems: one is the knowledge base system based on knowledge graphs, and the other is the knowledge base system based on large model information retrieval enhancement technology. Although the knowledge content fed back by the knowledge base system based on knowledge graphs is highly interpretable and traceable, and can guarantee the accuracy of the output content to a large extent, its feedback content is severely fragmented and cannot be effectively summarized and generalized. It needs to be manually summarized in series before it can be used; and the knowledge base system based on large model information retrieval enhancement technology can rely on the semantic analysis and generation capabilities of large models to feedback logically clear content without excessive human involvement, but the system is prone to hallucination problems, resulting in unstable accuracy of feedback knowledge, and the output content cannot be traced and has poor interpretability.

[0005] How to make the feedback content of the knowledge base system accurate, fluent, coherent and explainable is an important research direction at present. Summary of the invention

[0006] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method for empowering a large model knowledge base with a knowledge graph that is highly practical.

[0007] A further technical task of the present invention is to provide a device that is rationally designed, safe and applicable for empowering large model knowledge bases with knowledge graphs.

[0008] The technical solution adopted by the present invention to solve its technical problem is:

[0009] A method for empowering a large model knowledge base with a knowledge graph, wherein the knowledge base is divided into a knowledge storage module and a knowledge question and answer module, and has the following steps:

[0010] S1. Import the file into the knowledge storage module, load the text information in the document, set the similarity threshold, and complete the document slicing;

[0011] S2, load the Embedding model, vectorize and store document slices;

[0012] S3, load the Extractor model, extract the triple information in the document slice, write it into the graph database, and complete the graph storage;

[0013] S4. Input the query and complete query preprocessing.

[0014] S5, set the Top-K value, and recall the Top-K text slices with the highest similarity for use;

[0015] S6, set the value of Top-N, traverse the graph storage data, search for the subgraph within Top-N hops, and extract the triple information for standby use;

[0016] S7, fuse the recalled text slices and triple information to form a prompt word Prompt, and input it into the large model for reasoning;

[0017] S8. After reasoning, the large model generates a response.

[0018] Further, in step S1, the file is imported into the knowledge storage module, the text information in the document is loaded, the similarity threshold is set, and the BERT model is used to determine whether the similarity scores of two adjacent paragraphs are greater than the threshold from the front to the back according to the text order;

[0019] If it is greater, the two paragraphs are merged into one; otherwise, they are cut apart, ultimately forming a multi-layer document slice.

[0020] Furthermore, in step S2, the Embedding model is loaded, the document slices are input into the model, the high-dimensional data in the document is mapped to the low-dimensional space and converted into a numerical vector, and words with similar semantics have similar positions in the vector space to achieve dimensionality reduction storage.

[0021] Furthermore, in step S3, it further includes:

[0022] S3.1. Standardize the text information in the document fragments and unify the character encoding to UTF-8. By searching the character encoding in the document, filter out and remove tabs, line breaks, spaces, blank lines and special symbols irrelevant to the text, complete the cleaning of the document slices, and remove irrelevant formatting marks and noise data;

[0023] S3.2. Use natural language processing tools to segment the text content and divide the text into phrases. For keywords with customized meanings, customize the special words by importing a custom keyword dictionary. The format of the custom keyword dictionary is (word, part of speech). Then import a custom stop word dictionary to remove stop words in the text.

[0024] S3.3, load the pre-trained Extractor model, use the annotated data set to fine-tune the model, and then use the trained Extractor model to perform entity recognition on the document, extract entities mainly based on nouns, and obtain the attribute information of the extracted entities, and further extract the relationship between entities, mainly based on verbs and descriptive sentences, to complete the entity recognition, relationship extraction and attribute extraction of the document;

[0025] S3.4. Based on the extracted entities, relations, and attributes, construct triples in the form of "entity-relationship-entity" or "entity-attribute-value", and merge duplicate information and conduct manual verification;

[0026] S3.5. Define nodes, edges and attributes in the graph database, and import the constructed triples into the graph database to form a graph structure and save it.

[0027] Furthermore, in step S4, in the knowledge question answering module, for the input question query, the Embedding model is used to vectorize the query, and the Extractor model is used to extract entity keywords in the query.

[0028] Furthermore, in step S5, the Top-K value is set, and the cosine similarity calculation method is used to calculate the similarity between the query vector and the slice vector in the vector storage, and the similarities are sorted according to the size, and the Top-K text slices with the highest similarity are recalled for use.

[0029] Furthermore, in step S6, the value of Top-N is set, and a search algorithm is used to traverse the graph storage data based on the extracted entity keywords to search for subgraphs within Top-N hops, extract their entity and entity relationship triple information, and format it into text for later use.

[0030] Further, in step S7, it specifically includes: assuming that the input question query is represented by Q, the text slice content A generates a prompt word segment "the text slice content 'A' involved in the question", and the triple information is formatted into a text content B to generate a prompt word segment "the entity and entity relationship 'B' involved in the question", and finally the prompt word content is formed as "please feedback the answer to question Q based on the text slice content 'A' involved in the question and the entity and entity relationship 'B' involved in the question, and the feedback content must strictly comply with the entities and entity relationships in 'B'";

[0031] If it is found during the large model reasoning process that the input query cannot be answered from the input prompt words, the follow-up question mechanism is activated to feedback the follow-up questions. The user's question is clarified by guiding the user to enter the question details through multiple rounds, and then steps S2 to S7 are repeated to obtain a suitable answer.

[0032] A device for empowering a large model knowledge base with a knowledge graph, comprising: at least one memory and at least one processor;

[0033] The at least one memory is used to store a machine-readable program;

[0034] The at least one processor is used to call the machine-readable program to execute a method for empowering a large model knowledge base with a knowledge graph.

[0035] Compared with the prior art, the method and device for empowering a large model knowledge base with a knowledge graph of the present invention has the following outstanding beneficial effects:

[0036] The present invention empowers the knowledge extraction, knowledge retrieval, and knowledge construction capabilities based on the knowledge graph technology architecture into the knowledge base system based on the large model information retrieval enhancement technology. By simultaneously recalling vectorized document slices and triple graph data, prompt words are constructed and input to the large model for reasoning, so as to enhance the stability and accuracy of the knowledge base output content and improve the interpretability and traceability of knowledge. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 It is a flowchart of a method for empowering a large model knowledge base with a knowledge graph;

[0039] Figure 2It is a flow chart of the knowledge storage module in a method of empowering a large model knowledge base with a knowledge graph;

[0040] Figure 3 It is a flow chart of the knowledge question and answer module in a method of empowering a large model knowledge base with a knowledge graph. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] A best embodiment is given below:

[0043] like Figure 1-3 As shown, a method of empowering a large model knowledge base with a knowledge graph in this embodiment divides the knowledge base system into a knowledge storage module and a knowledge question and answer module, wherein the knowledge storage module is divided into vector storage and graph storage, and respectively performs embedded vectorization and storage on the imported file content and constructs a knowledge graph and stores it.

[0044] The knowledge question-answering module extracts relevant text slices and entity and entity relationship image segments from the vector storage and graph storage based on the input questions through similarity recall, and then uses the extracted text slices and image segments to generate prompt words for large-model reasoning to generate answers.

[0045] The specific steps are:

[0046] S1. Import the file into the knowledge storage module, load the text information in the document, set the similarity threshold, and complete the document slicing;

[0047] The BERT model is used to determine whether the similarity scores of two adjacent paragraphs are greater than the threshold from front to back in the order of the text. If so, the two paragraphs are merged into one, otherwise they are cut, eventually forming a multi-layer document slice.

[0048] S2, load the Embedding model, vectorize and store document slices;

[0049] Document slices are input into the model, and the high-dimensional data in the document is mapped to a low-dimensional space and converted into a numerical vector. Words with similar semantics have similar positions in the vector space, achieving dimensionality reduction storage.

[0050] S3, load the Extractor model, extract the triple information in the document slice, write it into the graph database, and complete the graph storage;

[0051] The specific steps are:

[0052] S3.1. Standardize the text information in the document fragments and unify the character encoding to UTF-8. By searching the character encoding in the document, filter out and remove tabs, line breaks, spaces, blank lines and special symbols irrelevant to the text, complete the cleaning of the document slices, and remove irrelevant formatting marks and noise data;

[0053] S3.2. Use natural language processing tools to segment the text content and divide the text into phrases. For keywords with customized meanings, customize the special words by importing a custom keyword dictionary. The format of the custom keyword dictionary is (word, part of speech). Then import a custom stop word dictionary to remove stop words in the text.

[0054] S3.3, load the pre-trained Extractor model, use the annotated data set to fine-tune the model, and then use the trained Extractor model to perform entity recognition on the document, extract entities mainly based on nouns, and obtain the attribute information of the extracted entities, and further extract the relationship between entities, mainly based on verbs and descriptive sentences, to complete the entity recognition, relationship extraction and attribute extraction of the document;

[0055] S3.4. Based on the extracted entities, relations, and attributes, construct triples in the form of "entity-relationship-entity" or "entity-attribute-value", and merge duplicate information and conduct manual verification;

[0056] S3.5. Define nodes, edges and attributes in the graph database, and import the constructed triples into the graph database to form a graph structure and save it.

[0057] S4. Input the query and complete query preprocessing.

[0058] In the knowledge question-answering module, for the input question (query), the Embedding model is used to vectorize the query, and the Extractor model is used to extract the entity keywords in the query.

[0059] S5, set the Top-K value, and recall the Top-K text slices with the highest similarity for use;

[0060] Sort by similarity and recall the top K text slices with the highest similarity for later use.

[0061] S6, set the value of Top-N, traverse the graph storage data, search for the subgraph within Top-N hops, and extract the triple information for use;

[0062] Search for subgraphs within the Top-N hops, extract triple information such as entities and entity relationships, and format them into text for later use.

[0063] S7, fuse the recalled text slices and triple information to form a prompt word Prompt, and input it into the large model for reasoning;

[0064] Specifically, it includes: assuming that the input question query is represented by "Q", the text slice content "A" is generated into a prompt word segment "the text slice content 'A' involved in the question", and the triple information is formatted into text content "B" to generate a prompt word segment "the entities and entity relationships 'B' involved in the question". Finally, the prompt word content is "Please provide feedback on the answer to question 'Q' based on the text slice content 'A' involved in the question and the entities and entity relationships 'B' involved in the question. The feedback content must strictly comply with the entities and entity relationships in 'B'."

[0065] If it is found during the large model reasoning process that the input query cannot be answered from the input prompt words, the follow-up question mechanism is activated to feedback the follow-up questions. The user's question is clarified by guiding the user to enter the question details through multiple rounds, and then steps S2 to S7 are repeated to obtain a suitable answer.

[0066] S8. After reasoning, the large model generates a response.

[0067] Based on the above method, a device for enabling a large model knowledge base with a knowledge graph in this embodiment includes: at least one memory and at least one processor;

[0068] The at least one memory is used to store a machine-readable program;

[0069] The at least one processor is used to call the machine-readable program to execute a method for empowering a large model knowledge base with a knowledge graph.

[0070] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

[0071] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for empowering a large model knowledge base with a knowledge graph, characterized in that: The knowledge base is divided into a knowledge storage module and a knowledge question and answer module, and has the following steps: S1. Import the file into the knowledge storage module, load the text information in the document, set the similarity threshold, and complete the document slicing; Import the file into the knowledge storage module, load the text information in the document, set the similarity threshold, and use the BERT model to determine whether the similarity scores of two adjacent paragraphs are greater than the threshold from front to back according to the text order; If it is greater than, the two paragraphs are merged into one; otherwise, they are cut, and finally a multi-layer document slice is formed; S2, load the Embedding model, vectorize and store document slices; Load the Embedding model, input document slices into the model, map the high-dimensional data in the document to a low-dimensional space and convert it into a numerical vector. In addition, words with similar semantics have similar positions in the vector space to achieve dimensionality reduction storage. S3, load the Extractor model, extract the triple information in the document slice, write it into the graph database, and complete the graph storage; Further including: S3.

1. Standardize the text information in the document fragments and unify the character encoding to UTF-8. By searching the character encoding in the document, filter out and remove tabs, line breaks, spaces, blank lines and special symbols irrelevant to the text, complete the cleaning of the document slices, and remove irrelevant formatting marks and noise data; S3.

2. Use natural language processing tools to segment the text content and divide the text into phrases. For keywords with customized meanings, customize the special words by importing a custom keyword dictionary. The format of the custom keyword dictionary is (word, part of speech). Then import a custom stop word dictionary to remove stop words in the text. S3.3, load the pre-trained Extractor model, use the annotated data set to fine-tune the model, and then use the trained Extractor model to perform entity recognition on the document, extract entities mainly based on nouns, and obtain the attribute information of the extracted entities, and further extract the relationship between entities, mainly based on verbs and descriptive sentences, to complete the entity recognition, relationship extraction and attribute extraction of the document; S3.

4. Based on the extracted entities, relations, and attributes, triples in the form of "entity-relationship-entity" or "entity-attribute-value" are constructed, and duplicate information is merged and manually checked; S3.

5. Define nodes, edges and attributes in the graph database, and import the constructed triples into the graph database to form a graph structure and save it; S4, input the query and complete the query preprocessing; In the knowledge question answering module, for the input query, the Embedding model is used to vectorize the query, and the Extractor model is used to extract the entity keywords in the query; S5, set the Top-K value, and recall the Top-K text slices with the highest similarity for use; Set the Top-K value, use the cosine similarity calculation method to calculate the similarity between the query vector and the slice vector in the vector storage, sort them according to the similarity, and recall the Top-K text slices with the highest similarity for use; S6, set the value of Top-N, traverse the graph storage data, search for the subgraph within Top-N hops, and extract the triple information for standby use; Set the Top-N value, use the search algorithm to traverse the graph storage data based on the extracted entity keywords, search for the subgraph within the Top-N jumps, extract its entity and entity relationship triple information, and format it into text for later use; S7, fuse the recalled text slices and triple information to form a prompt word Prompt, and input it into the large model for reasoning; Specifically, it includes: assuming that the input question query is represented by Q, the text slice content A is used to generate a prompt word segment "the text slice content 'A' involved in the question", and the triple information is formatted into text content B to generate a prompt word segment "the entity and entity relationship 'B' involved in the question", and finally the prompt word content is formed as "Please provide feedback on the answer to question Q based on the text slice content 'A' involved in the question and the entity and entity relationship 'B' involved in the question. The feedback content must strictly comply with the entities and entity relationships in 'B'"; If the input query cannot be answered from the input prompt words during the large model reasoning process, the follow-up question mechanism is activated to feedback the follow-up question. The user is guided to enter the question details in multiple rounds to clarify the user's question and repeat steps S2 to S7 to obtain a suitable answer. S8. After reasoning, the large model generates a response.

2. A device for empowering a large model knowledge base with a knowledge graph, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method of claim 1.

Citation Information

Patent Citations

  • Text index enhanced question and answer method and system based on knowledge graph

    CN117453851A

  • Medical auxiliary question and answer method and system based on knowledge calibration and retrieval enhancement

    CN117573843A