SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.14804 · ICLR · 2025

Can LLMs Solve longer Math Word Problems Better?

Yang Wang, Tong Xiao, Zhenya Huang, Xin Xu, Zitong Chao, Can Yang

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 6 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2405.14804.json · badge: /api/ran/2405.14804.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
xinxu-ustc/coleg-math canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
openai/grade-school-math canonical (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
LYH-YF/MWPToolkit community
Papers with Code archive
5 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
3 ran · 0 no recorded run
FunctionStatusWhere it lives
DataArguments Ran
ran on a synthesized input · constructed an object; no result was computed
xinxu-ustc/coleg-math/proprietary-llms/prompt_generator.py
pointer only (licence: NONE) · get_code("70fde71e0eca9262")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinxu-ustc/coleg-math 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.

MaskSymbol Ran
ran on a synthesized input · constructed an object; no result was computed
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("2c3131374c3b000f")
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, through the batch API) and returned an instance of its own class, MaskSymbol: the run constructed the object and did not call it, so no result was computed. 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
import torch.nn as nn

torch.manual_seed(0)

ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MaskSymbol — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MaskSymbol 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
NumMask Ran
ran on a synthesized input · constructed an object; no result was computed
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("2c71295aed1296d7")
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, through the batch API) and returned an instance of its own class, NumMask: the run constructed the object and did not call it, so no result was computed. 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
import numpy as np

torch.manual_seed(0)

ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NumMask — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a NumMask 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
PromptGenerator Ran
ran on a synthesized input · constructed an object; no result was computed
xinxu-ustc/coleg-math/proprietary-llms/prompt_generator.py
pointer only (licence: NONE) · get_code("48332bf292c7a698")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinxu-ustc/coleg-math 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.

RunningArguments Ran
ran on a synthesized input · constructed an object; no result was computed
xinxu-ustc/coleg-math/proprietary-llms/prompt_generator.py
pointer only (licence: NONE) · get_code("ac123f87180f8ea4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinxu-ustc/coleg-math 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.

batch_data Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from meta-math/MetaMath
pointer only · get_code("66b3b5450182da3a")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

eval_with_timeout Ran
ran; our contract draft was wrong, not the code
openai/grade-school-math/grade_school_math/calculator.py
pointer only (licence: NONE) · get_code("ecae39d7fc9bf490")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, openai/grade-school-math 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.

jload Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from meta-math/MetaMath
pointer only · get_code("d07d04439cd1d44f")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

lists2dict Ran
ran; our contract draft was wrong, not the code
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("c9f3d4816009a6e4")
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, through the batch API) and returned OrderedDict. 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.

from collections import OrderedDict

torch_seed = 0

list1 = ['key1', 'key2', 'key3']
list2 = [10, 20, 30]

