Logical reasoning question answering method, related device, equipment and storage medium
By combining and transforming logical description texts into logical expressions, the problem of inaccurate understanding of logical reasoning problems in the prior art is solved, and the accuracy of answering logical reasoning problems is improved.
Patent Information
- Application Number
- CN202411763281.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-05-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively deal with logical reasoning problems, especially when understanding the details of the problem expression, resulting in inaccurate reasoning results.
Provide a method for answering logical reasoning questions, by obtaining the logical reasoning questions to be answered, combining the logical description text, converting them into logical expressions, and performing inferences to obtain logical reasoning answers.
It improves the accuracy of answering logical reasoning questions, and reduces unstable factors in the reasoning process through pre-preparation and logical expression conversion.
Smart Images

Figure CN119917609A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method for answering logical reasoning questions and related devices, equipment and storage media. Background Art
[0002] With the development of natural language processing technology, artificial intelligence technology has been widely used in various application scenarios such as customer service, office, and life.
[0003] However, because logical reasoning involves multi-level logical analysis and advanced cognitive processes, existing technologies still have difficulty in dealing with logical reasoning problems. Although Chain of Thought (CoT) can make up for the shortcomings to a certain extent, research has found that existing technologies still have the defect of not fully understanding logical problems. For example, differences in the details of the problem statement will directly lead to different directions of subsequent reasoning. In view of this, how to improve the accuracy of answers to logical reasoning problems has become an urgent problem to be solved. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a method for answering logical reasoning questions and related devices, equipment and storage media, which can improve the accuracy of answering logical reasoning questions.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a method for answering logical reasoning questions, including: obtaining a logical reasoning question to be answered; wherein the logical reasoning question contains a plurality of logical description texts, and each logical description text belongs to a category that contains at least a premise; based on the question type of the logical reasoning question, the plurality of logical description texts are combined to obtain at least one logical description set; for each logical description set: each logical description text in the logical description set is converted into a logical expression containing logical operators, and reasoning is performed based on each logical expression in the logical description set to obtain a reasoning result of the logical description set; based on the reasoning results of each logical description set, a logical reasoning answer to the logical reasoning question is obtained.
[0006] In order to solve the above technical problems, the second aspect of the present application provides a logical reasoning question answering device, including: a question acquisition module, a description combination module, a logical reasoning module and a summary answer module, the question acquisition module is used to obtain the logical reasoning question to be answered; wherein the logical reasoning question contains a plurality of logical description texts, and each logical description text belongs to a category that contains at least a premise; the description combination module is used to combine the plurality of logical description texts based on the question type of the logical reasoning question to obtain at least one logical description set; the logical reasoning module is used to, for each logical description set: convert each logical description text in the logical description set into a logical expression expressed in logical symbols, and perform reasoning based on each logical expression in the logical description set to obtain the reasoning result of the logical description set; the summary answer module is used to obtain the logical reasoning answer to the logical reasoning question based on the reasoning result of each logical description set.
[0007] In order to solve the above technical problems, the third aspect of the present application provides an electronic device, which at least includes a memory and a processor coupled to each other, the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the method for answering logical reasoning questions in the above first aspect.
[0008] In order to solve the above technical problems, the fourth aspect of the present application provides a computer-readable storage medium storing program instructions that can be executed by a processor, and the program instructions are used to implement the method for answering logical reasoning questions of the first aspect.
[0009] The above scheme obtains a logical reasoning question to be answered, and the logical reasoning question includes several logical description texts, each logical description text belongs to a category that includes at least a premise, and then combines the several logical description texts based on the problem type of the logical reasoning question to obtain at least one logical description set. For each logical description set: each logical description text in the logical description set is converted into a logical expression containing logical operators, and reasoning is performed based on each logical expression in the logical description set to obtain the reasoning result of the logical description set, and the logical reasoning answer of the logical reasoning question is obtained based on the reasoning result of each logical description set. Therefore, on the one hand, by referring to the question type of the logical reasoning question, several logical description texts in the logical reasoning question are first combined into at least one logical description set, so that each logical description set can be processed separately in the subsequent process, which can prepare for the logical reasoning in advance and help improve the orderliness of the subsequent logical reasoning. On the other hand, in the process of reasoning for each logical description set, the logical description text described in natural language is first converted into a logical expression containing logical operators, and logical reasoning is performed based on this, which can avoid reasoning omissions caused by insufficient understanding of natural language as much as possible, and help reduce unstable factors in the reasoning process. Therefore, the accuracy of answering logical reasoning questions can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a flowchart of an embodiment of a method for answering logical reasoning questions of the present application; Figure 2a It is a process diagram of an embodiment of a method for answering logical reasoning questions of the present application; Figure 2b It is a process diagram of another embodiment of the method for answering logical reasoning questions of the present application; Figure 3 It is a schematic diagram of the framework of an embodiment of a device for answering logical reasoning questions of the present application; Figure 4 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application; Figure 5 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0011] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0012] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0013] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the fragment " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.
[0014] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the method for answering logical reasoning questions of the present application. Specifically, it may include the following steps: Step S11: Obtain the logical reasoning question to be answered.
[0015] In the disclosed embodiment, the logical reasoning problem includes several logical description texts, and each logical description text belongs to a category that contains at least a premise condition. It should be noted that the logical description text, as the name implies, refers to a logical event described in natural language (such as an affirmative event, a negative event, a causal event, etc.). For example, such as affirmative events such as "everyone will make mistakes", "Xiao Li is a worker", etc.; or, such as negative events such as "Xiao Zhou is not a manager", "some people may not make serious mistakes", etc.; or, such as causal events such as "because Xiao Qian is an adult, Xiao Qian can sign the contract himself". Of course, the above examples are only several possible examples in the actual application process, and the specific contents of the logical description text will not be given one by one here. In addition, the premise is the premise used in the subsequent reasoning process, that is, reasoning is performed on this basis.
[0016] In an implementation scenario, each logical description text contained in the logical reasoning problem may also include an expected conclusion in the category to which it belongs, that is, the reasoning conclusion expected to be obtained by subsequent reasoning.
[0017] In an implementation scenario, the types of logical reasoning questions may include, but are not limited to: multiple-choice questions, true-or-false questions, short-answer questions, etc., and the types of logical reasoning questions are not limited here. As a possible example, taking the type of logical reasoning questions as multiple-choice questions, logical reasoning questions may include, but are not limited to: It is impossible for everyone not to make mistakes, and not everyone will make serious mistakes. If the above judgment is true, which of the following One must be true? A. Everyone may make mistakes, but some people may not make serious mistakes.
[0018] B. Everyone may make mistakes, but not everyone may make serious mistakes.
[0019] C. Everyone makes mistakes, but some people may not make serious mistakes.
[0020] D. Everyone makes mistakes, but it is possible for not all people to make serious mistakes.
[0021] In this example, the logical description text may include: "It is impossible for no one to not make mistakes", "Not everyone will make serious mistakes", "Everyone may make mistakes", "Some people may not make serious mistakes", "All people may not make serious mistakes", "Everyone will definitely make mistakes", among which, "It is impossible for no one to not make mistakes" and "Not everyone will make serious mistakes" belong to the categories respectively as the premise, and "Everyone may make mistakes", "Some people may not make serious mistakes", "All people may not make serious mistakes", "Everyone will definitely make mistakes" belong to the categories respectively as the expected conclusion. That is to say, in the subsequent reasoning process, it is necessary to infer whether the expected conclusion is valid based on the first two. As another possible example, still taking the question type of logical reasoning questions as multiple-choice questions, logical reasoning questions may include but are not limited to: The following conditions hold: (1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) or Xiao Li is a worker. (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager. If the following is true, we can conclude that "Xiao Li is a worker": A. Xiao Zhou is not a manager; B. Xiao Wang is a worker; C. Xiao Zhao is not a student; D. Xiao Zhou is a manager; E. Xiao Zhang is not a doctor; F. None of the above is correct.
[0022] In this example, the logic description text may include: "If Xiao Wang is a worker, then Xiao Zhang is not a doctor", "or Xiao Li is a worker, or Xiao Wang is a worker", "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student", "or Xiao Zhao is a student, or Xiao Zhou is not a manager", "Xiao Zhou is not a manager", "Xiao Wang is a worker", "Xiao Zhao is not a student", "Xiao Zhou is a manager", "Xiao Zhang is not a doctor", "Xiao Li is a worker", "If Xiao Wang is a worker, then Xiao Zhang is not a doctor", "or Xiao Li is a worker, or Xiao Wang is a worker", "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student", "or Xiao Zhao is a student, or Xiao Zhou is not a manager" are all used as premise conditions in the reasoning process, and "Xiao Zhou is not a manager", "Xiao Wang is a worker", "Xiao Zhao is not a student", "Xiao Zhou is a manager", "Xiao Zhang is not a doctor" are used as premise conditions in the reasoning process (only one premise condition is used in each reasoning), and "Xiao Li is a worker" is the expected conclusion. That is to say, in the subsequent reasoning process, it is necessary to infer whether the expected conclusion is established based on the first four and any of the last five. Of course, the above examples are just a few possible examples when logical reasoning problems are multiple-choice questions in actual applications, and the specific content of the logical reasoning problems is not limited here.
[0023] Step S12: combining a number of logic description texts based on the question type of the logic reasoning problem to obtain at least one logic description set.
[0024] In an implementation scenario, when the question type of the logical reasoning question is a multiple-choice question, the logical description texts in each option can be selected respectively, and combined with the logical description texts outside each option in the logical reasoning question to obtain a logical description set with the same number of options. Taking the aforementioned logical reasoning question "It is impossible for everyone to not make mistakes, but not everyone will make serious mistakes" as an example, "Everyone may make mistakes, but some people may not make serious mistakes" and "It is impossible for everyone to not make mistakes, but not everyone will make serious mistakes" can be selected to combine into a logical description set, and "Everyone may make mistakes, but not all people may not make serious mistakes" and "It is impossible for everyone to not make mistakes, but not everyone will make serious mistakes" can be selected to combine into a logical description set, "Everyone will definitely make mistakes, but some people may not make minor mistakes" and "It is impossible for everyone to not make mistakes, but not everyone will make serious mistakes" can be selected to combine into a logical description set, and "Everyone will definitely make mistakes, but not all people may not make serious mistakes" and "It is impossible for everyone to not make mistakes, but not everyone will make serious mistakes" can be selected to combine into a logical description set. Of course, the above examples are merely possible examples of combining to obtain at least one logical description set when the logical reasoning question is a multiple-choice question, and other possible situations will not be given one by one here.
[0025] In another implementation scenario, when the question type of the logical reasoning problem is a judgment question, the various logical description texts in the logical reasoning problem can be directly combined into a logical description set. For example, if the logical reasoning problem is "It is impossible for people not to make mistakes, but not everyone will make serious mistakes. Assuming that the above conditions are met, please judge whether the following conclusion is true: Everyone will make mistakes, but some people may not make minor mistakes", you can choose "It is impossible for people not to make mistakes, but not everyone will make serious mistakes" and "Everyone will make mistakes, but some people may not make minor mistakes" to combine into a logical description set. Of course, the above examples are only possible examples of combining at least one logical description set when the logical reasoning problem is a judgment question, and other possible situations will not be given examples one by one here.
[0026] In another implementation scenario, when the question type of the logical reasoning problem is a short answer question, the various logical description texts in the logical reasoning problem can be directly combined into a logical description set. For example, if the logical reasoning problem is "the following conditions are met: (1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhou is a manager, please infer Xiao Li's identity", you can choose "If Xiao Wang is a worker, then Xiao Zhang is not a doctor", "Or Xiao Li is a worker, or Xiao Wang is a worker", "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student", "Or Xiao Zhao is a student, or Xiao Zhou is not a manager", "Xiao Zhou is a manager" to combine into a logical description set. Of course, the above examples are only possible examples of combining at least one logical description set when the logical reasoning problem is a short answer question, and other possible situations will not be given one by one here.
[0027] It should be noted that the above examples are only several possible examples of logical description sets obtained by combining the question types of logical reasoning questions into multiple-choice questions, true-or-false questions, and short-answer questions. Other possible situations will not be given one by one here, and the question types of logical reasoning questions are not limited thereto. For example, logical reasoning questions can also be fill-in-the-blank questions, etc., which will not be given one by one here.
[0028] Step S13: For each logic description set: convert each logic description text in the logic description set into a logic expression containing a logic operator, and perform reasoning based on each logic expression in the logic description set to obtain a reasoning result of the logic description set.
[0029] In an implementation scenario, after obtaining the logic description set, as a possible example, a first prompt instruction can be constructed based on each logic description text in the logic description set, and the first prompt instruction is used to instruct the first large model to convert the logic description text into a logical expression. On this basis, the first prompt instruction can be input to the first large model to obtain the logical expression output by the first large model. The above method uses the general understanding ability of the large language model to convert the natural language description text into a logical expression containing logical operators, which helps to improve the accuracy of the conversion from natural language to logical symbols. Of course, the above example is only a possible example of conversion from natural language to logical symbols in actual application, and does not limit other possible implementation methods. For example, as another possible example, several conversion rules (such as regular expressions) can be pre-set, and the conversion rules can be used to convert the logic description text into a logical expression. Exemplarily, the conversion rules may include "when it comes to any of the situations of 'if A then B', 'as long as A then B', 'for A must B', 'A must B', 'all A are B', 'A cannot do without B', 'as soon as A then B', convert to 'A→B'", "when it comes to any of the situations of 'only A is B', 'not / no / not A is not / no / not B', 'A is the basis / prerequisite / indispensable for B', 'unless A then not B', convert to 'B→A'", etc., and the conversion rules will not be given examples one by one here. Taking the aforementioned logical reasoning problem "It is impossible for everyone not to make mistakes, but not everyone will make serious mistakes" as an example, "make a mistake" can be symbolized as "Error(x)", "make a serious mistake" can be symbolized as "SevereError(x)", then "everyone will make mistakes" can be converted into the logical expression " ”, “It is possible that someone will not make a serious mistake” can be converted into a logical expression “ ”, “No one may make serious mistakes” can be converted into a logical expression “ ". It should be noted that the above conversions are only several possible examples in the actual application process, and other possible situations are not given examples one by one here. It should be noted that the embodiments of the present disclosure involve such as " "," "," "," For the specific meanings of logical symbols such as ", please refer to the technical details of logical symbols, which will not be elaborated here.
[0030] In an implementation scenario, after converting the logical description text into logical expressions containing logical operators, the first reasoning step can be planned based on the logical expressions in the logical description set, and the first reasoning step is used to reason two logical expressions, and then logical reasoning is performed based on the first reasoning step to obtain the first sub-result of the first reasoning step, and based on the first sub-result and the logical expression that is not planned in the logical description set, the second reasoning step is planned, and the second reasoning step is used to reason the first sub-result and a logical expression that is not planned in the Luojia description set. On this basis, reasoning can be performed based on the second reasoning step to obtain the second sub-result of the second reasoning step, and the second sub-result is selected as the new first sub-result, and the aforementioned first sub-result and the logical expression that is not planned in the logical description set are returned to execute, and the second reasoning step is planned to iterate until the reasoning result of the logical description set is obtained. In the above method, when planning and executing the current reasoning step, the sub-result of the previous reasoning step is referred to, and the logical expression can be combined in the reasoning process to realize step-by-step progress until the final result is inferred, so as to separate language understanding and logical reasoning, and greatly reduce the difficulty of reasoning tasks in a single stage.
[0031] In a specific implementation scenario, taking the aforementioned logical reasoning problem "the following conditions are established" as an example, in the logic description set, you can first select a logical expression that is only a prerequisite in the current logic description set (that is, each logical expression other than this is also a prerequisite in other logic description sets), and then select one of the logical expressions related to the logical expression in the logic description set, and use these two logical expressions to plan the first reasoning step. For example, take the logic description set "(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhou is not a manager" as an example, where "Xiao Zhou is not a manager" (that is, the logical expression can be recorded as: ) is a logical expression that is only used as a prerequisite in the current logical description set. In addition, the other logical expressions related to it are "either Xiao Zhao is a student, or Xiao Zhou is not a manager" (that is, the logical expression can be recorded as: ), the two can plan the first reasoning step, that is, combining the logical expression and logical expressions Perform reasoning. Of course, the above example is only a possible example of planning the first reasoning step, and does not limit other possible ways of planning the first reasoning step. Other possible situations for planning the first reasoning step will not be given one by one here. For example, the first reasoning step can also be planned for the logic description set by a large language model (in order to facilitate the distinction from the aforementioned first large model, it can be called the second large model). Specifically, the second large model can plan the first reasoning step in response to the second prompt instruction, and the second prompt instruction is used to instruct the second large model to plan the current reasoning step based on the sub-result of the previous reasoning step and the unplanned logical expression in the logic description set. Of course, since there is no previous reasoning step (that is, there is no sub-result of the previous reasoning step) during the first planning, the current reasoning step (that is, the first reasoning step) can be planned only by the logical expression in the logic description set. In other words, the general understanding ability of the large language model can be used to automatically mine the first reasoning step of the first reasoning.
[0032] In a specific implementation scenario, after obtaining the first reasoning step, logical reasoning can be performed based on the first reasoning step. As a possible example, logical reasoning can also be completed by a large language model (such as the aforementioned second large model, or other large models different from the aforementioned second large model). For example, a prompt example can be constructed based on the logical expression involved in the first reasoning step, and the prompt instruction is used to instruct the large language model to reason about the logical expression, and then the prompt instruction is input into the large language model to obtain the output result of the large language model as the first sub-result of the first reasoning step. Still taking the aforementioned first reasoning step (i.e., including the logical expression and logical expressions ) as an example, the first sub-result can be inferred: It may be true or not. In other words, Xiao Zhao may be a student or not. It is impossible to determine whether Xiao Zhao is a student. Of course, the above example is only a possible example of logical reasoning based on the first reasoning step in actual application. Other possible situations will not be given one by one here.
[0033] In a specific implementation scenario, after obtaining the first sub-result of the first reasoning step, the second reasoning step can be further planned based on the first sub-result and the unplanned logical expressions in the logical description set. As a possible example, similar to the aforementioned planning of the first reasoning step, a logical expression related to the first sub-result can be selected from the various logical expressions that are not planned in the logical description set, and the second reasoning step can be planned with this logical expression and the first sub-result. Continuing with the aforementioned first reasoning step as an example, when the first sub-result "It is impossible to determine whether Xiao Zhao is a student" is obtained, it is consistent with "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student" (that is, the logical expression: ), so the second reasoning step can be planned therewith. Alternatively, similar to the aforementioned planning of the first reasoning step, the second reasoning step can also be planned through a large language model (such as the aforementioned second large model, or other large models different from the second large model) (for details, please refer to the relevant description of the aforementioned planning of the first reasoning step). Of course, the above example is only a possible example of planning the second reasoning step in the actual application process, and other situations will not be given one by one here.
[0034] In a specific implementation scenario, after the second reasoning step is planned, logical reasoning can be performed based on the second reasoning step to obtain the second sub-result of the second reasoning step. As a possible example, logical reasoning can also be completed by a large language model (such as the aforementioned second large model, or other large models different from the aforementioned second large model). For details, please refer to the aforementioned description of logical reasoning based on the first reasoning step, which will not be repeated here. For ease of understanding, still taking the aforementioned second reasoning step as an example, since the first sub-result "cannot determine whether Xiao Zhao is a student", combined with the logical expression " " Perform logical reasoning, and you can get the second sub-result: "It is impossible to determine whether Xiao Zhang is a doctor", that is, Xiao Zhang may be a doctor or not. After that, you can select the second sub-result as the new first sub-result, and return to the aforementioned logical expressions based on the first sub-result and the logical description set that are not planned, and plan to obtain the second reasoning step until the reasoning result of the logical description set is obtained. That is to say, for any reasoning step (of course, except the last reasoning step), the sub-result of the reasoning step is used as the known condition of the next reasoning step of the reasoning step during reasoning, and the sub-result of the last reasoning step is used as the reasoning result of the logical description set. Continuing with the aforementioned second sub-result "It is impossible to determine whether Xiao Zhang is a doctor" as the new first sub-result as an example, based on the new first sub-result "It is impossible to determine whether Xiao Zhang is a doctor" and "If Xiao Wang is a worker, then Xiao Zhang is not a doctor" (that is, the logical expression: ) plan to get a new second reasoning step, and based on this, perform logical reasoning to get the second sub-result: "It is impossible to determine whether Xiao Wang is a worker", as the new first sub-result, and then based on the new first sub-result "It is impossible to determine whether Xiao Wang is a worker" and "Either Xiao Li is a worker, or Xiao Wang is a worker" (that is, the logical expression: ) plan to obtain a new second reasoning step, and based on this, perform logical reasoning to obtain the second sub-result: "It is impossible to determine whether Xiao Li is a worker". At this time, since the conclusion related to the expected conclusion "Xiao Li is a worker" has been obtained, the second sub-result "It is impossible to determine whether Xiao Li is a worker" can be determined as the reasoning result of the logical description set. Of course, it is also possible to use the exhaustion of logical expressions in the logical description set as a basis for judgment to determine that the logical description set has been reasoned. It should be noted that the above example is only a possible example of logical reasoning in actual application, and other possible situations will not be given one by one here.
[0035] In an implementation scenario, as described above, the process of reasoning based on each logical expression in the logic description set may include several reasoning steps executed sequentially. Among them, the first reasoning step may be composed of two logical expressions in the logic description set, and each reasoning step from the second to the last reasoning step may be composed of the sub-result of the previous reasoning step and one of the unplanned logical expressions in the logic description set. For details, please refer to the above-mentioned related descriptions, which will not be repeated here. In addition, please refer to Figure 2a , Figure 2a This is a process diagram of an embodiment of the method for answering logical questions of the present application. Figure 2a As shown, in each reasoning step, at each stage of executing the reasoning step, a supervisory verification matching the stage can be performed respectively, and each stage can include before reasoning, during reasoning, and after reasoning. On this basis, in response to the judgment results of the supervisory verification of the reasoning step at each stage being that the verification is correct, the next reasoning step can be executed, and in response to the judgment result of the supervisory verification of any of the reasoning steps in each stage being that the verification is incorrect, the current reasoning step can be corrected. In the above manner, at each stage before, during, and after the execution of the reasoning step, a supervisory verification matching the stage is performed respectively, and subsequent steps are executed according to the judgment results of the supervisory verification, which can realize process supervision in the whole link and minimize reasoning errors and reasoning hallucinations.
[0036] In a specific implementation scenario, at each stage including before reasoning, the logical expressions involved in the current reasoning step can be subjected to grammar checking. It should be noted that grammar checking may include, but is not limited to: checking whether variables are correctly defined, whether logical connectives are used appropriately, whether the scope of quantifiers is clear, variables are undefined, symbols are used incorrectly (such as writing ∀ as ∃), etc. The specific scope of grammar checking is not given one by one here. In addition, before reasoning, if the result of the supervised verification is that the verification is incorrect, then correcting the current reasoning step may specifically include: modifying the logical expressions involved in the current reasoning step, or regenerating the logical expressions involved in the current reasoning step. The above method, which performs grammar checking before reasoning, can help to avoid reasoning failures or reasoning errors due to grammatical problems in the subsequent reasoning process as much as possible.
[0037] In a specific implementation scenario, when each stage includes reasoning, the deduction process of executing the current reasoning step can be checked to see whether it complies with the logical rules. In other words, it is necessary to verify that each step of the deduction complies with the logical rules (such as basic logical rules such as AND, OR, and NOT). For example, taking the logical rule "OR" as an example, in the above example, since "Xiao Zhou is not a manager" (that is, the logical expression: ), and "either Xiao Zhao is a student, or Xiao Zhou is not a manager" (i.e., the logical expression: , that is, as long as the proposition satisfies "Xiao Zhao is a student" and "Xiao Zhou is not a manager", it is a true proposition. In other words, the logical rule is "or"), so now "Xiao Zhou is not a manager" is satisfied, that is, the logical expression " " must be a true proposition, regardless of whether "Xiao Zhao is a student" is satisfied. If it is treated as the logical rule "and" during the reasoning process, a deduction error will occur, that is, there will be a need to further satisfy the logical expression "Xiao Zhao is a student" " can be a wrong conclusion of a true proposition. Of course, the above example is only a possible example of checking whether it conforms to the logical rules, and other possible situations will not be given one by one here. It should be noted that in reasoning, if the judgment result of the supervision check is that the check is wrong, then correcting the current reasoning steps may specifically include: re-planning the current reasoning steps, etc., which are not limited here. That is to say, when it is found that the deduction process is inconsistent with the logical rules (such as incorrect application of logical rules, deduction without satisfying logical rules, etc.), the reasoning steps can be adjusted in time and correct reasoning can be performed again. The above method, which performs logical rule consistency check in reasoning, can help to ensure the consistency of the deduction process and the logical rules as much as possible.
[0038] In a specific implementation scenario, when each stage includes after reasoning, the consistency of the sub-result after executing the current reasoning step and the premise involved in the current reasoning step can be judged, and in this case, correcting the current reasoning step can include: re-executing the current reasoning step. The above method, after reasoning, makes a premise-conclusion consistency judgment, which can ensure as much as possible that the conclusion is logically derived based on the premise without any contradiction or unreasonable situation.
[0039] Step S14: Based on the reasoning results of each logical description set, a logical reasoning answer to the logical reasoning problem is obtained.
[0040] In an implementation scenario, after obtaining the reasoning results of each logical description set, a third prompt instruction can be constructed based on the reasoning results of each logical description set and its reasoning steps, and the third prompt instruction is used to instruct the third largest model to integrate the reasoning results of each logical description set and its reasoning steps into a natural language description. On this basis, the third prompt instruction can be input into the third largest model to obtain the natural language description text output by the third largest model as the logical reasoning answer. The above method further integrates and outputs after the reasoning is completed, which helps to improve the readability of the reasoning answer and makes the final output reasoning answer as easy to understand as possible.
[0041] In an implementation scenario, please refer to Figure 2b , Figure 2b This is a process diagram of another embodiment of the method for answering logical questions. Figure 2b As a special example, let’s take the aforementioned logical reasoning problem “the following conditions hold” as an example. The logical description set “(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhou is not a manager” can be obtained through the aforementioned logical reasoning. The inference result is “it is impossible to determine whether Xiao Li is a worker” (the various reasoning steps involved can refer to the aforementioned relevant descriptions). Similarly, the logical description set “(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Wang is a worker” can be combined with “Xiao Wang is a worker” (that is, the logical expression is: ) and "either Xiao Li is a worker, or Xiao Wang is a worker" (that is, the logical expression is: ) can be directly used as the inference result of the logical description set by obtaining the sub-result "It is impossible to determine whether Xiao Li is a worker"; similarly, the logical description set "(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhao is not a student" can be first combined with "Xiao Zhao is not a student" (that is, the logical expression is: ) and "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student" (i.e. the logical expression is: ) can get the sub-result "It is impossible to determine whether Xiao Zhang is a doctor", and use this sub-result as a known condition and "If Xiao Wang is a worker, then Xiao Zhang is not a doctor" (that is, the logical expression is: ) can get the sub-result "It is impossible to determine whether Xiao Wang is a worker", and use this sub-result as a known condition combined with "either Xiao Li is a worker, or Xiao Wang is a worker" (that is, the logical expression is: ) can be used as the reasoning result of the logical description set by obtaining the sub-result "It is impossible to determine whether Xiao Li is a worker"; similarly, the logical description set "(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhou is a manager" can be combined with "Xiao Zhou is a manager" (that is, the logical expression is: ) and "either Xiao Zhao is a student, or Xiao Zhou is not a manager" (i.e. the logical expression is: ) can get the sub-result "Xiao Zhao is a student", and use this sub-result as a known condition and "If Xiao Zhang is not a doctor, then Xiao Zhao is not a student" (that is, the logical expression is: ) can get the sub-result "Xiao Zhang is a doctor" and use this sub-result as a known condition and "If Xiao Wang is a worker, then Xiao Zhang is not a doctor" (that is, the logical expression is: ) can get the sub-result "Xiao Wang is not a worker" by following the reasoning steps, and use this sub-result as a known condition and either Xiao Li is a worker or Xiao Wang is a worker (that is, the logical expression is: ) can be used as the inference result of the logical description set. Similarly, the logical description set "(1) If Xiao Wang is a worker, then Xiao Zhang is not a doctor; (2) Either Xiao Li is a worker, or Xiao Wang is a worker; (3) If Xiao Zhang is not a doctor, then Xiao Zhao is not a student; (4) Either Xiao Zhao is a student, or Xiao Zhou is not a manager; (5) Xiao Zhang is not a doctor" can be combined with "Xiao Zhang is not a doctor" (that is, the logical expression is: ) and if Xiao Wang is a worker, then Xiao Zhang is not a doctor (that is, the logical expression is: ) can get the sub-result "It is impossible to determine whether Xiao Wang is a worker", and combine this as a known condition with "either Xiao Li is a worker, or Xiao Wang is a worker" (that is, the logical expression is: ) can be used as the reasoning result of the logical description set by obtaining the sub-result "It is impossible to determine whether Xiao Li is a worker". The above description is the reasoning process of each logical description set when taking the aforementioned logical reasoning problem "The following conditions are met" as an example (including several reasoning steps of each logical description set in the reasoning process). Of course, if Figure 2a and Figure 2b As shown in the figure, before, during, and after each reasoning step, a matching supervision check can be performed. After that, the large language model can be used to integrate the reasoning results and reasoning steps of each logical description set to obtain the logical reasoning answer: To solve this problem, we first need to convert each condition into propositional logic form and analyze them The logical relationship between them.
[0042] 1. Xiao Wang is a worker → Xiao Zhang is not a doctor (W → ¬Z) 2. Xiao Li is a worker ∨ Xiao Wang is a worker (L ∨W) 3. Xiao Zhang is not a doctor → Xiao Zhao is not a student (¬Z → ¬S) 4. Xiao Zhao is a student ∨ Xiao Zhou is not a manager (S ∨¬M) We need to find out which option can lead to the conclusion that "Xiao Li is a worker" (L).
[0043] ### Analysis of each option: **A. Xiao Zhou is not a manager (¬M)** - According to (4) S ∨¬M, if Xiao Zhou is not a manager, it is impossible to determine whether Xiao Zhao is a student (S).
[0044] - If Xiao Zhao is a student, according to (3) ¬Z → ¬S, it is impossible to determine whether Xiao Zhang is a doctor (Z).
[0045] - If Xiao Zhang is not a doctor, according to (1) W → ¬Z, it is impossible to determine whether Xiao Wang is a worker (W).
[0046] - If Xiao Wang is a worker, according to (2) L ∨W, it is impossible to determine whether Xiao Li is a worker (L), because Xiao Wang may A worker.
[0047] Therefore, option A cannot directly lead to "Xiao Li is a worker".
[0048] **B. Xiao Wang is a worker (W)** - According to (2) L ∨W, if we know that Xiao Wang is a worker, we cannot determine whether Xiao Li is a worker, because it is possible that Xiao Wang is a worker.
[0049] Therefore, option B cannot directly lead to "Xiao Li is a worker".
[0050] **C. Xiao Zhao is not a student (¬S)** - According to (3) ¬Z → ¬S, if Xiao Zhao is not a student, it is impossible to determine whether Xiao Zhang is a doctor (Z).
[0051] - If Xiao Zhang is not a doctor, according to (1) W → ¬Z, it is impossible to determine whether Xiao Wang is a worker (W).
[0052] - If Xiao Wang is a worker, according to (2) L ∨W, it is impossible to determine whether Xiao Li is a worker, because Xiao Wang may be Worker.
[0053] Therefore, option C cannot directly lead to "Xiao Li is a worker".
[0054] **D. Xiao Zhou is the manager (M)** - According to (4) S ∨¬M, if Xiao Zhou is a manager, then Xiao Zhao must be a student (S).
[0055] - According to (3) ¬Z → ¬S, if Xiao Zhao is a student, then Xiao Zhang must be a doctor (Z).
[0056] - According to (1) W → ¬Z, if Xiao Zhang is a doctor, then Xiao Wang cannot be a worker (¬W).
[0057] - According to (2) L ∨W, if Xiao Wang is not a worker, then Xiao Li must be a worker (L).
[0058] Therefore, option D can directly lead to "Xiao Li is a worker".
[0059] **E. Xiao Zhang is not a doctor (¬Z)** - According to (1) W → ¬Z, if Xiao Zhang is not a doctor, it is impossible to determine whether Xiao Wang is a worker (W).
[0060] - If Xiao Wang is a worker, according to (2) L ∨W, it is impossible to determine whether Xiao Li is a worker, because Xiao Wang may be Worker.
[0061] Therefore, option E cannot directly lead to "Xiao Li is a worker."
[0062] **F. None of the above** - Option D has proved that "Xiao Li is a worker", so option F is incorrect.
[0063] ### in conclusion: Only option **D. Xiao Zhou is a manager** can directly lead to the conclusion that "Xiao Li is a worker".
[0064] It should be noted that the above example is only a possible example of the logical reasoning answer when taking the aforementioned logical reasoning problem "the following conditions are met" as an example, and does not limit other possible situations. The specific reasoning process and logical reasoning answers for other logical reasoning problems will not be given one by one here.
[0065] The above scheme obtains a logical reasoning question to be answered, and the logical reasoning question includes several logical description texts, each logical description text belongs to a category that includes at least a premise, and then combines the several logical description texts based on the problem type of the logical reasoning question to obtain at least one logical description set. For each logical description set: each logical description text in the logical description set is converted into a logical expression containing logical operators, and reasoning is performed based on each logical expression in the logical description set to obtain the reasoning result of the logical description set, and the logical reasoning answer of the logical reasoning question is obtained based on the reasoning result of each logical description set. Therefore, on the one hand, by referring to the question type of the logical reasoning question, several logical description texts in the logical reasoning question are first combined into at least one logical description set, so that each logical description set can be processed separately in the subsequent process, which can prepare for the logical reasoning in advance and help improve the orderliness of the subsequent logical reasoning. On the other hand, in the process of reasoning for each logical description set, the logical description text described in natural language is first converted into a logical expression containing logical operators, and logical reasoning is performed based on this, which can avoid reasoning omissions caused by insufficient understanding of natural language as much as possible, and help reduce unstable factors in the reasoning process. Therefore, the accuracy of answering logical reasoning questions can be improved.
[0066] See also Figure 3 , Figure 3 It is a schematic diagram of the framework of an embodiment of the logical reasoning question answering device of the present application. The logical reasoning question answering device 30 includes: a question acquisition module 31, a description combination module 32, a logical reasoning module 33 and a summary answering module 34. The question acquisition module 31 is used to acquire the logical reasoning question to be answered; wherein the logical reasoning question contains a plurality of logical description texts, and each logical description text belongs to a category that contains at least a premise; the description combination module 32 is used to combine a plurality of logical description texts based on the question type of the logical reasoning question to obtain at least one logical description set; the logical reasoning module 33 is used for each logical description set: converting each logical description text in the logical description set into a logical expression expressed in logical symbols, and performing reasoning based on each logical expression in the logical description set to obtain the reasoning result of the logical description set; the summary answering module 34 is used to obtain the logical reasoning answer to the logical reasoning question based on the reasoning result of each logical description set.
[0067] In the above scheme, the logic reasoning question answering device 30 obtains a logic reasoning question to be answered, and the logic reasoning question includes a plurality of logic description texts, each logic description text belongs to a category that includes at least a premise, and then the plurality of logic description texts are combined based on the problem type of the logic reasoning question to obtain at least one logic description set. For each logic description set: each logic description text in the logic description set is converted into a logic expression containing a logic operator, and reasoning is performed based on each logic expression in the logic description set to obtain a reasoning result of the logic description set, and a logic reasoning answer to the logic reasoning question is obtained based on the reasoning result of each logic description set. Therefore, on the one hand, by referring to the question type of the logic reasoning question, the plurality of logic description texts in the logic reasoning question are first combined into at least one logic description set, so that each logic description set can be processed separately in the subsequent process, which can prepare for the logic reasoning in advance and help to improve the orderliness of the subsequent logic reasoning. On the other hand, in the process of reasoning for each logic description set, the logic description text described in natural language is first converted into a logic expression containing a logic operator, and logical reasoning is performed based on this, which can avoid reasoning omissions caused by insufficient understanding of natural language as much as possible and help to reduce unstable factors in the reasoning process. Therefore, the accuracy of answering logical reasoning questions can be improved.
[0068] In some disclosed embodiments, the logic reasoning module 33 includes a first construction submodule, which is used to construct a first prompt instruction based on a logic description text; wherein the first prompt instruction is used to instruct the first large model to convert the logic description text into a logical expression; the logic reasoning module 33 includes a first processing submodule, which is used to input the first prompt instruction into the first large model to obtain the logical expression output by the first large model.
[0069] In some disclosed embodiments, the logic reasoning module 33 includes a first planning submodule, which is used to plan a first reasoning step based on a logic expression in a logic description set; wherein the first reasoning step is used to infer two logic expressions; the logic reasoning module 33 includes a first reasoning submodule, which is used to perform logical reasoning based on the first reasoning step to obtain a first sub-result of the first reasoning step; the logic reasoning module 33 includes a second planning submodule, which is used to plan a second reasoning step based on the first sub-result and a logic expression that is not planned in the logic description set; wherein the second reasoning step is used to infer the first sub-result and a logic expression that is not planned in the logic description set; the logic reasoning module 33 includes a second reasoning submodule, which is used to perform logical reasoning based on the second reasoning step to obtain a second sub-result of the second reasoning step, and select the second sub-result as a new first sub-result, return to execute based on the first sub-result and each logic expression that is not planned in the logic description set, plan a second reasoning step, until the reasoning result of the logic description set is obtained.
[0070] In some disclosed embodiments, each reasoning step is planned by the second large model in response to a second prompt instruction, and the second prompt instruction is used to instruct the second large model to plan the current reasoning step based on the sub-result of the previous reasoning step and the unplanned logical expression in the logic description set; and / or, for any reasoning step, the sub-result of the reasoning step serves as a known condition for the next reasoning step of the reasoning step during reasoning, and the sub-result of the last reasoning step serves as the reasoning result of the logic description set.
[0071] In some disclosed embodiments, the process of reasoning based on each logical expression in the logic description set includes several reasoning steps executed sequentially, and the logic reasoning question answering device 30 includes a supervision verification module for performing supervision verification matching the stage at each stage of executing the reasoning steps; wherein each stage includes before reasoning, during reasoning and after reasoning; the logic reasoning question answering device 30 includes a first response module for responding to the result of the supervision verification of the reasoning step at each stage being that the verification is correct and executing the next reasoning step; the logic reasoning question answering device 30 includes a second response module for responding to the result of the supervision verification of any one of the reasoning steps at each stage being that the verification is incorrect and correcting the current reasoning step.
[0072] In some disclosed embodiments, the supervision verification module includes a first supervision submodule, which is used to check whether the deduction process when executing the current reasoning step complies with logical rules when each stage includes reasoning; wherein, correcting the current reasoning step includes: replanning the current reasoning step.
[0073] In some disclosed embodiments, the supervision verification module includes a second supervision submodule, which is used to check whether the deduction process when executing the current reasoning step complies with logical rules when each stage includes reasoning; wherein, correcting the current reasoning step includes: replanning the current reasoning step.
[0074] In some disclosed embodiments, the supervision verification module includes a third supervision submodule, which is used to judge the consistency of the sub-result after executing the current reasoning step and the preconditions involved in the current reasoning step in each stage including after reasoning; wherein, correcting the current reasoning step includes: re-executing the current reasoning step.
[0075] In some disclosed embodiments, the summary answer module 34 includes a third construction submodule, which is used to construct a third prompt instruction based on the reasoning results and reasoning steps of each logical description set; wherein the third prompt instruction is used to instruct the third largest model to integrate the reasoning results and reasoning steps of each logical description set into a natural language description; the summary answer module 34 includes a third processing submodule, which is used to input the third prompt instruction into the third largest model to obtain the natural language description text output by the third largest model as the logical reasoning answer.
[0076] In some disclosed embodiments, the categories to which each logic description text belongs also include expected conclusions; and / or the question type of the logic reasoning question is any one of multiple-choice questions, true-or-false questions, and short-answer questions.
[0077] See also Figure 4 , Figure 4 : is a schematic diagram of the framework of an embodiment of an electronic device of the present application. The electronic device 40 includes at least a memory 41 and a processor 42 coupled to each other, the memory 41 stores at least program instructions, and the processor 42 is used to execute the program instructions to implement the steps in any of the above-mentioned logical reasoning question answering method embodiments. For details, please refer to the aforementioned disclosed embodiments, which will not be repeated here. As a possible example, the electronic device 40 may include but is not limited to a server, a camera, a smart phone, a tablet computer, etc., and the specific type of the electronic device 40 is not limited here.
[0078] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above-mentioned logical reasoning question answering method embodiments. The processor 42 can also be called a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 42 can be implemented by an integrated circuit chip.
[0079] In the above scheme, the electronic device 40 obtains a logical reasoning question to be answered, and the logical reasoning question includes a plurality of logical description texts, each logical description text belongs to a category that includes at least a premise, and then the plurality of logical description texts are combined based on the question type of the logical reasoning question to obtain at least one logical description set. For each logical description set: each logical description text in the logical description set is converted into a logical expression containing logical operators, and reasoning is performed based on each logical expression in the logical description set to obtain a reasoning result of the logical description set, and a logical reasoning answer to the logical reasoning question is obtained based on the reasoning result of each logical description set. Therefore, on the one hand, by referring to the question type of the logical reasoning question, the plurality of logical description texts in the logical reasoning question are first combined into at least one logical description set, so that each logical description set can be processed separately later, which can prepare for the logical reasoning in advance and help improve the orderliness of the subsequent logical reasoning. On the other hand, in the process of reasoning for each logical description set, the logical description text described in natural language is first converted into a logical expression containing logical operators, and logical reasoning is performed accordingly, which can avoid reasoning omissions caused by insufficient understanding of natural language as much as possible and help reduce unstable factors in the reasoning process. Therefore, the accuracy of answering logical reasoning questions can be improved.
[0080] See also Figure 5 , Figure 5 1 is a schematic diagram of a computer-readable storage medium 50 of the present application. The computer-readable storage medium 50 stores program instructions 51 that can be executed by a processor, and the program instructions 51 are used to implement the steps in any of the above-mentioned logical reasoning question answering method embodiments.
[0081] In the above scheme, the computer-readable storage medium 50 obtains a logical reasoning question to be answered, and the logical reasoning question includes a plurality of logical description texts, each logical description text belongs to a category that includes at least a premise, and then the plurality of logical description texts are combined based on the problem type of the logical reasoning question to obtain at least one logical description set. For each logical description set: each logical description text in the logical description set is converted into a logical expression containing a logical operator, and reasoning is performed based on each logical expression in the logical description set to obtain a reasoning result of the logical description set, and a logical reasoning answer to the logical reasoning question is obtained based on the reasoning result of each logical description set. Therefore, on the one hand, by referring to the question type of the logical reasoning question, the plurality of logical description texts in the logical reasoning question are first combined into at least one logical description set, so that each logical description set can be processed separately in the subsequent process, which can prepare for the logical reasoning in advance and help to improve the orderliness of the subsequent logical reasoning. On the other hand, in the process of reasoning for each logical description set, the logical description text described in natural language is first converted into a logical expression containing a logical operator, and logical reasoning is performed accordingly, which can avoid reasoning omissions caused by insufficient understanding of natural language as much as possible and help to reduce unstable factors in the reasoning process. Therefore, the accuracy of answering logical reasoning questions can be improved.
[0082] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0083] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0084] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0088] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A method for answering logical reasoning questions, characterized in that: include: Obtaining a logical reasoning question to be answered; wherein the logical reasoning question includes a plurality of logical description texts, and each of the logical description texts belongs to a category that includes at least a premise condition; Combining the plurality of logic description texts based on the question type of the logic reasoning problem to obtain at least one logic description set; For each of the logic description sets: converting each of the logic description texts in the logic description set into a logic expression containing a logic operator, and performing reasoning based on each of the logic expressions in the logic description set to obtain a reasoning result of the logic description set; Based on the reasoning results of each of the logical description sets, a logical reasoning answer to the logical reasoning problem is obtained.
2. The method according to claim 1, characterized in that The step of converting each of the logic description texts in the logic description set into a logic expression containing a logic operator comprises: Based on the logic description text, construct a first prompt instruction; wherein the first prompt instruction is used to instruct the first large model to convert the logic description text into the logic expression; The first prompt instruction is input to the first large model to obtain a logical expression output by the first large model.
3. The method according to claim 1, characterized in that The reasoning based on each of the logical expressions in the logical description set to obtain the reasoning result of the logical description set includes: Based on the logic expression in the logic description set, a first reasoning step is planned; wherein the first reasoning step is used to reason about the two logic expressions; Performing logical reasoning based on the first reasoning step to obtain a first sub-result of the first reasoning step; Based on the first sub-result and the unplanned logical expression in the logical description set, a second reasoning step is planned; wherein the second reasoning step is used to reason about the first sub-result and a unplanned logical expression in the logical description set; Perform logical reasoning based on the second reasoning step to obtain a second sub-result of the second reasoning step, select the second sub-result as a new first sub-result, return to execute the logical expression based on the first sub-result and the unplanned in the logical description set, plan to obtain the second reasoning step, until the reasoning result of the logical description set is obtained.
4. The method according to claim 3, characterized in that Each reasoning step is respectively planned by the second large model in response to a second prompt instruction, wherein the second prompt instruction is used to instruct the second large model to plan the current reasoning step based on the sub-result of the previous reasoning step and the unplanned logical expression in the logic description set; And / or, for any reasoning step, the sub-result of the reasoning step serves as a known condition for the next reasoning step of the reasoning step during reasoning, and the sub-result of the last reasoning step serves as the reasoning result of the logic description set.
5. The method according to claim 1, characterized in that The process of reasoning based on each of the logic expressions in the logic description set includes a plurality of reasoning steps executed sequentially, and in each of the reasoning steps, the method further includes: At each stage of executing the inference step, a supervisory verification matching the stage is performed respectively; wherein the stages include before inference, during inference and after inference; In response to the judgment results of the supervisory verification of the reasoning step at each stage being all verified to be correct, executing the next reasoning step; In response to a judgment result of the supervisory verification of any one of the inference steps in each of the stages being that the verification is incorrect, the current inference step is corrected.
6. The method according to claim 5, characterized in that In the case where the various stages include the pre-reasoning stage, the step of supervised verification includes: Performing a grammar check on the logic expression involved in the current reasoning step; wherein, correcting the current reasoning step includes: modifying the logic expression involved in the current reasoning step, or regenerating the logic expression involved in the current reasoning step.
7. The method according to claim 5, characterized in that In the case where the various stages include reasoning, the step of supervised verification includes: Check whether the deduction process when executing the current reasoning step complies with the logical rules; wherein, correcting the current reasoning step includes: replanning the current reasoning step.
8. The method according to claim 5, characterized in that In the case where the various stages include post-inference, the step of supervised verification includes: A consistency judgment is performed on the sub-result after executing the current reasoning step and the premise conditions involved in the current reasoning step; wherein, correcting the current reasoning step includes: re-executing the current reasoning step.
9. The method according to claim 1, characterized in that: The step of obtaining a logical reasoning answer to the logical reasoning problem based on the reasoning results of each of the logical description sets includes: Based on the inference results and inference steps of each of the logic description sets, a third prompt instruction is constructed; wherein the third prompt instruction is used to instruct the third large model to integrate the inference results and inference steps of each of the logic description sets into a natural language description; Input the third prompt instruction to the third largest model to obtain the natural language description text output by the third largest model as the logical reasoning answer.
10. The method according to any one of claims 1 to 9, characterized in that: The categories to which each of the logic description texts belongs also include expected conclusions; And / or, the question type of the logical reasoning question is any one of multiple-choice questions, true-or-false questions, and short-answer questions.
11. A device for answering logical reasoning questions, characterized in that: include: A question acquisition module, used to acquire a logical reasoning question to be answered; wherein the logical reasoning question includes a plurality of logical description texts, and each of the logical description texts belongs to a category that includes at least a premise condition; A description combination module, used for combining the plurality of logic description texts based on the question type of the logic reasoning problem to obtain at least one logic description set; A logic reasoning module, for each of the logic description sets: converting each of the logic description texts in the logic description set into a logic expression expressed in logic symbols, and performing reasoning based on each of the logic expressions in the logic description set to obtain a reasoning result of the logic description set; The summary answer module is used to obtain the logical reasoning answer to the logical reasoning problem based on the reasoning results of each of the logical description sets.
12. An electronic device, characterized in that: The method comprises at least a memory and a processor coupled to each other, wherein the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the method for answering logical reasoning questions as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the method for answering logical reasoning questions as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Logic expression generation method and device, model training method and device and medium
CN116028605A
Proposition judgment method, deductive reasoning method and system based on Boolean algebra
CN118260377A
Knowledge graph complex logical reasoning-oriented generative method
CN118760745A
Question and answer processing method and device, storage medium and program product
CN118939780A