Continuous question answering method, device and electronic device based on large language model
Through the continuous question-and-answer method of applying a large language model in smart home, the problem of the inability to connect smart home products and the inability to provide personalized services is solved, and personalized and humanized smart home services are realized.
Patent Information
- Application Number
- CN202411440938.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-10-16
AI Technical Summary
Due to immature technology, existing smart home products cannot achieve interoperability and interconnection, and the product quality is unstable, so personalized services cannot be provided according to users' living habits.
The continuous question-and-answer method based on the large language model is adopted, and the product documents are structured decomposed and vectorized into the vector database, and the user language is understood using the large language model, personalized replies are generated, and humanized services are provided.
It realizes personalized and humanized services of smart home products, provides users with high-quality user experience, and improves the intelligence and interconnection capabilities of smart homes.
Smart Images

Figure CN118964585B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a continuous question-answering method, device and electronic equipment based on a large language model. Background Art
[0002] A large language model refers to a deep learning model that is pre-trained using a large amount of text data. It uses the Transformer architecture and pre-training objectives, and improves performance by increasing the model size, training data, and computing resources. It can generate natural language text or understand the meaning of language text. The large language model can handle a variety of natural language tasks, such as machine translation, text summarization, dialogue systems, question-answering systems, etc. It can be widely used in multiple scenarios in the field of natural language processing, including but not limited to text processing, text generation, robot dialogue, and speech recognition.
[0003] With the continuous development of science and technology, the home furnishing field has gradually ushered in a new development direction. As a new industry direction, smart home has put forward new ideas for enterprise development, and smart home products have begun to enter the family life of users. Due to the fact that the technical framework and standards for smart home research and development by different companies are not unified, the equipment of different brands cannot be interconnected; moreover, due to the immature development of technology and unstable product quality, it brings many inconveniences to users during use, including but not limited to high system failure rate, difficulty in replacing accessories, high cost, rigid procedures and other problems; these situations have led to the fact that most smart home products and systems only use very simple functions when applied, and cannot provide personalized services according to users' living habits.
[0004] The rapid development of artificial intelligence technology has laid the foundation for smart homes to provide safer and more reliable intelligent services. Current smart home products are becoming more and more intelligent, including support for voice control, intelligent recognition, remote supervision and control and other functions. After training and learning, the large language model can understand user language and learn user thinking. When it is applied in the field of smart homes, it makes it possible for products to provide users with personalized and humanized services, providing users with a better user experience, and has broad development prospects. Summary of the invention
[0005] The present invention aims to provide a continuous question-answering method, device and electronic device based on a large language model, which performs structural decomposition on product documents, and then vectorizes them through a large language model and stores them in a vector database; in the question-answering process, based on whether the user question contains the product and product model, the large language model is selected to determine whether the context is relevant and then search the general knowledge base. The large language model summarizes the searched related documents in connection with the user question, and generates a reply content to answer the user question.
[0006] To achieve the above object, the present invention proposes the following technical solutions:
[0007] First, a continuous question answering method based on a large language model is proposed, including:
[0008] Obtain fine-tuning corpus, fine-tune the vector model to be fine-tuned, and generate a fine-tuned optimized vector model;
[0009] Acquire a product document, perform structural decomposition on the product document to generate a plurality of text blocks, and use the optimized vector model to vectorize the text blocks and store them in a vector database;
[0010] Summarizing a product instruction set for the product document based on a large language model, wherein each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the question-answer pair is vectorized using the optimized vector model and then stored in a general knowledge base; wherein the general knowledge base contains a product instruction set for a number of product documents summarized by the large language model;
[0011] Obtain the user's question, and determine whether the user's question contains the product and product model;
[0012] If the user question includes a product and a product model, query the product document summary matching answer content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, search the general knowledge base summary matching answer content;
[0013] If the user question does not contain the product and product model, parse the keywords of the user question, determine the product model based on the keywords to summarize the matching answer content; otherwise, call the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarize the matching answer content based on the product of the previous question or search the general knowledge base to summarize the matching answer content.
[0014] Furthermore, the process of obtaining the fine-tuning corpus and fine-tuning the vector model to be fine-tuned includes:
[0015] Acquire a number of product documents, and use a large language model to generate a number of question-answer texts related to the content of the document based on the product documents; wherein the number of question-answer texts include multiple questions of the same question-answer method and different question-answer methods for the same question;
[0016] Obtaining an original user question, using a large language model to classify the question-answer pair text, and dividing the text into positive sample text and negative sample text; wherein the original user question includes the question in the question-answer pair text;
[0017] Constructing a fine-tuning sample set, wherein each fine-tuning sample in the fine-tuning sample set is composed of the original user question, a positive sample text corresponding to the original user question, and a negative sample text;
[0018] The vector model to be fine-tuned is fine-tuned according to the fine-tuning samples to generate a fine-tuned optimized vector model.
[0019] Furthermore, it also includes: when the user question does not contain the product and product model, and the matching degree of the answer content of the search of the general knowledge base summary and the user question is lower than a preset threshold, the user question is completed by using the large language model thinking chain to search the general knowledge base summary for matching answer content again;
[0020] The process of using the large language model thinking chain to complete the user question includes:
[0021] Obtaining a user question, and using the large language model to parse key words of the user question;
[0022] According to the key words, the large language model is used to match a number of product instructions containing the key words in the general knowledge base, and establish associations between the product instructions; wherein the associations include the question and answer objects of the product instructions, the question and answer target results, and the association relationship between the question and answer objects;
[0023] According to the association between the product instructions, a question-answer thinking chain based on the key words is constructed, and a prompt template is constructed according to the question-answer thinking chain;
[0024] The large language model is used to generate a completed user question based on the prompt template and the question-answering object of the previous round of questions asked by the current user question.
[0025] Furthermore, it also includes: when the user question does not include the product and product model, and the matching degree of the answer content of the search for the general knowledge base summary matching the user question is lower than a preset threshold, completing the user question to search the general knowledge base summary matching answer content again;
[0026] The process of completing the user question includes:
[0027] Acquire multiple question-answer pairs of continuous questions and answers before the user's question occurs, and use the large language model to generate a number of question-answer keywords that represent the question-answer process of each of the question-answer pairs;
[0028] The question-answer pairs are classified according to the application scenarios and functions of the question-answer keywords to obtain the inquiry scope of the continuous question-answer process;
[0029] For the user question to be completed, using the large language model to generate a number of key words representing the user question;
[0030] According to the inquiry scope of the continuous question-answering process, a plurality of the key words and various question-answering keywords are arranged and combined, and then generated into a plurality of pre-constructed questions using the large language model;
[0031] For any of the pre-constructed questions, the correlation between the pre-constructed question and the multiple question-answer pairs of the continuous question and answer is calculated, and the pre-constructed question with a correlation exceeding a preset correlation value and the largest value is selected as the completed user question.
[0032] Furthermore, it also includes: obtaining multiple question-answer pairs including the continuous question and answer of the user question, performing question-answer matching in the general knowledge base, and determining multiple product instruction sets whose matching degree with the multiple question-answer pairs of the current continuous question and answer exceeds a preset matching value;
[0033] For each of the product instruction sets, obtaining the next product instruction in the product instruction set that has the highest correlation with the plurality of question-answer pairs as the predicted next round of user questions;
[0034] The predicted multiple next-round user questions are displayed in order from high to low in terms of relevance to the multiple question-answer pairs.
[0035] Secondly, a continuous question answering device based on a large language model is proposed, comprising:
[0036] An acquisition fine-tuning module is used to acquire a fine-tuning corpus, fine-tune the vector model to be fine-tuned, and generate a fine-tuned optimized vector model;
[0037] An acquisition and decomposition module is used to acquire product documents, perform structural decomposition on the product documents to generate a plurality of text blocks, and use the optimized vector model to vectorize the text blocks and store them in a vector database;
[0038] a summarizing module, configured to summarize a product instruction set for the product document based on a large language model, wherein each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the question-answer pair is vectorized using the optimized vector model and then stored in a general knowledge base; wherein the general knowledge base contains a product instruction set summarized by the large language model for a number of product documents;
[0039] An acquisition and judgment module is used to acquire a user question and judge whether the user question contains a product and a product model;
[0040] If the user question includes a product and a product model, query the product document summary matching answer content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, search the general knowledge base summary matching answer content;
[0041] If the user question does not contain the product and product model, parse the keywords of the user question, determine the product model based on the keywords to summarize the matching answer content; otherwise, call the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarize the matching answer content based on the product of the previous question or search the general knowledge base to summarize the matching answer content.
[0042] Furthermore,
[0043] The acquisition and fine-tuning module acquires the fine-tuning corpus, fine-tunes the vector model to be fine-tuned, and generates an execution unit of the fine-tuned optimized vector model, including:
[0044] A first generating unit is used to obtain a number of product documents, and use a large language model to generate a number of question-answer texts related to the document content according to the product documents; wherein the number of question-answer texts include multiple questions of the same question-answer method, and different question-answer methods for the same question;
[0045] A first classification unit is used to obtain an original user question, classify the question-answer pair text using a large language model, and divide the text into positive sample text and negative sample text; wherein the original user question includes the question in the question-answer pair text;
[0046] A first construction unit is used to construct a fine-tuning sample set, wherein each fine-tuning sample in the fine-tuning sample set is composed of the original user question, a positive sample text corresponding to the original user question, and a negative sample text;
[0047] The fine-tuning unit is used to fine-tune the vector model to be fine-tuned according to the fine-tuning sample to generate a fine-tuned optimized vector model.
[0048] Furthermore, it also includes:
[0049] A first completion module is used to complete the user question using a large language model thinking chain to search the general knowledge base summary for matching answer content again when the user question does not contain the product and product model, and the matching degree of the answer content searched from the general knowledge base summary with the user question is lower than a preset threshold;
[0050] The first completion module is an execution unit that uses a large language model thinking chain to complete the user question, including: a parsing unit, which is used to obtain the user question and use the large language model to parse the key words of the user question; a matching establishment unit, which is used to match a number of product instructions containing the key words in the general knowledge base using the large language model according to the key words, and establish a relationship between the product instructions; wherein the relationship includes the question and answer object of the product instruction, the question and answer target result and the relationship between the question and answer objects; a second construction unit, which is used to construct a question and answer thinking chain based on the key words according to the relationship between the product instructions, and construct a prompt template according to the question and answer thinking chain; a completion unit, which is used to generate a completed user question according to the prompt template and the question and answer object of the previous round of questions asked by the current user question using the large language model.
[0051] Furthermore, it also includes: a second completion module, which is used to complete the user question to search the general knowledge base summary for matching answer content again when the user question does not contain the product and product model, and the matching degree of the answer content of the searched general knowledge base summary and the user question is lower than a preset threshold;
[0052] The execution unit of the second completion module for completing the user question includes: an acquisition generation unit, which is used to obtain multiple question-answer pairs of continuous questions and answers before the user question occurs, and use the large language model to generate a number of question-answer keywords that represent the question-answer process of each question-answer pair; a second classification unit, which is used to classify the question-answer pairs according to the application scenarios and functions of each question-answer keyword to obtain the inquiry scope of the continuous question-answer process; a second generation unit, which is used to use the large language model to generate a number of key words that represent the user question to be completed; a construction unit, which is used to arrange and combine a number of key words and various types of question-answer keywords according to the inquiry scope of the continuous question-answer process, and then use the large language model to generate a number of pre-constructed questions; a calculation and selection unit, which is used to calculate the correlation between the pre-constructed question and the multiple question-answer pairs of the continuous question and answer for any of the pre-constructed questions, and select the pre-constructed question with a correlation exceeding a preset correlation value and the largest value as the completed user question.
[0053] In the third aspect, an electronic device is proposed, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium; when a processor of the electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the above-mentioned continuous question-answering method based on a large language model.
[0054] It can be seen from the above technical solutions that the technical solutions of the present invention have the following beneficial effects:
[0055] The present invention discloses a continuous question-answering method, device and electronic device based on a large language model. The method comprises: obtaining fine-tuning corpus, fine-tuning a vector model to be fine-tuned, and generating a fine-tuned optimized vector model; obtaining a product document, structurally decomposing the product document to generate a plurality of text blocks, and using the optimized vector model to vectorize the text blocks and store them in a vector database; summarizing a product instruction set of the product document based on the large language model, wherein each product instruction in the product instruction set is expressed in the form of a question-answer pair, and using the optimized vector model to vectorize the question-answer pair and store them in a general knowledge base; obtaining a user question, and judging whether it contains a product and a product model; if it contains a product and a product model, querying a product document corresponding to the product or product model to summarize and match the answer content; if it does not contain the product and the product model, parsing the keywords of the user question, and determining the product model according to the keywords to summarize and match the answer content; otherwise, calling the large language model to perform a correlation judgment on the continuous question and answer to determine whether the product corresponding to the current question is the product of the previous question, and then summarizing and matching the answer content according to the product of the previous question or searching the general knowledge base to summarize and match the answer content.
[0056] The present invention applies the large language model in the field of smart home to understand user language, learn user thinking, accurately respond to user questions, provide users with personalized and humanized services, and provide users with a better user experience; at the same time, the application of the present invention in the field of smart home provides a new direction for the development of smart home.
[0057] It should be appreciated that all combinations of the foregoing concepts, as well as additional concepts described in greater detail below, may be considered to be part of the inventive subject matter of the present disclosure, provided such concepts are not mutually inconsistent.
[0058] The foregoing and other aspects, embodiments and features of the present invention can be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the present invention, such as the features and / or beneficial effects of the exemplary embodiments, will be apparent from the following description or learned from the practice of the specific embodiments according to the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings are not drawn to scale according to actual reference objects. In the accompanying drawings, each identical or nearly identical component shown in various figures may be represented by the same reference numeral. For the sake of clarity, not every component is labeled in each figure. Now, embodiments of various aspects of the present invention will be described by way of example and with reference to the accompanying drawings, in which:
[0060] Figure 1 A flow chart of a continuous question answering method based on a large language model disclosed in an embodiment;
[0061] Figure 2 A flow chart of fine-tuning instructions for a large language model to be fine-tuned disclosed in an embodiment;
[0062] Figure 3 A flowchart of using a large language model thinking chain to complete user questions disclosed in the embodiment;
[0063] Figure 4 A flow chart of a method for completing a user question disclosed in an embodiment;
[0064] Figure 5 A flowchart for predicting the next round of questions for users to continuously ask and answer according to the embodiment;
[0065] Figure 6 It is a structural block diagram of a continuous question-answering device based on a large language model disclosed in an embodiment;
[0066] Figure 7 A structural block diagram of an electronic device disclosed in an embodiment. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment 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. Unless otherwise defined, the technical terms or scientific terms used herein should be the common meaning understood by people with general skills in the field to which the present invention belongs.
[0068] The words "first", "second" and similar words used in the specification and claims of this application do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, unless the context clearly indicates otherwise, the singular form of "a", "an" or "the" and similar words do not indicate a quantitative limitation, but indicate the presence of at least one. "Include" or "comprises" and similar words mean that the elements or objects appearing before "include" or "comprises" include the features, wholes, steps, operations, elements and / or components listed after "include" or "comprises", and do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0069] Based on the development of science and technology, the field of home furnishing has ushered in technological innovation, and smart homes have gradually replaced traditional homes and entered people's lives; however, due to different development companies and usage standards, existing smart homes cannot achieve interoperability, have a low degree of intelligence, and cannot provide personalized services based on users' living habits; therefore, the present invention aims to propose a continuous question-answering method, device and electronic device based on a large language model, which can generate natural language text or understand the meaning of language text by using the large language model, and provide more intelligent and humanized services in the continuous question-answering process between users and smart homes.
[0070] The following is a further detailed introduction to the continuous question answering method, device and electronic device based on a large language model disclosed in the present invention in conjunction with the specific embodiments shown in the accompanying drawings.
[0071] Combination Figure 1 As shown, the continuous question answering method based on a large language model disclosed in the embodiment includes:
[0072] Step S102, obtaining fine-tuning corpus, fine-tuning the vector model to be fine-tuned, and generating a fine-tuned optimized vector model;
[0073] The fine-tuning process is to fine-tune the vector model to be fine-tuned through specific fine-tuning expectations. The BERT model is selected as the vector model in the scheme. The vector representations of the words and paragraphs in the fine-tuning expectations in the vector model to be fine-tuned are more similar, and the cosine distance is also closer. In the process of searching and matching target content, it is faster and more accurate.
[0074] In this embodiment, the vector model to be fine-tuned is fine-tuned according to the fine-tuning corpus, and the process is as follows: Figure 2 As shown, it includes: step S1021, obtaining several product documents, using a large language model to generate several question-answer texts related to the document content according to the product documents; wherein, the several question-answer texts include multiple questions of the same question-answer method, and different question-answer methods for the same question; that is, obtaining questions from different angles when summarizing, such as summarizing questions from chapters, paragraphs or sentences; step S1022, obtaining original user questions, using a large language model to classify the question-answer texts, and dividing positive sample texts and negative sample texts; wherein, the original user questions include questions in the question-answer texts; step S1023, constructing a fine-tuning sample set, wherein each fine-tuning sample in the fine-tuning sample set is composed of the original user question, the positive sample text corresponding to the original user question, and the negative sample text; step S1024, according to the fine-tuning sample, fine-tuning the vector model to be fine-tuned, and generating a fine-tuned optimized vector model. Fine-tuning the vector model to be fine-tuned by the positive sample text and the negative sample text can effectively improve the logic of the model generating relevant questions and answers.
[0075] Among them, when classifying the question-answer text, the question-answer text related to the original user question is used as the positive sample text, and the question-answer text unrelated to the original user question is used as the negative sample text; for example, the original user question is: How many gears does a microwave oven have? The positive sample text is: Microwave oven heating gears, and the negative sample text is: What are the functions of the water purifier. Optionally, the generated positive sample text and negative sample text need to be relatively consistent with the corresponding product document content. After further manual verification, the positive sample text and negative sample text that are relatively consistent with the document content can be selected from the classified text.
[0076] Step S104, obtaining a product document, structurally decomposing the product document to generate a number of text blocks, and vectorizing the text blocks using the optimized vector model and storing them in a vector database; the structural decomposition of the product document includes chapters, paragraphs, subheadings, lists, etc.
[0077] Step S106: summarize the product instruction set of the product document based on the large language model, each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the question-answer pair is vectorized using the optimized vector model and then stored in a general knowledge base; wherein the general knowledge base contains a product instruction set of several product documents summarized by the large language model; the product instruction set is mainly a number of question-answer pairs with logical relationships generated by the large language model according to the product document, and the question-answer pairs include product models, product functions, product usage methods, etc. summarized according to the product document.
[0078] Step S108, obtaining the user question, and determining whether the user question contains the product and the product model; including, if the user question contains the product and the product model, directly querying the product document summary matching reply content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, searching the general knowledge base summary matching reply content; if the user question does not contain the product and the product model, parsing the keywords of the user question, and determining the product model according to the keywords to summarize the matching reply content; otherwise, calling the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarizing the matching reply content according to the product of the previous question or searching the general knowledge base summary matching reply content.
[0079] Among them, when the product documents in the vector database cannot answer the user's question, it means that the product documents corresponding to the product or product model cannot summarize the knowledge or the matching degree between the summarized knowledge and the user's question is lower than the preset threshold. In addition, the general knowledge base is in a real-time online update state. In addition to the product instruction set generated according to the large language model, it also includes the historical continuous question and answer records of each product that are updated and stored in real time.
[0080] The above-mentioned application of the large language model in smart home can effectively realize the comprehensiveness of the continuous question-and-answer process between users and the product, and the product can provide more logical responses when answering; the overall continuous question-and-answer process is based on the understanding of the meaning of the user's language, and proposes responses that are more in line with natural language habits, making the service process more humane.
[0081] As an optional implementation, the continuous question-answering method further includes: when the user question does not contain the product and product model, and the matching degree of the answer content of the search for the general knowledge base summary match with the user question is lower than a preset threshold, such as the preset threshold is 0.85, using a large language model thinking chain to complete the user question, so as to search the general knowledge base summary match answer content again;
[0082] like Figure 3 As shown, the process of using the large language model thinking chain to complete the user question includes: step S202, obtaining the user question, and using the large language model to parse the key words of the user question; step S204, according to the key words, using the large language model to match a number of product instructions containing the key words in the general knowledge base, and establish a relationship between the product instructions; wherein the relationship includes the question and answer object of the product instruction, the question and answer target result and the relationship between the question and answer objects; this step is intended to obtain all content related to the key words in the general knowledge base, including possible inquiry objects, inquiry targets, the relationship between inquiry objects, and the relationship between inquiry targets, so as to determine whether the objects related to the key words are similar products, the same functions or similar functions, etc., so as to determine the expression habits of the key words in natural language. Step S206, constructing a question-and-answer thinking chain based on the key words according to the association between the product instructions, and constructing a prompt template according to the question-and-answer thinking chain; Step S208, generating a completed user question using the large language model according to the prompt template and the question-and-answer object of the previous round of questions asked by the current user question; the question-and-answer object of the previous round of questions is mainly to provide a reference for the current user question to be completed, including the product content involved in the continuous question and answer of the product, such as product usage methods and product functions.
[0083] The above process of using the large language model thinking chain to complete user questions is to summarize and sort out the associations between key words in the general database, construct prompt words containing key words, and input the large language model to generate completed user questions.
[0084] As another optional implementation, when the user question does not include the product and product model, and the matching degree of the answer content of the search for matching summary of the general knowledge base and the user question is lower than a preset threshold, the user question is completed to search the general knowledge base summary for matching answer content again; Figure 4 As shown, the process of completing the user question includes: step S302, obtaining multiple question-answer pairs of continuous questions and answers before the user question occurs, and using the large language model to generate several question-answer keywords that represent the question-answer process of each question-answer pair; step S304, classifying the question-answer pairs according to the application scenarios and functions of each question-answer keyword to obtain the inquiry scope of the continuous question-answer process; step S306, using the large language model to generate several key words representing the user question for the user question to be completed; step S308, according to the inquiry scope of the continuous question-answer process, after arranging and combining several key words with various types of question-answer keywords, using the large language model to generate several pre-constructed questions; step S310, for any of the pre-constructed questions, calculating the correlation between the pre-constructed question and the multiple question-answer pairs of the continuous question-answer, and selecting the pre-constructed question with a correlation exceeding a preset correlation value and the largest value as the completed user question; otherwise, the completion fails. The correlation calculation can be performed using various methods such as cosine similarity, Jaccard similarity and edit distance.
[0085] The above-mentioned method of question completion is to use the continuous questions and answers that have occurred to supplement the specific content of the current user's question, mainly based on the logical reasoning of the continuous questions and answers to the possible logic of the current user's question.
[0086] Optionally, the process of completing the user question can also utilize a large language model to directly complete the user question by performing operations such as reference resolution, contextual reasoning, semantic parsing, and default assumptions on the user's current question through the user's historical chat dialogues.
[0087] The continuous question-answering method disclosed in this embodiment also includes predicting the next user question of the continuous question-answering to further improve the user experience; specifically, Figure 5As shown, it includes: step S402, obtaining multiple question-answer pairs containing the continuous questions and answers of the user questions, matching the questions and answers in the general knowledge base, and determining multiple product instruction sets whose matching degree with the multiple question-answer pairs of the current continuous questions and answers exceeds the preset matching value; that is, according to the multiple question-answer pairs in each product instruction set and the continuous questions and answers that have occurred, one by one, the products that are the same or similar to the user's consultation content are found, and the next round of user questions are predicted according to the question and answer situations that have occurred for the same or similar products; step S404, for each of the product instruction sets, the next product instruction in the product instruction set with the highest correlation with the multiple question-answer pairs is obtained as the predicted next round of user questions; step S406, sequentially displaying the predicted multiple next round of user questions in a descending order of correlation with the multiple question-answer pairs. Specifically, the smart home usually has a display panel, and when the user enters a question, the predicted multiple next round of user questions are directly displayed on the panel, which reduces the user input information and facilitates the user's selection.
[0088] The continuous question-answering method based on a large language model disclosed in the present invention performs structural decomposition of product documents, such as product manuals, and then vectorizes and stores them in a vector database through a large language model; when applied, the large language model is used to determine whether the context is relevant, and then relevant documents are searched, and then the searched relevant documents are summarized according to the user's questions to generate reply content. The present invention utilizes the characteristics of the large language model that can understand the user's language and learn the user's thinking. When applied in the field of smart homes, the reply language is accurately organized, so as to provide users with personalized and humanized services and provide a better user experience.
[0089] In an embodiment of the present application, an electronic device is also provided, including a computer program, the computer program being stored in a computer-readable storage medium; when a processor of the electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the continuous question-answering method based on a large language model. Taking an electronic device running on a computer as an example, Figure 7 As shown, the electronic device may include one or more (only one is shown in the figure) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory for storing data, and a transmission device for communication functions. A person skilled in the art can understand that Figure 7 The structure shown is for illustration only and does not limit the structure of the above-mentioned electronic device.
[0090] The above program can be run in the processor, or it can be stored in the memory, that is, in the computer-readable medium, which includes permanent and non-permanent, removable and non-removable media. Information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include temporary computer-readable media, such as modulated data signals and carrier waves. These computer programs can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a block or multiple blocks may be implemented by different modules corresponding to different method steps.
[0091] In this embodiment, such a device or system is provided. The device can be called a continuous question-answering device based on a large language model. Figure 6As shown, it includes: an acquisition fine-tuning module, which is used to acquire fine-tuning corpus, fine-tune the vector model to be fine-tuned, and generate a fine-tuned optimized vector model; an acquisition decomposition module, which is used to acquire product documents, perform structural decomposition on the product documents to generate a number of text blocks, and use the optimized vector model to vectorize the text blocks and store them in a vector database; a summary module, which is used to summarize the product instruction set of the product document based on a large language model, each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the optimized vector model is used to vectorize the question-answer pair and store it in a general knowledge base; wherein the general knowledge base contains the product instruction set summarized by the large language model for a number of product documents; an acquisition judgment module, which is used to acquire user questions, judge Determine whether the user question contains the product and product model; if the user question contains the product and product model, query the product document summary matching reply content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, search the general knowledge base summary matching reply content; if the user question does not contain the product and product model, parse the keywords of the user question, and determine the product model according to the keywords to summarize the matching reply content; otherwise, call the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarize the matching reply content according to the product of the previous question or search the general knowledge base summary matching reply content.
[0092] The steps of the device for implementing the continuous question answering method based on a large language model disclosed in the above embodiment have been described and will not be repeated here.
[0093] For example, the acquisition and fine-tuning module acquires fine-tuning corpus, fine-tunes the vector model to be fine-tuned, and generates an execution unit for a fine-tuned optimized vector model, including: a first generation unit, used to acquire a number of product documents, and use a large language model to generate a number of question-answer pair texts related to the document content according to the product documents; wherein the several question-answer pair texts include multiple questions of the same question-answer method and different question-answer methods for the same question; a first classification unit, used to acquire original user questions, and use a large language model to classify the question-answer pair texts, and divide them into positive sample texts and negative sample texts; wherein the original user questions include the questions in the question-answer pair texts; a first construction unit, used to construct a fine-tuning sample set, each fine-tuning sample in the fine-tuning sample set consists of the original user question, the positive sample text corresponding to the original user question, and the negative sample text; a fine-tuning unit, used to fine-tune the vector model to be fine-tuned according to the fine-tuning samples, and generate a fine-tuned optimized vector model.
[0094] For another example, the continuous question-answering device further includes: a first completion module, which is used to use the large language model thinking chain to complete the user question when the user question does not contain the product and product model, and the matching degree of the answer content summarized by searching the general knowledge base and the user question is lower than a preset threshold, so as to search the general knowledge base summary for matching answer content again; the first completion module uses the large language model thinking chain to complete the user question. The execution unit includes: a parsing unit for obtaining the user question and parsing the key words of the user question using the large language model; a matching establishment unit, which uses According to the key words, the large language model is used to match several product instructions containing the key words in the general knowledge base, and establish associations between the several product instructions; wherein the association includes the question and answer object of the product instruction, the question and answer target result and the association relationship between the question and answer objects; a second construction unit is used to construct a question and answer thinking chain based on the key words according to the association between the product instructions, and construct a prompt template according to the question and answer thinking chain; a completion unit is used to generate a completed user question according to the prompt template and the question and answer object of the previous round of questions asked by the current user question using the large language model.
[0095] Optionally, some embodiments of the continuous question-and-answer device further include: a second completion module, which is used to complete the user question and search the general knowledge base summary for matching answer content again when the user question does not contain the product and product model, and the matching degree of the answer content searched from the general knowledge base summary and the user question is lower than a preset threshold; an execution unit for the second completion module to complete the user question, including: an acquisition generation unit, which is used to obtain multiple question-and-answer pairs of continuous questions and answers before the user question occurs, and use the large language model to generate a number of question-and-answer keywords that characterize the question-and-answer process of each of the question-and-answer pairs; a second classification unit, which is used to classify the question-and-answer pairs according to the question and answer The application scenarios and functions of keywords are classified to obtain the inquiry scope of the continuous question and answer process; a second generating unit is used to use the large language model to generate a number of key words representing the user question to be completed; a constructing unit is used to arrange and combine a number of key words with various question and answer keywords according to the inquiry scope of the continuous question and answer process, and then use the large language model to generate a number of pre-constructed questions; a calculating and selecting unit is used to calculate the correlation between the pre-constructed question and the multiple question and answer pairs of the continuous question and answer for any of the pre-constructed questions, and select the pre-constructed question with a correlation exceeding a preset correlation value and with the largest value as the completed user question.
[0096] For another example, the continuous question and answer device also includes: an acquisition matching module, which is used to acquire multiple question and answer pairs of the continuous question and answer containing the user question, perform question and answer matching in the general knowledge base, and determine multiple product instruction sets whose matching degree with the multiple question and answer pairs of the current continuous question and answer exceeds a preset matching value; an acquisition prediction module, which is used to acquire, for each of the product instruction sets, the next product instruction in the product instruction set with the highest correlation with the multiple question and answer pairs as the predicted next round of user questions; and a display module, which is used to display the predicted multiple next round of user questions in order from high to low correlation with the multiple question and answer pairs.
[0097] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. A person with ordinary knowledge in the technical field to which the present invention belongs may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be determined by the definition of the claims.
Claims
1. A continuous question answering method based on a large language model, characterized in that: include: Obtain fine-tuning corpus, fine-tune the vector model to be fine-tuned, and generate a fine-tuned optimized vector model; Acquire a product document, perform structural decomposition on the product document to generate a plurality of text blocks, and use the optimized vector model to vectorize the text blocks and store them in a vector database; Summarizing a product instruction set for the product document based on a large language model, wherein each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the question-answer pair is vectorized using the optimized vector model and then stored in a general knowledge base; wherein the general knowledge base contains a product instruction set for a number of product documents summarized by the large language model; Obtain the user's question, and determine whether the user's question contains the product and product model; If the user question includes a product and a product model, query the product document summary matching answer content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, search the general knowledge base summary matching answer content; If the user question does not contain the product and product model, parse the keywords of the user question, determine the product model based on the keywords to summarize the matching answer content; otherwise, call the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarize the matching answer content based on the product of the previous question or search the general knowledge base to summarize the matching answer content.
2. The continuous question answering method based on a large language model according to claim 1, characterized in that: The process of obtaining the fine-tuning corpus and fine-tuning the vector model to be fine-tuned includes: Acquire a number of product documents, and use a large language model to generate a number of question-answer texts related to the content of the document based on the product documents; wherein the number of question-answer texts include multiple questions of the same question-answer method and different question-answer methods for the same question; Obtaining an original user question, using a large language model to classify the question-answer pair text, and dividing it into positive sample text and negative sample text, wherein the positive sample text is the question-answer pair text related to the original user question, and the negative sample text is the question-answer pair text unrelated to the original user question; wherein the original user question includes the question in the question-answer pair text; Constructing a fine-tuning sample set, wherein each fine-tuning sample in the fine-tuning sample set is composed of the original user question, a positive sample text corresponding to the original user question, and a negative sample text; The vector model to be fine-tuned is fine-tuned according to the fine-tuning samples to generate a fine-tuned optimized vector model.
3. The continuous question answering method based on a large language model according to claim 1, characterized in that: Also includes: When the user question does not contain the product and product model, and the matching degree of the answer content of the search summary of the general knowledge base and the user question is lower than a preset threshold, the user question is completed by using the large language model thinking chain to search the summary of the general knowledge base for matching answer content again; The process of using the large language model thinking chain to complete the user question includes: obtaining the user question, and using the large language model to parse the key words of the user question; According to the key words, the large language model is used to match a number of product instructions containing the key words in the general knowledge base, and establish associations between the product instructions; wherein the associations include the question and answer objects of the product instructions, the question and answer target results, and the association relationship between the question and answer objects; According to the association between the product instructions, a question-answer thinking chain based on the key words is constructed, and a prompt template is constructed according to the question-answer thinking chain; The large language model is used to generate a completed user question based on the prompt template and the question-answering object of the previous round of questions asked by the current user question.
4. The continuous question answering method based on a large language model according to claim 1, characterized in that: Also includes: When the user question does not contain the product and product model, and the matching degree of the answer content of the search of the general knowledge base summary and the user question is lower than a preset threshold, the user question is completed to search the general knowledge base summary for matching answer content again; The process of completing the user question includes: Acquire multiple question-answer pairs of continuous questions and answers before the user's question occurs, and use the large language model to generate a number of question-answer keywords that represent the question-answer process of each of the question-answer pairs; The question-answer pairs are classified according to the application scenarios and functions of the question-answer keywords to obtain the inquiry scope of the continuous question-answer process; For the user question to be completed, using the large language model to generate a number of key words representing the user question; According to the inquiry scope of the continuous question-answering process, a plurality of the key words and various question-answering keywords are arranged and combined, and then generated into a plurality of pre-constructed questions using the large language model; For any of the pre-constructed questions, the correlation between the pre-constructed question and the multiple question-answer pairs of the continuous question and answer is calculated, and the pre-constructed question with a correlation exceeding a preset correlation value and the largest value is selected as the completed user question.
5. The continuous question answering method based on a large language model according to claim 1, characterized in that: Also includes: Acquire multiple question-answer pairs containing the continuous question and answer of the user question, perform question-answer matching in the general knowledge base, and determine multiple product instruction sets whose matching degree with the multiple question-answer pairs of the current continuous question and answer exceeds a preset matching value; For each of the product instruction sets, obtaining the next product instruction in the product instruction set that has the highest correlation with the plurality of question-answer pairs as the predicted next round of user questions; The predicted multiple next-round user questions are displayed in order from high to low in terms of relevance to the multiple question-answer pairs.
6. A continuous question-answering device based on a large language model, characterized in that: include: An acquisition fine-tuning module is used to acquire a fine-tuning corpus, fine-tune the vector model to be fine-tuned, and generate a fine-tuned optimized vector model; An acquisition and decomposition module is used to acquire product documents, perform structural decomposition on the product documents to generate a plurality of text blocks, and use the optimized vector model to vectorize the text blocks and store them in a vector database; a summarizing module, configured to summarize a product instruction set for the product document based on a large language model, wherein each product instruction in the product instruction set is expressed in the form of a question-answer pair, and the question-answer pair is vectorized using the optimized vector model and then stored in a general knowledge base; wherein the general knowledge base contains a product instruction set summarized by the large language model for a number of product documents; An acquisition and judgment module is used to acquire a user question and judge whether the user question contains a product and a product model; If the user question includes a product and a product model, query the product document summary matching answer content corresponding to the product or the product model in the vector database, and when the product document cannot answer the user question, search the general knowledge base summary matching answer content; If the user question does not contain the product and product model, parse the keywords of the user question, determine the product model based on the keywords to summarize the matching answer content; otherwise, call the large language model to perform relevance judgment on continuous questions and answers to determine whether the product corresponding to the current question is the product of the previous question, and then summarize the matching answer content based on the product of the previous question or search the general knowledge base to summarize the matching answer content.
7. The continuous question-answering device based on a large language model according to claim 6, characterized in that: The acquisition and fine-tuning module acquires the fine-tuning corpus, fine-tunes the vector model to be fine-tuned, and generates an execution unit of the fine-tuned optimized vector model, including: A first generating unit is used to obtain a number of product documents, and use a large language model to generate a number of question-answer texts related to the document content according to the product documents; wherein the number of question-answer texts include multiple questions of the same question-answer method, and different question-answer methods for the same question; A first classification unit is used to obtain an original user question, classify the question-answer pair text using a large language model, and divide it into positive sample text and negative sample text, wherein the positive sample text is the question-answer pair text related to the original user question, and the negative sample text is the question-answer pair text unrelated to the original user question; wherein the original user question includes the question in the question-answer pair text; A first construction unit is used to construct a fine-tuning sample set, wherein each fine-tuning sample in the fine-tuning sample set is composed of the original user question, a positive sample text corresponding to the original user question, and a negative sample text; The fine-tuning unit is used to fine-tune the vector model to be fine-tuned according to the fine-tuning sample to generate a fine-tuned optimized vector model.
8. The continuous question-answering device based on a large language model according to claim 6, characterized in that: Also includes: A first completion module is used to complete the user question using a large language model thinking chain to search the general knowledge base summary for matching answer content again when the user question does not contain the product and product model, and the matching degree of the answer content searched from the general knowledge base summary with the user question is lower than a preset threshold; The first completion module uses a large language model thinking chain to complete the user question, and includes: A parsing unit, used to obtain user questions and parse key words of the user questions using the large language model; A matching establishment unit, configured to match a plurality of product instructions containing the key words in the general knowledge base using the large language model according to the key words, and establish associations between the plurality of product instructions; wherein the associations include the question and answer objects of the product instructions, the question and answer target results, and the association relationship between the question and answer objects; A second construction unit is used to construct a question-answer thinking chain based on the key words according to the association between the product instructions, and construct a prompt template according to the question-answer thinking chain; The completion unit is used to generate a completed user question using the large language model according to the prompt template and the question-answering object of the previous round of questions asked by the current user question.
9. The continuous question-answering device based on a large language model according to claim 6, characterized in that: Also includes: A second completion module is used to complete the user question to search the general knowledge base summary for matching answer content again when the user question does not contain the product and product model, and the matching degree of the answer content of the searched general knowledge base summary and the user question is lower than a preset threshold; The execution unit of the second completion module for completing the user question includes: An acquisition generation unit is used to acquire a plurality of question-answer pairs of continuous questions and answers before the user's question occurs, and use the large language model to generate a plurality of question-answer keywords representing the question-answer process of each of the question-answer pairs; A second classification unit is used to classify the question-answer pairs according to the application scenarios and functions of the question-answer keywords to obtain the inquiry scope of the continuous question-answer process; A second generating unit, configured to generate a plurality of key words representing the user question to be completed by using the large language model; A construction unit, configured to generate a plurality of pre-constructed questions by arranging and combining a plurality of the key words and various types of the question-answering keywords according to the scope of the inquiry in the continuous question-answering process and then using the large language model; A calculation selection unit is used to calculate the correlation between any of the pre-constructed questions and the multiple question-answer pairs of the continuous question and answer, and select the pre-constructed question with a correlation exceeding a preset correlation value and the largest value as the completed user question.
10. An electronic device, characterized in that: It includes a computer program, which is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the continuous question answering method based on a large language model as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Natural language question answering method and device based on large language model, medium and equipment
CN117473053A
Online intelligent question answering method and device based on instruction fine tuning and retrieval enhancement generation
CN117688163A