IP Library Granted Patent US 12,468,898
Granted Patent B2
US 12,468,898 · App. 18/144,802 · Granted Nov 11, 2025

Mathematical reasoning using large language models

Inventors: Shima Imani (Sammamish, WA); Harsh Shrivastava (Redmond, WA); Liang Du (Redmond, WA)
Assignee: MICROSOFT TECHNOLOGY LICENSING, LLC
G06F40/40G06F16/3325G06F16/3329
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,468,898
App. No.
18/144,802
Granted
Nov 11, 2025
Kind
B2
Abstract

Disclosed are techniques for an AI system with a large language mode (LLM) with improved accuracy and reliability in solving mathematical problems. An initial query is transformed into a template query by replacing the original input values with variables. Multiple prompts are sent to the LLM, each being different from one another, and contextually related to the template query. Multiple results are responsively received from the LLM, each result including an analytical expression to solve the mathematical problem. Each of the expressions is evaluated using a numerical evaluation tool with variables of the expression being assigned a common set of randomly sampled values. A consensus is achieved when the evaluated expressions satisfy a consensus condition, such as when all outputs match consistently over N experiments or trials. After the consensus condition is reached, the original inputs are evaluated with one or more of the expressions, and the solution is output.

Claims (105)

1 . A method for an artificial intelligence (AI) system with a large language model (LLM) to solve a mathematical problem, the method comprising:

receiving an initial query that presents a problem with original input values;

creating key-value mappings between the original input values and variables;

transforming the initial query into a template query by replacing the original input values with the variables;

sending multiple prompts to the LLM, wherein each of the multiple prompts is different and contextually related to the template query;

responsive to the multiple prompts, receiving multiple results from the LLM, wherein each of the multiple results includes an analytical expression to solve the mathematical problem;

evaluating outputs of the analytical expressions included in the multiple results with the variables being assigned to a common set of randomly sampled values, wherein evaluating the outputs of the analytical expressions included in the multiple results comprises:

looping through a process over a number of trials, the process comprising:

assigning random values to the variables;

evaluating each of the analytical expressions with the variables having the random values assigned;

calculating a consensus rating based on the evaluating each of the analytical expressions with the variables having the random values assigned;

determining if additional trials are required based on the consensus rating and a test condition; and

terminating the looping when the consensus rating and the test condition indicate that the additional trials are not required; and

outputting final results based on the consensus rating and the test condition indicating that the additional trials are not required.

2 . The method of claim 1 , further comprising relaxing the test condition for terminating the loop when a non-convergence condition is detected.

3 . The method of claim 1 , wherein the test condition comprises one of:

terminating the loop when the number of trials is reached;

terminating the loop when all of the evaluated outputs are matched;

terminating the loop when all of the evaluated outputs are matched over a specified percentage;

terminating the loop when all of the evaluated outputs are matched over a specified number of consecutive trials; or

terminating the loop when all of the evaluated outputs are matched over the specified percentage for the specified number of consecutive trials.

4 . The method of claim 1 , wherein outputting the final results comprises:

assigning the original input values to the variables;

selecting one or more of the analytical expressions for evaluation;

evaluating outputs of each selected analytical expression with the variables having the original input values assigned; and

providing the evaluated outputs of each selected analytical expression.

5 . The method of claim 4 , wherein selecting one or more of the analytical expressions for evaluation comprises one of:

selecting a single analytical expression;

selecting all analytical expressions;

selecting a single analytical expression above a specified confidence rating;

selecting all analytical expressions above a specified confidence rating;

selecting a first analytical expression from all analytical expressions in a consensus from a most recent iteration;

randomly picking a single analytical expression from all analytical expressions in the consensus from the most recent iteration;

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting a highest ranked analytical expression; and

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting all ranked analytical expressions above a specified rating.

6 . A computer-readable storage medium having computer-executable instructions stored thereupon that, when executed by one or more processing units of an artificial intelligence (AI) system with a large language model (LLM), cause the AI system to:

receive an initial query that presents a problem with original input values;

transform the initial query into a template query by replacing the original input values with variables;

send multiple prompts to the LLM, wherein each of the multiple prompts is different and contextually related to the template query;

responsive to the multiple prompts, receive multiple results from the LLM, wherein each of the multiple results includes an analytical expression to solve the mathematical problem;

verify results from an evaluation of outputs of the analytical expressions included in the multiple results with the variables being assigned to a common set of randomly sampled values, wherein verifying the results from the evaluation of the outputs of the analytical expressions included in the multiple results comprises:

looping through a process over a number of trials, the process comprising:

assigning random values to the variables;

evaluating each of the analytical expressions with the variables having the random values assigned;

calculating a consensus rating based on the evaluating each of the analytical expressions with the variables having the random values assigned;

determining if additional trials are required based on the consensus rating and a test condition; and

terminating the looping when the consensus rating and the test condition indicate that the additional trials are not required; and

output final results based on the consensus rating and the test condition indicating that the additional trials are not required.

