DAG-Math: Graph-Guided Mathematical Reasoning in LLMs

Yuanhe Zhang, Ilja Kuzborskij, Jason D. Lee, Chenlei Leng, Fanghui Liu
10/19/2025
cs.AIcs.LG

Official code: YuanheZ/DAG-MATH (23 stars, last commit 2025-10-19).

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.

View on arXivView PDF

Code Implementations(1)

YuanheZ/DAG-MATHOfficial100%

[ICLR2026] DAG-Math: Graph-of-Thought Guided Mathematical Reasoning in LLMs

235PythonOct 19, 20251 years ago

Cite this paper

@article{zhang2025dagmath,
  title  = {DAG-Math: Graph-Guided Mathematical Reasoning in LLMs},
  author = {Yuanhe Zhang and Ilja Kuzborskij and Jason D. Lee and Chenlei Leng and Fanghui Liu},
  year   = {2025},
  eprint = {2510.19842},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.19842v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2510.19842.svg)](https://codeofpaper.com/paper/2510.19842)

Discussion