acceptodds
Under review as a conference paper at ICLR 2027

LEGO-MATH: Stacking Reasoning Blocks for Reliable and Harder Math Problem Synthesis

Abstract

High-quality mathematical reasoning data is essential for improving the reasoning capabilities of large language models, but obtaining such data at scale remains challenging. Existing LLM-based synthesis methods either rely on free-form prompting, which often produces invalid problems or incorrect solutions, or use rigid templates, which improve controllability but limit the diversity and difficulty of generated problems. In this work, we propose LEGO-MATH, a compositional framework for synthesizing mathematical reasoning problems by representing solutions as directed acyclic graphs (DAGs) and recombining them through compatible reasoning interfaces. LEGO-MATH first converts existing problem-solution pairs into reasoning DAGs, where nodes correspond to intermediate reasoning states and edges encode inferential dependencies. It then identifies compatible interfaces via edge-aware node clustering and iteratively stacks compatible DAG fragments, starting from an initial pair and extending the current composite until an adaptive stopping condition is met. Since the logical structure of the synthesized problem is inherited from verified source DAGs, correctness can be preserved by propagating only localized numerical updates along the affected downstream subgraph after each composition, reducing the role of the LLM to simple recomputation rather than open-ended generation. This structure-preserving composition enables LEGO-MATH to jointly improve validity, covering both problem and solution correctness, and effectiveness, reflected by increased problem difficulty. Extensive experiments show that LEGO-MATH produces more valid and more challenging mathematical reasoning data, and that the resulting data provides useful training signal for post-training large language models. Our code and examples of synthesized data are available at https://anonymous.4open.science/r/LEGO-MATH-PUBLIC-5D0E.

Primary area:
foundation or frontier models, including LLMs
Keywords:
mathematical reasoning, synthetic data, large language models

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_B6NfOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper presents LEGO-MATH, a framework that synthesizes mathematical problems by composing DAG fragments extracted from existing solutions and updating affected downstream values. The generated problems achieve higher measured validity and solver resistance than the evaluated synthesis baselines. GRPO training on LEGO-MATH data mixed with LIMO achieves the strongest results among the compared methods on multiple mathematical benchmarks.

Critical strengths
  1. Structured problem synthesis. Composing explicit solution dependencies provides a concrete way to reuse existing reasoning structures and constrain synthesis, offering an alternative to generating entire problems directly.
  2. Demonstrated training value. The paper evaluates both synthetic data quality and downstream GRPO performance. The consistent gains over several synthesis baselines support the practical usefulness of the generated data.
Critical weaknesses
  1. Incomplete training controls. The experiments do not include training on LEGO-MATH data alone or adding unmodified seed problems to LIMO under a matched budget. These comparisons would clarify the contribution of composition beyond additional source data and its dependence on LIMO.
  2. Limited isolation of DAG and composition-depth effects. The w/o DAG baseline uses direct pair composition, whereas the full method supports iterative composition with additional matching and correction mechanisms. The comparison therefore does not isolate the benefit of DAG representation. Furthermore, increased solver resistance at greater composition depths does not establish increased RL training value.
Questions for authors
  1. How exactly is w/o DAG implemented? Are the generation models, verification budgets, and numbers of composed source problems matched to the full method?
  2. How does training on the 800 LEGO-MATH problems alone compare with training on the LIMO mixture, under comparable training budgets?
  3. How does LEGO-MATH compare with adding 800 unmodified seed problems to the same 800 LIMO problems?
  4. How does composition depth affect downstream GRPO performance? Do deeper compositions improve learning, or increase the proportion of rollout groups in which all answers are incorrect?
2 comments
AuthorsOpenReview ↗

Response to Reviewer B6Nf

Thank you for suggesting that we test whether adding the original seed problems would yield the same gains.

Q1. Implementation and controls for "w/o DAG"

The "w/o DAG" variant directly asks the generator to merge two seed problems and then uses a strong solver for rejection sampling. Apart from the DAG pipeline, settings such as the generation model and verification budget are kept the same as in the full method. Both settings also use two source problems per composition.

