Question answering method based on large model, electronic device, and storage medium
View Patent ↗A question answering method based on a large model is performed by an electronic device. The method includes: determining a first result corresponding to a query statement based on a first large model, in which the first result includes a first response corresponding to the query statement, a first response logic corresponding to the first response, and first context knowledge corresponding to the first response; determining a retrieval result corresponding to the query statement by retrieving in a database based on the query statement; determining a type of a knowledge conflict between the first result and the retrieval result; and determining a target response corresponding to the query statement based on the first result, the retrieval result, and the type of the knowledge conflict.
1 . A computer-implemented question answering method based on a large model, applied in an intelligent question answering system or a personalized recommendation system, performed by an electronic device, the method comprising:
determining a first result corresponding to a query statement based on a first large model, wherein the first result comprises a first response corresponding to the query statement, a first response logic corresponding to the first response, and first context knowledge corresponding to the first response;
determining a retrieval result corresponding to the query statement by retrieving in a database based on the query statement;
determining a type of a knowledge conflict between the first result and the retrieval result; and
determining a target response corresponding to the query statement based on the first result, the retrieval result, and the type of the knowledge conflict;
wherein determining the target response corresponding to the query statement, comprises:
determining a first weight corresponding to the first result and a second weight corresponding to the retrieval result; and
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the first result, the retrieval result, the type of the knowledge conflict, the definition and the reference example corresponding to the semantic error, the first weight corresponding to the first result, and the second weight corresponding to the retrieval result into a third large model;
wherein determining the first weight corresponding to the first result and the second weight corresponding to the retrieval result, comprises:
determining the first weight corresponding to the first result based on a parameter amount corresponding to the first large model, wherein the parameter amount is proportional to the first weight; and
determining the second weight based on the first weight;
wherein determining the first result corresponding to the query statement based on the first large model, comprises:
obtaining a preset number of output results by inputting the query statement into the first large model for a preset number of times, wherein each of the output results comprises a second response corresponding to the query statement, a second response logic corresponding to the second response, and second context knowledge corresponding to the second response;
determining the first response by processing a preset number of second responses;
determining the first response logic by processing a preset number of second response logics; and
determining the first context knowledge by processing a preset number of pieces of second context knowledge.
2 . The method according to claim 1 , wherein the type of the knowledge conflict comprises at least one of a fact error or a semantic error.
3 . The method according to claim 2 , wherein determining the type of the knowledge conflict between the first result and the retrieval result, comprises:
obtaining a definition and a reference example corresponding to the fact error, or a definition and a reference example corresponding to the semantic error; and
determining the type of the knowledge conflict by inputting the first result, the retrieval result, the definition and the reference example corresponding to the fact error, and the definition and the reference example corresponding to the semantic error into a second large model.
4 . The method according to claim 1 , wherein determining the target response corresponding to the query statement, comprises:
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the first result, the retrieval result, the type of the knowledge conflict, and the definition and the reference example corresponding to the semantic error into a third large model.
5 . The method according to claim 1 , wherein after obtaining the preset number of output results by inputting the query statement into the first large model for the preset number of times, the method further comprises:
determining the first response corresponding to the query statement, the first response logic, and the first context knowledge by inputting the preset number of second responses, the preset number of second response logics and the preset number of pieces of second context knowledge into a fourth large model.
6 . The method according to claim 1 , wherein the output result comprises a confidence level corresponding to the second response, and determining the target response corresponding to the query statement, comprises:
determining a first weight corresponding to the first result based on a preset number of confidence levels;
obtaining a second weight corresponding to the retrieval result; and
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the retrieval result, the first result, the type of the knowledge conflict, the definition and the reference example corresponding to the semantic error, the first weight corresponding to the first result, and the second weight corresponding to the retrieval result into a third large model.
7 . The method according to claim 1 , further comprising:
in response to the type of the knowledge conflict being a fact error, determining a third result corresponding to the query statement based on the first large model again;
determining a new retrieval result corresponding to the query statement by retrieving in a database based on the query statement again; and
determining a type of a knowledge conflict between the third result and the new retrieval result until the type of the knowledge conflict between the third result and the new retrieval result is no longer the fact error.
8 . An electronic device, applied in an intelligent question answering system or a personalized recommendation system, comprising a processor; and a memory communicatively coupled to the processor and storing instructions executable by the processor, wherein the processor is configured to:
determine a first result corresponding to a query statement based on a first large model, wherein the first result comprises a first response corresponding to the query statement, a first response logic corresponding to the first response, and first context knowledge corresponding to the first response;
determine a retrieval result corresponding to the query statement by retrieving in a database based on the query statement;
determine a type of a knowledge conflict between the first result and the retrieval result; and
determine a target response corresponding to the query statement based on the first result, the retrieval result, and the type of the knowledge conflict;
wherein the processor is further configured to perform one of:
determining a first weight corresponding to the first result and a second weight corresponding to the retrieval result; and
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the first result, the retrieval result, the type of the knowledge conflict, the definition and the reference example corresponding to the semantic error, the first weight corresponding to the first result, and the second weight corresponding to the retrieval result into a third large model; or
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the first result, the retrieval result, the type of the knowledge conflict, and the definition and the reference example corresponding to the semantic error into a third large model;
wherein the processor is further configured to:
determine the first weight corresponding to the first result based on a parameter amount corresponding to the first large model, wherein the parameter amount is proportional to the first weight; and
determine the second weight based on the first weight;
wherein determining the first result corresponding to the query statement based on the first large model, comprises:
obtaining a preset number of output results by inputting the query statement into the first large model for a preset number of times, wherein each of the output results comprises a second response corresponding to the query statement, a second response logic corresponding to the second response, and second context knowledge corresponding to the second response;
determining the first response by processing a preset number of second responses;
determining the first response logic by processing a preset number of second response logics; and
determining the first context knowledge by processing a preset number of pieces of second context knowledge.
9 . The electronic device according to claim 8 , wherein the type of the knowledge conflict comprises at least one of a fact error or a semantic error.
10 . The electronic device according to claim 9 , wherein the processor is further configured to:
obtain a definition and a reference example corresponding to the fact error, and a definition and a reference example corresponding to the semantic error; and
determine the type of the knowledge conflict by inputting the first result, the retrieval result, the definition and the reference example corresponding to the fact error, and the definition and the reference example corresponding to the semantic error into a second large model.
11 . The electronic device according to claim 8 , wherein the processor is further configured to:
obtain a preset number of output results by inputting the query statement into the first large model for a preset number of times, wherein each of the output results comprises a second response corresponding to the query statement, a second response logic corresponding to the second response, and second context knowledge corresponding to the second response;
determine the first response by processing a preset number of second responses;
determine the first response logic by processing a preset number of second response logics; and
determine the first context knowledge by processing a preset number of pieces of second context knowledge.
12 . The electronic device according to claim 11 , wherein the processor is further configured to:
determine the first response corresponding to the query statement, the first response logic, and the first context knowledge by inputting the preset number of second responses, the preset number of second response logics and the preset number of pieces of second context knowledge into a fourth large model.
13 . The electronic device according to claim 11 , wherein the processor is further configured to:
determine a first weight corresponding to the first result based on a preset number of confidence levels;
obtain a second weight corresponding to the retrieval result; and
in response to the type of the knowledge conflict being a semantic error, determine the target response by inputting the retrieval result, the first result, the type of the knowledge conflict, the definition and the reference example corresponding to the semantic error, the first weight corresponding to the first result, and the second weight corresponding to the retrieval result into a third large model.
14 . The electronic device according to claim 8 , wherein the processor is further configured to: in response to the type of the knowledge conflict being a fact error, determine a third result corresponding to the query statement based on the first large model again;
determine a new retrieval result corresponding to the query statement by retrieving in a database based on the query statement again; and
determine a type of a knowledge conflict between the third result and the new retrieval result until the type of the knowledge conflict between the third result and the new retrieval result is no longer the fact error.
15 . A non-transitory computer readable storage medium storing computer instructions, applied in an intelligent question answering system or a personalized recommendation system, wherein the computer instructions are caused to enable a computer to perform a computer-implemented question answering method based on a large model, the method comprising:
determining a first result corresponding to a query statement based on a first large model, wherein the first result comprises a first response corresponding to the query statement, a first response logic corresponding to the first response, and first context knowledge corresponding to the first response;
determining a retrieval result corresponding to the query statement by retrieving in a database based on the query statement;
determining a type of a knowledge conflict between the first result and the retrieval result; and
determining a target response corresponding to the query statement based on the first result, the retrieval result, and the type of the knowledge conflict;
wherein determining the target response corresponding to the query statement, comprises:
determining a first weight corresponding to the first result and a second weight corresponding to the retrieval result; and
in response to the type of the knowledge conflict being a semantic error, determining the target response by inputting the first result, the retrieval result, the type of the knowledge conflict, the definition and the reference example corresponding to the semantic error, the first weight corresponding to the first result, and the second weight corresponding to the retrieval result into a third large model;
wherein determining the first weight corresponding to the first result and the second weight corresponding to the retrieval result, comprises:
determining the first weight corresponding to the first result based on a parameter amount corresponding to the first large model, wherein the parameter amount is proportional to the first weight; and
determining the second weight based on the first weight;
wherein determining the first result corresponding to the query statement based on the first large model, comprises:
obtaining a preset number of output results by inputting the query statement into the first large model for a preset number of times, wherein each of the output results comprises a second response corresponding to the query statement, a second response logic corresponding to the second response, and second context knowledge corresponding to the second response;
determining the first response by processing a preset number of second responses;
determining the first response logic by processing a preset number of second response logics; and
determining the first context knowledge by processing a preset number of pieces of second context knowledge.