Knowledge retrieval method and device applied to large model knowledge questions and answers

Through the segmentation and interdependence of knowledge data, combined with the knowledge full-text search library and graph, the multisynonyms and efficiency problems in knowledge retrieval are solved, more accurate and efficient knowledge retrieval is achieved, and the performance and user experience of the question-and-answer system are improved. .

CN119311850APending Publication Date: 2025-01-14WUHAN FIBERHOME DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411261054.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the prior art, knowledge retrieval has problems such as polysynonyms and ambiguity, difficulty in updating dynamic knowledge, low retrieval speed and efficiency, difficulty in integrating information fragments and selecting, resulting in reduced accuracy of knowledge questions and answers and poor user experience. .

Method used

By sorting and cleaning the knowledge data, segmenting it into independent knowledge points, and using the attention mechanism of the deep model to determine the interdependence between knowledge points, building a full-text knowledge search library and knowledge graph, calculating the similarity of knowledge points, and using the minimum Adjacent graph grouping and maximum spanning tree sorting, generate appropriate propt templates and input them to the big model for the final search results.

Benefits of technology

It improves the accuracy and relevance of knowledge retrieval, enhances knowledge coverage, optimizes the organizational structure of search results, reduces the "illusion" phenomenon generated by question and answers, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311850A_ABST
    Figure CN119311850A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge retrieval method and device applied to large-model knowledge questions and answers. The method comprises the following steps: sorting and cleaning knowledge data and converting the knowledge data into knowledge texts; the knowledge text is segmented into independent knowledge points, corresponding titles, abstracts, keywords and the like are marked, and the relation between the knowledge points is determined; constructing a knowledge full-text retrieval library and a knowledge graph; identifying knowledge points in the retrieval problem, retrieving corresponding candidate knowledge points, calculating the similarity between the candidate knowledge points and the knowledge points in the retrieval problem, and screening based on the similarity to obtain a knowledge point set; the knowledge points with correlation are grouped according to the minimum adjacency graph, the knowledge points without correlation are grouped independently, and the grouped knowledge points and the independent knowledge points are sorted and combined according to the maximum spanning tree mode; preparing a proper prompt template for the question big model, nesting the sorted and combined knowledge points into the template, and generating a prompt context; and inputting the prompt context into the questioning big model, and sorting out a final retrieval result by utilizing the reasoning, induction and summarization capabilities of the questioning big model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge retrieval, and in particular to a knowledge retrieval method and device applied to large-model knowledge question and answer. Background Art

[0002] Knowledge retrieval plays a very critical role and significance in the RAG (retrieval-augmented generation) process, mainly in terms of providing accurate information sources, enhancing contextual understanding, improving the diversity of answers, increasing transparency and explainability, etc. The knowledge retrieved provides accurate and relevant contextual information for the generation model, thereby improving the performance and output quality of the entire system at multiple levels. The current knowledge retrieval process for question and answer has problems such as polysemy and ambiguity, difficulty in updating dynamic knowledge, low retrieval speed and efficiency, and difficulty in merging and selecting information fragments, which seriously affect the quality of the retrieved knowledge, and then lead to hallucinations in the results of question and answer generation, reducing the accuracy of knowledge questions and answers and affecting user experience. Summary of the invention

[0003] In view of the technical defects and technical drawbacks in the prior art, the embodiments of the present invention provide a knowledge retrieval method and device for large model knowledge question answering that overcomes the above problems or at least partially solves the above problems. The specific scheme is as follows:

[0004] As a first aspect of the present invention, a knowledge retrieval method applied to large model knowledge question answering is provided, the method comprising:

[0005] Step 1: organize and clean the knowledge data, and convert the cleaned knowledge data into knowledge text;

[0006] Step 2: Segment the knowledge text into sentences, paragraphs, and topics at the semantic level, divide the knowledge text into independent knowledge points, annotate each knowledge point with the corresponding title, abstract, keywords, text, and extended explanation, and use the attention mechanism in the deep model to determine the interdependence between knowledge points;

[0007] Step 3: Based on the knowledge points and the interdependencies between the knowledge points, a knowledge full-text retrieval library for knowledge point retrieval and a knowledge graph for associated knowledge retrieval are constructed;