Thus, the full method used to construct our training data and the "w/o DAG" variant are matched in the number of source problems. This comparison evaluates the DAG composition pipeline relative to direct pair composition.

Q2. Training with LEGO-MATH data only

We added a LEGO-MATH-only control using Qwen3-4B-Instruct-2507. Training on only 800 LEGO-MATH problems yields an Avg. of 64.29 ± 0.58, comparable to 63.95 ± 4.16 with LIMO alone. Combining the two datasets yields 70.37 ± 2.17.

Setting# TrainAIME24AIME25AIME26AMC22AMC23AMC24Avg.
LIMO80052.50 ± 6.1136.67 ± 5.0444.17 ± 6.6178.49 ± 4.7780.16 ± 1.3972.50 ± 3.7463.95 ± 4.16
LEGO-MATH only80053.75 ± 5.4739.58 ± 4.1544.58 ± 9.4276.74 ± 5.4279.62 ± 5.3273.33 ± 1.6864.29 ± 0.58
LIMO + LEGO-MATH800+80058.75 ± 3.0543.75 ± 1.1852.08 ± 3.0584.30 ± 2.7186.68 ± 1.3978.06 ± 2.7770.37 ± 2.17

All three settings are trained for 1 epoch, and LEGO-MATH only uses half as many training examples as the mixed setting. These results indicate complementarity between LEGO-MATH and LIMO, consistent with our goal of augmenting small, high-quality datasets.

Q3. Directly adding unmodified seed problems

We added a LIMO + Random Seeds control. Both this setting and LIMO + LEGO-MATH use 1,600 training examples and follow the same settings in the paper.

Setting# TrainAIME24AIME25AIME26AMC22AMC23AMC24Avg.
LIMO80052.50 ± 6.1136.67 ± 5.0444.17 ± 6.6178.49 ± 4.7780.16 ± 1.3972.50 ± 3.7463.95 ± 4.16
LIMO + Random Seeds800+80053.33 ± 6.9038.75 ± 4.6944.58 ± 5.3378.78 ± 1.9477.99 ± 4.2672.78 ± 3.3164.06 ± 2.57
LIMO + LEGO-MATH800+80058.75 ± 3.0543.75 ± 1.1852.08 ± 3.0584.30 ± 2.7186.68 ± 1.3978.06 ± 2.7770.37 ± 2.17

Directly adding the original seed problems yields an Avg. of 64.06 ± 2.57, comparable to 63.95 ± 4.16 with LIMO alone. Adding LEGO-MATH's composed problems yields 70.37 ± 2.17, exceeding the random-seed control by 6.31 percentage points. In this setting, composed data provides gains that simply adding source problems does not.

Q4. Composition depth and downstream GRPO

Figure 5 shows that difficulty increases as more DAGs are composed, with the same trend observed across two different solvers. This supports using composition depth to control the difficulty of synthesized problems.

All data used for downstream GRPO training in this paper is composed from two source problems, consistent with the baselines. The reported downstream training gains therefore correspond to this composition depth.

Due to time constraints, we leave experiments on how composition depth affects downstream GRPO performance and the proportion of all-wrong rollout groups to future work.

AuthorsOpenReview ↗

A Gentle Follow-up Before the Discussion Deadline

Dear Reviewer B6Nf,

Thank you again for your time and consideration. As the discussion period is approaching its deadline, we would like to kindly follow up on our previous responses and manuscript revisions.

We would greatly appreciate it if you could take a moment to let us know whether any concerns remain. We would be happy to provide any further clarification if needed before the discussion closes.

If our rebuttal and revisions have addressed your concerns, we would sincerely appreciate your consideration of updating your assessment accordingly.

Thank you once again for your time and thoughtful consideration.

Best regards, Authors of Paper 37948

Reviewer_YZE9OpenReview ↗
Rating
2
Confidence
1
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This work presents LEGO‑MATH, a compositional math‑problem synthesis framework. It converts existing problem‑solution pairs into reasoning DAGs, stacks compatible DAG fragments and propagates local numerical updates to generate harder valid math problems. Experiments compare against existing synthesis baselines, with ablation, human evaluation and downstream GRPO training on competition math benchmarks.

