Table of Contents
Fetching ...

DAG-Math: Graph-Guided Mathematical Reasoning in LLMs

Yuanhe Zhang, Ilja Kuzborskij, Jason D. Lee, Chenlei Leng, Fanghui Liu

TL;DR

This work proposes a DAG-based framework for mathematical reasoning in LLMs, modeling CoT as a rule-based stochastic process on task-specific DAGs and introducing logical closeness and PRR as measures of reasoning fidelity. It defines a DAG-MATH formatted CoT, builds a gold-standard benchmark of 2,894 DAGs, and demonstrates how model performance decomposes into final-answer accuracy and rule-consistent derivation. Across challenging datasets, they observe that PASS@1 can be inflated by exploratory search even when the underlying perfect reasoning ability is similar across models, underscoring gaps between final answers and derivational fidelity. The framework thus provides a diagnostic tool balancing free-form CoT and formal reasoning, with practical implications for evaluating and improving LLM mathematical reasoning.

Abstract

Large Language Models (LLMs) demonstrate strong performance on mathematical problems when prompted with Chain-of-Thought (CoT), yet it remains unclear whether this success stems from search, rote procedures, or rule-consistent reasoning. To address this, we propose modeling CoT as a certain rule-based stochastic process over directed acyclic graphs (DAGs), where nodes represent intermediate derivation states and edges encode rule applications. Within this framework, we introduce logical closeness, a metric that quantifies how well a model's CoT trajectory (i.e., the LLM's final output) adheres to the DAG structure, providing evaluation beyond classical PASS@k metrics. Building on this, we introduce the DAG-MATH CoT format and construct a benchmark that guides LLMs to generate CoT trajectories in this format, thereby enabling the evaluation of their reasoning ability under our framework. Across standard mathematical reasoning datasets, our analysis uncovers statistically significant differences in reasoning fidelity among representative LLM families-even when PASS@k is comparable-highlighting gaps between final-answer accuracy and rule-consistent derivation. Our framework provides a balance between free-form CoT and formal proofs systems, offering actionable diagnostics for LLMs reasoning evaluation. Our benchmark and code are available at: https://github.com/YuanheZ/DAG-MATH-Formatted-CoT.

DAG-Math: Graph-Guided Mathematical Reasoning in LLMs

TL;DR

This work proposes a DAG-based framework for mathematical reasoning in LLMs, modeling CoT as a rule-based stochastic process on task-specific DAGs and introducing logical closeness and PRR as measures of reasoning fidelity. It defines a DAG-MATH formatted CoT, builds a gold-standard benchmark of 2,894 DAGs, and demonstrates how model performance decomposes into final-answer accuracy and rule-consistent derivation. Across challenging datasets, they observe that PASS@1 can be inflated by exploratory search even when the underlying perfect reasoning ability is similar across models, underscoring gaps between final answers and derivational fidelity. The framework thus provides a diagnostic tool balancing free-form CoT and formal reasoning, with practical implications for evaluating and improving LLM mathematical reasoning.

Abstract

Large Language Models (LLMs) demonstrate strong performance on mathematical problems when prompted with Chain-of-Thought (CoT), yet it remains unclear whether this success stems from search, rote procedures, or rule-consistent reasoning. To address this, we propose modeling CoT as a certain rule-based stochastic process over directed acyclic graphs (DAGs), where nodes represent intermediate derivation states and edges encode rule applications. Within this framework, we introduce logical closeness, a metric that quantifies how well a model's CoT trajectory (i.e., the LLM's final output) adheres to the DAG structure, providing evaluation beyond classical PASS@k metrics. Building on this, we introduce the DAG-MATH CoT format and construct a benchmark that guides LLMs to generate CoT trajectories in this format, thereby enabling the evaluation of their reasoning ability under our framework. Across standard mathematical reasoning datasets, our analysis uncovers statistically significant differences in reasoning fidelity among representative LLM families-even when PASS@k is comparable-highlighting gaps between final-answer accuracy and rule-consistent derivation. Our framework provides a balance between free-form CoT and formal proofs systems, offering actionable diagnostics for LLMs reasoning evaluation. Our benchmark and code are available at: https://github.com/YuanheZ/DAG-MATH-Formatted-CoT.
Paper Structure (26 sections, 23 equations, 6 figures, 4 tables)

This paper contains 26 sections, 23 equations, 6 figures, 4 tables.

Figures (6)

  • Figure 1: Task-specific DAG via LLaMA-3.1-8B-Instruct.
  • Figure 2: Toy DAG.
  • Figure 3: Empirical distributions of DAG statistics across problem difficulty groups, where group $k$ corresponds to problems with difficulty in $(k-1, k]$. Shown are the distributions of #Nodes, #Edges, graph density $\left(\text{i.e., } \frac{2\#\text{Edges}}{\#\text{Nodes}(\#\text{Nodes}-1)}\right)$, maximum in-degree, and maximum out-degree.
  • Figure 4: The AUC curves of averaged accuracy under the logical closeness rate over three datasets for five selected LLMs.
  • Figure 5: Visualization of the heptagon problem.
  • ...and 1 more figures

Theorems & Definitions (3)

  • Definition 3.1: Logical closeness and perfect reasoning
  • Definition 3.2: Mathematical reasoning ability
  • Definition A.1: Atomic Step of CoT