[0008] Step 4: Identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval database and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain a knowledge point set based on the similarity;

[0009] Step 5, for the set of knowledge points in step 4, group the knowledge points with relevance according to the minimum adjacency graph, group the knowledge points without relevance into a separate group, and sort and combine the grouped and separate knowledge points in a maximum spanning tree manner;

[0010] Step 6: prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate a prompt context;

[0011] Step 7: Input the prompt context into the question model, and use its reasoning and summarizing capabilities to sort out the final search results.

[0012] Furthermore, in step 1, the knowledge data includes relational database data and document data, wherein the relational database data includes data in xlsx format, and the document data includes data in word and pdf formats.

[0013] Furthermore, step 2 also includes: using the representation model to vectorize the title, abstract, keywords, text and extended explanation of the knowledge point respectively, to obtain a set of index vectors of five aspects: title, abstract, keywords, text and extended explanation, each index vector contains the vector and the ID of the knowledge point entity.

[0014] Furthermore, step 4 specifically includes: identifying the knowledge points in the retrieval question, searching in the knowledge full-text retrieval library based on the knowledge points in the retrieval question, and retrieving the knowledge points that meet the preset conditions; searching in the knowledge graph based on the knowledge points that meet the preset conditions, and retrieving related knowledge points that have a preset correlation with the knowledge points that meet the preset conditions, taking the knowledge points that meet the preset conditions and the related knowledge points as candidate knowledge points, calculating the similarity and weighting the relevance of the knowledge points in the retrieval question with all the candidate knowledge points, and obtaining the final similarity between each candidate knowledge point and the knowledge point in the retrieval question, and filtering out the knowledge points whose similarity is higher than a threshold based on the final similarity, and obtaining a set of knowledge points that meet the preset requirements.

[0015] The similarity between the knowledge point or intention in the search question and the subject, title, abstract, text, extended description and other features of all candidate knowledge points is calculated respectively, so as to obtain the corresponding similarity for the subject, abstract, keyword, text, extended description and other features respectively. (x,y) , PCA principal component analysis is used to calculate the variance explanation of the multi-dimensional features as weights, and the weights are weighted with the corresponding feature similarities to obtain the final similarity of the corresponding features.

[0016] Furthermore, in step 6, when knowledge points are nested into the template, since the combined knowledge points have a high correlation, they are embedded adjacently when generating prompts, and different groups of knowledge points have a low correlation and are embedded separately.

[0017] As a second aspect of the present invention, a knowledge retrieval device applied to large model knowledge question answering is provided, the device comprising:

[0018] The knowledge point sorting and conversion module is used to sort and clean the knowledge data and convert the cleaned knowledge data into knowledge text;

[0019] The segmentation module is used to segment the knowledge text into sentences, paragraphs, and topics at the semantic level, and divide the knowledge text into independent knowledge points. Each knowledge point is annotated with the corresponding title, abstract, keywords, text, and extended description, and the attention mechanism in the deep model is used to determine the interdependence between knowledge points;

[0020] A knowledge base creation module is used to construct a knowledge full-text retrieval base for knowledge point retrieval and a knowledge graph for associated knowledge retrieval based on knowledge points and the interdependencies between knowledge points;

[0021] The knowledge point screening module is used to identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval library and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain the knowledge point set based on the similarity screening;

[0022] A sorting module is used for grouping the knowledge points with relevance according to the minimum adjacency graph for the knowledge point set, grouping the knowledge points without relevance into a separate group, and sorting and combining the grouped and separate knowledge points in a maximum spanning tree manner;

[0023] The context generation module is used to prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate the prompt context;

[0024] The model output module is used to input the prompt context into the question model, and use its reasoning and inductive summary capabilities to organize the final retrieval results.

[0025] Furthermore, the knowledge data includes relational database data and document data, wherein the relational database data includes data in xlsx format, and the document data includes data in word and pdf formats.

[0026] Furthermore, the segmentation module is also used to: use the representation model to vectorize the title, abstract, keywords, text and extended explanation of the knowledge point respectively, and obtain a set of index vectors of five aspects: title, abstract, keywords, text and extended explanation, each index vector contains the vector and the ID of the knowledge point entity.