Critical strengths
  1. This paper introduces a DAG‑based compositional paradigm different from prompt‑based and template‑driven math synthesis.
  2. This method alleviates the typical trade‑off between sample validity and problem difficulty in prior work.
  3. It includes baseline comparisons, ablation studies and human expert evaluation with inter‑annotator agreement.
  4. GRPO fine‑tuning shows synthesized data brings accuracy gains on competition math for small‑size models.
Critical weaknesses
  1. Downstream training experiments are only conducted on 3B‑4B models, missing results for larger models.
  2. The difficulty metric relies on a fixed solver’s pass rate, which is an indirect and potentially biased proxy.
  3. Evaluations are limited to algebra, number theory and combinatorics, without geometry or calculus tests.
Questions for authors
  1. What are the main barriers to support parallel and conditional DAG fusion?
  2. Could you provide results on larger models to verify the generalizability of your synthesized data?
  3. Can you extend evaluation to geometry or calculus scenarios?
  4. How do you mitigate bias brought by the solver‑based difficulty metric?
2 comments
AuthorsOpenReview ↗

Response to Reviewer YZE9

Thank you for asking how LEGO-MATH performs on a larger model and how well it covers geometry and calculus.

Q1. Parallel and conditional DAG fusion

Multi-round DAG composition allows the same problem to serve as the base multiple times, which can be viewed as a form of parallel composition.

Conditional fusion would introduce additional branching conditions absent from the original problems, potentially compromising the consistency of the original DAGs. We therefore do not currently use it.

Q2. Results on a larger model

We added training experiments on an 8B model, using the community-released instruction-aligned checkpoint JunHowie/Qwen3-8B-Instruct. The results are as follows:

Setting# TrainAIME24AIME25AIME26AMC22AMC23AMC24Avg.
Base031.25 ± 8.1522.92 ± 5.7627.50 ± 5.5659.01 ± 4.1160.05 ± 4.6455.56 ± 6.5145.76 ± 2.40
LIMO80034.17 ± 4.2723.33 ± 5.6327.92 ± 5.0261.63 ± 6.0964.13 ± 7.5356.94 ± 5.0347.88 ± 2.17
LIMO + LEGO-MATH800+80034.58 ± 6.6524.17 ± 6.1129.58 ± 7.0062.21 ± 5.6665.22 ± 6.5757.22 ± 3.0948.66 ± 2.34

Adding LEGO-MATH data increases Avg. from 47.88 to 48.66, with higher mean scores on all six benchmarks. These results show that LEGO-MATH data also provides gains on the 8B model.

Q3. Coverage of geometry and calculus

The limitations concerning geometry are already discussed in the Limitations section; extending coverage involves diagram representations and multimodal support.

Mathematical competition problems sometimes group calculus under algebra, so we did not define calculus as a separate category. Nevertheless, our training data includes calculus problems, and our framework supports them. One example from our training data is:

Let f(t)f(t) be a cubic polynomial such that for all real xx,

cos⁡(3x)=f(cos⁡x).\cos(3x)=f(\cos x).

Evaluate the integral

I=∫01(f(t))21−t2 dt.I=\int_0^1 \bigl(f(t)\bigr)^2\sqrt{1-t^2}\,\mathrm{d}t.

Q4. Solver-based difficulty metrics

We use a relative difficulty comparison: the seed problems are all problems that the solver can already solve correctly. We then examine changes in its pass rate on the composed problems to measure the increase in difficulty introduced by composition.

Moreover, Figure 5 shows a consistent trend of increasing difficulty with composition depth across two different solvers, providing cross-solver support for this relative change in difficulty.

AuthorsOpenReview ↗

A Gentle Follow-up Before the Discussion Deadline

Dear Reviewer YZE9,

Thank you again for your time and consideration. As the discussion period is approaching its deadline, we would like to kindly follow up on our previous responses and manuscript revisions.

We would greatly appreciate it if you could take a moment to let us know whether any concerns remain. We would be happy to provide any further clarification if needed before the discussion closes.

