Intelligent question answering method, device and equipment based on large language model and storage medium

By constructing a knowledge base and extracting keywords to characterize the user's intention, the problem of insufficient accuracy of retrieval results in the intelligent Q & A system is solved, and the overall accuracy and performance of the system are improved.

CN119357359APending Publication Date: 2025-01-24GUANGDONG KAITONG SOFTWARE DEV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411469224.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The existing intelligent question-and-answer system based on large language models has shortcomings in the accuracy of the search results, which affects the overall performance of the system.

Method used

By constructing the knowledge base, the keywords represent the user's intention from the user's problems, and the knowledge base recalls the knowledge base based on the user's intent and problems, and generates a large language model to generate the answer.

Benefits of technology

It improves the accuracy of intelligent question answering systems based on large language models, and enhances the understanding of user intentions and the accuracy of knowledge recall.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357359A_ABST
    Figure CN119357359A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent question-answering method, device and equipment based on a large language model and a storage medium. The technical problem that an existing intelligent question-answering system based on the large language model is low in accuracy is solved. The method comprises the following steps: constructing a knowledge base; extracting a plurality of keywords from the user question, and representing the user intention by adopting the plurality of keywords; performing knowledge recall on the knowledge base according to the user intention and the user question to obtain a recall result; adopting the user question and the recall result to generate a Prompt (Prompt); and inputting the cue word into a large language model to generate an answer to the user question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent question answering technology, and in particular to an intelligent question answering method, device, equipment and storage medium based on a large language model. Background Art

[0002] With the rise of large language models (LLMs), intelligent question-answering assistants based on large language models are widely used in many industries and scenarios. Intelligent question-answering assistants based on large language models have more powerful semantic understanding and language organization capabilities, but their shortcomings are also very obvious, such as backward knowledge and easy hallucinations. In order to solve this problem, people have proposed a method called RAG (Retrieval-Augmented Generation). Technology is a hot area in the application of large language models (LLMs). It solves some challenges of LLM in knowledge updating, long-tail knowledge mastery and data privacy protection by combining retrieval and generation. RAG is widely used in knowledge-intensive scenarios or specific professional fields that require continuous knowledge updating, without the need to retrain large language models for specific tasks. RAG includes two steps: retrieval and generation. The retrieval results are the basis for determining the subsequent generation process and have a decisive influence on the final generation results. Therefore, it is crucial to improve the accuracy of retrieval results in the RAG method.

[0003] However, limited by the existing technological development and performance requirements, the existing RAG retrieval technology still has many problems and the retrieval accuracy is still unsatisfactory. How to improve the accuracy of the retrieval process in the RAG system is the key and difficulty faced in many current application scenarios.

[0004] The current mainstream research on RAG technology mainly includes the following aspects:

[0005] 1) Basic RAG process: The core of RAG technology is to combine the user's query with the retrieved relevant information to form an enhanced context, which is then input into the LLM to generate an answer. This process includes data extraction, text segmentation, vectorization, index creation, retrieval, automatic sorting (Rerank) and LLM induction generation.

[0006] 2) Advanced RAG techniques: To improve the performance of RAG systems, researchers have proposed a variety of advanced techniques, such as pre-retrieval and post-retrieval processing, using a re-ranking model to optimize the order of retrieval results, and reducing the amount of text processed by LLM through prompt compression technology.

[0007] 3) Modular RAG: Modular RAG provides flexibility by integrating sub-modules with different functions, including search module, memory module, fusion module, routing module, prediction and task adapter, etc., to adapt to different application scenarios and requirements.

[0008] 4) RAG optimization: Optimization measures include index optimization (such as chunk optimization, metadata addition, and use of structured corpus), retrieval source optimization, query optimization, embedding optimization, and retrieval process optimization, such as iterative retrieval, recursive retrieval, and adaptive retrieval.

[0009] 5) Multimodal RAG: RAG technology is not limited to text, but has also been extended to multimodal content such as images, videos, and audio. By combining the multimodal large model (LMM) and vector database, it improves the ability to understand and generate multimodal content.

[0010] 6) RAG frameworks and tools: Some RAG frameworks and tools have emerged, such as LangChain, LlamaIndex, and Haystack, which provide the infrastructure and components for building RAG systems and simplify the development process.

[0011] Although RAG technology has made significant progress in improving the accuracy of large language models (LLMs) and the speed of knowledge updating, there is still the problem of insufficient accuracy of retrieval results. Summary of the invention