[0027] Furthermore, the knowledge point screening module is specifically used to: identify the knowledge points in the retrieval question, and based on the knowledge points in the retrieval question, search in the knowledge full-text retrieval library to retrieve the knowledge points that meet the preset conditions; based on the knowledge points that meet the preset conditions, search in the knowledge graph to retrieve related knowledge points that have a preset correlation with the knowledge points that meet the preset conditions, use the knowledge points that meet the preset conditions and the related knowledge points as candidate knowledge points, calculate the similarity and weight the correlation between the knowledge points in the retrieval question and all the candidate knowledge points, obtain the final similarity between each candidate knowledge point and the knowledge points in the retrieval question, and screen out knowledge points with a similarity higher than a threshold based on the final similarity to obtain a set of knowledge points that meet the preset requirements.

[0028] The similarity between the knowledge point or intention in the search question and the subject, title, abstract, text, extended description and other features of all candidate knowledge points is calculated respectively, so as to obtain the corresponding similarity for the subject, abstract, keyword, text, extended description and other features respectively. (x,y) , PCA principal component analysis is used to calculate the variance explanation of the multi-dimensional features as weights, and the weights are weighted with the corresponding feature similarities to obtain the final similarity of the corresponding features.

[0029] Furthermore, when knowledge points are nested into the template, since the combined knowledge points have a high correlation, they are embedded adjacently when generating prompts, and different groups of knowledge points have a low correlation and are embedded separately.

[0030] The present invention has the following beneficial effects:

[0031] 1. In the process of building the knowledge base, the segmentation and assembly of knowledge texts are adopted, which mainly includes: segmentation at the semantic level, using a large model to segment sentences, paragraphs, and topics to deeply understand the text content; and annotation of knowledge points, labeling each segmented knowledge point with a title, abstract, keywords, etc., to facilitate subsequent retrieval.

[0032] 2. In the process of building the knowledge base, different parts of the knowledge points (such as title and abstract) are vectorized separately, rather than simply concatenating them and vectorizing them as a whole.

[0033] 3. The construction of the knowledge retrieval database uses a combination of the knowledge full-text retrieval database and the knowledge graph, which can not only be used to quickly retrieve the content of knowledge points, but also can be used to obtain related knowledge related to the knowledge points.

[0034] 4. In terms of knowledge point similarity calculation, after the full-text retrieval library and knowledge graph query, the candidate knowledge points are combined with the similarities of multiple dimensions such as topics and keywords, and the similarities of the final candidate knowledge points are weighted by principal component analysis and sorted. Compared with traditional knowledge retrieval, the retrieval results have wider knowledge coverage and stronger relevance.

[0035] 5. Combining knowledge points, using minimum adjacency graph grouping, grouping knowledge points according to relevance, and optimizing the organizational structure of search results.

[0036] The above innovations together constitute a comprehensive and efficient knowledge retrieval method, especially in the application of semantic segmentation, vectorized representation, retrieval intent identification and result generation using large models, showing the potential of this method in improving the performance of knowledge question-answering systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A schematic diagram of a flow chart of a knowledge retrieval method for large-model knowledge question answering provided by an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of representing the attention relationship between entities provided in an embodiment of the present invention;

[0039] Figure 3 An event entity relationship diagram provided for an embodiment of the present invention;

[0040] Figure 4 A schematic diagram of marking key information such as the subject and summary provided in the embodiment of the present invention;

[0041] Figure 5 A schematic diagram of quantization of key information such as the subject and summary provided by the embodiment of the present invention;

[0042] Figure 6 A schematic diagram of a process for retrieving a candidate set provided by an embodiment of the present invention;

[0043] Figure 7 A schematic diagram of a knowledge point combination provided by an embodiment of the present invention;

[0044] Figure 8 A schematic diagram of a knowledge point set provided in an embodiment of the present invention being nested into a prompt template. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the present invention, not all 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.

[0046] like Figure 1 As shown, an embodiment of the present invention provides a knowledge retrieval method applied to large model knowledge question answering, including:

[0047] Step 1: organize and clean the knowledge data, and convert the cleaned knowledge data into knowledge text;