If our rebuttal and revisions have addressed your concerns, we would sincerely appreciate your consideration of updating your assessment accordingly.

Thank you once again for your time and thoughtful consideration.

Best regards, Authors of Paper 37948

Reviewer_8KPhOpenReview ↗
Rating
2
Confidence
4
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

This paper proposes LEGO-MATH, a framework for synthesizing mathematical reasoning problems through the composition of solution graphs. It first converts existing problem-solution pairs into directed acyclic graphs (DAGs), in which nodes represent mathematical states and edges represent dependency-preserving reasoning operations. Nodes are annotated with ontology-guided semantic tags, and candidate bridge states across different solution DAGs are identified using representations that incorporate the node content, semantic tags, and incoming and outgoing dependency contexts. Given a compatible pair of bridge states, LEGO-MATH retains the upstream subgraph of one solution and the downstream subgraph of another. It then connects the two fragments and propagates changed numerical values through the affected downstream nodes. This process can be applied iteratively to compose more than two source DAGs. The final corrected graph is rendered into a natural-language problem and solution. The method is evaluated by synthesizing 800 problems from 2,640 filtered historical AMC/AIME problems. Each synthetic set is combined with 800 LIMO examples and used for GRPO training. The primary experiment reports an average accuracy of 70.37% for Qwen3-4B-Instruct-2507 over six AMC/AIME benchmarks, compared with 63.95% for LIMO and 64.56% for the strongest reported full synthesis baseline. The authors additionally report cross-backbone results, model-judged validity, solver-based effectiveness, a comparison against direct composition without DAGs, and human ratings of logical consistency, fusion elegance, and innovation.

Critical strengths
  1. Interpretable structure-first synthesis pipeline The DAG representation makes the provenance and dependency structure of synthesized problems more transparent than unconstrained text-level generation. It should be possible to inspect which source fragments were used, which states were connected, and where numerical propagation or rendering errors occurred. This auditability is valuable for synthetic mathematical data.
  2. Encouraging downstream results in the reported setting LEGO-MATH achieves consistent improvements over the included baselines on the reported AMC/AIME evaluation. The authors run eight training seeds and provide standard deviations, which is stronger than reporting a single run. The no-DAG comparison also suggests that adding structured composition provides benefits beyond direct text-level composition and rejection sampling. These are meaningful strengths. However, in my assessment, they are not sufficient to overcome the novelty, positioning, and evaluation concerns below.
Critical weaknesses
  1. Limited novelty over closely related structured and compositional data-synthesis methods The core contribution of LEGO-MATH is to extract solution DAGs from existing problems, identify compatible nodes using their local dependency contexts, splice upstream and downstream graph fragments, and locally recompute affected values to generate new problems. However, this broader structure-first and compositional synthesis paradigm has already been substantially explored. RV-Syn extracts computational graphs from existing solutions, constructs a reusable function library, composes new graphs, and back-translates them into mathematical problems. Tales from a Graph composes symbolic subproblems through input-output compatibility and generates problems from the resulting graph. RSS uses reasoning DAGs to guide instruction-response synthesis. MathFusion, CogAtom, MathAgent, and From A and B to A+B similarly synthesize more complex problems by combining problems, reasoning units, or structured constraints. MathTrap is also relevant because it systematically studies the failure of LLMs to combine individually available mathematical knowledge components in novel settings, directly motivating and evaluating compositional mathematical reasoning. Game-RL is relevant to the reliability argument: its Code2Logic framework reuses executable game logic to generate verifiable reasoning data with controllable difficulty, illustrating the broader paradigm of constructing a reliable reasoning structure before rendering training instances. The potentially distinctive elements of LEGO-MATH are therefore limited to edge-aware bridge matching, subgraph splicing, and localized value propagation. However, the paper neither clearly distinguishes these mechanisms from prior work nor isolates their contributions through component-level ablations. The current “w/o DAG” comparison removes the entire structured pipeline and is insufficient to establish novelty. Relevant works include:
  • RV-Syn: Rational and Verifiable Mathematical Reasoning Data Synthesis based on Structured Function Library
  • Tales from a Graph: a Pipeline for Mathematical Problem Generation
  • RSS: Enhanced Data Synthesis for LLM through Reasoning Structures Generated by Hierarchical GFlowNet
  • MathFusion: Enhancing Mathematical Problem-solving of LLM through Instruction Fusion
  • CogAtom: From Cognitive Atoms to Olympiad-level Mathematical Reasoning in Large Language Models
  • MathAgent: Adversarial Evolution of Constraint Graphs for Mathematical Reasoning Data Synthesis
  • From A and B to A+B: Can Large Language Models Solve Compositional Math Problems?
  • MathTrap: Exploring the Compositional Deficiency of Large Language Models in Mathematical Reasoning Through Trap Problems
  • Game-RL: Synthesizing Multimodal Verifiable Game Data to Boost VLMs’ General Reasoning
  1. Insufficient evidence that the proposed components cause the reported gains The experiments do not separately evaluate edge-aware matching, semantic tags, iterative stacking, localized propagation, or adaptive stopping. Moreover, the main comparison is not fully model- or compute-matched, since LEGO-MATH relies on strong models such as Gemini 3 Flash and GPT-5.2 at multiple synthesis and verification stages. It is therefore difficult to determine whether the gains arise from the proposed graph-composition mechanism, stronger verification and filtering, or a larger synthesis budget. Direct comparisons with the most closely related methods under the same generator, verifier, seed pool, and compute budget are necessary.
