Large model question-answering dialogue method, system and storage medium based on vector knowledge base

Through the large model question and answer method based on the vector knowledge base, the retrieval results are constructed and verified to match the large question and answer model in the business field, which solves the problems of high training cost and outdated knowledge of the large model, improves the accuracy and professionalism of the answer, and is applicable Answers to problems in many fields.

CN118484526BActive Publication Date: 2024-09-20SICHUAN ZHONGDIAN AOSTAR INFORMATION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410949498.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-09-20
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

Existing large-model knowledge question and answer solutions suffer from high training costs, knowledge forgetting and hallucination problems. Traditional vector knowledge base search results in low answer accuracy, making it difficult to solve problems in multiple fields.

Method used

A large model Q&A method based on a vector knowledge base is adopted. A vector knowledge base is constructed through a document processor for retrieval and verification. A double verification model is used to screen the retrieval results, and the corresponding large Q&A model is called to generate answers based on user questions and matching business fields.

Benefits of technology

It reduces the cost of training large models, avoids knowledge forgetting and hallucination problems, improves the accuracy and professionalism of answers, and can quickly update knowledge and solve problems in multiple fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118484526B
    Figure CN118484526B
Patent Text Reader

Abstract

The present invention discloses a large-model question-answering dialogue method, system and storage medium based on a vector knowledge base. A search is performed based on the vector knowledge base to obtain a search result containing k document fragment vectors; then the search result is double-verified according to the user's question to screen and obtain the preferred search result. According to the user's question and the text block in the priority search result, the business field is matched. The question-answering large model of the business field is called, and the user's question and the search result output in step S2 are input into the question-answering large model of the business field to generate an answer and send it to the user. The present invention improves the accuracy of the output search results and reduces the interference of irrelevant search fragments and incorrect sorting on the large-model answer. Moreover, before generating the answer, based on the matched business field, a professional question-answering large model is called to answer questions in a specific field, which significantly improves the accuracy and professionalism of the answer and has good practicality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, and specifically relates to a large-model question-answering dialogue method, system and storage medium based on a vector knowledge base. Background Art

[0002] At present, the importance of large-model knowledge question and answer is becoming increasingly prominent. These large language models can interact in human natural language and provide a wide range of knowledge and information to help people solve problems and get answers. Large-model knowledge question and answer can be used in various fields such as education, research, and business to provide users with fast and accurate information retrieval and solutions. The question and answer function of large models not only improves the efficiency of information acquisition, but also promotes knowledge dissemination and sharing, which is of great significance to promoting the development of human society.

[0003] There are two existing basic implementation schemes for large-model knowledge question answering: one is to perform knowledge increment training on the large model, and the other is to use an external vector knowledge base. In the first scheme, relevant knowledge data must first be collected and organized, and then used for large-model training so that the large model can learn and accumulate this knowledge to support knowledge question answering tasks; after training, the model needs to be evaluated and tuned to ensure that it performs well in question answering tasks. However, the training cost of this scheme is high, and the establishment of a sample library is difficult, involving requirements for data volume and data diversity. Due to the large amount of data, the computing resources required for training are also high, and a lot of manpower, time and resources need to be invested in the process. It is difficult for ordinary trainers to meet these requirements; secondly, the problem of knowledge forgetting may occur during the training process, that is, the model may forget the previously learned knowledge while learning new knowledge, affecting the overall knowledge reserve and performance; in addition, the problem of hallucination may also occur during the training process, that is, the model may have a wrong understanding or misunderstanding of certain knowledge during the learning process, resulting in errors in the model when answering questions. Therefore, these factors together lead to the limitations of the first scheme, making it difficult for trainers to effectively train a model with good performance.

[0004] In the second scenario, it is crucial to build and maintain a vector knowledge base, which stores vector representations of questions and answers. When answering a question, the large model first searches the vector knowledge base for the vector representation of the relevant answer, and then passes the found answer to the large model for further processing and answering. The successful implementation of this process requires converting questions and answers into vector representations and implementing efficient search and answer logic in the large model. However, traditional search-answer methods may introduce search fragments that are not relevant to the question, which may interfere with the model's answer generation process, resulting in a decrease in the quality of the final generated answer. Therefore, the limitation of traditional methods is that they fail to effectively distinguish and utilize relevant information, thereby affecting the quality and consistency of the model's answers.