[0048] Step 2: Segmentation and assembly of knowledge text: This includes segmenting the knowledge text into sentences, paragraphs, and topics at the semantic level, segmenting the knowledge text into independent knowledge points, annotating each knowledge point with the corresponding title, abstract, keywords, text, and extended description, and using the attention mechanism in the deep model to determine the interdependencies between knowledge points;

[0049] Step 3: Based on the knowledge points and the interdependencies between the knowledge points, a knowledge full-text retrieval library for knowledge point retrieval and a knowledge graph for associated knowledge retrieval are constructed;

[0050] Step 4: Identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval database and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain a knowledge point set based on the similarity;

[0051] Step 5, for the set of knowledge points in step 4, group the knowledge points with relevance according to the minimum adjacency graph, group the knowledge points without relevance into a separate group, and sort and combine the grouped and separate knowledge points in a maximum spanning tree manner;

[0052] Step 6: prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate a prompt context;

[0053] Step 7: Input the prompt context into the question model, and use its reasoning and summarizing capabilities to sort out the final search results.

[0054] In the process of constructing the knowledge base, the present invention adopts the segmentation and assembly of knowledge text, and labels each segmented knowledge point with title, abstract, keywords, etc., to facilitate subsequent retrieval. In the process of constructing the knowledge base, the knowledge points are vectorized, and different parts of the knowledge points (such as title, abstract) are vectorized separately, rather than simply splicing and vectorizing the whole. In knowledge retrieval, the combination of knowledge full-text retrieval library and knowledge graph is adopted, which can not only realize the rapid retrieval of knowledge point content, but also can be used to obtain related knowledge related to the knowledge point; in terms of knowledge point similarity calculation, the candidate knowledge points after the full-text retrieval library and the knowledge graph query are combined with the similarity of multiple dimensions such as themes and keywords, and the similarity of the final candidate knowledge points is obtained and sorted by weighting through principal component analysis. Compared with traditional knowledge retrieval, the retrieval result has a wider knowledge coverage and stronger relevance. When combining knowledge points, the minimum adjacency graph grouping is adopted, and the knowledge points are grouped according to the relevance to optimize the organizational structure of the retrieval results.

[0055] In some specific embodiments, the knowledge data includes relational database data and document data. The relational database data includes the data itself and its metadata information, such as forms, table fields, comments, etc.; the document data includes operation manuals, logs, industry standards and other documents. These data have no fixed format and structure, and usually exist in the form of word documents, pdf, etc.

[0056] Knowledge data organization and cleaning mainly involves cleaning and converting the above three types of data, including text format conversion (converting pdf, doc, xlsx and other formats into text) and illegal character cleaning. Here, open source tools such as PyPDF2, docx2txt, and pandas are used to process and clean pdf, word documents, and excel table data files respectively. The specific processing process will not be repeated here.

[0057] In some specific embodiments, the segmentation and assembly of the knowledge text is to first segment the questions sorted in step 1 at the semantic level through the ChatGLM4 large model, mainly including sentence segmentation, paragraph segmentation, topic segmentation, etc., to segment the knowledge text into independent knowledge points. Each knowledge point needs to be annotated with key information such as title, abstract, keywords, text, extended explanation, etc. Figure 2 As shown, the interdependence between knowledge points is determined with the help of the self-attention mechanism in the deep model. In step 3, a knowledge graph is generated through the interdependence between knowledge points.

[0058] The self-attention mechanism is the encoding and decoding attention in which Q, K, and V are mapped to the same input vector. It can ignore the distance between words and directly calculate the dependency, learn the internal structure of a sentence, and is relatively simple to implement and can be calculated in parallel. In this process, you first need to obtain the Embedding vector of each word in the knowledge text. For each word, you need to create a Query vector, a Key vector, and a Value vector. These vectors are created by multiplying the Embedding by the three matrices trained during the training process.

[0059] Q=W q X

[0060] K=W k X

[0061] V=W V X

[0062]