7 . The computer-readable storage medium of claim 6 , wherein the computer-executable instructions further cause the AI system to relax the test condition for terminating the loop when a non-convergence condition is detected.

8 . The computer-readable storage medium of claim 6 , wherein the test condition comprises one of:

terminating the loop when the number of trials is reached;

terminating the loop when all of the evaluated outputs are matched;

terminating the loop when all of the evaluated outputs are matched over a specified percentage;

terminating the loop when all of the evaluated outputs are matched over a specified number of consecutive trials; or

terminating the loop when all of the evaluated outputs are matched over the specified percentage for the specified number of consecutive trials.

9 . The computer-readable storage medium of claim 6 , wherein outputting the final results comprises:

assigning the original input values to the variables;

selecting one or more of the analytical expressions for evaluation;

evaluating outputs of each selected analytical expression with the variables having the original input values assigned; and

providing the evaluated outputs of each of the selected analytical expression.

10 . The computer-readable storage medium of claim 9 , wherein selecting one or more of the analytical expressions for evaluation comprises one of:

selecting a single analytical expression;

selecting all analytical expressions;

selecting a single analytical expression above a specified confidence rating;

selecting all analytical expressions above a specified confidence rating;

selecting a first analytical expression from all analytical expressions in a consensus from a most recent iteration;

randomly picking a single analytical expression from all analytical expressions in the consensus from the most recent iteration;

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting a highest ranked analytical expression; and

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting all ranked analytical expressions above a specified rating.

11 . An artificial intelligence (AI) system, comprising:

a processor; and

a computer-readable storage medium having computer-executable instructions stored thereupon that, when executed by the processor, cause the AI system to:

receive an initial query that presents a problem with original input values;

transform the initial query into a template query by replacing the original input values with variables;

send multiple prompts to the LLM, wherein each of the multiple prompts is and contextually related to the template query;

responsive to the multiple prompts, receive multiple results from the LLM, wherein each of the multiple results includes an analytical expression to solve the mathematical problem;

verify results from an evaluation of outputs of the analytical expressions included in the multiple results with the variables being assigned to a common set of randomly sampled values, wherein verifying the results from the evaluation of the outputs of the analytical expressions included in the multiple results comprises:

looping through a process over a number of trials, the process comprising:

assigning random values to the variables;

evaluating each of the analytical expressions with the variables having the random values assigned;

calculating a consensus rating based on the evaluating each of the analytical expressions with the variables having the random values assigned;

determining if additional trials are required based on the consensus rating and a test condition; and

terminating the looping when the consensus rating and the test condition indicate that the additional trials are not required; and

output final results based on the consensus rating and the test condition indicating that the additional trials are not required.

12 . The AI system of claim 11 , wherein the computer-executable instructions further cause the AI system to relax the test condition for terminating the loop when a non-convergence condition is detected.

13 . The AI system of claim 11 , wherein the test condition comprises one of:

terminating the loop when the number of trials is reached;

terminating the loop when all of the evaluated outputs are matched;

terminating the loop when all of the evaluated outputs are matched over a specified percentage;

terminating the loop when all of the evaluated outputs are matched over a specified number of consecutive trials; or

terminating the loop when all of the evaluated outputs are matched over the specified percentage for the specified number of consecutive trials.

14 . The AI system of claim 11 , wherein outputting the final results comprises:

assigning the original input values to the variables;

selecting one or more of the analytical expressions for evaluation;

evaluating outputs of each selected analytical expression with the variables having the original input values assigned; and

providing the evaluated outputs of each of the selected analytical expression.

15 . The AI system of claim 14 , wherein selecting one or more of the analytical expressions for evaluation comprises one of:

selecting a single analytical expression;

selecting all analytical expressions;

selecting a single analytical expression above a specified confidence rating;

selecting all analytical expressions above a specified confidence rating;

selecting a first analytical expression from all analytical expressions in a consensus from a most recent iteration;

randomly picking a single analytical expression from all analytical expressions in the consensus from the most recent iteration;

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting a highest ranked analytical expression; and