[0005] In summary, existing solutions cannot provide the latest or real-time training data, and there are problems of information lag and outdated knowledge; secondly, traditional vector knowledge base search will interfere with the large model answer, resulting in low answer accuracy and poor user experience. Moreover, with limited training data and knowledge, conventional large model knowledge question and answer is difficult to solve problems in multiple fields, and it is difficult to deeply understand and accurately answer problems in multiple fields. Summary of the invention

[0006] The purpose of the present invention is to provide a large-model question-answering dialogue method, system and storage medium based on a vector knowledge base, aiming to solve the above-mentioned problems.

[0007] The present invention is mainly achieved through the following technical solutions:

[0008] The large model question-answering dialogue method based on the vector knowledge base includes the following steps:

[0009] Step S1: constructing a vector knowledge base: inputting the collected domain knowledge documents into a document processor for parsing and outputting document blocks, then vectorizing the document blocks and finally storing them in a vector knowledge base;

[0010] Step S2: Retrieval and verification based on the vector knowledge base: vectorize the user's question, retrieve several document fragment vectors with similar semantics to the question in the vector knowledge base, and convert the first k document fragment vectors sorted from high to low in terms of similarity into text blocks to obtain the retrieval results;

[0011] Then, based on the user's question and the search results, a double verification is performed to determine whether the content of the text block in the search results is consistent with the background entity or question entity in the question, and whether the content of the text block in the search results answers the question raised in the question; the text blocks in the search results that do not match the user's question or have incorrect answers are screened and removed, and the order of the text blocks in the search results is optimized accordingly;

[0012] Step S3: Question answering: If there is no text block in the search results output in step S2, the user's question is directly input into the general question-and-answer big model and the answer is output; otherwise, the business domain is further obtained based on the user's question and the text block in the search results. Then, the question-and-answer big model of the business domain is called, and the user's question and the search results output in step S2 are input into the question-and-answer big model of the business domain to generate an answer and send it to the user.

[0013] In order to better implement the present invention, further, the document processor includes a document classifier and a content extractor, and the step S1 includes the following steps:

[0014] Step S11: In the document classifier, the domain knowledge documents are divided into structured and unstructured types of documents, and then, for each type of document, the documents are classified according to the format of the document;

[0015] Step S12: According to the type and format of the document, a corresponding content extractor is selected to parse the document data and remove interference items, while retaining the original structure and association relationship of the document data;

[0016] Step S13: According to the type of the document and the content parsed and extracted in step S12, the document is divided into document blocks, and the semantic structure of the original document is retained;

[0017] Step S14: After obtaining the document block, the document block is vectorized and stored in the vector knowledge base.

[0018] In order to better implement the present invention, further, in the step S12, for structured documents, a CSV extractor, an HTML extractor, a JSON extractor and an Excel extractor are designed, and the CSV extractor and the Excel extractor respectively extract each line of the file as a piece of data, and retain the column name before each piece of data content; the HTML extractor decodes and extracts content according to the structure tag; the JSON extractor extracts content according to the key and content of the data; for unstructured documents, a Word extractor, a Text extractor and a PDF extractor are designed, and the Word extractor reads the text content and retains the original format, and for the table contained in the document, each line is extracted as a piece of data, and the column name is retained before the content of each line of data; the Text extractor reads the text content and retains the original format; in the PDF extractor, if it is in the form of an image, the text is extracted through OCR recognition, and if it is not in the form of an image, the text content is read and the original format is retained, and the PDF extractor extracts each line of the table contained in the document as a piece of data, and the column name is retained before the content of each line of data.

[0019] In order to better implement the present invention, further, in the step S13, for structured documents, if a CSV extractor is used to parse the data, the data is divided into blocks based on each line as an independent block; if an HTML extractor or a JSON extractor is used to parse the data, the data is divided into blocks based on the structure of the field; if an Excel extractor is used to parse the data, the data is divided into blocks based on each line as an independent block; for unstructured documents, if a Word extractor or a Text extractor or a PDF extractor is used to parse the data, a progressive block method is used to divide the data into blocks based on paragraphs, and if a paragraph exceeds the word limit, the data is divided into blocks based on the number of words.