[0063] The Q matrix contains all query vectors, and each row represents a query vector. Each query vector is used to measure the degree of association between the current position and other positions in the sequence. The K matrix contains all key vectors, and each row represents a key vector. Each key vector is used to calculate the degree of association between the query vector and other positions in the sequence. The V matrix contains all value vectors, and each row represents a value vector. Each value vector is a representation of each position, which is used to capture information related to the query vector. d is the vector dimension of the query and key. For example, through the self-attention mechanism, for the text "suspect / Zhang San / beating / Li Si / after / escaping...", it can be judged that the "escaping" action refers to "suspect Zhang San" instead of "Li Si".

[0064] The attention relationship between entities is represented as Figure 3 shown.

[0065] According to the relationship between the knowledge points in the above text, we can construct Figure 4 The entity relationship diagram shown.

[0066] In some specific embodiments, the knowledge points are vectorized to obtain a set of index vectors in five aspects: title, abstract, keyword, text and extended description. Each index vector contains a vector and an ID of a knowledge point entity. Based on the index vectors of title, abstract, keyword, text and extended description, a knowledge full-text retrieval library can be constructed.

[0067] Specifically, the representation model is used to realize text vectorization, which mainly includes the separate vectorization of the title, abstract, keywords, text, and extended description of the knowledge point, rather than simply concatenating the above texts and vectorizing them all. For example, for the "knowledge point" of "Zhang San's intentional injury case", the title, abstract, keywords, text, and extended description are vectorized separately, and the index vector sets of the above five aspects are obtained respectively, and their contents contain the vector and the ID of the knowledge point entity, such as Figure 5 shown.

[0068] The contents of the knowledge retrieval database include the knowledge full-text retrieval database and the knowledge graph, which are used for the retrieval of knowledge points and the analysis and retrieval of related knowledge respectively. The specific process of constructing the full-text retrieval database and the graph will not be described here.

[0069] In some embodiments, during the retrieval process for knowledge points, NER recognition of the knowledge points included in the retrieval question is first implemented, and then the knowledge full-text retrieval database and the knowledge graph are searched separately, including searching the knowledge full-text retrieval database to retrieve knowledge points that meet preset conditions; based on the knowledge points that meet the preset conditions, searching the knowledge graph to retrieve related knowledge points that have a correlation of 1-2 with the knowledge points that meet the preset conditions, and taking the knowledge points that meet the preset conditions and the related knowledge points as candidate knowledge points, and then calculating the similarity between the knowledge points or intentions in the retrieval question and the themes, titles, abstracts, texts, and extended descriptions of all candidate knowledge points, and weighting them based on the correlation between the retrieval intention and the candidate knowledge points, so as to obtain the final similarity of the selected results. The specific process is as follows: Figure 6 As shown:

[0070] For example, there is an embedding vector V(x) of the retrieved text = (x1, x2, x3, …, x n ), for any vector V(y)=(y1,y2,y3,…,y n ), the similarity between two vectors is calculated by the following formula: xy .

[0071]

[0072] Therefore, we can obtain the corresponding similarity sets for the topic, abstract, keyword, text, and extended description respectively:

[0073]

[0074] where y i Represents the theme, title, abstract, text or extended description features. For any feature vector V in a candidate knowledge point (x,y) , PCA principal component analysis is used to calculate the feature y iThe variance explanation of the dimension is used as the weight, and the weight is weighted with the corresponding feature similarity to obtain the final similarity of the selected results. For details, refer to the following formula:

[0075]

[0076] PCA i (V (x,y) ) represents the variance explanation rate of feature i after PCA weighting, Represents the similarity between the selected structure on feature i and the retrieval question.

[0077] After obtaining a set of knowledge points that meet the preset requirements, it is necessary to deduplicate knowledge points in the search results. Due to the diversity of search intents, the retrieved knowledge points may be repeated to some extent. Therefore, it is necessary to discard the knowledge points with the lowest similarity to the search intent and the repeated ones, sort them according to the similarity calculated above, and screen out candidate results with a similarity higher than the threshold for generating prompts. This process can filter out irrelevant knowledge and minimize the "hallucination" phenomenon of the final answer of the large model.

