Papers › Exploring the Compositional Deficiency of Large Language Models in Mathematical Reasoning

Exploring the Compositional Deficiency of Large Language Models in Mathematical Reasoning

5 May 2024arXiv:2405.06680archive 2025-07-28

Jun Zhao, Jingqi Tong, Yurong Mou, Ming Zhang, Qi Zhang, Xuanjing Huang

Human cognition exhibits systematic compositionality, the algebraic ability to generate infinite novel combinations from finite learned components, which is the key to understanding and reasoning about complex logic. In this work, we investigate the compositionality of large language models (LLMs) in mathematical reasoning. Specifically, we construct a new dataset \textsc{MathTrap} by introducing carefully designed logical traps into the problem descriptions of MATH and GSM8K. Since problems with logical flaws are quite rare in the real world, these represent "unseen" cases to LLMs. Solving these requires the models to systematically compose (1) the mathematical knowledge involved in the original problems with (2) knowledge related to the introduced traps. Our experiments show that while LLMs possess both components of requisite knowledge, they do not \textbf{spontaneously} combine them to handle these novel cases. We explore several methods to mitigate this deficiency, such as natural language prompts, few-shot demonstrations, and fine-tuning. Additionally, we test the recently released OpenAI o1 model and find that human-like `slow thinking' helps improve the compositionality of LLMs. Overall, systematic compositionality remains an open challenge for large language models.

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="2405.06680")

Code

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

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

tongjingqi/MathTrap officialmentioned in papermentioned on GitHubApache-2.0 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

10 samples harvested; 7 ran; 0 honoured the contract we drafted; 3 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.

1ran · violated contract
4ran · our draft was wrong
2ran
3unverified

Licence: 0 of the 10 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 tongjingqi/MathTrap. “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.

is_number tongjingqi/MathTrap/eval/eval_GSM8K_category.py official repository ran · violated contract Apache-2.0 (permissive) · 0fe9cf6c00ef56ea · report
batch_data tongjingqi/MathTrap/eval/eval_GSM8K_category.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 66b3b5450182da3a · report
jload tongjingqi/MathTrap/train_math.py official repository ran · our draft was wrong Apache-2.0 (permissive) · d07d04439cd1d44f · report
last_boxed_only_string tongjingqi/MathTrap/eval/util.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 0b14c648516c38a7 · report
preprocess tongjingqi/MathTrap/train_math.py official repository ran Apache-2.0 (permissive) · 51c01dd0d033f660 · report
read_json tongjingqi/MathTrap/GPT4_eval/get_response_example.py official repository ran Apache-2.0 (permissive) · 0bb621c7242d2fbe · report
remove_boxed tongjingqi/MathTrap/eval/eval_MATH_category2.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · f3bbe264b05aadd3 · report
last_boxed_only tongjingqi/MathTrap/eval/util.py official repository unverified Apache-2.0 (permissive) · 8720975b15d076e8 · report
make_supervised_data_module tongjingqi/MathTrap/train_math.py official repository unverified Apache-2.0 (permissive) · abbd983f4f37a1d5 · report
only_until_first_boxed_from_tokens tongjingqi/MathTrap/eval/util.py official repository unverified Apache-2.0 (permissive) · 0bbf876ced018c83 · report

Tasks

GSM8KMathMathematical Reasoning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

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