[0020] In order to better implement the present invention, further, in step S2, the double verification includes the following steps:

[0021] Step S21: Based on the user's question, use the BERT model to extract background entities and question entities in the question;

[0022] Step S22: for the text block in the search result, expand the text block and broaden the coverage of the text block through continuous context integration;

[0023] Step S23: input the background entity extracted in step S21 and the text block expanded in step S22 into the entity evaluation model for evaluation to determine whether the content of the expanded text block is consistent with the background entity and whether it covers the information surrounding the background entity; if the evaluation is passed, retain the text block and proceed to step S24, otherwise delete the text block from the search results; the entity evaluation model is trained based on a large language model;

[0024] Step S24: The question entity extracted in step S21 and the text block of the search result filtered in step S23 are respectively input into the answer evaluation model for evaluation to determine whether the content of the expanded text block truly answers the question raised in the question; the answer evaluation model is trained based on a large language model.

[0025] In order to better implement the present invention, further, in step S23, the formation of the entity evaluation model includes the following steps:

[0026] Step SA1: First, input the background entity into the LLM general language model and generate the abbreviation, expansion, synonym, Chinese and English of the background entity;

[0027] Step SA2: Secondly, construct prompt word and training data based on the content generated in step SA1.

[0028] Step SA3: Then, based on the prompt word prompt and the training data, the training base model is trained.

[0029] Step SA4: Finally, an entity evaluation model is generated through model evaluation.

[0030] In order to better implement the present invention, further, in step S3, matching to obtain relevant fields includes the following steps:

[0031] Step S31: Add a domain and a business tag under the domain according to actual business needs to construct a domain pool;

[0032] Step S32: extracting keywords based on the user's question and the text blocks in the search results and based on the general large language model;

[0033] Step S33: Calculate the similarity between the keyword in step S32 and the business tag in step S31 to perform spatial matching between the keyword and the business tag;

[0034] Step S34: Calculate the correlation score C of the k domain k (x), finally, the relevance score C of each field k (x) Sort from large to small and set the correlation score C k (x) The highest field is taken as the matching related field; where the relevance score C k The calculation formula of (x) is as follows:

[0035]

[0036] in, Sim j Indicates the similarity between the keyword and the jth business tag;

[0037] J The total number of business labels in this field.

[0038] The present invention is mainly achieved through the following technical solutions:

[0039] The large-model question-answering dialogue system based on a vector knowledge base adopts the above-mentioned large-model question-answering dialogue method based on a vector knowledge base, and includes a vector knowledge base module, a retrieval module, a verification module and a reply module. The vector knowledge base module is used to construct and update the vector knowledge base; the retrieval module is used to retrieve the retrieval results including k text blocks based on the vector knowledge base; the verification module is used to perform double verification on the text blocks in the retrieval results, and screen to obtain the optimal retrieval results; the reply module is used to match the business field based on the user's questions and the retrieval results, and call the large-scale language model corresponding to the business field to generate answers and send them to the user.

[0040] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned large-model question-answering dialogue method based on a vector knowledge base.

[0041] The beneficial effects of the present invention are as follows:

[0042] (1) The present invention adopts a vector knowledge base to replace incremental knowledge training, solves the problem of obsolete knowledge in large models, avoids knowledge forgetting and hallucination problems caused by knowledge training on large models, and also reduces the training cost of large models. The present invention cleverly combines vector knowledge base and model training, reduces the construction cost of conventional knowledge question and answer large models, and improves the accuracy of question and answer dialogues. In addition, the present invention verifies and screens the search results based on the vector knowledge base through retrieval and verification, reduces the interference of irrelevant search fragments on the answers of the large model, and quotes and applies question and answer large models in different fields to solve problems in professional fields, improves the accuracy and professionalism of the answers, and has good practicality.