[0078] In some specific embodiments, it is necessary to combine knowledge points according to the set of knowledge points that meet the preset requirements obtained in the above process, such as Figure 7 As shown in the figure, the knowledge points with correlation in the knowledge point set are grouped according to the minimum adjacency graph, and the knowledge points without correlation are grouped separately. The minimum adjacency graph refers to the minimum spanning tree, which is a tree that connects all vertices in an undirected connected graph and has the smallest sum of weights. These algorithms start from a vertex in the graph and gradually expand to form a minimum spanning tree. The use of the minimum adjacency graph in the process of generating prompt words here is mainly because for the entities in the candidate result set, the minimum adjacency graph can more comprehensively and richly express the information of the candidate knowledge point entity, so as to make the argument of the generated final answer more complete as much as possible.

[0079] Among them, combined knowledge points have high correlation and need to be embedded adjacently when generating prompts. Different groups of knowledge points have low correlation and need to be embedded separately.

[0080] like Figure 8 As shown, it is a schematic diagram of knowledge point set nesting provided in an embodiment of the present invention. For the question large model, a suitable prompt template is prepared, and the knowledge point set is nested into the prompt template to generate a large model prompt context.

[0081] An embodiment of the present invention further provides a knowledge retrieval device applied to large model knowledge question answering, the device comprising:

[0082] The knowledge point sorting and conversion module is used to sort and clean the knowledge data and convert the cleaned knowledge data into knowledge text;

[0083] The segmentation module is used to segment the knowledge text into sentences, paragraphs, and topics at the semantic level, and divide the knowledge text into independent knowledge points. Each knowledge point is annotated with the corresponding title, abstract, keywords, text, and extended description, and the attention mechanism in the deep model is used to determine the interdependence between knowledge points;

[0084] A knowledge base creation module is used to construct a knowledge full-text retrieval base for knowledge point retrieval and a knowledge graph for associated knowledge retrieval based on knowledge points and the interdependencies between knowledge points;

[0085] The knowledge point screening module is used to identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval library and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain the knowledge point set based on the similarity screening;

[0086] A sorting module is used for grouping the knowledge points with relevance according to the minimum adjacency graph for the knowledge point set, grouping the knowledge points without relevance into a separate group, and sorting and combining the grouped and separate knowledge points in a maximum spanning tree manner;

[0087] The context generation module is used to prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate the prompt context;

[0088] The model output module is used to input the prompt context into the question model, and use its reasoning and inductive summary capabilities to organize the final retrieval results.