[0012] The present invention provides an intelligent question answering method, apparatus, device and storage medium based on a large language model, which are used to solve the technical problem of low accuracy of the existing intelligent question answering based on a large language model.

[0013] The present invention provides an intelligent question-answering method based on a large language model, comprising:

[0014] Build a knowledge base;

[0015] Extracting multiple keywords from the user's question and using the multiple keywords to represent the user's intention;

[0016] Recalling the knowledge base according to the user intention and the user question to obtain a recall result;

[0017] Generate prompt words using the user question and the recall result;

[0018] The prompt word is input into a large language model to generate an answer to the user's question.

[0019] Optionally, the step of building a knowledge base includes:

[0020] Access unstructured documents;

[0021] extracting text information, table information, chapter title information and image information from the unstructured file;

[0022] Performing format conversion on the text information, the table information, the chapter title information and the image information to obtain a target format text;

[0023] Extracting abstracts and segmenting text from the target format text to obtain knowledge entry corpus blocks;

[0024] Performing vector encoding on the knowledge item corpus to obtain an encoding vector;

[0025] The encoding vector is used to construct a knowledge base.

[0026] Optionally, the step of performing knowledge recall on the knowledge base according to the user intention and the user question to obtain a recall result includes:

[0027] Recalling a first recall corpus containing all of the user intentions from the knowledge base to generate a first recall corpus set;

[0028] Calculating a first vector similarity between the user question and each first recalled corpus in the first corpus set;

[0029] Sorting the first recalled corpora according to the first vector similarity, and obtaining top K first recalled corpora with the highest similarity according to the sorting to obtain a first corpus set;

[0030] Determine whether the number of first corpora in the first corpus set is less than K;

[0031] If not, return the top K first corpora with the highest similarity as the recall result.

[0032] Optionally, it also includes:

[0033] If the number of first corpora in the first corpus set is less than K, recall second recalled corpora containing any user intention from the knowledge base to obtain a second recalled corpus set;

[0034] Calculating a second vector similarity between the user question and each second recalled corpus in the second recalled corpus set;

[0035] Sorting the second recalled corpora according to the second vector similarity, and obtaining first K second recalled corpora with the highest similarity according to the sorting to obtain a second corpus set;

[0036] Merging the first corpus and the second corpus, and removing duplicates from the merged result to obtain a third corpus;

[0037] Determine whether the number of third corpora in the third corpus set is less than K pieces;

[0038] If not, the third corpora in the third corpus set are reordered according to the first vector similarity and the second vector similarity, and top K third corpora with the highest similarity are returned as the recall result.

[0039] Optionally, it also includes:

[0040] If the number of third corpora in the third corpus set is less than K pieces, calculating the third vector similarity between the user question and each piece of corpus in the knowledge base;

[0041] Sorting the corpus according to the third vector similarity, and obtaining top K corpora with the highest similarity according to the sorting to obtain a fourth corpus set;

[0042] Merging the third corpus and the fourth corpus, and removing duplicates from the merging result to obtain a fifth corpus;

[0043] The fifth corpus in the fifth corpus set is reordered according to the first vector similarity, the second vector similarity, and the third vector similarity, and top K corpora with the highest similarity are returned as recall results.

[0044] The present invention also provides an intelligent question-answering device based on a large language model, comprising:

[0045] A knowledge base construction module is used to construct a knowledge base;

[0046] A user intention generation module, used to extract multiple keywords from the user's question and use the multiple keywords to represent the user's intention;

[0047] A recall module, used to recall knowledge from the knowledge base according to the user intention and the user question, and obtain a recall result;

[0048] A prompt word generation module, used to generate prompt words using the user question and the recall result;

[0049] The answer generation module is used to input the prompt word into the large language model to generate an answer to the user's question.

[0050] Optionally, the knowledge base construction module includes:

[0051] An unstructured file acquisition submodule is used to acquire unstructured files;

[0052] A text information, table information, chapter title information and image information extraction submodule, used to extract text information, table information, chapter title information and image information from the unstructured file;

[0053] A target format text conversion submodule is used to perform format conversion on the text information, the table information, the chapter title information and the image information to obtain a target format text;

[0054] A knowledge entry corpus block generation submodule is used to extract abstracts and segment texts of the target format text to obtain knowledge entry corpus blocks;