[0043] (2) The present invention establishes a document classifier and a content extractor to accurately construct a vector knowledge base. By constructing a large-scale retrieval verification model, the accuracy of the output retrieval results is improved, and the interference of irrelevant search fragments and incorrect sorting on the large-scale model answers is reduced. This method not only ensures the rapid update of the question-answering model knowledge, but also significantly improves the accuracy of the answers. Moreover, before generating answers, a domain classifier is used to classify business domains to guide the professional question-answering large model to answer questions in specific fields, which can significantly improve the accuracy and effect of the answers and has good practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flow chart of the large model question-answering dialogue method based on the vector knowledge base of the present invention;

[0045] Figure 2 It is the principle block diagram of the document processor;

[0046] Figure 3 A classification diagram for document classifiers and content extractors;

[0047] Figure 4 To retrieve and verify the principle block diagram of the large model;

[0048] Figure 5 Generate schematics for entity evaluation models;

[0049] Figure 6 Generate schematic diagrams of the evaluation model for the answer;

[0050] Figure 7 This is the principle block diagram of the domain classifier. DETAILED DESCRIPTION

[0051] Embodiment 1:

[0052] A large model question-answering dialogue method based on vector knowledge base, such as Figure 1 As shown, the specific steps include:

[0053] (1) Construction of vector knowledge base: vertical domain knowledge documents are obtained and input into the document processor for parsing and output of document blocks, which are then vectorized and stored in the vector knowledge base.

[0054] (2) Vector knowledge base retrieval and verification: Based on the user's question, a number of document fragment vectors are retrieved from the vector knowledge base, and the top k most similar document fragment vectors are used as the retrieval results; the document fragment vectors in the retrieval results are converted into text blocks, and the retrieval results are input into the retrieval verification model for double verification, and the final retrieval results are obtained by screening;

[0055] (3) Question answering: If there is no text block in the final search results, the user's question is input into the general question-answering model and the answer is output; if there is a text block in the final search results, the text block in the search results and the user's question are respectively input into the domain classifier to match the business domain, retrieve the question-answering model of the domain, and input the user's question and search results into the question-answering model of the domain and the answer is output.

[0056] Preferably, in the vector knowledge base construction phase, the collected domain knowledge documents are input into the document processor for parsing, and after the document blocks are output, the document blocks are vectorized and finally stored in the vector knowledge base. Figure 2 As shown, a document processor is constructed, which includes a document classifier and a content extractor, and is used to process different documents in different ways to improve the accuracy of searching for document content in the vector knowledge base. The specific steps are as follows:

[0057] 1) Input the collected domain knowledge documents into the document classifier and classify them according to their different formats and types, so as to facilitate the selection of different content extractors in the next step.

[0058] 2) As shown in Table 1 and Figure 3 As shown, a dedicated content extractor is designed for each document format to accurately parse the data and remove interference items while retaining the original structure and association relationships of the data.

[0059] Table 1 Content extractors and extraction methods for documents in different formats

[0060]

[0061] 3) As shown in Table 2, targeted segmentation is performed according to different types of documents and extracted content, aiming to preserve the semantic structure of the original file and improve search accuracy.

[0062] The setting of the word count threshold for each block is related to many factors such as the embedding model, the word count of the original document, and the user's questioning habits, and needs to be adjusted according to the actual situation. For the embedding model, select an appropriate word count threshold for each block based on the selected embedding model; for the word count of the original document, if it is a long article or book, a larger block helps to retain the contextual semantics, and if it is an independent short text, a smaller block helps to accurately query; if the user's question is short, the word count threshold for each block can be smaller, and if the user's question is complex, the word count threshold for each block can be larger.

[0063] Table 2 Chunking methods of different content extractors

[0064]

[0065] 4) After obtaining the text block, the text block is vectorized and stored in the vector knowledge base to be provided for retrieval in the next step.

[0066] Preferably, a retrieval verification is performed to verify the document fragment vectors retrieved from the vector knowledge base to avoid interference of incorrect answer searches and irrelevant texts on the large model answers, thereby improving the accuracy of knowledge questions and answers. In the vector knowledge base retrieval and verification stage, first search for similar document fragment vectors in the vector knowledge base based on the question, and then input the retrieval verification large model to verify the retrieval results: 1) Vectorize the user's question, search for document fragment vectors with similar semantics to the question in the vector knowledge base, convert the first k document fragment vectors from vectors to text and return them, and obtain several text blocks, where the k value is set by the user according to the actual test situation. 2) After obtaining the retrieval results, the user's original question and the retrieved text block need to be input into a retrieval verification large model for verification.