Questions for authors

None

3 comments
AuthorsOpenReview ↗

Response to Reviewer 8KPh (Part 1/2)

Thank you for pointing us to these related papers and for asking us to clarify what LEGO-MATH adds to prior work.

Weakness 1: Novelty and distinctions from related work These studies broadly share the idea of structured generation or compositional reasoning with our work, but differ in what they compose, how composition is performed, and their research objectives. LEGO-MATH's specific contribution is to match compatible nodes in existing solution DAGs using their local dependency contexts, splice upstream and downstream subgraphs, and locally propagate numerical updates through the affected portions.

MathFusion [4], CogAtom [5], and From A and B to A+B [7] are already cited and discussed in Section 2. The distinctions from the other six studies are as follows:

  • RV-Syn [1] extracts executable functions from existing solutions, builds a function library, samples and recombines computation graphs, and then generates problems from them. LEGO-MATH instead directly matches compatible interfaces across existing solution DAGs, splices subgraphs, and propagates numerical updates locally.

  • Tales from a Graph [2]: Based on its public abstract, this work uses symbolic solution graphs to generate pairs of mathematical problems and word problems that share reasoning steps. LEGO-MATH focuses on composition across existing solution DAGs and local numerical propagation. We were unable to access the full text.

  • RSS [3] actively generates reasoning DAGs using a Hierarchical GFlowNet and uses them to guide instruction-response synthesis. LEGO-MATH extracts solution DAGs from existing problems and composes them according to their specific dependency relations.

  • MathAgent [6] constructs constraint graphs through adversarial evolution and instantiates the constraints as natural-language problems. LEGO-MATH reuses upstream and downstream subgraphs from existing solutions through compatibility matching and local propagation.

  • MathTrap [8] introduces logical traps into MATH and GSM8K problems to investigate models' ability to compose existing mathematical knowledge. LEGO-MATH composes solution structures to generate new training problems.

  • Game-RL [9] uses Code2Logic to reuse executable game logic and generate verifiable multimodal game data for training VLMs. LEGO-MATH generates mathematical reasoning training data by composing solution DAGs across mathematical problems. The component analysis is provided in our response to Weakness 2 in Part 2.

References

[1] Wang et al. (2026). RV-Syn: Rational and Verifiable Mathematical Reasoning Data Synthesis based on Structured Function Library. Findings of EACL.

[2] Le Chenadec et al. (2025). Tales from a Graph: a Pipeline for Mathematical Problem Generation. MATH-AI Workshop at NeurIPS.