[0055] A vector encoding submodule, used for performing vector encoding on the knowledge item corpus to obtain an encoding vector;

[0056] The knowledge base construction submodule is used to construct a knowledge base using the encoding vector.

[0057] Optionally, the recall module includes:

[0058] A first recall corpus generation submodule is used to recall the first recall corpus containing all the user intentions from the knowledge base to generate a first recall corpus set;

[0059] A first vector similarity calculation submodule, used to calculate the first vector similarity between the user question and each first recalled corpus in the first corpus set;

[0060] A first corpus generation submodule is used to sort the first recalled corpus according to the first vector similarity, and obtain the first K first recalled corpora with the highest similarity according to the sorting to obtain a first corpus;

[0061] A first judgment submodule, used to judge whether the number of first corpora in the first corpus set is less than K;

[0062] The first recall result generating submodule is used to return the top K first corpora with the highest similarity as the recall result if no.

[0063] The present invention also provides an electronic device, the device comprising a processor and a memory:

[0064] The memory is used to store program code and transmit the program code to the processor;

[0065] The processor is used to execute the intelligent question answering method based on a large language model as described in any of the above items according to the instructions in the program code.

[0066] The present invention also provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the intelligent question answering method based on a large language model as described in any of the above items.

[0067] From the above technical scheme, it can be seen that the present invention has the following advantages: the present invention constructs a knowledge base; extracts multiple keywords from user questions and uses multiple keywords to represent user intentions; recalls knowledge from the knowledge base according to user intentions and user questions to obtain recall results; generates prompt words using user questions and recall results; inputs the prompt words into a large language model to generate answers to user questions. This improves the accuracy of intelligent question answering based on a large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] 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 only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0069] Figure 1 A flowchart of a method for intelligent question answering based on a large language model provided by an embodiment of the present invention;

[0070] Figure 2 A flowchart of a method for intelligent question answering based on a large language model provided by another embodiment of the present invention;

[0071] Figure 3 Create a process diagram for the knowledge base;

[0072] Figure 4 Schematic diagram of the user intent recognition process;

[0073] Figure 5 This is a flowchart of the knowledge recall process;

[0074] Figure 6 Flowchart for knowledge recall;

[0075] Figure 7 Generate a flowchart for the answer;

[0076] Figure 8 A structural block diagram of an intelligent question-answering device based on a large language model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0077] The embodiments of the present invention provide a large language model-based intelligent question answering method, apparatus, device and storage medium, which are used to solve the technical problem of low accuracy of existing large language model-based intelligent question answering.

[0078] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not 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.

[0079] See also Figure 1 , Figure 1 A flowchart of the steps of an intelligent question-answering method based on a large language model provided in an embodiment of the present invention.

[0080] The present invention provides an intelligent question answering method based on a large language model, which may specifically include the following steps:

[0081] Step 101, building a knowledge base;

[0082] A knowledge base is a structured, easy-to-operate, easy-to-use, and fully organized knowledge cluster in knowledge engineering. It is a collection of interconnected knowledge pieces that are stored, organized, managed, and used in a computer memory using a certain (or several) knowledge representation method to solve problems in a certain (or certain) field. These knowledge pieces include theoretical knowledge and factual data related to the field, heuristic knowledge obtained from expert experience, such as definitions, theorems, and operation rules related to a certain field, as well as common sense knowledge.

[0083] In the embodiment of the present invention, the knowledge base construction process may be a process of parsing and processing unstructured file information, converting it into knowledge corpus, and saving it into the knowledge base.

[0084] Step 102, extracting multiple keywords from the user's question and using the multiple keywords to represent the user's intention;

[0085] Keywords refer to words that can represent the semantic information of user questions.

[0086] In the embodiment of the present invention, multiple keywords may be extracted from the user question to determine the user intention through the extracted multiple keywords.

[0087] Step 103, recalling knowledge from the knowledge base according to the user's intention and the user's question to obtain a recall result;

[0088] The knowledge recall process is to retrieve and recall the chunks of corpus related to the user's question from the knowledge base, reorder the recall results, and obtain the final recall results.

[0089] After determining the user's intention, the knowledge base can be recalled according to the user's intention and the user's question to obtain the recall result.

[0090] Step 104, generating prompt words using the user question and the recall result;

[0091] Step 105: Input the prompt word into the large language model to generate an answer to the user's question.

