LEGO-MATH: Stacking Reasoning Blocks for Reliable and Harder Math Problem Synthesis
Anonymous authors
ICLR 2027
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 \textbf{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 \textit{validity}, covering both problem and solution correctness, and \textit{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 \url{https://anonymous.4open.science/r/LEGO-MATH-PUBLIC-5D0E}.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 24 Nov 2026, 17:05 UTC.
- Rating
- 2/4
- Confidence
- 2/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
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.
Strengths
- 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.
- 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.
Weaknesses
- 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.
- 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 the authors
- How exactly is w/o DAG implemented? Are the generation models, verification budgets, and numbers of composed source problems matched to the full method?
- How does training on the 800 LEGO-MATH problems alone compare with training on the LIMO mixture, under comparable training budgets?
- How does LEGO-MATH compare with adding 800 unmodified seed problems to the same 800 LIMO problems?
- 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
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
- Rating
- 2/4
- Confidence
- 1/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
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.
Strengths
- This paper introduces a DAG‑based compositional paradigm different from prompt‑based and template‑driven math synthesis.
- This method alleviates the typical trade‑off between sample validity and problem difficulty in prior work.
- It includes baseline comparisons, ablation studies and human expert evaluation with inter‑annotator agreement.
- GRPO fine‑tuning shows synthesized data brings accuracy gains on competition math for small‑size models.
Weaknesses
- Downstream training experiments are only conducted on 3B‑4B models, missing results for larger models.
- The difficulty metric relies on a fixed solver’s pass rate, which is an indirect and potentially biased proxy.
- Evaluations are limited to algebra, number theory and combinatorics, without geometry or calculus tests.
Questions for the authors
- What are the main barriers to support parallel and conditional DAG fusion?
- Could you provide results on larger models to verify the generalizability of your synthesized data?
- Can you extend evaluation to geometry or calculus scenarios?
- How do you mitigate bias brought by the solver‑based difficulty metric?
2 comments
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 | # Train | AIME24 | AIME25 | AIME26 | AMC22 | AMC23 | AMC24 | Avg. |
|---|---|---|---|---|---|---|---|---|
| Base | 0 | 31.25 ± 8.15 | 22.92 ± 5.76 | 27.50 ± 5.56 | 59.01 ± 4.11 | 60.05 ± 4.64 | 55.56 ± 6.51 | 45.76 ± 2.40 |
| LIMO | 800 | 34.17 ± 4.27 | 23.33 ± 5.63 | 27.92 ± 5.02 | 61.63 ± 6.09 | 64.13 ± 7.53 | 56.94 ± 5.03 | 47.88 ± 2.17 |
| LIMO + LEGO-MATH | 800+800 | 34.58 ± 6.65 | 24.17 ± 6.11 | 29.58 ± 7.00 | 62.21 ± 5.66 | 65.22 ± 6.57 | 57.22 ± 3.09 | 48.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 be a cubic polynomial such that for all real ,
Evaluate the integral
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.
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
- Rating
- 2/4
- Confidence
- 4/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 1/3
Read review
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.
Strengths
- 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.
- 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.
Weaknesses
- 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
- 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 the authors
None
3 comments
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.
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 Item | Original Setting → Ablated Setting | Successful pairs | Internal score | Bridgeable ratio | Noise ratio |
|---|---|---|---|---|---|
| Structured representation | Structured → Content only | 40 → 37 | 22.175 → 22.054 | 0.431 → 0.337 | 0.270 → 0.389 |
| Embedding | Qwen3 → TF-IDF variants | 34 → 28 | 22.618 → 21.875 | 0.483 → 0.374 | 0.074 → 0.351–0.450 |
| Clustering | KMeans → DBSCAN | 64 → 63 | 22.016 → 22.317 | 0.099 → 0.704 | 0.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.
| Method | Validity | Effectiveness |
|---|---|---|
| CoT-Self-Instruct | 55.22% | 2.15% |
| DESIGNER | 79.57% | 1.17% |
| PromptCoT | 81.72% | 3.74% |
| SAND-Math | 55.20% | 1.14% |
| LEGO-MATH | 81.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.
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.
Loading the discussion…
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.
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.
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.