A program, apparatus, and method for inferring answers from questions while considering the inference process of a language model.
The program and apparatus improve answer inference accuracy in language models by using an inference principle database to generate prompts and apply inference principles, addressing the challenges of complex reasoning tasks and reducing the need for specialized knowledge in prompt optimization.
Patent Information
- Application Number
- JP2025069258
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2026-11-02
- Estimated Expiration
- 2045-04-21
AI Technical Summary
Existing technologies for inferring answers using language models face challenges in achieving sufficient accuracy for complex logical or mathematical reasoning tasks, require specialized knowledge for prompt optimization, and struggle with defining representative few-shot examples that are not task-specific.
A program and apparatus that utilizes an inference principle database to store embedded vectors and inference principle sentences, enabling the generation of appropriate prompts and improving inference accuracy by dynamically applying inference principles from the training phase to unknown questions, leveraging the language model's self-correction ability.
Enhances the accuracy of answer inference for new tasks by automatically generating task-specific prompts and correcting errors, particularly in complex reasoning tasks, without the need for exploratory optimization or task-dependent few-shot design.
Smart Images

Figure 2026174798000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a technology for inferring answers from questions using language models (for example, Large Language Models).
Background Art
[0002] Conventionally, to execute a new task using a language model, it has been necessary to input a large amount of labeled training data and perform fine-tuning (additional learning). In contrast, there is In-context Learning that provides appropriate instructions and examples related to a task to the language model. This makes it possible to improve task execution capability without retraining the parameters inside the language model.
[0003] Typically, there is the technology of Zero-Shot Chain of Thought Prompting (see, for example, Non-Patent Document 1). According to this technology, only a general-purpose prompt such as "Let's think step by step." is presented. With this alone, step-by-step reasoning can be promoted by leveraging the internal knowledge of the language model.
[0004] There is also the technology of Few-Shot Prompting / Few-Shot CoT (see, for example, Non-Patent Document 2). According to this technology, explicit input-output examples (Few-Shot) suitable for the task are included in the prompt to instruct the language model. This allows the language model to perform reasoning while referring to those input-output examples. At this time, by explicitly presenting the thought process for each input-output example, step-by-step reasoning results can be obtained.
[0005] Furthermore, there are techniques for extracting inference principles from language models (see, for example, Non-Patent Document 3). According to this technique, after providing "representative few-shot examples" obtained in advance for each task, incorrect answers are deliberately generated, and "principles" for improving 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 its 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> [Overview of the project] [Problems that the invention aims to solve]
[0007] According to Non-Patent Literature 1, for example, it may not be able to achieve sufficient accuracy for problems involving logical or mathematical reasoning of several steps or more (such as mathematical tests or advanced reasoning problems). Furthermore, according to Non-Patent Literature 2, selecting and adjusting Few-Shot input / output examples requires specialized knowledge and experience related to the task. Operators themselves will have to repeatedly experiment with the language model to optimize the description of prompt input / output examples. Furthermore, according to Non-Patent Document 3, it is extremely difficult to immediately define "representative few shots" for actual tasks, and, as with Non-Patent Document 2, operators themselves need to redesign appropriate examples each time the task itself changes. In many cases, it is not possible to secure high-quality few shots applicable to all tasks from the outset.
[0008] Therefore, the present invention aims to provide a program, apparatus, and method for inferring answers from questions while taking into account the inference process of a language model. [Means for solving the problem]
[0009] According to the present invention, a program that causes a computer to function in order to infer an answer to a question using a language model, An inference principle database that stores embedded vectors based on combinations of known correct answers for teacher questions and inference process sentences leading from those teacher questions to the answers, and inference principle sentences that lead from those teacher questions to the correct answers, Regarding the inference stage, A preliminary inference means inputs a target question with an unknown correct answer into a language model and obtains a preliminary answer to the target question and a preliminary inference process sentence leading to that preliminary answer, A preliminary embedding vector generation means that generates a preliminary embedding vector based on a combination of the target question and preliminary reasoning process sentences, An inference principle search means that searches for inference principle sentences having embedding vectors similar to preliminary embedding vectors using an inference principle database, The main inference means inputs the target question and the inference principle sentence into a language model and obtains the answer from the language model. It is characterized by enabling the computer to function in this way.
[0010] According to other embodiments of the program of the present invention, The inference principle database stores inference principle statements that lead to the correct answer, such as error avoidance principle statements that prevent incorrect answers when the answer is incorrect, or correct answer arrival principle statements that lead to the correct answer when the answer is correct. The inference principle sentence search means uses an inference principle database to search for sentences that avoid incorrect answers or sentences that lead to the correct answer. The main inference mechanism inputs the target question and either a principle sentence for avoiding incorrect answers or a principle sentence for reaching the correct answer into a language model, and retrieves the answer from the language model. It is also preferable to make the computer function in this way.
[0011] According to other embodiments of the program of the present invention, The inference principle database stores both error avoidance principle statements that prevent incorrect answers when the answer is wrong, and correct answer arrival principle statements that lead to the correct answer when the answer is correct, as inference principle statements that lead to the correct answer. The inference principle sentence search means uses an inference principle database to search for both incorrect answer avoidance principle sentences and correct answer arrival principle sentences. The main reasoning means inputs the target question, the wrong answer avoidance principle statement, and the correct answer arrival principle statement into the language model, and obtains a response from the language model It is also preferable to cause a computer to function as described above.
[0012] According to another embodiment of the program of the present invention, Regarding the training phase, a teacher reasoning means that inputs a teacher question with a known correct answer into the language model, and obtains a response to the teacher question and a teacher reasoning process statement leading from the teacher question to the response; an embedding vector generation means that generates an embedding vector based on the combination of the teacher question and the teacher reasoning process statement; a principle statement reasoning means that inputs a prompt instructing to generate a reasoning principle statement that leads from the teacher question to the correct answer into the language model, and obtains the reasoning principle statement; are caused to function, and the reasoning principle database stores the reasoning principle statement with the embedding vector as a key It is also preferable to cause a computer to function as described above.
[0013] According to another embodiment of the program of the present invention, a response determination means for determining whether the response to the teacher question is a correct answer or a wrong answer is caused to further function, the principle statement reasoning means: when the response from the teacher question is a wrong answer, inputs a prompt instructing to generate a wrong answer avoidance principle statement for avoiding the wrong answer, together with the teacher question and the response, into the language model; when the response from the teacher question is a correct answer, inputs a prompt instructing to generate a correct answer arrival principle statement for arriving at the correct answer, together with the teacher question and the response, into the language model It is also preferable to cause a computer to function as described above.
[0014] According to another embodiment of the program of the present invention, the language model performs reasoning by Zero-Shot CoT (Chain of Thought) It is also preferable to cause a computer to function as described above.
[0015] According to the present invention, there is provided an inference apparatus for inferring an answer to a question using a language model, comprising: an inference rule database that stores an embedding vector based on a combination of a training question with a known correct answer and an inference process sentence leading from the training question to an answer, in association with an inference rule sentence that leads from the training question to the correct answer; for an inference stage: preliminary inference means for inputting a target question with an unknown correct answer into the language model, and obtaining a preliminary answer to the target question and a preliminary inference process sentence leading to the preliminary answer; preliminary embedding vector generation means for generating a preliminary embedding vector based on a combination of the target question and the preliminary inference process sentence; inference rule sentence search means for searching, using the inference rule database, for an inference rule sentence having an embedding vector similar to the preliminary embedding vector; main inference means for inputting the target question and the inference rule sentence into the language model, and obtaining an answer from the language model; and the inference apparatus is characterized by comprising the above elements.
[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 apparatus: comprises an inference rule database that stores an embedding vector based on a combination of a training question with a known correct answer and an inference process sentence leading from the training question to an answer, in association with an inference rule sentence that leads from the training question to the correct answer; for an inference stage: a first step of inputting a target question with an unknown correct answer into the 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 sentence; a third step of searching, using the inference rule database, for an inference rule sentence having an embedding vector similar to the preliminary embedding vector; The fourth step involves inputting the target question and the inference principle sentence into a language model and obtaining the answer from that language model. It is characterized by performing the following. [Effects of the Invention]
[0017] According to the program, apparatus, and method of the present invention, it is possible to infer an answer from a question by taking into account the inference process of a language model. [Brief explanation of the drawing]
[0018] [Figure 1] This is a functional configuration diagram of the training phase in the inference device of the present invention. [Figure 2] This is an example of the first prompt of the teacher inference unit in the inference device of the present invention. [Figure 3] This is an example of a second prompt in the teacher inference unit of the inference device of the present invention. [Figure 4] This is an example of the first prompt of the principle statement inference unit, which retrieves a principle statement to avoid incorrect answers in response to an incorrect answer. [Figure 5] This is an example of the second prompt in the principle statement inference unit, which retrieves a principle statement to avoid incorrect answers for the correct answer. [Figure 6] This is the first example of using a single language model to retrieve inference principle statements from an inference principle database. [Figure 7] This is a second example of using multiple language models to retrieve inference principle statements from an inference principle database. [Figure 8] This is a functional configuration diagram of the inference stage in the inference device of the present invention. [Figure 9] This is an example of a prompt in the preliminary inference unit of the inference device of the present invention. [Figure 10] This is an explanatory diagram of the inference principle text retrieval unit in the inference device of the present invention. [Figure 11] This is an example of a prompt in the main inference unit of the inference device of the present invention. [Modes for carrying out the invention]
[0019] Embodiments of the present invention will be described in detail below with reference to the drawings.
[0020] The inference device in this invention uses a language model (e.g., a large language model) to infer answers to questions. In particular, by highly controlling the inference process (Chain of Thought) of the language model, the accuracy of answer inference can be improved even for questions based on new tasks.
[0021] The inference device of the present invention can automatically generate prompts appropriate to the purpose of the task and instruct the language model simply by inputting a target question. Even if the target question comes from a user without specialized knowledge or experience, it can automatically generate appropriate prompts and improve the inference accuracy of the language model. In other words, it is possible to adaptively correct the inference results by utilizing only the inference results of existing language models, without exploratory optimization like conventional prompt automatic design methods or by presenting representative few-shot examples suitable for the task.
[0022] The inference device of the present invention consists of a training phase and an inference phase (test phase).
[0023] <Training Stage> Figure 1 is a functional configuration diagram of the training phase in the inference device of the present invention.
[0024] The inference device 1 of the present invention, in response to a training question (Train data) with known correct answers, has the language model 2 perform inference using Zero-Shot CoT, and then obtains an inference principle sentence (Principle) corresponding to the answer. An inference principle sentence expresses "a broad principle for the inference process that leads the answer to the correct answer."
[0025] The inference device 1 of the present invention includes, for the training phase, 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 makes the computer installed in the device function. Furthermore, the processing flow of these functional components can also be understood as a training method for the device.
[0026] During the training phase of inference device 1, it is assumed that several training questions (training data) with known correct answers are prepared in advance as training data. Furthermore, the effectiveness of the inference device 1 of the present invention is higher for tasks requiring deeper inference. That is, it is preferable that even with the same question, the answer result differs depending on the type of language model 2. The inference device 1 of the present invention can improve the accuracy of the answer by using the self-correction ability of the language model 2, especially for complex inference tasks.
[0027] [Teacher reasoning section 111] The teacher inference unit 111 inputs the teacher question to the language model 2 and obtains the "answer" to the teacher question and the "teacher inference process sentence" that leads from the teacher question to the answer using Zero-Shot CoT.
[0028] Figure 2 shows an example of the first prompt of the teacher inference unit in the inference device of the present invention.
[0029] As shown in Figure 2, suppose the following teacher question a, in which the correct answer "$13.4" is known, is input to language model 2. (Teacher question a)----------------------------------------------------------------- Customers using a certain calling plan... ····· Please consider each step individually. -------------------------------------------------------------------------------- At the end of the prompt, it says "Think step by step" based on Zero-Shot CoT. This instructs the system to output a "teacher reasoning process statement" that shows the chain of thought from the teacher's question to the answer.
[0030] In contrast, let's say language model 2 inferred the answer to teacher question a, for example, "$20.16". It also outputs the teacher inference process sentence from the teacher question to the answer. (Answer and teacher reasoning process)------------------------------------------------------ During a one-hour phone call with country W, ... ····· Maximum savings = discount = $20.16 -------------------------------------------------------------------------------- Here, the incorrect answer "$20.16" is inferred in response to teacher question a.
[0031] Figure 3 shows an example of a second prompt in the teacher inference unit of the inference device of the present invention.
[0032] As shown in Figure 3, suppose the following teacher question b, in which the correct answer "36%" is known, is input to language model 2. (Teacher question b)----------------------------------------------------------------- At a certain fruit shop, ... ····· Please consider each step individually. --------------------------------------------------------------------------------
[0033] In contrast, language model 2 inferred, for example, the answer "36%" to teacher question b. It also outputs the teacher inference process sentence from the teacher question to the answer. (Answer and teacher reasoning process)------------------------------------------------------ Let's denote the price of mango B as B. ····· =36% -------------------------------------------------------------------------------- Here, the correct answer "36%" is inferred for teacher question b.
[0034] [Teacher Embedding Vector Generation Unit 112] The teacher embedding vector generation unit 112 generates an "embedding vector" based on a combination of "teacher questions" and "teacher inference process sentences". The teacher embedding vector generation unit 112 uses, for example, 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 meaning. It is particularly suitable for quickly searching for documents that are semantically similar to a given query sentence within a large amount 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's question is "correct" or "incorrect". The answer determination unit 113 receives the answer inferred from the teacher reasoning unit 111, compares it with the correct answer to the teacher's question, and makes a determination.
[0036] In the example in Figure 2, while the correct answer is "$13.4", language model 2 inferred the incorrect answer "$20.16". In this case, the teacher's reasoning process sentence is understood as "the teacher's reasoning process sentence from the teacher's question to the incorrect answer". In the example shown in Figure 3, language model 2 also inferred the correct answer "36%" for the given correct answer "36%". In this case, the teacher inference process sentence is understood as "the teacher inference process sentence from the teacher's question to the correct answer".
[0037] [Principle sentence reasoning part 114] The principle sentence inference unit 114 inputs a prompt to the language model 2 instructing it to generate an "inference principle sentence that leads the answer to the correct answer" in response to the teacher's question. This allows the language model 2 to retrieve the inference principle sentence.
[0038] The principle sentence inference unit 114 inputs the following prompt to the language model 2. (1) If the answer to a teacher's question is incorrect, the system is instructed to generate a "principle statement for avoiding incorrect answers" along with the teacher's question and the answer. (2) When the answer to the teacher's question is the "correct answer", the system is instructed to generate the "principle statement for arriving at the correct answer" along with the teacher's question and the answer.
[0039] Figure 4 shows an example of the first prompt of the principle sentence inference unit, which retrieves a principle sentence to avoid incorrect answers in response to an incorrect answer.
[0040] As shown in Figure 4, a prompt is sent to language model 2 that clearly indicates that the answer to teacher question a in Figure 2 is an "incorrect answer," and instructs it to infer a "principle sentence for avoiding incorrect answers (principle sentence for avoiding incorrect answers)." It is also preferable to clearly indicate the known "correct answer" to the previous teacher question in the prompt. (prompt)------------------------------------------------------------------ The answer to the previous question was "incorrect." The correct answer is $13.40. Infer a general principle (a principle for avoiding incorrect answers) that can be applied to similar questions and helps avoid giving wrong answers. --------------------------------------------------------------------------------
[0041] In response to teacher question a, language model 2 recognizes that the answer is incorrect and infers a "principle sentence for avoiding incorrect answers." This infers a principle from a broad perspective, for example, regarding "what kind of thinking pitfalls should be avoided." (Principles for avoiding incorrect answers)-------------------------------------------------------------- Before drawing a conclusion... ····· This can reduce the possibility. --------------------------------------------------------------------------------
[0042] Figure 5 shows an example of the second prompt of the principle sentence inference unit, which retrieves the principle sentence for avoiding incorrect answers in response to the correct answer.
[0043] As shown in Figure 5, the response to teacher question b in Figure 3 is clearly identified as the "correct answer," and a prompt is sent to language model 2 instructing it to infer the "principle sentence that led to the correct answer (principle sentence for arriving at the correct answer)." (prompt)------------------------------------------------------------------ The answer to the previous question was "correct." Infer a general principle (principle for arriving at the correct answer) that can be applied to similar questions. --------------------------------------------------------------------------------
[0044] In response, 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 it to infer principles from a broad perspective, such as "what thought process was key to success." (Principles for arriving at the correct answer)-------------------------------------------------------------- In order to achieve the desired result, ····· This allows us to reach a solution efficiently. --------------------------------------------------------------------------------
[0045] [Inference Principles Database 10] The inference principle database 10 stores the "embedded vectors" generated by the teacher embedding vector generation unit 112 and the "inference principle sentences" obtained by the principle sentence inference unit 114 in association with each other. The embedded vector is based on a combination of a teacher question and the reasoning process sentences that lead from that teacher question to the answer. This embedded vector is used as a key for similarity searches. A reasoning principle statement is either a principle statement for avoiding incorrect answers or a principle statement for arriving at the correct answer.
[0046] In this first embodiment, it is preferable that the reasoning principle database 10 stores both "principles for avoiding incorrect answers and principles for reaching correct answers" in association with the embedded vectors. Furthermore, in a second embodiment, the inference principle database 10 may store only "error avoidance principle sentences" linked to the embedded vectors. Furthermore, in a third embodiment, the inference principle database 10 may store only the "principle statements for arriving at the correct answer" in association with the embedded vectors.
[0047] Figure 6 shows the first example of retrieving inference principle statements from an inference principle database using a single language model.
[0048] According to Figure 6, the response determination unit 113 determines whether the response from the language model 2 to the teacher's question is correct or incorrect. Furthermore, the principle sentence inference unit 114 inputs a prompt to the language model instructing it to generate an inference principle sentence that leads to the correct answer from the teacher's question, and obtains a principle sentence to avoid incorrect answers according to the incorrect answer, or a principle sentence to reach the correct answer according to the correct answer. As a result, the inference principle database 10 stores the answers in the following categories, depending on whether they are correct or incorrect. Incorrect answer -> Embedded vector <-> Principle for avoiding incorrect answers Correct answer -> Embedded vector <-> Principle for arriving at the correct answer
[0049] For example, if there are 50 teacher questions, and 47 of them result in correct answers and 3 incorrect answers, the inference principle database 10 will store 47 correct answer-reach principle statements and 3 incorrect answer-avoidance principle statements. In other words, there may be a bias in the number of each type of inference principle statement.
[0050] Figure 7 shows a second example of retrieving inference principle statements from an inference principle database using multiple language models. As shown in Figure 7, the same teacher question is sent to multiple language models 21-23, and inference is performed using Zero-Shot CoT to obtain multiple answers and inference principle sentences. Depending on the type of language model 2, some may provide a correct answer to the same teacher question, while others may provide an incorrect answer. As a result, the reasoning principle database 10 stores the incorrect answer avoidance principle sentences and the correct answer arrival principle sentences separately, depending on whether the answer is correct or incorrect, even for the same question.
[0051] <Inference Stage> The inference device dynamically applies the "inference principle sentences" from the training phase to an unknown target question (Test data), causing language model 2 to infer an answer using Zero-Shot CoT.
[0052] Figure 8 is a functional configuration diagram of the inference stage in the inference device of the present invention.
[0053] As shown in Figure 8, the inference device 1 in the inference stage includes, in addition to the inference principle database 10, a preliminary inference unit 121, a preliminary embedded vector generation unit 122, an inference principle sentence search unit 123, and a main inference unit 124. These functional components are realized by executing a program that makes the computer installed in the device function. Furthermore, the processing flow of these functional components can also be understood as the inference method of the device.
[0054] [Preliminary reasoning unit 121] The preliminary inference unit 121 inputs a "target question" (Test data) whose correct answer is unknown to the language model 2, and obtains a "preliminary answer" to the target question and a "preliminary inference process sentence" that leads to that preliminary answer using Zero-Shot CoT.
[0055] Figure 9 shows an example of a prompt in the preliminary inference unit of the inference device of the present invention.
[0056] According to Figure 9, the following target questions, for which the answers are unknown, have been input into language model 2. (Target Question)-------------------------------------------------------------------- Two friends are eating a jar full of candy. ····· If two people are eating at the same time, how long would it take to empty the jar? Please consider each step individually. -------------------------------------------------------------------------------- The prompt ends with the message, "Think step by step." This instructs the system to output a "preliminary reasoning process statement" that leads from the target question to the answer, as part of a chain of thought.
[0057] In contrast, language model 2 inferred, for example, the answer "3.33 minutes" as the response to the target question. It also outputs the preliminary inference process sentences that led from the target question to the answer. (Answer and preliminary reasoning process)------------------------------------------------------ P's eating speed is 1 bottle per 10 minutes = 0.1 bottles / minute. Q's eating speed is 1 bottle per 5 minutes = 0.2 bottles / minute. Answer: 3.33 minutes. --------------------------------------------------------------------------------
[0058] [Preliminary embedded vector generation unit 122] The preliminary embedding vector generation unit 122 generates a preliminary embedding vector based on a combination of the target question and the preliminary inference process statement. The preliminary embedding vector generation unit 122, similar to the teacher embedding vector generation unit 112 described above, uses, for example, a Sentence Transformer to generate text embedding vectors. The preliminary embedded vector is output to the inference principle sentence search unit 123.
[0059] [Inference Principle Text Search Unit 123] The inference principle statement search unit 123 uses the inference principle database 10 to search for inference principle statements that have embedding vectors similar to the preliminary embedding vector. From the inference principle database 10, it searches for the embedding vector with the highest cosine similarity to the preliminary embedding vector and retrieves its inference principle statement. The acquired inference principle sentence is output to the main inference unit 124.
[0060] In this case, the search may include not only the embedding vector most similar to the preliminary embedding vector, but also a predetermined number (e.g., 2) of embedding vectors with high similarity. In that case, a predetermined number of reasoning principle statements (principles for avoiding incorrect answers and / or principles for reaching the correct answer) will be searched.
[0061] Figure 10 is an explanatory diagram of the inference principle sentence retrieval unit in the inference device of the present invention.
[0062] According to Figure 10, the inference principle database 10 stores, using embedded vectors as keys, the following incorrect answer avoidance principle statements and correct answer arrival principle statements, respectively, which constitute inference principle statements. (Principles for avoiding incorrect answers) -> • Divide the problem into manageable parts, calculate the individual speeds, and consider the cumulative effect of changing conditions. Pay attention to ensuring that no variables are set correctly or that calculation processes are overlooked. (Principles for arriving at the correct answer) -> • Clearly define the variables and verify each step against the 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 that has an embedding vector similar to the preliminary embedding vector. At this time, the inference principle statement is obtained in one of the following three embodiments. (1) Extract only the principle sentences for avoiding incorrect answers (Ours PF (Principles from Failures)) (2) Only obtain the principle sentence for reaching the correct answer (Ours PS (Principles from Successes)) (3) Acquire both the principle statement for avoiding incorrect answers and the principle statement 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 search unit 123 into the language model 2 and obtains an answer from the language model 2. The main inference unit 124 improves its inference accuracy by reinforcing the answer to the correct answer through preliminary inference for the target question and main inference (reinference) based on the inference search sentence.
[0065] Figure 11 shows an example of a prompt in the main inference unit of the inference device of the present invention.
[0066] According to Figure 11, the following prompt is entered into language model 2. (prompt)------------------------------------------------------------------ Target question -> Two friends are eating a jar full of candy. ····· Please consider each step individually. Previous inference result -> P's eating speed is 1 bottle per 10 minutes = 0.1 bottles / minute. ····· Answer: 3.33 minutes. Principles for arriving at the correct answer (principles for arriving at the correct answer) -> Clearly define the variables and verify each step against the given conditions. Principles for avoiding incorrect answers (Principles for avoiding incorrect answers) -> Divide the problem into manageable parts, calculate the individual speeds, and then calculate the cumulative effect of the changing conditions. Please consider the potential impact. Apply the principles for avoiding incorrect answers to identify and correct errors in your reasoning. Next, apply the principle statement for arriving at the correct answer to further refine your reasoning. Please consider each step individually. -------------------------------------------------------------------------------
[0067] According to Figure 11, the "target question," the "previous estimation result," the "principle sentence for avoiding incorrect answers," and the "principle sentence for reaching the correct answer" are input into language model 2. In this case, the "previous estimation result" may be optional, and further input into language model 2 can lead to error correction.
[0068] The main inference unit 124 may input either the "principle statement for avoiding incorrect answers" or the "principle statement for reaching the correct answer" along with the target question to the language model 2, and obtain the answer from the language model 2. Alternatively, the main inference unit 124 may input both the "principle sentence for avoiding incorrect answers and the principle sentence for reaching the correct answer" along with the target question to the language model 2 and obtain the answer from the language model 2. By inputting both, it is possible to provide instructions on the inference principle sentence that leads to the correct answer from both the perspective of incorrect and correct answers, thereby improving the accuracy of the answer.
[0069] As described in detail above, according to the program, apparatus, and method of the present invention, it is possible to infer an answer from a question by considering the inference process sentence of a language model.
[0070] According to the present invention, regardless of the task's objective, a Zero-Shot based preliminary inference is performed once, and past Chain of Thought inference principle statements (error avoidance principle statements and / or correct answer arrival principle statements) are dynamically applied. This allows the language model's self-correcting ability to be utilized, eliminating the need for task-dependent few-shot design. Furthermore, the present invention is a novel in-context learning (ICL) technique that can improve the accuracy of responses, particularly in tasks requiring highly complex mathematical or logical reasoning. Furthermore, because the present invention has the function of correcting errors in the reasoning process, it is also effective for tracking the behavioral trajectories of AI agents that output many reasoning processes.
[0071] Furthermore, this will enable improvements in the accuracy of responses to tasks requiring particularly difficult mathematical and logical reasoning, for example, thereby contributing to Goal 9 of the United Nations-led Sustainable Development Goals (SDGs): "Build resilient infrastructure, promote sustainable industrialization and foster innovation."
[0072] Various changes, modifications, and omissions to the scope of the technical concept and viewpoint of the present invention can be readily made by those skilled in the art with respect to the various embodiments of the present invention described above. The above description is merely illustrative and is not intended to limit the present invention in any way. The present invention is limited only to what is limited 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 Inference Unit 122 Pre-embedded vector generation unit 123 Inference Principles Text Search Unit 124 Main inference part 2 language models
Claims
1. A program that causes a computer to function in order to infer answers to questions using a language model, An inference principle database that stores embedded vectors based on combinations of known correct answers for teacher questions and inference process sentences leading from those teacher questions to the answers, and inference principle sentences that lead from those teacher questions to the correct answers, Regarding the inference stage, A preliminary inference means inputs a target question with an unknown correct answer into a language model and obtains a preliminary answer to the target question and a preliminary inference process sentence leading to that preliminary answer, A preliminary embedding vector generation means that generates a preliminary embedding vector based on a combination of the target question and preliminary reasoning process sentences, An inference principle search means that searches for inference principle sentences having embedding vectors similar to preliminary embedding vectors using an inference principle database, The main inference means inputs the target question and the inference principle sentence into a language model and obtains the answer from the language model. A program characterized by its ability to make a computer function.
2. The inference principle database stores inference principle statements that lead to the correct answer, such as error avoidance principle statements that prevent incorrect answers when the answer is incorrect, or correct answer arrival principle statements that lead to the correct answer when the answer is correct. The inference principle sentence search means uses an inference principle database to search for sentences that avoid incorrect answers or sentences that lead to the correct answer. The main inference mechanism inputs the target question and either a principle sentence for avoiding incorrect answers or a principle sentence for reaching the correct answer into a language model, and retrieves the answer from the language model. The program according to claim 1, characterized in that it causes the computer to function in such a way.
3. The inference principle database stores both error avoidance principle statements that prevent incorrect answers when the answer is wrong, and correct answer arrival principle statements that lead to the correct answer when the answer is correct, as inference principle statements that lead to the correct answer. The inference principle sentence search means uses an inference principle database to search for both incorrect answer avoidance principle sentences and correct answer arrival principle sentences. The main inference mechanism inputs the target question, the principle statement for avoiding incorrect answers, and the principle statement for reaching the correct answer into a language model, and retrieves the answer from the language model. The program according to claim 1, characterized in that it causes the computer to function in such a way.
4. Regarding the training phase, A teacher inference means that inputs a teacher question with a known correct answer into a language model and obtains the answer to the teacher question and the teacher inference process sentence from the teacher question to the answer, An embedding vector generation means that generates an embedding vector based on a combination of teacher questions and teacher reasoning process sentences, A principle sentence inference means inputs prompts into a language model that instruct it to generate inference principle sentences that lead to the correct answer from a teacher's question, and obtains the inference principle sentences. and make it work The inference principle database stores inference principle statements using embedded vectors as keys. The program according to claim 1, characterized in that it causes the computer to function in such a way.
5. A means for determining whether an answer to a teacher's question is correct or incorrect. And make it work even better. The principle sentence inference means is, If the answer to a teacher's question is incorrect, the language model is input a prompt instructing it to generate a principle sentence to avoid incorrect answers, along with the teacher's question and the answer. If the answer to a teacher's question is correct, the language model is input a prompt instructing it to generate a correct answer principle statement, along with the teacher's question and the answer itself, to arrive at the correct answer. The program according to claim 4, characterized in that it causes the computer to function in such a way.
6. The language model performs inference using Zero-Shot CoT (Chain of Thought). The program according to claim 1, characterized in that it causes the computer to function in such a way.
7. An inference device that uses a language model to infer answers to questions, An inference principle database that stores embedded vectors based on combinations of known correct answers for teacher questions and inference process sentences leading from those teacher questions to the answers, and inference principle sentences that lead from those teacher questions to the correct answers, Regarding the inference stage, A preliminary inference means inputs a target question with an unknown correct answer into a language model and obtains a preliminary answer to the target question and a preliminary inference process sentence leading to that preliminary answer, A preliminary embedding vector generation means that generates a preliminary embedding vector based on a combination of the target question and preliminary reasoning process sentences, An inference principle search means that searches for inference principle sentences having embedding vectors similar to preliminary embedding vectors using an inference principle database, The main inference means inputs the target question and the inference principle sentence into a language model and obtains the answer from the language model. An inference device characterized by having the following features.
8. An inference method for a device that infers answers to questions using a language model, The device is It has an inference principle database that stores embedded vectors based on combinations of known correct answers for teacher questions and inference process sentences leading from those teacher questions to the answers, and associates them with inference principle sentences that lead from those teacher questions to the correct answers. Regarding the inference stage, The first step involves inputting a target question with an unknown correct answer into a language model and obtaining a preliminary answer to that target question and a preliminary reasoning process sentence leading to that preliminary answer. A second step involves generating a preliminary embedding vector based on a combination of the target question and preliminary reasoning process sentences, The third step involves using an inference principle database to search for inference principle sentences that have embedding vectors similar to the preliminary embedding vectors, The fourth step involves inputting the target question and the inference principle sentence into a language model and obtaining the answer from that language model. An inference method for a device characterized by performing the following.