[0092] In an embodiment of the present invention, after completing the knowledge recall, the user question, the recall result and related requirements can be combined in the prompt words, and finally submitted to the large language model to allow the large language model to generate and output the corresponding answer.

[0093] The present invention improves the accuracy of intelligent question-answering based on the large language model by constructing a knowledge base; extracting multiple keywords from user questions and using multiple keywords to represent user intentions; recalling knowledge from the knowledge base according to user intentions and user questions to obtain recall results; generating prompt words using user questions and recall results; and inputting the prompt words into a large language model to generate answers to user questions.

[0094] See also Figure 2 , Figure 2 A flowchart of a method for intelligent question answering based on a large language model provided in another embodiment of the present invention. Specifically, the method may include the following steps:

[0095] Step 201, obtaining an unstructured file;

[0096] Step 202, extracting text information, table information, chapter title information and image information from the unstructured file;

[0097] Step 203, converting the text information, table information, chapter title information and image information to obtain a target format text;

[0098] Step 204, extracting a summary and segmenting the target format text to obtain knowledge item corpus blocks;

[0099] Step 205, vector encoding is performed on the knowledge item corpus to obtain an encoding vector;

[0100] Step 206, constructing a knowledge base using the encoding vector;

[0101] In the embodiment of the present invention, the knowledge base creation process is as follows: Figure 3 shown.

[0102] First, obtain unstructured files (such as PDF, docx, doc, HTML, Markdown, CSV, xls, xlsx), then parse the unstructured files, extract text information, table information, chapter title information and image information (for image information, first save it to the file management system and record its path and name), and then convert various formats of information into target format text, such as Markdown format text (where image information can be converted into the corresponding format through OCR and URL). Then extract the summary and segment the text from the Markdown text to obtain the knowledge entry corpus chunk. On this basis, vector encode each chunk to obtain the encoding vector and save it in the knowledge base.

[0103] Step 207, extracting multiple keywords from the user's question, and using the multiple keywords to represent the user's intention;

[0104] In the embodiment of the present invention, the user intention recognition process is as follows: Figure 4 As shown. User intent recognition is to extract n keywords that can effectively represent the semantic information of the question from the user question (Query), output the keywords, and use the extracted keywords as the user intent. Multiple keywords can reflect the user's main intent from different angles and obtain multi-intent representations. Among them, the extraction of keywords can be based on the jieba word segmentation scheme, or it can be generated using the large language model (LLM). For details, please refer to the conventional jieba word segmentation extraction scheme and large language model generation method, which will not be repeated here.

[0105] Furthermore, if keyword extraction is performed through Jieba word segmentation, after the keywords are extracted, the keywords can be rewritten and the user intent can be summarized using the capabilities of a large language model, thereby obtaining keywords that are more in line with the style and structure of the existing knowledge base.

[0106] Step 208, recalling knowledge from the knowledge base according to the user's intention and the user's question to obtain a recall result;

[0107] After determining the user's intention, the knowledge base can be recalled according to the user's intention and the user's question to obtain the recall result.

[0108] In the embodiment of the present invention, Figure 5 As shown, Figure 5 FIG. 2 is a flow chart of the knowledge recall process. The recall process mainly includes two stages: intent filtering and vector recall. The corpus in the knowledge base is retrieved mainly based on the user's question (Query) and the user's intent. Under this premise, step 208 may include the following sub-steps:

[0109] S801, recalling first recall corpus containing all user intentions from a knowledge base to generate a first recall corpus set;

[0110] S802, calculating the first vector similarity between the user question and each first recalled corpus in the first corpus set;

[0111] S803, sorting the first recalled corpora according to the first vector similarity, and obtaining the first K first recalled corpora with the highest similarity according to the sorting, to obtain a first corpus set;

[0112] S804, determining whether the number of first corpora in the first corpus set is less than K pieces;

[0113] S805, if not, returning the first K pieces of the first corpus with the highest similarity as the recall result;

[0114] S806, if the number of first corpora in the first corpus set is less than K, recall second recalled corpora containing any user intention from the knowledge base to obtain a second recalled corpus set;

[0115] S807, calculating the second vector similarity between the user question and each second recalled corpus in the second recalled corpus set;

[0116] S808, sorting the second recalled corpora according to the second vector similarity, and obtaining the first K second recalled corpora with the highest similarity according to the sorting, to obtain a second corpus set;

[0117] S809, merging the first corpus and the second corpus, and removing duplicates from the merging result to obtain a third corpus;