[0067] In traditional retrieval methods, usually only the similarity between user questions and text fragments is compared, rather than comparing the correct answer with the text fragment. This method has a problem that it may mistakenly match text fragments that are irrelevant to the question or have incorrect answers.

[0068] The retrieval verification model needs to verify two key aspects: whether the content of the retrieved text block is consistent with the background theme or question entity in the question, and whether the content of the retrieved text block truly answers the question raised in the question; through this double verification, we can ensure that the answer finally presented to the user is not only closely related to the question, but also can accurately answer the user's question, thereby providing higher quality retrieval results. The retrieval verification model is composed of a plurality of large and small models in a collaborative combination, each model is responsible for different tasks, specifically, the retrieval verification model includes an entity evaluation model and an answer evaluation model. By using the retrieval verification model, the present invention can effectively filter out and remove text blocks that do not match the user's question or have incorrect answers, and optimize the sorting of the text blocks in the filtered retrieval results accordingly. Doing so can avoid interference of irrelevant or incorrectly sorted answers in the vector knowledge base with the final answer.

[0069] like Figure 4 As shown, the specific scheme of the retrieval verification model is as follows:

[0070] i) Based on the user's question, the BERT model is used to extract the background entities and question entities in the question. For example, if the question is "What are the working hours of the power trading center", the extracted background entity is "power trading center" and the question entity is "working hours".

[0071] ii) Convert the k document fragment vectors in the retrieval results into k text blocks, and then perform text block expansion operations, that is, broaden the coverage of text blocks through continuous context integration.

[0072] iii) Input the expanded text block and the extracted background entity into the entity evaluation model for evaluation to determine whether the content of the expanded text block is consistent with the background entity and whether it covers the core related information around the background entity. If the evaluation passes, the text block is retained and proceeds to step iv). If the evaluation fails, the text block is deleted from the retrieval results.

[0073] like Figure 5 As shown in the figure, the entity evaluation model is constructed by fine-tuning the large language model, taking into account the abbreviations, expansions, synonyms, and Chinese and English contexts of the background entities to ensure the accuracy and comprehensiveness of the evaluation. The specific steps include:

[0074] First, the LLM general large language model is used to generate abbreviations, expansions, synonyms, Chinese and English of background entities. Secondly, the generated content is used to build prompt words and training data. Then, model training and model evaluation are performed through the training base model based on model evaluation screening, and finally an entity evaluation model is generated.

[0075] Examples of the Prompt words are as follows:

[0076] “You are a background entity assessment assistant.

[0077] I will provide you with background entities, text snippets, and abbreviations, expansions, synonyms, Chinese and English phrases related to the background entities.

[0078] Your task is to determine whether the text fragment is consistent with the background entity based on the background entity and text fragment in the input and considering the relevant entity expansion words. If it is consistent, answer "yes", if it is inconsistent, answer "no".

[0079] iv) If the background entity evaluation is passed, the text block and the question entity are input into the answer evaluation model for in-depth analysis. The answer evaluation model aims to evaluate whether the text block accurately responds to the user's query, thereby avoiding the semantic deviation problem that may be caused by matching only the question and text vector. If the evaluation is passed, the text block is retained and proceeds to step v). If the evaluation is not passed, the text block is deleted from the retrieval results.

[0080] like Figure 6 As shown in the figure, the answer evaluation model is constructed by fine-tuning the large language model. First, data is collected and the corresponding training data and prompt words are constructed. Secondly, fine-tuning training and model evaluation are performed through the training base model screened based on model evaluation, verification and tuning, and finally the answer evaluation model is output.

[0081] v) The text blocks that have passed the question evaluation are included in the text block set, and the text blocks in the text block set are reordered using the reordering algorithm, and finally the optimized retrieval results are output.

[0082] Preferably, in the question answering stage, the specific steps are as follows:

[0083] (1) If there is no text block related to the question in the optimized search results output above, the user's question is directly input into the universal large model to obtain an answer and send it to the user.