[3] Bu et al. (2025). Enhanced Data Synthesis for LLM through Reasoning Structures Generated by Hierarchical GFlowNet. Findings of ACL.

[4] Pei et al. (2025). MathFusion: Enhancing Mathematical Problem-solving of LLM through Instruction Fusion. ACL.

[5] Chen et al. (2025). CogAtom: From Cognitive Atoms to Olympiad-level Mathematical Reasoning in Large Language Models. Findings of EMNLP.

[6] Yu et al. (2026). MathAgent: Adversarial Evolution of Constraint Graphs for Mathematical Reasoning Data Synthesis. Findings of ACL.

[7] Xiao and Zhao (2025). From A and B to A+B: Can Large Language Models Solve Compositional Math Problems?. EMNLP.

[8] Zhao et al. (2024). Exploring the Compositional Deficiency of Large Language Models in Mathematical Reasoning Through Trap Problems. EMNLP.

[9] Tong et al. (2026). Game-RL: Synthesizing Multimodal Verifiable Game Data to Boost VLMs' General Reasoning. ICLR.

AuthorsOpenReview ↗

Response to Reviewer 8KPh (Part 2/2)

Weakness 2: Component contributions and the effects of generation and verification models

(a) Component analysis of the compatibility stage

Using the same Step2/Step3 pipeline, we varied the structured representation used for clustering, the embedding method, and the clustering algorithm, covering 48 configurations in total. The table below compares each factor after averaging over the other factors. Internal score assesses successful pairings at the bridge stage.

Ablation ItemOriginal Setting → Ablated SettingSuccessful pairsInternal scoreBridgeable ratioNoise ratio
Structured representationStructured → Content only40 → 3722.175 → 22.0540.431 → 0.3370.270 → 0.389
EmbeddingQwen3 → TF-IDF variants34 → 2822.618 → 21.8750.483 → 0.3740.074 → 0.351–0.450
ClusteringKMeans → DBSCAN64 → 6322.016 → 22.3170.099 → 0.7040.000 → 0.613

The components affect the compatibility stage in different ways:

  • Removing structural fields reduces the Bridgeable ratio and increases the Noise ratio, indicating that structured representations facilitate bridge matching.
  • Compared with the TF-IDF variants, Qwen3 embeddings provide broader successful-pair coverage and lower noise.
  • DBSCAN increases the Bridgeable ratio while labeling more nodes as noise, without increasing the number of Successful pairs. This suggests that clustering mainly changes the composition of the candidate pool.

These results support our choice of Structured Representation + Qwen3 Embedding + KMeans: structural fields and embeddings improve matching, while KMeans retains full candidate coverage. These bridge metrics analyze implementation differences at the compatibility stage.

(b) Comparison with the same generation and verification models

We reran all compared methods using the same model configuration: Gemini-3-Flash for data synthesis and GPT-5.2 for verification.

MethodValidityEffectiveness
CoT-Self-Instruct55.22%2.15%
DESIGNER79.57%1.17%
PromptCoT81.72%3.74%
SAND-Math55.20%1.14%
LEGO-MATH81.90%14.52%

Under this configuration, the Validity of both PromptCoT and DESIGNER improves. PromptCoT reaches 81.72%, close to LEGO-MATH's 81.90%. However, LEGO-MATH achieves 14.52% Effectiveness, exceeding the strongest baseline, PromptCoT at 3.74%, by 10.78 percentage points.

Thus, with the same generation and verification models, LEGO-MATH maintains high Validity while achieving substantially higher Effectiveness.

AuthorsOpenReview ↗

A Gentle Follow-up Before the Discussion Deadline

Dear Reviewer 8KPh,

Thank you again for your time and consideration. As the discussion period is approaching its deadline, we would like to kindly follow up on our previous responses and manuscript revisions.

We would greatly appreciate it if you could take a moment to let us know whether any concerns remain. We would be happy to provide any further clarification if needed before the discussion closes.

If our rebuttal and revisions have addressed your concerns, we would sincerely appreciate your consideration of updating your assessment accordingly.

Thank you once again for your time and thoughtful consideration.

Best regards, Authors of Paper 37948

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.