[0118] S810, determining whether the number of third corpora in the third corpus set is less than K pieces;

[0119] S811, if not, reorder the third corpora in the third corpus set according to the first vector similarity and the second vector similarity, and return the top K third corpora with the highest similarity as the recall result;

[0120] S812, if the number of third corpora in the third corpus set is less than K pieces, calculate the third vector similarity between the user question and each piece of corpus in the knowledge base;

[0121] S813, sorting the corpus according to the third vector similarity, and obtaining the top K corpora with the highest similarity according to the sorting, to obtain a fourth corpus set;

[0122] S814, merging the third corpus and the fourth corpus, and removing duplicates from the merging result to obtain a fifth corpus;

[0123] S815 , reorder the fifth corpus in the fifth corpus set according to the first vector similarity, the second vector similarity, and the third vector similarity, and return the top K corpora with the highest similarity as the recall result.

[0124] In the specific implementation, Figure 6 As shown, first, the first M keywords can be extracted from the query to represent the user intent (if the number of keywords is less than M, all keywords are retained), and the first recall corpus containing M user intents is recalled from the knowledge base to generate the first recall corpus set D1. Then, the first vector similarity between the query and each first recall corpus in D1 is calculated, and the first vector similarity is sorted from large to small according to the first vector similarity, and the first K first recall corpus are returned to generate the first corpus set R1. It is determined whether the number of first corpus in R1 is less than K; if not, the first K first corpus with the highest similarity in the first corpus set R1 are returned as the recall result. If so, the second recall corpus containing any user intent is recalled from the knowledge base to obtain the second recall corpus set D2; the second vector similarity between the query and each second recall corpus in D2 is calculated, and the second vector similarity is sorted from large to small according to the second vector similarity, and the first K second corpus are returned to obtain the second corpus set R2. Then merge the first corpus R1 and the second corpus R2, remove duplicates, and obtain the third corpus R3; determine whether the number of third corpora in the third corpus is less than K; if not, reorder the third corpus according to similarity, and return the top K corpora with the highest similarity as the recall result. If the number of third corpora in the third corpus is less than K, calculate the third vector similarity between the query and each corpus in the knowledge base, sort them from large to small according to the third vector similarity, and return the top K corpora as the fourth corpus R4; merge R3 and R4, and then remove duplicates to obtain the fifth corpus R5; then reorder R5, and return the top K corpora with the highest similarity as the recall result.

[0125] In one example, the first vector similarity, the second vector similarity, and the third vector similarity may be cosine similarity, or Euclidean similarity, or dot product similarity. Taking cosine similarity as an example, its calculation formula is:

[0126]

[0127] in, is the vector similarity, X is the vector of the user's question, Y t is the vector of the t-th corpus, and n is the length of the vector.

[0128] Step 209, using the user question and the recall result to generate prompt words;

[0129] Step 210, input the prompt word into the large language model to generate an answer to the user's question.

[0130] In the embodiment of the present invention, after the knowledge recall is completed, the user's question, the recall result and the relevant requirements can be combined in the prompt word, and finally submitted to the large language model, so that the large language model generates and outputs the corresponding answer. The specific process is as follows Figure 7 shown.

[0131] The present invention improves the accuracy of intelligent question-answering based on the large language model by constructing a knowledge base; extracting multiple keywords from user questions and using multiple keywords to represent user intentions; recalling knowledge from the knowledge base according to user intentions and user questions to obtain recall results; generating prompt words using user questions and recall results; and inputting the prompt words into a large language model to generate answers to user questions.

[0132] See also Figure 8 , Figure 8 A structural block diagram of an intelligent question-answering device based on a large language model provided in an embodiment of the present invention.

[0133] The embodiment of the present invention provides an intelligent question-answering device based on a large language model, comprising:

[0134] A knowledge base construction module 801 is used to construct a knowledge base;

[0135] A user intention generation module 802 is used to extract multiple keywords from the user question and use the multiple keywords to represent the user intention;

[0136] The recall module 803 is used to recall knowledge from the knowledge base according to the user's intention and the user's question to obtain a recall result;

[0137] A prompt word generation module 804, used to generate prompt words using user questions and recall results;

[0138] The answer generation module 805 is used to input the prompt words into the large language model to generate answers to user questions.

[0139] In the embodiment of the present invention, the knowledge base construction module 801 includes:

[0140] An unstructured file acquisition submodule is used to acquire unstructured files;