[0084] (2) If there are text blocks related to the question in the optimized search results output above, the user's question and the text blocks in the optimized search results should be input into the domain classifier for domain division. Build a domain classifier to divide the business domain according to the user's question and the searched answer. Different business domains can call different domain models. Using more professional models to answer user questions can improve the answer effect and user experience.

[0085] The domain classifier is a specially designed large model for domain classification. Its core function is to perform domain-level classification based on user questions and their related search fragments. This process is crucial for the subsequent accurate calling of dedicated models for the corresponding fields to generate answers. Compared with small models, LLM general large language models have significant advantages in the depth and breadth of language understanding, which enables them to show higher accuracy and generalization when performing domain classification tasks. The domain classifier adopted by the present invention, by utilizing the advanced language processing capabilities of the LLM general large language model, realizes an efficient solution that can be directly configured and used without additional training, which is more convenient and universal. Figure 7 As shown, the specific steps are as follows:

[0086] The first step is to add domains and business tags under the domains in the domain pool according to actual business needs. For example, domain A business tag, domain B business tag, domain C business tag, etc. Specifically, in the field of power dispatching, business tags include load forecasting, power generation dispatching, power transmission, etc.

[0087] In the second step, the LLM general large language model extracts keywords based on the user's question and the text blocks in the search results, which are used for spatial matching with business tags in the next step;

[0088] The third step is to determine the tags related to the keywords by calculating the similarity between the keywords and the business tags (e.g., cosine similarity);

[0089] Step 4: Calculate the relevance score C for each field k (x), then according to the correlation score C k (x) Sort the fields.

[0090]

[0091] in, Sim j Indicates the similarity between the keyword and the jth business tag;

[0092] J The total number of business labels in this field.

[0093] (3) After sorting, the business field with the strongest correlation with the question and text block is selected, and the question-answering model matching this field is used to answer the user's question based on the retrieved text block, and finally the answer is returned to the user.

[0094] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A large model question-answering dialogue method based on a vector knowledge base, characterized in that: The following steps are involved: Step S1: constructing a vector knowledge base: inputting the collected domain knowledge documents into a document processor for parsing and outputting document blocks, then vectorizing the document blocks and finally storing them in a vector knowledge base; Step S2: Retrieval and verification based on the vector knowledge base: vectorize the user's question, retrieve several document fragment vectors with similar semantics to the question in the vector knowledge base, and convert the first k document fragment vectors sorted from high to low in terms of similarity into text blocks to obtain the retrieval results; Then, based on the user's question and the search results, a double verification is performed to determine whether the content of the text block in the search results is consistent with the background entity or question entity in the question, and whether the content of the text block in the search results answers the question raised in the question; the text blocks in the search results that do not match the user's question or have incorrect answers are screened and removed, and the order of the text blocks in the search results is optimized accordingly; In step S2, the double verification includes the following steps: Step S21: Based on the user's question, use the BERT model to extract background entities and question entities in the question; Step S22: for the text block in the search result, expand the text block and broaden the coverage of the text block through continuous context integration; Step S23: input the background entity extracted in step S21 and the text block expanded in step S22 into the entity evaluation model for evaluation to determine whether the content of the expanded text block is consistent with the background entity and whether it covers the information surrounding the background entity; if the evaluation is passed, retain the text block and proceed to step S24, otherwise delete the text block from the search results; the entity evaluation model is trained based on a large language model; Step S24: inputting the question entity extracted in step S21 and the text block of the search result screened in step S23 into the answer evaluation model for evaluation to determine whether the content of the expanded text block truly answers the question raised in the question; the answer evaluation model is trained based on the large language model; Step S3: Question answering: If there is no text block in the search results output in step S2, the user's question is directly input into the general question-and-answer big model and the answer is output; otherwise, the business domain is further obtained based on the user's question and the text block in the search results. Then, the question-and-answer big model of the business domain is called, and the user's question and the search results output in step S2 are input into the question-and-answer big model of the business domain to generate an answer and send it to the user.