ARGS = {
    'list1': list1,
    'list2': list2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
remove_boxed Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from meta-math/MetaMath
pointer only · get_code("f3bbe264b05aadd3")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

seg_and_tag_math23k Ran
ran; our contract draft was wrong, not the code
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("14cc18e6c2bedaa7")
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, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 re

def seg_and_tag_math23k(st, nums_fraction, nums):
    res = []
    pos_st = re.search('([+]|-|[*]|/|[(]|=)-(([(]\\d+\\.\\d+[)])|([(]\\d+/\\d+[)]))', st)
    if pos_st:
        p_start = pos_st.start() + 1
        p_end = pos_st.end()
        if p_start > 0:
            res += seg_and_tag_math23k(st[:p_start], nums_fraction, nums)
        try:
            st_num = str(eval(st[p_start:p_end]))
        except:
            st_num = st[p_start:p_end]
        try:
            res.append(nums[st_num])
        except:
            try:
                number = str(int(eval(st_num)))
                if abs(eval(number) - eval(st_num)) < 0.0001:
                    res.append(nums[number])
                else:
                    res.append(st_num)
            except:
                res.append(st_num)
        if p_end < len(st):
            res += seg_and_tag_math23k(st[p_end:], nums_fraction, nums)
        return res
    for n in nums_fraction:
        if n in st:
            p_start = st.find(n)
            p_end = p_start + len(n)
            if p_start > 0:
                res += seg_and_tag_math23k(st[:p_start], nums_fraction, nums)
            try:
                res.append(nums[n])
            except:
                res.append(n)
            if p_end < len(st):
                res += seg_and_tag_math23k(st[p_end:], nums_fraction, nums)
            return res
    pos_st = re.search('\\d+\\.\\d+%?|\\d+%?', st)
    if pos_st:
        p_start = pos_st.start()
        p_end = pos_st.end()
        if p_start > 0:
            res += seg_and_tag_math23k(st[:p_start], nums_fraction, nums)
        st_num = st[p_start:p_end]
        try:
            res.append(nums[st_num])
        except:
            try:
                number = str(int(eval(st_num)))
                res.append(nums[number])
            except:
                res.append(st_num)
        if p_end < len(st):
            res += seg_and_tag_math23k(st[p_end:], nums_fraction, nums)
        return res
    for ss in st:
        res.append(ss)
    return res

# Setup valid arguments for seg_and_tag_math23k
st = "5 + 3.5 = 8.5"
nums_fraction = ["1/2", "1/3", "1/4"]
nums = {
    "5": "num_0",
    "3.5": "num_1",
    "8.5": "num_2",
    "1/2": "num_frac_0",
    "1/3": "num_frac_1",
}

ARGS = {
    "st": st,
    "nums_fraction": nums_fraction,
    "nums": nums,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
str2float Ran
ran, honoured the contract we drafted
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("7e32bb1abfcffea8")
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, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
import numpy as np

torch.manual_seed(0)

ARGS = {
    "v": "42.5"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
number_transfer_math23k Not yet run
unverified (harvested, no recorded run)
LYH-YF/MWPToolkit/mwptoolkit/utils/preprocess_tools.py
code served (permissive licence) · get_code("3080becc78cd2db7")
How it ran

no invocation recorded.

sample Not yet run
unverified (harvested, no recorded run)
openai/grade-school-math/grade_school_math/calculator.py
pointer only (licence: NONE) · get_code("f982e7500a211eee")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, openai/grade-school-math 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. No invocation recorded.

use_calculator Not yet run
unverified (harvested, no recorded run)
openai/grade-school-math/grade_school_math/calculator.py
pointer only (licence: NONE) · get_code("7eaccadc036430c1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, openai/grade-school-math 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. No invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 3 the same month, 3 later) and 10 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
jload 46 other papers
24 dated earlier, 3 the same month, 16 later, 3 same year, order not determinable
2302.13971 (2023-02)
LLaMA: Open and Efficient Foundation Language Models
2305.12870 (2023-05)
Lion: Adversarial Distillation of Proprietary Large Language Models
2305.13068 (2023-05)
Making Language Models Better Tool Learners with Execution Feedback
and 43 more not named here
remove_boxed 20 other papers
6 dated earlier, 2 the same month, 11 later, 1 same year, order not determinable · 1 only as an assembly brick
2103.03874 (2021-03)
Measuring Mathematical Problem Solving With the MATH Dataset
2309.06275 (2023-09)
Re-Reading Improves Reasoning in Large Language Models
2309.12284 (2023-09)
MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models
and 17 more not named here
batch_data 7 other papers
2 dated earlier, 2 the same month, 3 later
2309.12284 (2023-09)
MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models
2404.10346 (2024-04)
Self-Explore: Enhancing Mathematical Reasoning in Language Models with Fine-grained Rewards
2405.06680 (2024-05)
Exploring the Compositional Deficiency of Large Language Models in Mathematical Reasoning Through Trap Problems
and 4 more not named here
eval_with_timeout 1 other paper
1 dated earlier
2402.03268 (2024-02)
Understanding the Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregation
use_calculator 1 other paper
1 dated earlier
2402.03268 (2024-02)
Understanding the Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregation

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-22.

Repositories linked to this paper

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

Abstract

Math Word Problems (MWPs) play a vital role in assessing the capabilities of Large Language Models (LLMs), yet current research primarily focuses on questions with concise contexts. The impact of longer contexts on mathematical reasoning remains under-explored. This study pioneers the investigation of Context Length Generalizability (CoLeG), which refers to the ability of LLMs to solve MWPs with extended narratives. We introduce Extended Grade-School Math (E-GSM), a collection of MWPs featuring lengthy narratives, and propose two novel metrics to evaluate the efficacy and resilience of LLMs in tackling these problems. Our analysis of existing zero-shot prompting techniques with proprietary LLMs along with open-source LLMs reveals a general deficiency in CoLeG. To alleviate these issues, we propose tailored approaches for different categories of LLMs. For proprietary LLMs, we introduce a new instructional prompt designed to mitigate the impact of long contexts. For open-source LLMs, we develop a novel auxiliary task for fine-tuning to enhance CoLeG. Our comprehensive results demonstrate the effectiveness of our proposed methods, showing improved performance on E-GSM. Additionally, we conduct an in-depth analysis to differentiate the effects of semantic understanding and reasoning efficacy, showing that our methods improves the latter. We also establish the generalizability of our methods across several other MWP benchmarks. Our findings highlight the limitations of current LLMs and offer practical solutions correspondingly, paving the way for further exploration of model generalizability and training methodologies.

For agents

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

get_harvested_code_for_paper("2405.14804")
get_code_for_paper("2405.14804")
have("2405.14804")

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

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

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

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

Connect an agent — have() is free.