SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.17452 · ICLR · 2024

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

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

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 3 violated it and 0 have no contract verdict; 8 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2309.17452.json · badge: /api/ran/2309.17452.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
microsoft/tora canonical (classifier label)
classifier basis not recorded on the link
9 ran · 1 no recorded run
microsoft/ToRA canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
construct_prompt Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from ChengpengLi1003/CoRT, is pointer only (licence: NONE) · get_code("ecdacf069c9d10db")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ChengpengLi1003/CoRT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

encode_with_messages_format Ran
ran; our contract draft was wrong, not the code
microsoft/ToRA/src/train/finetune.py
code served (permissive licence) · get_code("bc1a96ec28a11a5f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.eos_token = '<|end|>'
    
    def __call__(self, text, return_tensors=None, max_length=None, truncation=False):
        # Simple mock: return a fixed-size tensor based on text length
        # Simulate tokenization by creating token ids
        num_tokens = min(len(text.split()) + 5, max_length) if max_length else len(text.split()) + 5
        input_ids = torch.randint(0, 1000, (1, num_tokens))
        
        class TokenizerOutput:
            def __init__(self, input_ids):
                self.input_ids = input_ids
        
        return TokenizerOutput(input_ids)

example = {
    'messages': [
        {
            'role': 'system',
            'content': 'You are a helpful assistant.'
        },
        {
            'role': 'user',
            'content': 'What is 2+2?'
        },
        {
            'role': 'assistant',
            'content': 'The answer is 4.'
        }
    ]
}

tokenizer = MockTokenizer()
max_seq_length = 128
mask_prompt = True

ARGS = {
    'example': example,
    'tokenizer': tokenizer,
    'max_seq_length': max_seq_length,
    'mask_prompt': mask_prompt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
encode_with_prompt_completion_format Ran
ran; our contract draft was wrong, not the code
microsoft/ToRA/src/train/finetune.py
code served (permissive licence) · get_code("1906977026be9a86")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.eos_token = "</s>"
    
    def __call__(self, text, return_tensors=None, max_length=None, truncation=False):
        # Simple mock: create token ids based on text length
        token_count = len(text.split()) + 1
        token_ids = torch.arange(token_count).unsqueeze(0)
        
        if max_length and token_ids.shape[1] > max_length:
            token_ids = token_ids[:, :max_length]
        
        class TokenizerOutput:
            def __init__(self, input_ids):
                self.input_ids = input_ids
        
        return TokenizerOutput(input_ids=token_ids)

example = {
    'prompt': 'What is the capital of France?',
    'completion': 'Paris is the capital of France.'
}

tokenizer = MockTokenizer()
max_seq_length = 128
mask_prompt = True

ARGS = {
    'example': example,
    'tokenizer': tokenizer,
    'max_seq_length': max_seq_length,
    'mask_prompt': mask_prompt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_answer Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/parser.py
pointer only (licence: MIT); the stored copy get_code serves, from ChengpengLi1003/CoRT, is pointer only (licence: NONE) · get_code("951c55f8667c735f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ChengpengLi1003/CoRT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

extract_program Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/parser.py
pointer only (licence: MIT); the stored copy get_code serves, from ChengpengLi1003/CoRT, is pointer only (licence: NONE) · get_code("1d961161c71cc153")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ChengpengLi1003/CoRT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_digit Ran
ran, violated the contract we drafted
microsoft/tora/src/eval/grader.py
pointer only (licence: MIT); the stored copy get_code serves, from cyp-jlu-ai/ba-lora, is pointer only (licence: NONE) · get_code("8ae8c583b21633b3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from cyp-jlu-ai/ba-lora, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_prompt Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from ChengpengLi1003/CoRT, is pointer only (licence: NONE) · get_code("3bb02b5083de68fd")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ChengpengLi1003/CoRT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

lower_keys Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from QwenLM/Qwen2.5-Math, is pointer only (licence: NONE) · get_code("0af0b06d6cf22524")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from QwenLM/Qwen2.5-Math, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

math_equal Ran
ran, violated the contract we drafted
microsoft/tora/src/eval/grader.py
pointer only (licence: MIT); the stored copy get_code serves, from cyp-jlu-ai/ba-lora, is pointer only (licence: NONE) · get_code("65c738adb08e913c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from cyp-jlu-ai/ba-lora, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

math_equal_process Ran
ran, violated the contract we drafted
microsoft/tora/src/eval/grader.py
pointer only (licence: MIT); the stored copy get_code serves, from cyp-jlu-ai/ba-lora, is pointer only (licence: NONE) · get_code("f63c83de2a26f67c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from cyp-jlu-ai/ba-lora, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

strip_string Ran
ran; our contract draft was wrong, not the code
microsoft/tora/src/utils/parser.py
pointer only (licence: MIT); the stored copy get_code serves, from ChengpengLi1003/CoRT, is pointer only (licence: NONE) · get_code("06b04cb075356fb9")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ChengpengLi1003/CoRT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

apply_rotary_pos_emb Not yet run
unverified (harvested, no recorded run)
microsoft/tora/src/train/llama2_flash_attn_monkey_patch.py
code served (permissive licence) · get_code("3408dd47e939d760")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 12 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 12 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
apply_rotary_pos_emb 6 other papers
6 later
2312.00401 (2023-12)
VIoTGPT: Learning to Schedule Vision Tools in LLMs towards Intelligent Video Internet of Things
2312.14187 (2023-12)
WaveCoder: Widespread And Versatile Enhancement For Code Large Language Models By Instruction Tuning
2025.emnlp-main.19 (2025 (year only))
SensorLLM: Aligning Large Language Models with Motion Sensors for Human Activity Recognition
and 3 more not named here
extract_program 5 other papers
5 later
2403.13315 (2024-03)
PuzzleVQA: Diagnosing Multimodal Reasoning Challenges of Language Models with Abstract Visual Patterns
2406.18629 (2024-06)
Step-DPO: Step-wise Preference Optimization for Long-chain Reasoning of LLMs
2502.12067 (2025-02)
TokenSkip: Controllable Chain-of-Thought Compression in LLMs
and 2 more not named here
lower_keys 5 other papers
4 later, 1 undated
2502.06773 (2025-02)
On the Emergence of Thinking in LLMs I: Searching for the Right Intuition
2510.06307 (2025-10)
Belief-Calibrated Multi-Agent Consensus Seeking for Complex NLP Tasks
2510.20342 (2025-10)
Teaching Language Models to Reason with Tools
and 2 more not named here
is_digit 4 other papers
4 later
2310.14747 (2023-10)
MCC-KD: Multi-CoT Consistent Knowledge Distillation
2403.00799 (2024-03)
An Empirical Study of Data Ability Boundary in LLMs' Math Reasoning
2405.15179 (2024-05)
VB-LoRA: Extreme Parameter Efficient Fine-Tuning with Vector Banks
and 1 more not named here
strip_string 4 other papers
4 later
2402.06925 (2024-02)
A Thorough Examination of Decoding Methods in the Era of LLMs
2410.15700 (2024-10)
InternLM2.5-StepProver: Advancing Automated Theorem Proving via Critic-Guided Search
2502.06781 (2025-02)
Exploring the Limit of Outcome Reward for Learning Mathematical Reasoning
and 1 more not named here
math_equal 3 other papers
3 later
2403.00799 (2024-03)
An Empirical Study of Data Ability Boundary in LLMs' Math Reasoning
2405.15179 (2024-05)
VB-LoRA: Extreme Parameter Efficient Fine-Tuning with Vector Banks
2408.04556 (2024-08)
BA-LoRA: Bias-Alleviating Low-Rank Adaptation to Mitigate Catastrophic Inheritance in Large Language Models
math_equal_process 3 other papers
3 later
2403.00799 (2024-03)
An Empirical Study of Data Ability Boundary in LLMs' Math Reasoning
2405.15179 (2024-05)
VB-LoRA: Extreme Parameter Efficient Fine-Tuning with Vector Banks
2408.04556 (2024-08)
BA-LoRA: Bias-Alleviating Low-Rank Adaptation to Mitigate Catastrophic Inheritance in Large Language Models
encode_with_messages_format 2 other papers
1 dated earlier, 1 later
2308.04371 (2023-08)
Cumulative Reasoning with Large Language Models
2403.00799 (2024-03)
An Empirical Study of Data Ability Boundary in LLMs' Math Reasoning
encode_with_prompt_completion_format 2 other papers
1 dated earlier, 1 later
2308.04371 (2023-08)
Cumulative Reasoning with Large Language Models
2403.00799 (2024-03)
An Empirical Study of Data Ability Boundary in LLMs' Math Reasoning
construct_prompt 1 other paper
1 later
2510.20342 (2025-10)
Teaching Language Models to Reason with Tools
extract_answer 1 other paper
1 later
2510.20342 (2025-10)
Teaching Language Models to Reason with Tools
load_prompt 1 other paper
1 later
2510.20342 (2025-10)
Teaching Language Models to Reason with Tools

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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 1 . * Equal contribution. See Contributions section for details. Work done during an internship at Microsoft.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2309.17452")
get_code_for_paper("2309.17452")
have("2309.17452")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2309.17452.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2309.17452.svg)](https://syntology.ai/paper/2309.17452)

Connect an agent — have() is free.