2. The large model question-answering dialogue method based on vector knowledge base according to claim 1 is characterized in that: The document processor includes a document classifier and a content extractor, and the step S1 includes the following steps: Step S11: In the document classifier, the domain knowledge documents are divided into structured and unstructured types of documents, and then, for each type of document, the documents are classified according to the format of the document; Step S12: According to the type and format of the document, a corresponding content extractor is selected to parse the document data and remove interference items, while retaining the original structure and association relationship of the document data; Step S13: According to the type of the document and the content parsed and extracted in step S12, the document is divided into document blocks, and the semantic structure of the original document is retained; Step S14: After obtaining the document block, the document block is vectorized and stored in the vector knowledge base.

3. The large model question-answering dialogue method based on vector knowledge base according to claim 2 is characterized in that: In the step S12, for structured documents, a CSV extractor, an HTML extractor, a JSON extractor and an Excel extractor are designed. The CSV extractor and the Excel extractor extract each line of the file as a piece of data, respectively, and reserve the column name before each piece of data content; The HTML extractor extracts content by decoding according to the structure tag; the JSON extractor extracts content according to the key and content of the data; for unstructured documents, Word extractors, Text extractors and PDF extractors are designed. The Word extractor reads the text content and retains the original format. For the table contained in the document, each row is extracted as a piece of data, and the column name is retained before each row of data content; The Text extractor reads the text content and retains the original format; in the PDF extractor, if it is in the form of an image, the text is extracted through OCR recognition, and if it is not in the form of an image, the text content is read and the original format is retained. For the table contained in the document, the PDF extractor extracts each row as a piece of data, and retains the column name before each row of data content.

4. The large model question-answering dialogue method based on vector knowledge base according to claim 3 is characterized in that: In the step S13, for structured documents, if a CSV extractor is used to parse data, each line is divided into independent blocks; if an HTML extractor or a JSON extractor is used to parse data, the data is divided into blocks according to the structure of the field; if an Excel extractor is used to parse data, each line is divided into independent blocks; for unstructured documents, if a Word extractor, a Text extractor, or a PDF extractor is used to parse data, a progressive block method is used to divide the data into blocks according to paragraphs. If a paragraph exceeds the word limit, the data is divided into blocks according to the number of words.

5. The large model question-answering dialogue method based on vector knowledge base according to claim 1 is characterized in that: In step S23, the formation of the entity evaluation model includes the following steps: Step SA1: First, input the background entity into the LLM general language model and generate the abbreviation, expansion, synonym, Chinese and English of the background entity; Step SA2: Secondly, construct prompt word and training data based on the content generated in step SA1. Step SA3: Then, based on the prompt word prompt and the training data, the training base model is trained. Step SA4: Finally, an entity evaluation model is generated through model evaluation.

6. The large model question-answering dialogue method based on vector knowledge base according to claim 1 is characterized in that: In step S3, matching and obtaining relevant fields includes the following steps: Step S31: Add a domain and a business tag under the domain according to actual business needs to construct a domain pool; Step S32: extracting keywords based on the user's question and the text blocks in the search results and based on the general large language model; Step S33: Calculate the similarity between the keyword in step S32 and the business tag in step S31 to perform spatial matching between the keyword and the business tag; Step S34: Calculate the correlation score C of the k domain k (x), finally, the relevance score C of each field k (x) Sort from large to small and set the correlation score C k (x) The highest field is taken as the matching related field; where the relevance score C k The calculation formula of (x) is as follows: in, Sim j Indicates the similarity between the keyword and the jth business tag; J The total number of business labels in this field.

7. A large model question-answering dialogue system based on a vector knowledge base, which is implemented by using a large model question-answering dialogue method based on a vector knowledge base as described in any one of claims 1 to 6, characterized in that: The system comprises a vector knowledge base module, a retrieval module, a verification module and a reply module. The vector knowledge base module is used to construct and update a vector knowledge base; the retrieval module is used to retrieve and obtain a retrieval result including k text blocks based on the vector knowledge base; the verification module is used to perform double verification on the text blocks in the retrieval result and screen to obtain the optimal retrieval result; the reply module is used to match the business field based on the user's question and the retrieval result, and call the large language model corresponding to the business field to generate an answer and send it to the user.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the large model question-answering dialogue method based on a vector knowledge base described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for improving response speed of large-scale language model based on similarity retrieval

    CN116910221A

  • Conversational knowledge base

    US20240070434A1