[0141] A text information, table information, chapter title information and image information extraction submodule, used for extracting text information, table information, chapter title information and image information from unstructured files;

[0142] The target format text conversion submodule is used to convert the text information, table information, chapter title information and image information into a target format text;

[0143] The knowledge entry corpus block generation submodule is used to extract the summary and segment the text of the target format to obtain the knowledge entry corpus block;

[0144] A vector encoding submodule is used to perform vector encoding on a knowledge item corpus to obtain an encoding vector;

[0145] The knowledge base construction submodule is used to construct a knowledge base using encoding vectors.

[0146] In the embodiment of the present invention, the recall module 803 includes:

[0147] A first recall corpus generation submodule is used to recall the first recall corpus containing all user intentions from the knowledge base to generate a first recall corpus set;

[0148] A first vector similarity calculation submodule, used to calculate the first vector similarity between the user question and each first recall corpus in the first corpus set;

[0149] A first corpus generation submodule is used to sort the first recall corpus according to the first vector similarity, and obtain the first K first recall corpora with the highest similarity according to the sorting to obtain the first corpus;

[0150] A first judgment submodule is used to judge whether the number of first corpus in the first corpus set is less than K pieces;

[0151] The first recall result generating submodule is used to return the top K first corpora with the highest similarity as the recall result if no.

[0152] In the embodiment of the present invention, the recall module 803 further includes:

[0153] A second recall corpus generation submodule is used to recall second recall corpus containing any user intention from the knowledge base to obtain a second recall corpus if the number of first corpus in the first corpus is less than K pieces;

[0154] A second vector similarity calculation submodule, used to calculate the second vector similarity between the user question and each second recall corpus in the second recall corpus set;

[0155] A second corpus generation submodule is used to sort the second recall corpus according to the second vector similarity, and obtain the first K second recall corpora with the highest similarity according to the sorting to obtain the second corpus;

[0156] A third corpus generation submodule is used to merge the first corpus and the second corpus, and remove duplicates from the merged result to obtain a third corpus;

[0157] The second judgment submodule is used to judge whether the number of the third corpus in the third corpus set is less than K pieces;

[0158] The second recall result generating submodule is used for, if not, reordering the third corpus in the third corpus set according to the first vector similarity and the second vector similarity, and returning the top K third corpus with the highest similarity as the recall result.

[0159] In the embodiment of the present invention, the recall module 803 further includes:

[0160] A third vector similarity calculation submodule, for calculating the third vector similarity between the user question and each corpus in the knowledge base if the number of third corpora in the third corpus set is less than K;

[0161] The fourth corpus generation submodule is used to sort the corpus according to the third vector similarity, and obtain the top K corpora with the highest similarity according to the sorting to obtain the fourth corpus;

[0162] The fifth corpus generation submodule is used to merge the third corpus and the fourth corpus, and remove duplicates from the merged result to obtain the fifth corpus;

[0163] The third recall result generating submodule is used to reorder the fifth corpus in the fifth corpus set according to the first vector similarity, the second vector similarity and the third vector similarity, and return the top K corpora with the highest similarity as the recall result.

[0164] An embodiment of the present invention further provides an electronic device, the device comprising a processor and a memory:

[0165] The memory is used to store the program code and transmit the program code to the processor;

[0166] The processor is used to execute the intelligent question answering method based on a large language model according to the instructions in the program code.

[0167] An embodiment of the present invention also provides a computer-readable storage medium, which is used to store program code, and the program code is used to execute the intelligent question-answering method based on a large language model of an embodiment of the present invention.

[0168] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0169] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0170] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0171] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0172] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0174] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0175] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0176] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An intelligent question answering method based on a large language model, characterized in that: include: Build a knowledge base; Extracting multiple keywords from the user's question and using the multiple keywords to represent the user's intention; Recalling the knowledge base according to the user intention and the user question to obtain a recall result; Generate prompt words using the user question and the recall result; The prompt word is input into a large language model to generate an answer to the user's question.

2. The method according to claim 1, characterized in that The steps of constructing the knowledge base include: Access unstructured documents; extracting text information, table information, chapter title information and image information from the unstructured file; Performing format conversion on the text information, the table information, the chapter title information and the image information to obtain a target format text; Extracting abstracts and segmenting text from the target format text to obtain knowledge entry corpus blocks; Performing vector encoding on the knowledge item corpus to obtain an encoding vector; The encoding vector is used to construct a knowledge base.

