NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Shape of Reasoning: Topological Analysis of Reasoning Traces in Large Language Models

Xue Wen Tan, Nathaniel Tan, Galen Lee, Stanley KokarXiv 2025 · DOI

Introduction

As Large Language Models (LLMs) advance, evaluating the "faithfulness" of their reasoning becomes critical. A correct final answer does not guarantee a sound logical path; models often exhibit "hallucinated" or spurious reasoning. Traditional evaluation methods, which rely on manual expert review or simple graph-theoretic proxies (e.g., node/edge counts), struggle to capture the high-dimensional complexity of logical arguments. This paper proposes a novel framework using Topological Data Analysis (TDA) to objectively measure the quality of reasoning traces by treating them as geometric objects.

Methodology

The authors developed a four-stage pipeline to quantify the "shape" of reasoning:

  1. Trace Generation: Reasoning traces were elicited from models including Qwen and DeepSeek using complex mathematical problems.
  2. Alignment via Biological Analogy: To establish a ground truth for quality, the researchers adapted the Smith-Waterman algorithm—traditionally used for DNA sequence alignment. This method aligns LLM reasoning steps with expert "gold" solutions within an embedding space, producing an objective alignment score.
Alignment of LLM reasoning traces to gold solutions using a modified Smith-Waterman algorithm.
  1. Topological Feature Extraction: The sequence of reasoning steps is treated as a "point cloud" in high-dimensional space. Using Vietoris-Rips persistence, the framework identifies topological invariants:
  2. $H_0$ (Connected Components): Measures how ideas cluster together.
  3. $H_1$ (1-Cycles/Holes): Identifies "detours" where reasoning branches out and subsequently reconciles.
  4. Comparative Analysis: These TDA features were benchmarked against standard graph-theoretic metrics (e.g., clustering coefficients, path lengths) to determine their predictive power regarding the alignment score.

Data and Experimental Setup

The study utilized a dataset derived from the American Invitational Mathematics Examination (AIME). AIME is ideal because it offers challenging problems with detailed, mathematician-contributed solutions. Crucially, the dataset supports multi-path solutions, acknowledging that multiple valid reasoning trajectories can lead to the same correct answer.

Key Results

The experimental results demonstrate that TDA features are significantly more diagnostic of reasoning quality than traditional graph metrics.

Predictive performance (R²) of Graph vs. TDA features across various LLM architectures.

As shown in the table above, TDA features explained substantially more variance in alignment scores ($R^2 \approx 0.236$) compared to graph-based features ($R^2 \approx 0.064$). TDA outperformed graph metrics in 7 out of 8 model-size combinations tested, suggesting a robust and generalizable signal for reasoning quality.

Discussion and Insights

The analysis reveals that high-quality reasoning possesses a distinct "geometric signature." Effective traces typically maintain a clear "main line" of thought (indicated by narrow $H_0$ width) while occasionally exploring alternative ideas that rejoin the primary path (higher $H_0$ spread and $H_1$ width). Conversely, "long detours"—captured by high $H_1$ max birth/death values—are strong indicators of flawed or inefficient reasoning.

While TDA provides a powerful objective metric, some limitations remain. The current study is focused on competitive mathematics; the applicability of these topological patterns to domains like creative writing or coding is yet to be explored. Furthermore, while "topological holes" correlate with quality, mapping these geometric events to specific logical fallacies remains a challenge for future interpretability research.

Conclusion

By treating reasoning as a geometric structure, this work provides a more nuanced and automated way to evaluate LLM outputs. The identified topological features offer a potential "reward signal" for reinforcement learning, paving the way for training models that reason with greater human-like precision and faithfulness.

Summary updated

BibTeX
@misc{tan2025shape,
  author = {Xue Wen Tan and Nathaniel Tan and Galen Lee and Stanley Kok},
  title = {{The Shape of Reasoning: Topological Analysis of Reasoning Traces in Large Language Models}},
  year = {2025},
  eprint = {2510.20665},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.20665},
}
Figure