ranking all the analytical expressions in the consensus from the most recent iteration, and selecting all ranked analytical expressions above a specified rating.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 9, 2023
From: IMANI, SHIMA; SHRIVASTAVA, HARSH; DU, LIANG
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 063586/0494 →
Continuity (2)
Provisional Application 63488159 · Mar 2, 2023
Related Publication 20240296294A1 · Sep 5, 2024
References Cited (33)
US 12067366B1 · Heller · 2024 [cited by examiner]
US 20110320187A1 · Motik · 2011 [cited by examiner]
US 20230418815A1 · Zorn · 2023 [cited by examiner]
US 20240185001A1 · Nagaraju · 2024 [cited by examiner]
CN 115705398A · 2023 [cited by applicant]
Galatolo, et al., “Zero-shot Mathematical Problem Solving via Generative Pre-trained Transformers”, Department of Information Engineering-ICEIS, vol. 1, 2022, pp. 479-483. [cited by applicant]
International Search Report and Written Opinion received for PCT Application No. PCT/US2024/017198, Jul. 1, 2024, 14 pages. [cited by applicant]
Weng, et al., “Large language models are reasoners with self-verification”, arXiv preprint arXiv:2212.095612, Dec. 19, 2022, pp. 1-24. [cited by applicant]
Brown, et al., “Language models are few-shot learners”, In Journal of Advances in neural information processing systems, 2020, pp. 1-25. [cited by applicant]
Chowdhery, et al., “PaLM: Scaling Language Modeling with Pathways”, In Repository of arXiv:2204.02311v1, Apr. 6, 2022, 83 Pages. [cited by applicant]
Cobbe, et al., “Training verifiers to solve math word problems”, In Repository of arXiv:2110.14168v1, Oct. 27, 2021, pp. 1-22. [cited by applicant]
Devlin, et al., “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding”, In Repository of arXiv:1810.04805v1, Oct. 11, 2018, 14 Pages. [cited by applicant]
Gao, et al., “Making pre-trained language models better few-shot learners”, In Repository of arXiv:2012.15723v1, Dec. 31, 2020, 15 Pages. [cited by applicant]
Geva, et al., “Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies”, In Journal Transactions of the Association for Computational Linguistics, Apr. 26, 2021, pp. 346-361. [cited by applicant]
Kojima, et al., “Large language models are zero-shot reasoners”, In Repository of arXiv:2205.11916v1, May 24, 2022, pp. 1-36. [cited by applicant]
Koncel-Kedziorski, et al., “Mawps: A math word problem repository”, In Proceedings of the 2016 conference of the North American chapter of the association for computational linguistics: human language technologies, Jun.… [cited by applicant]
Liu, et al., “Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing”, In Journal of ACM Computing Surveys, Jan. 16, 2023, pp. 1-35. [cited by applicant]
Liu, et al., “What makes good in-context examples for gpt-3?”, In Repository of arXiv:2101.06804v1, Jan. 17, 2021, 12 Pages. [cited by applicant]
Patel, et al., “Are nlp models really able to solve simple math word problems?”, In Repository of arXiv:2103.07191v1, Mar. 12, 2021, 15 Pages. [cited by applicant]
Rae, et al., “Scaling language models: Methods, analysis & insights from training gopher”, In Repository of arXiv:2112.11446v1, Dec. 8, 2021, pp. 1-118. [cited by applicant]
Raffel, et al., “Exploring the limits of transfer learning with a unified text-to-text transformer”, In Journal of Machine Learning Research, vol. 21, Issue 1, Jan. 1, 2020, pp. 1-67. [cited by applicant]
Reynolds, et al., “Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigm”, In proceedings of CHI EA '21: Extended Abstracts of the CHI Conference on Human Factors in Computing Systems, May 18, 2021,… [cited by applicant]
Roy, et al., “Solving general arithmetic word problems”, In Repository of arXiv:1608.01413v1, Aug. 4, 2016. [cited by applicant]
Schick, et al., “It's not just size that matters: Small language models are also few-shot learners”, In Repository of arXiv:2009.07118v1, Sep. 15, 2020, 11 Pages. [cited by applicant]
Shin, et al., “Autoprompt: Eliciting knowledge from language models with automatically generated prompts”, In Repository of arXiv:2010.15980v1, Oct. 29, 2020, 14 Pages. [cited by applicant]
Srivastava, et al., “Beyond the imitation game: Quantifying and extrapolating the capabilities of language models”, In Repository of arXiv:2206.04615v1, Jun. 9, 2022, pp. 1-100. [cited by applicant]
Stanovich, et al., “Individual Differences in Reasoning: Implications for the Rationality Debate?”, In Journal of Behavioral and Brain Sciences, vol. 23, Issue 5, Apr. 9, 2001, pp. 645-726. [cited by applicant]
Talmor, et al., “Commonsenseqa: A question answering challenge targeting commonsense knowledge”, In Repository of arXiv:1811.00937v1, Nov. 2, 2018, 10 Pages. [cited by applicant]
Thoppilan, et al., “Lamda: Language models for dialog applications”, In Repository of arXiv:2201.08239v1, Jan. 20, 2022, pp. 1-47. [cited by applicant]
Vaswani, et al., “Attention is all you need”, In Book of Advances in Neural Information Processing Systems, Jun. 12, 2017, pp. 1-11. [cited by applicant]
Wang, et al., “Self-Consistency Improves Chain of Thought Reasoning in Language Models”, In Repository of arXiv:2203.11171v3, Oct. 4, 2022, 24 Pages. [cited by applicant]
Wei, et al., “Chain of Thought Prompting Elicits Reasoning In Large Language Models”, In Repository of arXiv:2201.11903v1, Jan. 28, 2022, 24 Pages. [cited by applicant]
International Preliminary Report on Patentability (Chapter I) received for PCT Application No. PCT/US2024/017198, mailed on Sep. 11, 2025, 8 pages. [cited by applicant]