Program, device and method for inferring answers from questions in consideration of the inference process of a language model
The program and device improve language model accuracy in logical and mathematical reasoning by using an inference principle database to generate prompts and dynamically apply inference principles, correcting errors and enhancing self-correcting abilities.
Patent Information
- Application Number
- JP2025069258
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-11-05
- Estimated Expiration
- 2045-04-21
AI Technical Summary
Existing language models struggle with achieving sufficient accuracy for questions requiring logical or mathematical reasoning, especially when specialized knowledge and experience are needed to select and adjust input/output examples, and determining representative few-shots is difficult, making it challenging to ensure high-quality examples applicable to all tasks.
A program and device that utilize an inference principle database to store embedding vectors and inference process statements, enabling the generation of appropriate prompts for language models through Zero-Shot Chain of Thought, and dynamically applying inference principles to improve accuracy by avoiding incorrect answers and reaching correct answers.
Enhances the accuracy of language model inferences for new tasks by automatically generating task-specific prompts and correcting errors, eliminating the need for exploratory optimization and few-shot design, particularly improving mathematical and logical reasoning tasks.
Smart Images

Figure 0007764656000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to techniques for inferring answers from questions using language models (e.g., large language models). [Background technology]
[0002] Previously, to perform new tasks using a language model, it was necessary to input large amounts of training data and perform fine-tuning (additional learning). In contrast, there is in-context learning, which provides appropriate task-related instructions and examples to a language model, thereby improving task performance without retraining the parameters inside the language model.
[0003] A representative example is the Zero-Shot Chain of Thought Prompting technology (see, for example, Non-Patent Document 1). This technology presents only a general prompt, such as "Let's think step by step." This alone makes it possible to utilize knowledge within the language model and encourage step-by-step reasoning.
[0004] There is also a technology called Few-Shot Prompting / Few-Shot CoT (see, for example, Non-Patent Document 2). According to this technology, explicit input / output examples (few shots) appropriate for the task are included in the prompt and instructed to the language model. This allows the language model to make inferences while referring to these input / output examples. In this case, by explicitly presenting the thought process for each input / output example, it is possible to obtain step-by-step inference results.
[0005] Furthermore, there is a technology that extracts principles of inference from language models (see, for example, Non-Patent Document 3). According to this technology, "representative few-shot examples" obtained in advance according to the task are given, and then incorrect answers are deliberately generated, and "principles" that improve inference are extracted from the difference between the incorrect and correct answers. These principles are then applied to other samples of the same task. This utilizes the language model's ability to learn from incorrect inferences and self-correct. [Prior art documents] [Non-patent literature]
[0006] [Non-Patent Document 1] Kojima, T., et al.: Large Language Models are Zero-Shot Reasoners, Advances in Neural Information Processing Systems, Vol. 35, pp. 22199-22213 (2022), [online], [Retrieved April 12, 2025], Internet<URL:https: / / arxiv.org / abs / 2205.11916> [Non-patent document 2] Brown, T., et al.: Language Models are Few-Shot Learners, in Advances in Neural Information Processing Systems, Vol. 33, pp. 1877-1901 (2020), [online], [Retrieved April 12, 2025], Internet<URL:https: / / arxiv.org / abs / 2005.14165> [Non-patent document 3] Zhang, T., et al. (2024). In-Context Principle Learning from Mistakes. In Proceedings of the 41st International Conference on Machine Learning (Vol. 235, pp. 59520-59558), [online], [Retrieved April 12, 2025], Internet<URL:https: / / arxiv.org / abs / 2402.05403> Summary of the Invention [Problem to be solved by the invention]
[0007] According to Non-Patent Document 1, for example, sufficient accuracy may not be achieved for questions that involve logical or mathematical reasoning of several steps or more (such as mathematics tests or advanced reasoning questions). Furthermore, according to Non-Patent Document 2, selecting and adjusting input / output examples for Few-Shot requires specialized knowledge and experience related to the task. To optimize the descriptions of input / output examples for prompts, the operator must repeatedly conduct trial and error on the language model. Furthermore, according to Non-Patent Document 3, it is extremely difficult to instantly determine a "representative few-shot" for an actual task, and as with Non-Patent Document 2, every time the task itself changes, the operator must redesign appropriate examples. In many cases, it is not possible to ensure high-quality few-shots that are applicable to all tasks from the start.
[0008] Therefore, an object of the present invention is to provide a program, device, and method for inferring an answer from a question by taking into account the inference process of a language model. [Means for solving the problem]
[0009] According to the present invention, there is provided a program for causing a computer to infer an answer to a question using a language model, the program comprising: an inference principle database that stores embedding vectors based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with inference principle statements that lead from the teacher question to the correct answer; Regarding the inference stage, a preliminary inference means for inputting a target question for which a correct answer is unknown into a language model and acquiring a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a preliminary embedding vector generating means for generating a preliminary embedding vector based on a combination of a target question and a preliminary inference process statement; an inference principle sentence search means for searching an inference principle sentence having an embedding vector similar to the preliminary embedding vector using an inference principle database; a main inference means for inputting a target question and an inference principle sentence into a language model and obtaining an answer from the language model; The present invention is characterized by the fact that it makes a computer function by using the above-mentioned method.
[0010] According to another embodiment of the program of the present invention, The inference principle database stores, as an inference principle sentence that leads to a correct answer, an incorrect answer avoidance principle sentence that avoids an incorrect answer when the answer is incorrect, or a correct answer arrival principle sentence that arrives at the correct answer when the answer is correct. The inference principle sentence search means searches for an incorrect answer avoidance principle sentence or a correct answer attainment principle sentence using an inference principle database; The main inference means inputs the target question and the principle sentence for avoiding an incorrect answer or the principle sentence for reaching a correct answer into a language model, and obtains an answer from the language model. It is also preferable to make the computer function in this way.
[0011] According to another embodiment of the program of the present invention, The inference principle database stores, as inference principle sentences that lead to a correct answer, both an incorrect answer avoidance principle sentence that avoids an incorrect answer when the answer is incorrect, and a correct answer arrival principle sentence that arrives at the correct answer when the answer is correct; The inference principle sentence search means searches for both the incorrect answer avoidance principle sentence and the correct answer attainment principle sentence using the inference principle database; The main inference means inputs the target question, the principle sentence for avoiding an incorrect answer, and the principle sentence for reaching a correct answer into a language model, and obtains an answer from the language model. It is also preferable to make the computer function in this way.
[0012] According to another embodiment of the program of the present invention, Regarding the training stage: a teacher inference means for inputting a teacher question, the correct answer of which is already known, into a language model and acquiring an answer to the teacher question and a teacher inference process sentence leading from the teacher question to the answer; an embedding vector generating means for generating an embedding vector based on a combination of a teacher question and a teacher reasoning process statement; a principle sentence inference means for inputting a prompt to a language model to generate an inference principle sentence that leads to a correct answer from a teacher question, and acquiring the inference principle sentence; and make it work, The inference principle database stores inference principle statements using embedding vectors as keys. It is also preferable to make the computer function in this way.
[0013] According to another embodiment of the program of the present invention, answer determination means for determining whether an answer to a teacher question is correct or incorrect; and further enhance its functionality. The principle sentence inference means is When the answer to the teacher question is an incorrect answer, a prompt instructing the language model to generate an incorrect answer avoidance principle sentence for avoiding the incorrect answer is input together with the teacher question and the answer; If the answer to the teacher question is correct, a prompt is input to the language model together with the teacher question and the answer, instructing the language model to generate a correct answer arriving principle sentence for arriving at the correct answer. It is also preferable to make the computer function in this way.
[0014] According to another embodiment of the program of the present invention, The language model is inferred using Zero-Shot Chain of Thought (CoT). It is also preferable to make the computer function in this way.
[0015] According to the present invention, there is provided an inference device that infers an answer to a question using a language model, comprising: an inference principle database that stores embedding vectors based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with inference principle statements that lead from the teacher question to the correct answer; Regarding the inference stage, a preliminary inference means for inputting a target question for which a correct answer is unknown into a language model and acquiring a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a preliminary embedding vector generating means for generating a preliminary embedding vector based on a combination of a target question and a preliminary inference process statement; an inference principle sentence search means for searching an inference principle sentence having an embedding vector similar to the preliminary embedding vector using an inference principle database; a main inference means for inputting a target question and an inference principle sentence into a language model and obtaining an answer from the language model; The present invention is characterized by having the following.
[0016] According to the present invention, there is provided an inference method for an apparatus that infers an answer to a question using a language model, the method comprising the steps of: The device is an inference principle database that stores an embedding vector based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with an inference principle statement that leads from the teacher question to the correct answer; Regarding the inference stage, a first step of inputting a target question for which a correct answer is unknown into a language model and obtaining a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a second step of generating a preliminary embedding vector based on a combination of the target question and the preliminary inference process statement; a third step of searching for an inference principle sentence having an embedding vector similar to the preliminary embedding vector using an inference principle database; a fourth step of inputting the target question and the inference principle sentence into a language model and obtaining an answer from the language model; The present invention is characterized by carrying out the following. [Effects of the Invention]
[0017] According to the program, device and method of the present invention, an answer can be inferred from a question by taking into account the inference process of a language model. [Brief explanation of the drawings]
[0018] [Figure 1] FIG. 2 is a functional configuration diagram of the training stage in the inference device of the present invention. [Figure 2] 10 is an example of a first prompt of the teacher reasoning section in the reasoning device of the present invention. [Figure 3] 10 is an example of a second prompt of the teacher reasoning section in the reasoning device of the present invention. [Figure 4] 10 is an example of a first prompt of the principle sentence reasoning unit that acquires an incorrect answer avoidance principle sentence for an incorrect answer. [Figure 5] 10 is an example of a second prompt of the principle sentence inference unit that obtains a principle sentence for avoiding an incorrect answer for a correct answer. [Figure 6] This is a first example of obtaining an inference principle sentence from an inference principle database using one language model. [Figure 7] This is a second example of obtaining an inference principle statement from an inference principle database using multiple language models. [Figure 8] FIG. 2 is a functional configuration diagram of the inference stage in the inference device of the present invention. [Figure 9] 10 is an example of a prompt for a preliminary inference section in the inference device of the present invention. [Figure 10] FIG. 2 is an explanatory diagram of an inference principle statement search unit in the inference device of the present invention. [Figure 11] 10 is an example of a prompt of the main inference section in the inference device of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0019] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0020] The inference device of the present invention uses a language model (e.g., large language models) to infer answers to questions. In particular, by highly controlling the inference process (Chain of Thought) of the language model, it is possible to improve the accuracy of inferring answers even for questions based on new tasks.
[0021] The inference device of the present invention can automatically generate prompts appropriate for the purpose of the task and instruct the language model simply by inputting a target question. Even when a target question is asked by a user without specialized knowledge or experience, an appropriate prompt can be automatically generated, improving the inference accuracy of the language model. In other words, it is possible to adaptively correct inference results by utilizing only the inference results of existing language models, without the need for exploratory optimization as in conventional automatic prompt design methods, or presenting representative few-shot examples suitable for the task.
[0022] The inference device of the present invention comprises a training phase and an inference phase (test phase).
[0023] <Training Stage> FIG. 1 is a functional block diagram of the training stage in the inference device of the present invention.
[0024] The inference device 1 of the present invention uses the language model 2 to make inferences using Zero-Shot CoT for training questions (train data) with known correct answers, and then acquires an inference principle statement (Principle) corresponding to the answer. An inference principle statement expresses a "global principle for the inference process that leads to the correct answer."
[0025] The inference device 1 of the present invention has, for the training stage, an inference principle database 10, a teacher inference unit 111, a teacher embedding vector generation unit 112, an answer determination unit 113, and a principle sentence inference unit 114. These functional components are realized by executing a program that causes a computer installed in the device to function. The processing flow of these functional components can also be understood as a training method for the device.
[0026] In the training stage of the inference device 1, a plurality of training questions (train data) whose correct answers are known are prepared in advance as training data. It should be noted that the more in-depth the inference required for the task, the more effective the question to be posed to the inference device 1 of the present invention. In other words, even if the question is the same, it is preferable that the answer result will differ depending on the type of language model 2. The more complex the inference task, the more the inference device 1 of the present invention can improve the accuracy of the answer by using the self-correcting ability of the language model 2.
[0027] [Teacher reasoning section 111] The teacher inference unit 111 inputs a teacher question to the language model 2, and acquires an "answer" to the teacher question and a "teacher inference process sentence" from the teacher question to the answer using Zero-Shot CoT.
[0028] FIG. 2 shows an example of a first prompt from the teacher reasoning section in the reasoning device of the present invention.
[0029] According to FIG. 2, suppose that the following teacher question a, for which the correct answer "13.4 dollars" is known, is input to the language model 2. (Teacher question a)----------------------------------------------------------------- A customer with a calling plan... ... Think step by step. -------------------------------------------------------------------------------- At the end of the prompt, we write "Please think about it step by step," based on Zero-Shot CoT. This instructs the system to output a "teacher reasoning process sentence" that leads from the teacher question to the answer as a chain of thought.
[0030] In response to this, let us say that Language Model 2 infers the answer to teacher question a to be, for example, "20.16 dollars." It also outputs a teacher inference process statement from the teacher question to the answer. (Answer and teacher reasoning process)------------------------------------------------------ During a one-hour call to Country W... ... Maximum Savings = Discount = $20.16 -------------------------------------------------------------------------------- Here, the incorrect answer "20.16 dollars" is inferred for teacher question a.
[0031] FIG. 3 is an example of a second prompt from the teacher reasoning section in the reasoning device of the present invention.
[0032] According to FIG. 3, suppose that the following teacher question b, for which the correct answer "36%" is known, is input to the language model 2. (Teacher question b)----------------------------------------------------------------- At a fruit store... ... Think step by step. --------------------------------------------------------------------------------
[0033] In response to this, let us say that Language Model 2 infers the answer "36%" as the answer to Teacher Question B. It also outputs a teacher inference process statement from the teacher question to the answer. (Answer and teacher reasoning process)------------------------------------------------------ Let the price of mango B be B. ... =36% -------------------------------------------------------------------------------- Here, the correct answer to teacher question b is inferred to be "36%."
[0034] [Teacher embedding vector generation unit 112] The teacher embedding vector generation unit 112 generates an "embedding vector" based on a combination of a "teacher question" and a "teacher inference process statement." The teacher embedding vector generation unit 112 uses, for example, a Sentence Transformer as the text embedding vector. Sentence Transformer (Sentence-BERT) is a deep learning model for converting a sentence into a fixed-length vector representation (embedding vector) that captures its semantic content. It is particularly suited to quickly searching for documents that are semantically similar to a given query sentence among a large number of documents. The semantic similarity between documents can be calculated using the cosine similarity between the embedding vectors.
[0035] [Answer determination unit 113] The answer determination unit 113 determines whether the answer to the teacher question is a "correct answer" or an "incorrect answer." The answer determination unit 113 receives the answer inferred from the teacher inference unit 111 and compares it with the correct answer to the teacher question to make a determination.
[0036] In the example of Figure 2, for the correct answer "13.4 dollars," Language Model 2 inferred the incorrect answer "20.16 dollars." In this case, the teacher inference process sentence is understood as the "teacher inference process sentence from the teacher question to the incorrect answer." In the example of Figure 3, for the correct answer "36%", Language Model 2 also infers the correct answer "36%". In this case, the teacher inference process sentence is understood as "the teacher inference process sentence from the teacher question to the correct answer".
[0037] [Principle sentence reasoning section 114] The principle sentence inference unit 114 inputs a prompt to the language model 2 to instruct it to generate an "inference principle sentence that leads to a correct answer" for the teacher question. In this way, the inference principle sentence is acquired from the language model 2.
[0038] The principle sentence inference unit 114 inputs the following prompt to the language model 2: (1) When the answer to the teacher question is "wrong answer," an instruction is given to generate "avoidance principle sentence for avoiding wrong answer" together with the teacher question and the answer. (2) If the answer to the teacher question is "correct answer," an instruction is given to generate a "correct answer arriving principle sentence that arrives at the correct answer" together with the teacher question and the answer.
[0039] FIG. 4 shows an example of a first prompt of the principle sentence reasoning unit that acquires a principle sentence for avoiding an incorrect answer for an incorrect answer.
[0040] According to Fig. 4, the answer to the previous teacher question a in Fig. 2 is clearly indicated as an "incorrect answer," and a prompt instructing the language model 2 to infer a "principle sentence for avoiding an incorrect answer (principle sentence for avoiding an incorrect answer)" is sent to the language model 2. It is also preferable that the prompt clearly indicates the known "correct answer" to the previous teacher question. (prompt)------------------------------------------------------------------ The answer to the previous question was "wrong." The correct answer is $13.40. Infer general principles for avoiding incorrect answers (principles for avoiding incorrect answers) that can be applied to similar questions. --------------------------------------------------------------------------------
[0041] In response to this, Language Model 2 recognizes that the answer to Teacher Question A is incorrect and infers a "principle sentence for avoiding incorrect answers." This allows the model to infer principles from a global perspective, such as "what kind of thinking pitfalls should be avoided?" (Principles for avoiding incorrect answers)-------------------------------------------------------------- Before you draw any conclusions... ... You can reduce the possibility. --------------------------------------------------------------------------------
[0042] FIG. 5 shows an example of a second prompt of the principle sentence inference unit that obtains a principle sentence for avoiding an incorrect answer for a correct answer.
[0043] According to Figure 5, the answer to the previous teacher question b in Figure 3 is clearly indicated as the "correct answer," and a prompt is sent to the language model 2 instructing it to infer the "principle sentence that led to the correct answer (principle sentence that led to the correct answer)." (prompt)------------------------------------------------------------------ The answer to the previous question was "correct." Infer a general principle statement (principle statement for arriving at the correct answer) that can be applied to similar questions. --------------------------------------------------------------------------------
[0044] In response to this, Language Model 2 recognizes that the answer to Teacher Question B is the correct answer and infers the "principle sentence for arriving at the correct answer." This allows the model to infer principles from a global perspective, such as "what line of thinking was the key to success." (Principle of reaching the correct answer)-------------------------------------------------------------- To achieve the desired results... ... You can arrive at a solution efficiently. --------------------------------------------------------------------------------
[0045] [Inference Principles Database 10] The inference principle database 10 stores the "embedded vector" generated by the teacher embedding vector generation unit 112 and the "inference principle statement" acquired by the principle statement inference unit 114 in association with each other. The embedding vector is based on a combination of a teacher question and an inference process statement leading from the teacher question to the answer. This embedding vector is used as a key for similarity searches. The inference principle sentence is a principle sentence for avoiding an incorrect answer or a principle sentence for arriving at a correct answer.
[0046] Here, as a first embodiment, it is preferable that the inference principle database 10 stores "both the incorrect answer avoidance principle sentence and the correct answer arrival principle sentence" in association with the embedding vector. Furthermore, as a second embodiment, the inference principle database 10 may store "only the incorrect answer avoidance principle sentences" in association with the embedding vectors. Furthermore, as a third embodiment, the inference principle database 10 may store "only correct answer attainment principle sentences" in association with the embedded vectors.
[0047] FIG. 6 shows a first example of using one language model to obtain an inference principle statement from the inference principle database.
[0048] According to FIG. 6, the answer determination unit 113 determines whether the answer from the language model 2 to the teacher question is correct or incorrect. In addition, the principle sentence inference unit 114 inputs a prompt to the language model to instruct it to generate an inference principle sentence that leads from the teacher question to the correct answer, and obtains a principle sentence for avoiding an incorrect answer corresponding to an incorrect answer, or a principle sentence for reaching the correct answer corresponding to the correct answer. As a result, the inference principle database 10 stores the answers in the following categories according to whether they are correct or incorrect: Wrong answer -> Embedding vector <-> Wrong answer avoidance principle Correct answer -> Embedding vector <-> Correct answer attainment principle
[0049] Specifically, if there are 50 teacher questions, and for example, 47 are correct answers and 3 are incorrect answers, the inference principle database 10 will store 47 correct answer attainment principle sentences and 3 incorrect answer avoidance principle sentences. In other words, there may be a bias in the number of inference principle sentences for both.
[0050] FIG. 7 shows a second example of using multiple language models to obtain an inference principle statement for the inference principle database. 7, the same teacher question is sent to multiple language models 21 to 23, and they are inferred using Zero-Shot CoT to obtain multiple answers and inference principle statements. Depending on the type of language model 2, the same teacher question may be answered correctly or incorrectly. As a result, even for the same question, the inference principle database 10 stores the incorrect answer avoidance principle sentence and the correct answer attainment principle sentence separately depending on whether the answer is correct or incorrect.
[0051] <Inference stage> The inference device dynamically applies the "inference principle sentences" from the training phase to unknown target questions (test data), causing language model 2 to infer answers using Zero-Shot CoT.
[0052] FIG. 8 is a functional configuration diagram of the inference stage in the inference device of the present invention.
[0053] 8, the inference device 1 in the inference stage has, in addition to the inference principle database 10, a preliminary inference unit 121, a preliminary embedding vector generation unit 122, an inference principle statement search unit 123, and a main inference unit 124. These functional components are realized by executing a program that causes a computer installed in the device to function. The processing flow of these functional components can also be understood as an inference method of the device.
[0054] [Preliminary reasoning section 121] The preliminary inference unit 121 inputs a "target question" (test data) for which the correct answer is unknown into the language model 2, and uses Zero-Shot CoT to obtain a "preliminary answer" to the target question and a "preliminary inference process sentence" that leads to the preliminary answer.
[0055] FIG. 9 shows an example of a prompt for the preliminary inference section in the inference device of the present invention.
[0056] According to FIG. 9, the following target question, the answer of which is unknown, is input to the language model 2. (Target Question)-------------------------------------------------------------------- Two friends eating a jar full of candy. ... If two people are eating at the same time, how many minutes will it take to empty the jar? Think step by step. -------------------------------------------------------------------------------- At the end of the prompt, it says, "Think about it step by step." This instructs the system to output a "preliminary reasoning process sentence" that leads from the target question to the answer as a chain of thought.
[0057] In response to this, let us say that Language Model 2 infers the answer to the target question as "3.33 minutes." It also outputs a preliminary inference process statement leading from the target question to the answer. (Answer and preliminary reasoning sentence)------------------------------------------------------ P's eating rate is 1 jar / 10 min = 0.1 [jars / min]. Q's eating rate is 1 jar / 5 minutes = 0.2 [jars / minute]. Answer: 3.33 minutes. --------------------------------------------------------------------------------
[0058] [Preliminary embedding vector generation unit 122] The preliminary embedding vector generating unit 122 generates a "preliminary embedding vector" based on a combination of a "target question" and a "preliminary inference process statement." The preliminary embedding vector generation unit 122, like the teacher embedding vector generation unit 112 described above, uses, for example, a Sentence Transformer to generate text embedding vectors. The preliminary embedding vector is output to the inference principle sentence search unit 123 .
[0059] [Inference principle sentence search part 123] The inference principle statement search unit 123 searches for an inference principle statement having an embedding vector similar to the preliminary embedding vector using the inference principle database 10. The inference principle database 10 is searched for an embedding vector having the highest cosine similarity with the preliminary embedding vector, and the inference principle statement is obtained. The acquired inference principle statement is output to the main inference unit 124.
[0060] At this time, it is possible to search not only for the embedding vector that is most similar to the preliminary embedding vector, but also for a predetermined number (for example, 2) of embedding vectors with high similarity. In this case, a predetermined number of inference principle sentences (principles for avoiding incorrect answers and / or principles for arriving at correct answers) will be searched.
[0061] FIG. 10 is an explanatory diagram of the inference principle statement search unit in the inference device of the present invention.
[0062] According to FIG. 10, the inference principle database 10 stores the following incorrect answer avoidance principle sentences and correct answer attainment principle sentences, which serve as inference principle sentences, using the embedding vector as a key. (Principles for avoiding incorrect answers)-> · Break the problem down into manageable parts, calculate individual speeds, and consider the cumulative effect of changing conditions. · Be careful of omissions in variable settings and calculation processes. (Principle of reaching the correct answer)-> ·Clearly define variables and validate each step against given conditions. · Break down the problem step by step. · Organize typical theorems and formulas.
[0063] Here, the inference principle statement search unit 123 searches for an inference principle statement having an embedding vector similar to the preliminary embedding vector. At this time, the inference principle statement is acquired in one of the following three embodiments. (1) Obtain only the principle sentences for avoiding incorrect answers (Ours PF (Principles from Failures)) (2) Obtain only the correct answer achievement principle sentence (Ours PS (Principles from Successes)) (3) Obtain both the principles for avoiding incorrect answers and the principles for reaching the correct answer (Ours PFS (Principles from Failures and Successes))
[0064] [Main inference part 124] The main inference unit 124 inputs the “target question” and the “inference principle sentence” retrieved by the inference principle sentence retrieval unit 123 into the language model 2, and obtains an answer from the language model 2. The main inference unit 124 reinforces the answer from the preliminary inference for the target question by a main inference (second inference) based on the inference query statement so as to lead to a correct answer, thereby improving the inference accuracy.
[0065] FIG. 11 shows an example of a prompt of the main inference section in the inference device of the present invention.
[0066] According to FIG. 11, the following prompt is input to Language Model 2: (prompt)------------------------------------------------------------------ Target Question-> Two friends eating a jar full of candy. ... Think step by step. Previous inference result-> P's eating rate is 1 jar / 10 min = 0.1 [jars / min]. ... Answer: 3.33 minutes. Principles for arriving at the correct answer (Principles for arriving at the correct answer) Define your variables clearly and validate each step against the given conditions. Principles for avoiding incorrect answers (Principles for avoiding incorrect answers) Break the problem into manageable parts, calculate the individual speeds, and calculate the cumulative speed of changing conditions. Consider the impact. Apply the Avoid Errors Principle Statement to identify and correct errors in reasoning. Next, apply the correct answer attainment principle to further refine your reasoning. Think step by step. -------------------------------------------------------------------------------
[0067] 11, the "target question," the "previous inference result," the "principle sentence for avoiding an incorrect answer," and the "principle sentence for arriving at a correct answer" are input to the language model 2. In this case, the "previous inference result" may be optional, and can be further input to the language model 2 to lead to the correction of an error.
[0068] The main inference unit 124 may input either the “principle sentence for avoiding an incorrect answer” or the “principle sentence for arriving at a correct answer” together with the target question to the language model 2, and obtain an answer from the language model 2. Furthermore, the main inference unit 124 may input both the "principle sentence for avoiding an incorrect answer and the principle sentence for arriving at a correct answer" together with the target question to the language model 2, and acquire the answer from the language model 2. By inputting both, the inference principle sentence that leads to the correct answer can be indicated from the perspective of both the incorrect answer and the correct answer, thereby improving the accuracy of the answer.
[0069] As described above in detail, the program, device and method of the present invention make it possible to infer an answer from a question by taking into account the inference process statements of a language model.
[0070] According to the present invention, regardless of the purpose of the task, a zero-shot based preliminary inference is performed once and inference principles (principles for avoiding incorrect answers and / or principles for arriving at correct answers) from past Chain of Thoughts are dynamically applied. This makes the self-correcting ability of the language model available, and eliminates the need for task-dependent few-shot design. The present invention also provides a new in-context learning (ICL) technology that can improve the accuracy of answers, particularly in tasks that require highly difficult mathematical or logical reasoning. Furthermore, since the present invention has the function of correcting errors in the inference process, it is also effective for the behavioral trajectory of an AI agent that outputs many inference processes.
[0071] Furthermore, this will enable, for example, "to improve the accuracy of answers in tasks that require particularly difficult mathematical and logical reasoning," which will contribute to Goal 9 of the United Nations-led Sustainable Development Goals (SDGs), which is to "build resilient infrastructure, promote sustainable industrialization and foster innovation."
[0072] With respect to the various embodiments of the present invention described above, various changes, modifications, and omissions that fall within the scope of the technical spirit and aspects of the present invention may be easily made by those skilled in the art. The above description is merely illustrative and is not intended to be limiting in any way. The present invention is limited only by the claims and their equivalents. [Explanation of symbols]
[0073] 1 Reasoning device 10. Inference Principles Database 111 Teacher Reasoning Department 112 Teacher embedding vector generation unit 113 Answer Judgment Department 114 Principle Sentence Reasoning Division 121 Preliminary Reasoning Section 122 Preliminary embedding vector generation unit 123 Inference Principle Sentence Search Unit 124 Main inference part 2. Language Model
Claims
1. A program that causes a computer to infer answers to questions using a language model, an inference principle database that stores embedding vectors based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with inference principle statements that lead from the teacher question to the correct answer; Regarding the inference stage, a preliminary inference means for inputting a target question for which a correct answer is unknown into a language model and acquiring a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a preliminary embedding vector generating means for generating a preliminary embedding vector based on a combination of a target question and a preliminary inference process statement; an inference principle sentence search means for searching an inference principle sentence having an embedding vector similar to the preliminary embedding vector using an inference principle database; a main inference means for inputting a target question and an inference principle sentence into a language model and obtaining an answer from the language model; A program that causes a computer to function.
2. The inference principle database stores, as an inference principle sentence that leads to a correct answer, an incorrect answer avoidance principle sentence that avoids an incorrect answer when the answer is incorrect, or a correct answer arrival principle sentence that arrives at the correct answer when the answer is correct. The inference principle sentence search means searches for an incorrect answer avoidance principle sentence or a correct answer attainment principle sentence using an inference principle database; The main inference means inputs the target question and the principle sentence for avoiding an incorrect answer or the principle sentence for reaching a correct answer into a language model, and obtains an answer from the language model.
2. The program according to claim 1, which causes a computer to function as follows:
3. The inference principle database stores, as inference principle sentences that lead to a correct answer, both an incorrect answer avoidance principle sentence that avoids an incorrect answer when the answer is incorrect, and a correct answer arrival principle sentence that arrives at the correct answer when the answer is correct; The inference principle sentence search means searches for both the incorrect answer avoidance principle sentence and the correct answer attainment principle sentence using the inference principle database; The main inference means inputs the target question, the principle sentence for avoiding an incorrect answer, and the principle sentence for reaching a correct answer into a language model, and obtains an answer from the language model.
2. The program according to claim 1, which causes a computer to function as follows:
4. Regarding the training stage: a teacher inference means for inputting a teacher question, the correct answer of which is already known, into a language model and acquiring an answer to the teacher question and a teacher inference process sentence leading from the teacher question to the answer; an embedding vector generating means for generating an embedding vector based on a combination of a teacher question and a teacher reasoning process statement; a principle sentence inference means for inputting a prompt to a language model to generate an inference principle sentence that leads to a correct answer from a teacher question, and acquiring the inference principle sentence; and make it work, The inference principle database stores inference principle statements using embedding vectors as keys.
2. The program according to claim 1, which causes a computer to function as follows:
5. answer determination means for determining whether an answer to a teacher question is correct or incorrect; and further enhance its functionality. The principle sentence inference means is When the answer to the teacher question is an incorrect answer, a prompt instructing the language model to generate an incorrect answer avoidance principle sentence for avoiding the incorrect answer is input together with the teacher question and the answer; If the answer to the teacher question is correct, a prompt is input to the language model together with the teacher question and the answer, instructing the language model to generate a correct answer arriving rule sentence.
5. The program according to claim 4, which causes a computer to function as follows.
6. The language model is inferred using Zero-Shot Chain of Thought (CoT).
2. The program according to claim 1, which causes a computer to function as follows:
7. An inference device that infers an answer to a question using a language model, an inference principle database that stores embedding vectors based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with inference principle statements that lead from the teacher question to the correct answer; Regarding the inference stage, a preliminary inference means for inputting a target question for which a correct answer is unknown into a language model and acquiring a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a preliminary embedding vector generating means for generating a preliminary embedding vector based on a combination of a target question and a preliminary inference process statement; an inference principle sentence search means for searching an inference principle sentence having an embedding vector similar to the preliminary embedding vector using an inference principle database; a main inference means for inputting a target question and an inference principle sentence into a language model and obtaining an answer from the language model; An inference device comprising:
8. An inference method for a device that infers an answer to a question using a language model, comprising: The device is an inference principle database that stores an embedding vector based on a combination of a teacher question for which a correct answer is known and an inference process statement from the teacher question to the answer, in association with an inference principle statement that leads from the teacher question to the correct answer; Regarding the inference stage, a first step of inputting a target question for which a correct answer is unknown into a language model and obtaining a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; a second step of generating a preliminary embedding vector based on a combination of the target question and the preliminary reasoning process statement; a third step of searching an inference principle database for an inference principle sentence having an embedding vector similar to the preliminary embedding vector; a fourth step of inputting the target question and the inference principle sentence into a language model and obtaining an answer from the language model; An inference method for an apparatus, comprising:
Citation Information
Patent Citations
LLM model reasoning method based on medical rule base and related equipment
CN119443262A
Information processing device, information processing method, and computer program
JP2025044032A
Natural language generation device, natural language generation method, and program
JP7644944B1
JPP7644944B