3. The method according to claim 1, characterized in that: The step of recalling knowledge from the knowledge base according to the user intention and the user question to obtain a recall result includes: Recalling a first recall corpus containing all the user intentions from the knowledge base to generate a first recall corpus set; Calculating a first vector similarity between the user question and each first recalled corpus in the first corpus set; Sorting the first recalled corpora according to the first vector similarity, and obtaining top K first recalled corpora with the highest similarity according to the sorting to obtain a first corpus set; Determine whether the number of first corpora in the first corpus set is less than K; If not, return the top K first corpora with the highest similarity as the recall result.

4. The method according to claim 3, characterized in that Also includes: If the number of first corpora in the first corpus set is less than K, recall second recalled corpora containing any user intention from the knowledge base to obtain a second recalled corpus set; Calculating a second vector similarity between the user question and each second recalled corpus in the second recalled corpus set; Sorting the second recalled corpora according to the second vector similarity, and obtaining first K second recalled corpora with the highest similarity according to the sorting to obtain a second corpus set; Merging the first corpus and the second corpus, and removing duplicates from the merged result to obtain a third corpus; Determine whether the number of third corpora in the third corpus set is less than K pieces; If not, the third corpora in the third corpus set are reordered according to the first vector similarity and the second vector similarity, and top K third corpora with the highest similarity are returned as the recall result.

5. The method according to claim 4, characterized in that Also includes: If the number of third corpora in the third corpus set is less than K pieces, calculating the third vector similarity between the user question and each piece of corpus in the knowledge base; Sorting the corpus according to the third vector similarity, and obtaining top K corpora with the highest similarity according to the sorting to obtain a fourth corpus set; Merging the third corpus and the fourth corpus, and removing duplicates from the merging result to obtain a fifth corpus; The fifth corpus in the fifth corpus set is reordered according to the first vector similarity, the second vector similarity, and the third vector similarity, and top K corpora with the highest similarity are returned as recall results.

6. An intelligent question-answering device based on a large language model, characterized in that: include: A knowledge base construction module is used to construct a knowledge base; A user intention generation module, used to extract multiple keywords from the user's question and use the multiple keywords to represent the user's intention; A recall module, used to recall knowledge from the knowledge base according to the user intention and the user question, and obtain a recall result; A prompt word generation module, used to generate prompt words using the user question and the recall result; The answer generation module is used to input the prompt word into the large language model to generate an answer to the user's question.

7. The device according to claim 6, characterized in that The knowledge base construction module includes: An unstructured file acquisition submodule is used to acquire unstructured files; A text information, table information, chapter title information and image information extraction submodule, used to extract text information, table information, chapter title information and image information from the unstructured file; A target format text conversion submodule is used to perform format conversion on the text information, the table information, the chapter title information and the image information to obtain a target format text; A knowledge entry corpus block generation submodule is used to extract abstracts and segment texts of the target format text to obtain knowledge entry corpus blocks; A vector encoding submodule, used for performing vector encoding on the knowledge item corpus to obtain an encoding vector; The knowledge base construction submodule is used to construct a knowledge base using the encoding vector.

8. The device according to claim 6, characterized in that The recall module comprises: A first recall corpus generation submodule is used to recall the first recall corpus containing all the user intentions from the knowledge base to generate a first recall corpus set; A first vector similarity calculation submodule, used to calculate the first vector similarity between the user question and each first recalled corpus in the first corpus set; A first corpus generation submodule is used to sort the first recalled corpus according to the first vector similarity, and obtain the first K first recalled corpora with the highest similarity according to the sorting to obtain a first corpus; A first judgment submodule, used to judge whether the number of first corpora in the first corpus set is less than K; The first recall result generating submodule is used to return the top K first corpora with the highest similarity as the recall result if no.

9. An electronic device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the intelligent question answering method based on a large language model as described in any one of claims 1-5 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the intelligent question answering method based on a large language model as described in any one of claims 1-5.

Citation Information

Cited By

  • Intelligent question and answer enhancement method and system based on RAG technology

    CN120723877A

  • Intelligent question answering enhancement method and system based on RAG technology

    CN120723877B

  • Intelligent assurance knowledge question and answer method and system based on LLM and RAG technologies

    CN120744072A

  • System question and answer method and device based on abstract index and cue word, electronic equipment and storage medium

    CN121456117A