[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A knowledge retrieval method applied to large-model knowledge question answering, characterized in that: The method comprises: Step 1: organize and clean the knowledge data, and convert the cleaned knowledge data into knowledge text; Step 2: Segment the knowledge text into sentences, paragraphs, and topics at the semantic level, divide the knowledge text into independent knowledge points, annotate each knowledge point with the corresponding title, abstract, keywords, text, and extended explanation, and use the attention mechanism in the deep model to determine the interdependence between knowledge points; Step 3: Based on the knowledge points and the interdependencies between the knowledge points, a knowledge full-text retrieval library for knowledge point retrieval and a knowledge graph for associated knowledge retrieval are constructed; Step 4: Identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval database and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain a knowledge point set based on the similarity; Step 5, for the set of knowledge points in step 4, group the knowledge points with relevance according to the minimum adjacency graph, group the knowledge points without relevance into a separate group, and sort and combine the grouped and separate knowledge points in a maximum spanning tree manner; Step 6: prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate a prompt context; Step 7: Input the prompt context into the question model, and use its reasoning and summarizing capabilities to sort out the final search results.

2. The knowledge retrieval method for large-model knowledge question answering according to claim 1 is characterized in that: In step 1, the knowledge data includes relational database data and document data, wherein the relational database data includes data in xlsx format, and the document data includes data in word and pdf formats.

3. The knowledge retrieval method for large-scale knowledge question answering according to claim 1 is characterized in that: Step 2 also includes: using the representation model to vectorize the title, abstract, keywords, text and extended description of the knowledge point respectively, to obtain a set of index vectors of five aspects: title, abstract, keywords, text and extended description, each index vector contains the vector and the ID of the knowledge point entity.

4. The knowledge retrieval method for large-scale knowledge question answering according to claim 1 is characterized in that: Step 4 specifically includes: identifying the knowledge points in the retrieval question, searching in the knowledge full-text retrieval database based on the knowledge points in the retrieval question, and retrieving the knowledge points that meet the preset conditions; searching in the knowledge graph based on the knowledge points that meet the preset conditions, and retrieving the related knowledge points that have a preset correlation with the knowledge points that meet the preset conditions, taking the knowledge points that meet the preset conditions and the related knowledge points as candidate knowledge points, calculating the similarity and weighting the relevance of the knowledge points in the retrieval question with all the candidate knowledge points, and obtaining the final similarity between each candidate knowledge point and the knowledge point in the retrieval question, and filtering out the knowledge points whose similarity is higher than a threshold based on the final similarity, and obtaining a set of knowledge points that meet the preset requirements.

5. The knowledge retrieval method for large-model knowledge question answering according to claim 4 is characterized in that: In step 6, when knowledge points are nested into the template, since the combined knowledge points have a high correlation, they are embedded adjacently when generating prompts. Different groups of knowledge points have a low correlation and are embedded separately.

6. A knowledge retrieval device applied to large-model knowledge question answering, characterized in that: The device comprises: The knowledge point sorting and conversion module is used to sort and clean the knowledge data and convert the cleaned knowledge data into knowledge text; The segmentation module is used to segment the knowledge text into sentences, paragraphs, and topics at the semantic level, and divide the knowledge text into independent knowledge points. Each knowledge point is annotated with the corresponding title, abstract, keywords, text, and extended description, and the attention mechanism in the deep model is used to determine the interdependence between knowledge points; A knowledge base creation module is used to construct a knowledge full-text retrieval base for knowledge point retrieval and a knowledge graph for associated knowledge retrieval based on knowledge points and the interdependencies between knowledge points; The knowledge point screening module is used to identify the knowledge points in the retrieval question, retrieve the knowledge points related to the knowledge points in the retrieval question from the full-text retrieval library and the knowledge graph as candidate knowledge points, calculate the similarity between each candidate knowledge point and the knowledge point in the retrieval question, and obtain the knowledge point set based on the similarity screening; A sorting module is used for grouping the knowledge points with relevance according to the minimum adjacency graph for the knowledge point set, grouping the knowledge points without relevance into a separate group, and sorting and combining the grouped and separate knowledge points in a maximum spanning tree manner; The context generation module is used to prepare a suitable prompt template for the question model, embed the knowledge points sorted and combined in the maximum spanning tree into the template, and generate the prompt context; The model output module is used to input the prompt context into the question model, and use its reasoning and inductive summary capabilities to organize the final retrieval results.

7. The knowledge retrieval device for large-scale knowledge question answering according to claim 6, characterized in that: The knowledge data includes relational database data and document data, wherein the relational database data includes data in xlsx format and the document data includes data in word and pdf formats.

8. The knowledge retrieval device for large-scale knowledge question answering according to claim 6, characterized in that: The segmentation module is also used to: use the representation model to vectorize the title, abstract, keywords, text and extended description of the knowledge point respectively, and obtain a set of index vectors of five aspects: title, abstract, keywords, text and extended description. Each index vector contains the vector and the ID of the knowledge point entity.

9. The knowledge retrieval device for large-scale knowledge question answering according to claim 6, characterized in that: The knowledge point screening module is specifically used to: identify the knowledge points in the retrieval question, search in the knowledge full-text retrieval library based on the knowledge points in the retrieval question, and retrieve the knowledge points that meet the preset conditions; search in the knowledge graph based on the knowledge points that meet the preset conditions, and retrieve related knowledge points that have a preset correlation with the knowledge points that meet the preset conditions, use the knowledge points that meet the preset conditions and the related knowledge points as candidate knowledge points, calculate the similarity and weight the relevance of the knowledge points in the retrieval question with all the candidate knowledge points, obtain the final similarity between each candidate knowledge point and the knowledge points in the retrieval question, and screen out knowledge points with a similarity higher than a threshold based on the final similarity to obtain a set of knowledge points that meet the preset requirements.

10. The knowledge retrieval device for large-scale knowledge question answering according to claim 6, characterized in that: When knowledge points are nested into the template, since the combined knowledge points have a high correlation, they are embedded adjacently when generating prompts. Different groups of knowledge points have a low correlation and are embedded separately.

Citation Information

Cited By

  • Large model knowledge base construction method based on multi-granularity retrieval

    CN119647581A