Papers › ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving

ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving

29 Sep 2023arXiv:2309.17452archive 2025-07-28

Zhibin Gou, Zhihong Shao, Yeyun Gong, Yelong Shen, Yujiu Yang, Minlie Huang, Nan Duan, Weizhu Chen

Large language models have made significant progress in various language tasks, yet they still struggle with complex mathematics. In this paper, we propose ToRA a series of Tool-integrated Reasoning Agents designed to solve challenging mathematical problems by seamlessly integrating natural language reasoning with the utilization of external tools (e.g., computation libraries and symbolic solvers), thereby amalgamating the analytical prowess of language and the computational efficiency of tools. To train ToRA, we curate interactive tool-use trajectories on mathematical datasets, apply imitation learning on the annotations, and propose output space shaping to further refine models' reasoning behavior. As a result, ToRA models significantly outperform open-source models on 10 mathematical reasoning datasets across all scales with 13%-19% absolute improvements on average. Notably, ToRA-7B reaches 44.6% on the competition-level dataset MATH, surpassing the best open-source model WizardMath-70B by 22% absolute. ToRA-Code-34B is also the first open-source model that achieves an accuracy exceeding 50% on MATH, which significantly outperforms GPT-4's CoT result, and is competitive with GPT-4 solving problems with programs. Additionally, we conduct a comprehensive analysis of the benefits and remaining challenges of tool interaction for mathematical reasoning, providing valuable insights for future research.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2309.17452")

Code

Syntology Ran 5 of 12 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 3 ran with no contract checked.

By repository: official repository: 12 samples from 1 repository, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

microsoft/tora officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 5 ran; 0 honoured the contract we drafted; 7 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
3ran
7unverified

Licence: 0 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from microsoft/ToRA. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

encode_with_messages_format microsoft/ToRA/src/train/finetune.py official repository ran · our draft was wrong MIT (permissive) · bc1a96ec28a11a5f · report
encode_with_prompt_completion_format microsoft/ToRA/src/train/finetune.py official repository ran · our draft was wrong MIT (permissive) · 1906977026be9a86 · report
is_digit microsoft/tora/src/eval/grader.py official repository ran MIT (permissive) · 8ae8c583b21633b3 · report
math_equal microsoft/tora/src/eval/grader.py official repository ran MIT (permissive) · 65c738adb08e913c · report
math_equal_process microsoft/tora/src/eval/grader.py official repository ran fingerprinted MIT (permissive) · f63c83de2a26f67c · report
apply_rotary_pos_emb microsoft/tora/src/train/llama2_flash_attn_monkey_patch.py official repository unverified MIT (permissive) · 3408dd47e939d760 · report
construct_prompt microsoft/tora/src/utils/utils.py official repository unverified MIT (permissive) · ecdacf069c9d10db · report
extract_answer microsoft/tora/src/utils/parser.py official repository unverified MIT (permissive) · 951c55f8667c735f · report
extract_program microsoft/tora/src/utils/parser.py official repository unverified MIT (permissive) · 1d961161c71cc153 · report
load_prompt microsoft/tora/src/utils/utils.py official repository unverified MIT (permissive) · 3bb02b5083de68fd · report
lower_keys microsoft/tora/src/utils/utils.py official repository unverified MIT (permissive) · 0af0b06d6cf22524 · report
strip_string microsoft/tora/src/utils/parser.py official repository unverified MIT (permissive) · 06b04cb075356fb9 · report

Tasks

Arithmetic ReasoningComputational EfficiencyImitation LearningMathMath Word Problem SolvingMathematical Problem-SolvingMathematical Reasoning

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Arithmetic Reasoning GSM8K ToRA-70B (SC, k=50) Accuracy 88.3 #28 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-70B (SC, k=50) Parameters (Billion) 70 #28 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code-34B (SC, k=50) Accuracy 85.1 #45 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code-34B (SC, k=50) Parameters (Billion) 34 #45 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA 70B Accuracy 84.3 #51 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA 70B Parameters (Billion) 70 #51 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 34B Accuracy 80.7 #69 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 34B Parameters (Billion) 34 #69 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 13B Accuracy 75.8 #85 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 13B Parameters (Billion) 13 #85 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 7B Accuracy 72.6 #98 of 164 Archive leaderboard report
Arithmetic Reasoning GSM8K ToRA-Code 7B Parameters (Billion) 7 #98 of 164 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 34B model (w/ code, SC, k=50) Accuracy 60.0 #27 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 34B model (w/ code, SC, k=50) Parameters (Billions) 34 #27 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 70B (w/ code, SC, k=50) Accuracy 56.9 #33 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 70B (w/ code, SC, k=50) Parameters (Billions) 70 #33 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 34B (w/ code) Accuracy 50.8 #46 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 34B (w/ code) Parameters (Billions) 34 #46 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 70B (w/ code) Accuracy 49.7 #49 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 70B (w/ code) Parameters (Billions) 70 #49 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 13B (w/ code) Accuracy 48.1 #56 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 13B (w/ code) Parameters (Billions) 13 #56 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 7B (w/ code) Accuracy 44.6 #67 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA-Code 7B (w/ code) Parameters (Billions) 7 #67 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 13B (w/ code) Accuracy 43.0 #74 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 13B (w/ code) Parameters (Billions) 13 #74 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 7B (w/ code) Accuracy 40.1 #78 of 135 Archive leaderboard report
Math Word Problem Solving MATH ToRA 7B (w/ code) Parameters (Billions) 7 #78 of 135 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections