Question answering method and device based on knowledge processor, computer equipment and medium
Through the Q&A method based on the knowledge processor, using multiple information sources and user portrait optimization solutions, the false and biased problems of large language models in the knowledge Q&A are solved, and the user experience is improved.
Patent Information
- Application Number
- CN202311390389.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-24
- Publication Date
- 2025-07-08
AI Technical Summary
Large language models have problems such as false response information and bias in the field of knowledge Q&A, and the small model fine-tuning solution is not effective, resulting in a reduced user experience.
The question-and-answer method based on the knowledge processor is adopted, and the first and second knowledge processors are used to process similar question information and no similar question information respectively, and answer them in combination with historical information, knowledge graphs and knowledge bases. The answer information is optimized through user portraits and fine-tuning models to ensure the accuracy of the answers and meet user preferences.
It improves the intelligence and accuracy of the Q&A process, reduces false information, and improves the user experience.
Smart Images

Figure CN120277173A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a question-answering method, device, computer equipment and medium based on a knowledge processor. Background Art
[0002] With the rapid development of large language models (LLMs), the field of natural language processing (NLP) has shown great potential with its assistance, and even paved the way for artificial general intelligence (AGI).
[0003] In the field of knowledge Q&A, large models still have problems such as false and biased reply information. Moreover, the high training cost of large models discourages small and medium-sized enterprises. Although there are solutions for fine-tuning small models such as LoRA and QLoRA, their Q&A effects are not satisfactory, making the entire Q&A process not intelligent enough and resulting in a reduced user experience.
[0004] Therefore, there is an urgent need for a Q&A method and device that can effectively avoid problems such as false and biased reply information, and can make the entire Q&A process more intelligent, thereby improving the user experience. Summary of the Invention
[0005] In view of this, the present invention provides a question-answering method, device, computer equipment and medium based on a knowledge processor to solve the problems of false and biased reply information in related technologies, and the lack of intelligence in its Q&A process, which is likely to lead to a reduced user experience.
[0006] In a first aspect, the present invention provides a question-answering method for a knowledge processor, including:
[0007] Receiving the question information input by the user;
[0008] Preprocessing the question information to obtain standard input information;
[0009] Judging whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than a threshold;
[0010] If there is the similar question information, using the first knowledge processor to complete the answer;
[0011] If there is no such similar question information, using the second knowledge processor to complete the answer.
[0012] A question-and-answer method for a knowledge processor provided by the present invention can make the question-and-answer process more fluent and intelligent by using a first knowledge processor to complete the answer when there is similar question information, and using a second knowledge processor to complete the answer when there is no similar question information. At the same time, it can effectively avoid the occurrence of false and biased reply information, which helps to improve the user experience.
[0013] In an alternative embodiment, the step of using the first knowledge processor to complete the answer if there is the similar question information includes:
[0014] Determine whether there is a first question information in the historical information whose similarity to the standard input information is greater than a threshold;
[0015] If there is the first question information, push the first answer information corresponding to the first question information to the user;
[0016] If there is no the first question information, determine whether there is a second question information in the knowledge graph whose similarity to the standard input information is greater than a threshold;
[0017] If there is the second question information, push the second answer information corresponding to the second question information to the user;
[0018] If there is no the second question information, use the knowledge list in the knowledge base to perform keyword matching and similarity matching on the standard input information to obtain the answer information corresponding to the standard input information and push it to the user.
[0019] A question-and-answer method for a knowledge processor provided by the present invention performs similarity matching on the standard input information through historical information, knowledge graph and knowledge list in the knowledge base successively, which can ensure finding the answer information for answering the user's question information.
[0020] In an alternative embodiment, the method further includes:
[0021] Analyze the preference type of the user according to the user profile of the user;
[0022] According to the preference type, perform a scoring operation on multiple standard input information and multiple answer information corresponding to the multiple standard input information respectively;
[0023] According to the scoring result, select the target answer information that meets the user's preference type from the multiple answer information.
[0024] A question-answering method for a knowledge processor provided by the present invention scores multiple answer information corresponding to multiple standard input information respectively through preference types, and selects target answer information that meets the user's preference type according to the scoring results, enabling the large model to better understand the user's preferences and hobbies, and thus being able to give more considerate reply information.
[0025] In an alternative embodiment, if the similar question information does not exist, the second knowledge processor is used to complete the answer, including:
[0026] Extract entities and entity relationships from the standard input information, and establish a multi-tuple based on the entities and the entity relationships;
[0027] Determine associated information from a preset knowledge graph based on the multi-tuple, where the associated information represents information associated with the question information;
[0028] Perform text summarization extraction processing on the associated information;
[0029] Input the extracted summary information into a fine-tuning model to output summary information;
[0030] Judge the similarity between the summary information and the summary information. If the similarity is greater than or equal to a second threshold, the summary information is pushed to the user as the first answer information.
[0031] A question-answering method for a knowledge processor provided by the present invention can analyze and summarize all knowledge information related to the user's question by establishing a multi-tuple, determining associated information from a preset knowledge graph based on the multi-tuple, performing summary extraction on the associated information, inputting the extracted summary information into a fine-tuning model to output summary information, judging the similarity between the summary information and the summary information, and if the similarity is greater than or equal to a second threshold, pushing the summary information to the user as the first answer information, so as to obtain the most suitable answer information.
[0032] In an alternative embodiment, the method further includes:
[0033] If the similarity is less than the second threshold, the associated information is encapsulated;
[0034] Input the encapsulation result into a third knowledge processor to output the second answer information, and push the second answer information to the user.
[0035] In an alternative embodiment, the encapsulating the associated information includes:
[0036] Fill the associated information and the question information input by the user into the prompt template according to the corresponding relationship to obtain a packaged result.
[0037] In an alternative embodiment, the method further includes:
[0038] When the second knowledge processor does not meet the project scenario requirements, perform secondary packaging processing on the second answer information, and push the secondary packaging result as the answer information to the user.
[0039] A question-answering method for a knowledge processor provided by the present invention can ensure the credibility of the output answer information through primary packaging processing; through secondary packaging processing, it can meet the product requirements under specific application scenarios, thereby improving the user experience.
[0040] In a second aspect, the present invention provides a question-answering device for a knowledge processor, including:
[0041] An information receiving module, configured to receive the question information input by the user;
[0042] A preprocessing module, configured to preprocess the question information to obtain standard input information;
[0043] A judgment module, configured to judge whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than a threshold;
[0044] A first answer module, configured to, if there is the similar question information, complete the answer using the first knowledge processor;
[0045] A second answer module, configured to, if there is no such similar question information, complete the answer using the second knowledge processor.
[0046] In a third aspect, the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the question-answering method of the knowledge processor in the first aspect or any corresponding embodiment thereof.
[0047] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the question-answering method of the knowledge processor in the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0049] Figure 1 is a schematic flowchart of a question-answering method based on a knowledge processor according to an embodiment of the present invention;
[0050] Figure 2 is a schematic flowchart of a joint retrieval method according to an embodiment of the present invention;
[0051] Figure 3 is a schematic flowchart of another question-answering method based on a knowledge processor according to an embodiment of the present invention;
[0052] Figure 4 is a schematic flowchart of yet another question-answering method based on a knowledge processor according to an embodiment of the present invention;
[0053] Figure 5 is a schematic flowchart of a specific embodiment of question-answering based on a knowledge processor according to an embodiment of the present invention;
[0054] Figure 6 is a schematic flowchart of still another question-answering method based on a knowledge processor according to an embodiment of the present invention;
[0055] Figure 7 is a block diagram of the structure of a question-answering device based on a knowledge processor according to an embodiment of the present invention;
[0056] Figure 8 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Specific Embodiments
[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0058] With the rapid development of large language models (LLMs), the field of natural language processing (NLP) has shown great potential with its assistance, even paving the way for artificial general intelligence (AGI).
[0059] In the field of question answering, large models still have certain problems, such as false and biased information. Moreover, the high training cost of large models discourages small and medium-sized enterprises. Although there are solutions for fine-tuning small models such as LoRA and QLoRA, the effects are not entirely satisfactory, making the entire question-answering process less intelligent and resulting in a reduced user experience.
[0060] Based on the problems of false and biased reply information and other issues in the above-mentioned related technologies, as well as the lack of intelligence in its question-answering process, which is likely to lead to a reduced user experience, the present invention provides a question-answering method based on a knowledge processor. This method builds on the advantages of the original knowledge-based question answering (KBQA) system (easy to maintain and customize template information configuration), and utilizes the advantages of large models in semantic understanding, natural language generation, instruction-intensive tasks, reasoning ability, etc., enabling both to jointly handle tasks in the field of question answering, making the entire question-answering system more "intelligent" in terms of user experience, thereby achieving the purpose of improving the user experience.
[0061] According to an embodiment of the present invention, there is provided an embodiment of a question-answering method based on a knowledge processor. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0062] In this embodiment, a question-answering method based on a knowledge processor is provided. Figure 1 It is a flowchart of the question-answering method based on a knowledge processor according to an embodiment of the present invention, as Figure 1 shown, and the process includes the following steps:
[0063] Step S101, receive the question information input by the user.
[0064] Specifically, the question information input by the user can be a combination of text, numbers, and punctuation marks, that is, the question information of a normal user question, such as "What is the weather in Beijing on July 23?"
[0065] Step S102, preprocess the question information to obtain standard input information.
[0066] Specifically, the preprocessing here can be error correction processing for typos, sensitive words, non-standard pinyin, and ungrammatical sentences. The question information input by the user can be preprocessed through the above error correction processing to obtain standard input information that can be input into the knowledge processor for question answering. When there are no such problems in the question information input by the user, the step of preprocessing the question information can be omitted, and the question information input by the user can be directly used as the standard input information.
[0067] Step S103: Determine whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than the threshold.
[0068] Specifically, the knowledge base refers to the knowledge base of the first knowledge processor. By inputting the standard input information into the knowledge base for retrieval, it is judged whether similar question information with a similarity greater than the threshold can be retrieved in its knowledge base. The threshold can be set by the user according to the actual situation.
[0069] More specifically, as Figure 2 shown: The results of multiple retrieval methods can be jointly calculated through the joint retrieval method, and different weights are set for different retrieval methods (the weights are obtained based on experience values. Generally, the weight values of all retrieval methods are evenly divided, that is, text retrieval model: 0.5; es retrieval: 0.5). Then, based on the threshold selection results of different retrieval methods, as shown in Table 1 specifically:
[0070] Table 1
[0071]
[0072] First, based on the text retrieval model (such as bert, word2vec), that is, for the text retrieval model trained in a fixed scenario, the standard input information is retrieved; at the same time, based on the Elasticsearch system (map_reduce, bm25), the scores of the retrieval results are calculated and sorted for the keywords / edit distances, etc. of the standard input information; finally, corresponding weight values are set for the above two retrieval results, and based on the threshold selection results of different retrieval methods. For example, when the final result is 0.8 which is greater than the retrieval result threshold of 0.65, and 0.89 which is greater than the retrieval result of 0.7, the first processor can be selected to complete the answer.
[0073] In a preferred embodiment, the question information input by the user, the standard information obtained through preprocessing, and other analysis information (such as the keywords obtained by performing word segmentation on the question information and the part-of-speech of each segmented word) can also be input into the knowledge base for retrieval, so as to determine whether to answer by the first knowledge processor or by the second knowledge processor. Compared with retrieving only using the standard input information, in this embodiment, by performing knowledge base retrieval using the question information, the standard information, and other analysis information, the accuracy of the retrieval result can be further improved.
[0074] Step S104, if there is such similar question sentence information, then use the first knowledge processor to complete the answer.
[0075] Specifically, when it is determined that there is similar question sentence information corresponding to the standard input information in the knowledge base of the first knowledge processor, the standard input information can be input into the first knowledge processor for question answering. Among them, the first knowledge processor can be a KBQA processor (i.e., Knowledge-based QA), an intelligent question answering processor based on a structured knowledge base (i.e., a knowledge graph), which can understand questions based on the knowledge graph and query or infer the answer corresponding to the question from the knowledge graph according to the result of question understanding.
[0076] Step S105, if there is no such similar question sentence information, then use the second knowledge processor to complete the answer.
[0077] Specifically, when it is determined that there is no similar question sentence information corresponding to the standard input information in the knowledge base of the first knowledge processor, the standard input information can be input into the second knowledge processor for question answering. Among them, the second knowledge processor can be an LLM processor (Large Language Model), that is, a large-scale language model, a natural language processing model based on deep learning, which can learn the grammar and semantics of natural language, so as to generate human-readable text and can perform question answering based on the constructed large-scale language model.
[0078] In this embodiment, a question answering method based on a knowledge processor is provided, and the method includes the following steps:
[0079] Step S201, receive the question information input by the user. For details, please refer to Figure 1 Step S101 of the illustrated embodiment, which will not be elaborated here.
[0080] Step S202, preprocess the question information to obtain standard input information. For details, please refer to Figure 1 Step S102 of the illustrated embodiment, which will not be elaborated here.
[0081] Step S203: Determine whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than the threshold. For details, please refer to Figure 1 Step S103 of the illustrated embodiment, which will not be elaborated here.
[0082] Step S204: If there is such similar question information, use the first knowledge processor to complete the answer.
[0083] Specifically, as Figure 3 shown, the above step S204 includes:
[0084] Step S2041: Determine whether there is a first question information in the historical information whose similarity to the standard input information is greater than the threshold.
[0085] Step S2042: If there is such first question information, push the first answer information corresponding to the first question information to the user.
[0086] Step S2043: If there is no such first question information, determine whether there is a second question information in the knowledge graph whose similarity to the standard input information is greater than the threshold.
[0087] Step S2044: If there is such second question information, push the second answer information corresponding to the second question information to the user.
[0088] Step S2045: If there is no such second question information, use the knowledge list in the knowledge base to perform keyword matching and similarity matching on the standard input information to obtain the answer information corresponding to the standard input information and push it to the user.
[0089] In the above steps 2041 - 2045, when using the first knowledge processor (i.e., the KBQA processor) to answer, factual knowledge processing, user memory analysis, user profile analysis, and knowledge template matching will be performed on the user's input question information and similar statement information. Specifically as follows:
[0090] 1. Retrieve the historical information to determine whether there is a historical question information in the historical information whose similarity to the question information is greater than the threshold (e.g., 0.85), or whether there is a historical standard input information whose similarity to the standard input information is greater than the threshold. If there is, push the first answer information corresponding to the historical question information or the historical standard input information to the user.
[0091] 2. If there is no historical question information or historical standard input information, semantic analysis is performed on the question information or standard input information, and the knowledge graph is queried based on the semantic analysis results to determine whether there is graph question information or graph standard input information in the knowledge graph whose similarity to the question information or standard input information is greater than the threshold. If so, the corresponding second answer information of the graph question information or graph standard input information is pushed to the user.
[0092] 3. If there is no graph question information or graph standard input information, the knowledge list in the knowledge base is used to perform keyword matching and similarity matching on the question information or standard input information to obtain knowledge content with a relatively high similarity to the question information or standard input information as the answer information to be pushed to the user.
[0093] Step S205, if the similar question information does not exist, the second knowledge processor is used to complete the answer. For details, please refer to Figure 1 Step S105 of the illustrated embodiment, which will not be elaborated here.
[0094] In a preferred specific embodiment, as shown in Table 1, a specific example of using the LLM knowledge processor for answering is given, that is:
[0095] Table 1
[0096]
[0097] What are the new regulations for electric bicycles in Hangzhou in 2023?
[0098] According to the similarity list and the statement analysis results, the answer information for this input is finally obtained in the knowledge base. The specific steps are as follows:
[0099] ① Check whether there are items and constraints of statement analysis in the analysis memory. If so, directly use the historical answer in the user's memory for reply. If not, proceed to ②.
[0100] ② Use the statement analysis results to query the knowledge graph information. If it exists, reply; if not, proceed to ③.
[0101] ③ Analyze the knowledge list matched by the knowledge base (keywords, similarity, etc.), and select the knowledge content with higher accuracy for reply.
[0102] ④ Additional reply: Use the user profile to perform the reply of recommended information.
[0103] In this embodiment, a question and answer method based on a knowledge processor is also provided. The method includes the following steps:
[0104] Step S301, receive the question information input by the user. For details, please refer to Figure 1 Step S101 of the embodiment shown, which will not be elaborated here.
[0105] Step S302, preprocess the question information to obtain the standard input information. For details, please refer to Figure 1 Step S102 of the embodiment shown, which will not be elaborated here.
[0106] Step S303, determine whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than the threshold. For details, please refer to Figure 1 Step S103 of the embodiment shown, which will not be elaborated here.
[0107] Step S304, if there is the similar question information, use the first knowledge processor to complete the answer. For details, please refer to Figure 1 Step S104 of the embodiment shown, which will not be elaborated here.
[0108] Step S305, if there is no such similar question information, use the second knowledge processor to complete the answer.
[0109] Specifically, as Figure 4 shown, the above Step S305 includes:
[0110] Step S3051, extract entities and entity relationships from the standard input information, and establish a multi-tuple based on the entities and the entity relationships.
[0111] Specifically, the steps of extracting association information may also include the following multi-level parallel manner:
[0112] First, extract entity information and relationships for the standard input, construct a query statement, and query the results; then perform knowledge retrieval, and the content retrieved in this part is a vector database constructed based on document data, including documents in the forms of PDF, word, txt, etc.; finally, the results obtained by the above multiple retrieval methods are the association information.
[0113] Step S3052, determine the association information from the preset knowledge graph based on the multi-tuple, and the association information represents the information associated with the question information.
[0114] Step S3053, perform text summary extraction processing on the association information.
[0115] Step S3054, input the extracted summary information into the fine-tuning model to output the summary information.
[0116] Step S3055: Determine the similarity between the summary information and the abstract information, and if the similarity is greater than or equal to a second threshold, push the summary information as the first answer information to the user. The second threshold can be set according to the situation and is not specifically limited here.
[0117] Specifically, similarity judgment can be obtained based on clustering scores, that is, the classification of summary information for standard input information.
[0118] In the above steps 3051 to 3055, if Figure 5 As shown, the second knowledge processor (LLM processor) includes a knowledge analyzer, a preprocessor, a call wrapper and a postprocessor; wherein the knowledge analyzer includes an entity processing layer, a knowledge retrieval layer and a knowledge summarization layer.
[0119] Among them, the entity processing layer is used to extract entities and entity relationships between entities based on the question information input by the user or the standard input information, and to construct multi-tuples based on multiple entities and entity relationships; the knowledge retrieval layer is used to retrieve related information from the knowledge graph based on multi-tuples; the knowledge summary layer is used to perform text summary extraction on the related information and the knowledge information associated with the question information or the standard input information, and to input the extracted summary information into the fine-tuning model to output the summary information.
[0120] A preprocessor is used to judge the similarity between the summary information and the abstract information. If the similarity is greater than or equal to a second threshold, the summary information is pushed to the user as the first answer information, or the summary information is judged to be similar to the question information or the standard input information to judge the relevance of the current summary information and the question information or the standard input information input by the user. If the similarity is high, the summary information can be pushed to the user as the first answer information.
[0121] In some optional embodiments, the method further comprises:
[0122] If the similarity is less than a second threshold, encapsulating the associated information;
[0123] The encapsulation result is input into a third knowledge processor to output second answer information, and the second answer information is pushed to the user.
[0124] Specifically, if the similarity is less than the second threshold, it means that the output summary information is weakly correlated with the user's question information and is an unreliable result; therefore, the present invention encapsulates the associated information (including knowledge information and other knowledge information) by calling the encapsulator, and inputs the encapsulated result into a third knowledge processor (such as a local LLM service or a remote LLM service), and sends the final result as answer information to the user.
[0125] In a preferred specific embodiment, encapsulating the associated information includes:
[0126] The associated information and the question information input by the user are filled into the prompt word template according to the corresponding relationship to obtain a packaging result.
[0127] Specifically, LLM calls the packager to encapsulate the associated information. The encapsulation is mainly based on the prompt engineering, that is, the question information input by the user and all the associated information obtained by the knowledge analyzer are filled according to the prompt word template, for example:
[0128] Prompt word template:
[0129] Known information: [knowledge]----specifies the scope of knowledge;
[0130] Please summarize the above information and answer the user's questions. ---Reply with specific instructions;
[0131] User input: [input]------question;
[0132] User input / standard input: How to withdraw provident fund
[0133] Related knowledge: Hello, currently provident fund withdrawals include retirement withdrawals, resignation withdrawals (sealed for 6 months), rental withdrawals for non-households (no house in Pingyang County), repayment of provident funds or public-to-commercial loans, withdrawals for enjoying urban minimum living security, withdrawals for emigration and settlement, withdrawals for purchasing self-occupied housing, withdrawals for building self-occupied housing, withdrawals for repayment of housing commercial loans, withdrawals for death, and withdrawals for family life difficulties caused by major diseases. Different provident fund withdrawals have different application conditions and required materials. Among them, the first 6 withdrawal businesses can be directly processed through the Zhejiang Government Affairs Network and Zhejiang Liban app if they meet the conditions, without providing additional materials. If you do not have a house in Pingyang, you can apply for rental withdrawals for non-households. The maximum monthly withdrawal amount shall not exceed 1,200 yuan, and the maximum number of months for which you can apply for withdrawals at one time shall not exceed 12 months, that is, the maximum withdrawal amount at one time is 14,400 yuan. If you have purchased a self-occupied house in Pingyang within the past year. You can apply for withdrawals for purchasing self-occupied houses, and the amount that can be withdrawn is capped at the total price of the house. You can call 63160308 for further consultation, or follow the "Wenzhou Housing Provident Fund" official account to learn about the service guidelines.
[0134] Replace [knowledge] and [input]. [knowledge] corresponds to "associated knowledge" and [input] corresponds to "user input / standard input"
[0135] Packaging results:
[0136] Known information: Hello, currently provident fund withdrawals include retirement withdrawals, resignation withdrawals (sealed for 6 months), rental withdrawals for non-households (no house in Pingyang County), repayment of provident funds or public-to-commercial loans, withdrawals for enjoying urban minimum living security, withdrawals for emigration and settlement, withdrawals for purchasing self-occupied housing, withdrawals for building self-occupied housing, withdrawals for repayment of housing commercial loans, withdrawals for death, and withdrawals for family life difficulties caused by major diseases. Different provident fund withdrawals have different application conditions and required materials. Among them, the first 6 withdrawal businesses can be directly processed through the Zhejiang Government Affairs Network and Zhejiang Liban app if they meet the conditions, without providing additional materials. If you do not have a house in Pingyang, you can apply for rental withdrawals for non-households. The maximum monthly withdrawal amount shall not exceed 1,200 yuan, and the maximum number of months for which you can apply for withdrawals at one time shall not exceed 12 months, that is, the maximum withdrawal amount at one time is 14,400 yuan. If you have purchased a self-occupied house in Pingyang within the past year. You can apply for withdrawals for purchasing self-occupied houses, and the amount that can be withdrawn is capped at the total price of the house. You can call 63160308 for further consultation, or follow the "Wenzhou Housing Provident Fund" official account to learn about the service guidelines.
[0137] Please summarize the above information and answer the questions entered by the user.
[0138] User input: How to withdraw provident fund
[0139] Finally, the packaged results are sent to the second knowledge processor, and the answer information is replied to the user.
[0140] In a preferred embodiment, the method further comprises:
[0141] When the second knowledge processor does not meet the project scenario requirements, the second answer information is repackaged and the repackaged result is pushed to the user as the answer information.
[0142] Specifically, the post-processor mainly performs secondary packaging. It can determine whether it is necessary to perform secondary packaging on the results of the LLM call wrapper output according to the system configuration or user-defined configuration. For example, the "data id" marks an item (this mark will circulate in the entire system process), and add a configuration for this attribute: whether to execute the post-processing configuration (True / False). The determination of whether to perform secondary packaging can be made based on the configuration information. The secondary packaging here mainly serves to meet the product requirements for additional reply protocol packaging for replies.
[0143] In a preferred embodiment, Figure 6 As shown, the method also includes:
[0144] Step a1, analyzing the user's preference type according to the user's user portrait;
[0145] Step a2: Score multiple standard input messages and multiple answer messages corresponding to the multiple standard input messages one by one according to the preference type.
[0146] Step a3: Select a target answer message that meets the user's preference type from the multiple answer messages according to the scoring results.
[0147] In the above steps a1 - a3, after obtaining multiple answer messages through the above steps S2041 - S2045, the recommended information can be replied according to the user's own portrait, that is, analyze the user's preferences and inclinations according to the user's own portrait; then score the multiple answer messages respectively according to this preference and inclination; finally, select one or more answer messages with scores within a preset range according to the scores corresponding to the answer messages and push them to the user. Through this method, the answer can be made more inclined to the user's historical preferences.
[0148] In a preferred specific embodiment, the method further includes:
[0149] For a single-round knowledge Q&A process, locate the answer message corresponding to the question message or standard input message; for a multi-round knowledge Q&A process, locate the knowledge template, and determine the answer message corresponding to the current question message according to the current question message of the knowledge template and push it to the user.
[0150] In a preferred specific embodiment, as shown in Table 2, a specific example of using the LLM knowledge processor for answering is given, that is:
[0151] Table 2
[0152]
[0153] User's question message: I am going to take the teacher qualification exam this year. What preparations should I make?
[0154] According to the similarity list and the sentence analysis results, extract relevant knowledge from multiple knowledge bases, and summarize the knowledge. The specific steps are as follows:
[0155] ① Check if there is information in the analysis memory that is semantically consistent with the user's input. If so, directly use the historical answer in the user's memory for reply. If not, proceed to ②.
[0156] ② Use the sentence analysis results to query the knowledge graph information, record the knowledge graph results in the associated knowledge relations, and then proceed to ③.
[0157] ③ Based on the user input, similar questions, and associated knowledge, extract knowledge fragments from the KBQA knowledge base and the document library as the information of the associated knowledge.
[0158] ④ Additional reply: Use the user profile to obtain the user's orientation and hobbies, enabling the large model to better understand the user and give more considerate replies.
[0159] In a preferred specific embodiment, the training steps of the fine-tuning model are as follows:
[0160] 1. Knowledge data preparation
[0161] Data source: The knowledge base in KBQA is organized into QA pair data as follows:
[0162] “question”: “What is intellectual property?”,
[0163] "answer": "Intellectual property refers to the results of intellectual creation, such as inventions, literary and artistic works, designs, symbols, names, and images used in business, etc. Intellectual property is legally protected by patents, copyrights, trademarks, etc., which enables people to obtain recognition or economic benefits from their inventions or creations. By achieving an appropriate balance between the interests of innovators and the general public, the intellectual property system aims to create an environment conducive to the flourishing of creation and innovation."
[0164] Data description: Here, data collation and cleaning need to be carried out on the original KBQA knowledge base:
[0165] Data collation: That is, for the original data, it is organized into json format (i.e., the data form in the above text), and data is differentiated according to different business types
[0166] Data cleaning: Clean the collated data, including generalization of similar questions (i.e., generative generalization for questions - data augmentation)
[0167] 2. Training data preparation (depending on different training methods and models, the training data is different. The following is only an example):
[0168] "input_text": "What is intellectual property?",
[0169] "predict": "Intellectual property refers to the results of intellectual creation, such as inventions, literary and artistic works, designs, symbols, names, and images used in business, etc. Intellectual property is legally protected by patents, copyrights, trademarks, etc., which enables people to obtain recognition or economic benefits from their inventions or creations. By achieving an appropriate balance between the interests of innovators and the general public, the intellectual property system aims to create an environment conducive to the flourishing of creation and innovation."
[0170] 3. Execute training
[0171] The training is carried out by keeping the original model parameters unchanged and constructing an additional parameter model (using the LoRA model here) for the business training.
[0172] Construct the LoRA model
[0173] Load the LLM model base
[0174] Train the LoRA model weights and save them
[0175] It is implemented in the perft + lora way. The model construction is to set the parameters (the default is to fix the link size for the A / B matrix and the LoRA normalization hyperparameter size). After the training is completed, the trained model will be evaluated (Evaluation) using semantic similarity task benchmarks (MRPC, QQP, STS-B) and natural language inference task benchmarks (MNLI, QNLI, RTE). Some are selected from multiple benchmarks for evaluation to ensure the usability of the trained model in the benchmark tests.
[0176] 4. Model loading
[0177] Load the LoRA model weights and the LLM model and merge them. The overall model loading is completed.
[0178] The technical effects of the present invention are:
[0179] The present invention proposes to use LLM and KBQA to cooperate to complete the entire Q&A process. Using LLM makes the original KBQA system more intelligent, and the knowledge constructed by KBQA enables the answers of LLM to avoid the harm of hallucinations and falsehoods.
[0180] The present invention proposes knowledge hierarchical decision-making (based on KBQA), and through this part, it realizes to distinguish which processor should be used for the user input to better complete the answer.
[0181] The present invention proposes to use a small model to preprocess the knowledge information first, so that the whole system does not completely rely on the ability of the large model. In this way, the number of calls to the large model can also be reduced, and the system cost can be reduced.
[0182] Compared with the traditional KBQA Q&A system, when dealing with questions that do not exist in the KBQA knowledge base, the present invention uses the ability of the large model, can summarize a feasible solution based on the known information, and gives the user a credible guiding reply.
[0183] In order to ensure the fault tolerance of the system, the present invention uses a small model in the LLM knowledge processor to softly unbind the whole system from the LLM, that is, the whole system does not necessarily completely rely on the ability of the LLM, and can also solve the whole Q&A process.
[0184] The present invention adds a post-processor to the tail of the LLM knowledge processor, making the overall LLM-based capabilities more flexible and controllable.
[0185] In this embodiment, a question-and-answer device based on a knowledge processor is also provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0186] This embodiment provides a question-and-answer device based on a knowledge processor, as Figure 7 shown, including:
[0187] An information receiving module, configured to receive question information input by a user;
[0188] A preprocessing module, configured to preprocess the question information to obtain standard input information;
[0189] A judgment module, configured to judge whether there is similar question information corresponding to the standard input information in a knowledge base; the similarity between the similar question information and the standard input information is greater than a threshold;
[0190] A first answering module, configured to, if there is the similar question information, complete the answer using a first knowledge processor;
[0191] A second answering module, configured to, if there is no such similar question information, complete the answer using a second knowledge processor.
[0192] In a preferred specific embodiment, the first answering module includes:
[0193] A first judgment unit, configured to judge whether there is first question information in historical information whose similarity to the standard input information is greater than a threshold;
[0194] A first pushing unit, configured to, if there is the first question information, push first answer information corresponding to the first question information to the user;
[0195] A second judgment unit, configured to, if there is no such first question information, judge whether there is second question information in a knowledge graph whose similarity to the standard input information is greater than a threshold;
[0196] A second pushing unit, configured to, if there is the second question information, push second answer information corresponding to the second question information to the user;
[0197] A third push unit, configured to, if the second question information does not exist, use the knowledge list in the knowledge base to perform keyword matching and similarity matching on the standard input information, so as to obtain the answer information corresponding to the standard input information and push it to the user.
[0198] In a preferred specific embodiment, the device further includes:
[0199] A preference analysis module, configured to analyze the preference type of the user according to the user profile of the user;
[0200] An information scoring module, configured to perform a scoring operation on multiple standard input information and multiple answer information corresponding to the multiple standard input information respectively according to the preference type;
[0201] An information selection module, configured to select a target answer information that meets the user preference type from the multiple answer information according to the scoring result.
[0202] In a preferred specific embodiment, the second answer module includes:
[0203] A multi-tuple building unit, configured to extract entities and entity relationships from the standard input information, and build a multi-tuple based on the entities and the entity relationships;
[0204] An associated information determination unit, configured to determine associated information from a preset knowledge graph based on the multi-tuple, where the associated information represents information associated with the question information;
[0205] An abstract extraction unit, configured to perform text abstract extraction processing on the associated information;
[0206] A summary information output unit, configured to input the extracted abstract information into a fine-tuning model and output summary information;
[0207] A similarity judgment unit, configured to judge the similarity between the summary information and the abstract information, and if the similarity is greater than or equal to a second threshold, push the summary information as the first answer information to the user.
[0208] In a preferred specific embodiment, the device further includes:
[0209] An encapsulation processing module, configured to, if the similarity is less than the second threshold, perform encapsulation processing on the associated information;
[0210] An answer information push module, configured to input the encapsulation result into a third knowledge processor to output second answer information, and push the second answer information to the user.
[0211] In a preferred specific embodiment, the encapsulation processing module includes:
[0212] An information filling unit for filling the associated information and the question information input by the user into the prompt word template according to the corresponding relationship to obtain an encapsulation result.
[0213] In a preferred specific embodiment, the device further includes:
[0214] A secondary encapsulation module for performing secondary encapsulation processing on the second answer information when the second knowledge processor does not meet the project scenario requirements, and pushing the secondary encapsulation result as the answer information to the user.
[0215] The further function descriptions of the above-mentioned various modules and units are the same as those in the corresponding above-mentioned embodiments, and will not be elaborated here.
[0216] The embodiment of the present invention also provides a computer device having the above-mentioned Figure 7 question-answering device based on a knowledge processor as shown.
[0217] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention. As shown in Figure 8 , the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including a high-speed interface and a low-speed interface. Each component communicates with each other using different buses and can be installed on a common main board or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a set of blade servers, or a multi-processor system). Figure 8 Take one processor 10 as an example in
[0218] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above-mentioned programmable logic device can be a complex programmable logic device, a field programmable gate array, a general array logic, or any combination thereof.
[0219] Among them, the memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiments.
[0220] The memory 20 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the computer device and the like. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 may optionally include a memory remotely provided with respect to the processor 10, and these remote memories may be connected to the computer device through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0221] The memory 20 may include a volatile memory, for example, a random access memory; the memory may also include a non-volatile memory, for example, a flash memory, a hard disk, or a solid-state drive; the memory 20 may also include a combination of the above types of memories.
[0222] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0223] The embodiments of the present invention further provide a computer-readable storage medium. The method according to the embodiments of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code originally stored in a remote storage medium or a non-transitory machine-readable storage medium and downloaded through a network and to be stored in a local storage medium, so that the method described herein can be processed by such software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium may also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.
[0224] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A question-answering method based on a knowledge processor, characterized in that including: Receiving the question information input by the user; Preprocessing the question information to obtain standard input information; Judging whether there is similar question information corresponding to the standard input information in the knowledge base; The similarity between the similar question information and the standard input information is greater than the threshold; If the similar question information exists, use the first knowledge processor to complete the answer; If the similar question information does not exist, use the second knowledge processor to complete the answer.
2. The question-answering method based on a knowledge processor according to claim 1, characterized in that The "if the similar question information exists, use the first knowledge processor to complete the answer" includes: Judging whether there is a first question information in the historical information whose similarity to the standard input information is greater than the threshold; If the first question information exists, push the first answer information corresponding to the first question information to the user; If the first question information does not exist, judge whether there is a second question information in the knowledge graph whose similarity to the standard input information is greater than the threshold; If the second question information exists, push the second answer information corresponding to the second question information to the user; If the second question information does not exist, use the knowledge list in the knowledge base to perform keyword matching and similarity matching on the standard input information to obtain the answer information corresponding to the standard input information and push it to the user.
3. The method according to claim 2, wherein The method further includes: Analyzing the preference type of the user according to the user portrait of the user; According to the preference type, perform a scoring operation on multiple standard input information and multiple answer information corresponding to the multiple standard input information one by one; According to the scoring result, select the target answer information that meets the user's preference type from the multiple answer information.
4. The method according to claim 1 or 2, characterized in that, If the similar question information does not exist, using the second knowledge processor to complete the answer includes: Extracting entities and entity relationships from the standard input information, and establishing a multi-tuple based on the entities and the entity relationships; Determining associated information from a preset knowledge graph based on the multi-tuple, where the associated information represents information associated with the question information; Performing text summary extraction processing on the associated information; Inputting the extracted summary information into a fine-tuning model to output summary information; Judging the similarity between the summary information and the summary information. If the similarity is greater than or equal to the second threshold, push the summary information as the first answer information to the user.
5. The method according to claim 4, wherein The method further includes: If the similarity is less than the second threshold, perform encapsulation processing on the associated information; Input the encapsulation result into a third knowledge processor to output the second answer information, and push the second answer information to the user.
6. The method according to claim 5, characterized in that The "performing encapsulation processing on the associated information" includes: Filling the associated information and the question information input by the user into a prompt template according to the corresponding relationship to obtain an encapsulation result.
7. The method according to claim 5 or 6, characterized in that, The method further includes: When the second knowledge processor does not meet the project scenario requirements, perform secondary encapsulation processing on the second answer information, and push the secondary encapsulation result as the answer information to the user.
8. A question-answering device based on a knowledge processor, characterized in that, The device includes: An information receiving module for receiving the question information input by the user; A preprocessing module for preprocessing the question information to obtain standard input information; A judgment module for judging whether there is similar question information corresponding to the standard input information in the knowledge base; the similarity between the similar question information and the standard input information is greater than a threshold; A first answering module for, if there is the similar question information, completing the answering by using a first knowledge processor; A second answering module for, if there is no such similar question information, completing the answering by using a second knowledge processor.
9. A computer device, characterized in that, It includes: A memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the computer instructions to execute the knowledge-processor-based question-answering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to cause a computer to execute the knowledge-processor-based question-answering method according to any one of claims 1 to 7.