GraphGhost: Tracing Structures Behind Large Language Models

Xinnan Dai, Kai Guo, Chung-Hsiang Lo, Shenglai Zeng, Jiayuan Ding, Dongsheng Luo, Subhabrata Mukherjee, Jiliang TangarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) have demonstrated remarkable multi-step reasoning capabilities, yet the internal mechanisms driving these processes remain opaque. Traditional interpretability tools often rely on local token-level attribution, failing to capture the global structure of reasoning. We present GraphGhost, a framework that maps internal LLM interactions as structured graphs. By tracing dependencies through layers and identifying recurring patterns, GraphGhost reveals "reasoning primitives" such as semantic merging and logical triggers. Our evaluation across mathematical, logical, and scientific domains shows that GraphGhost significantly outperforms standard baselines in identifying critical reasoning paths and enables surgical mechanistic interventions.

Introduction: Beyond Token Importance

While LLMs excel at complex tasks like mathematical word problems, understanding how they compose these solutions is a significant challenge. Most current interpretability methods utilize saliency maps or attention weights to highlight important tokens. However, these methods are inherently localized; they identify which inputs matter but do not explain the structure of the reasoning process.

GraphGhost provides a global view of token interactions compared to traditional token-level attribution and human-aligned reasoning steps.

There exists a substantial gap between the human-readable "Chain of Thought" (CoT) produced in outputs and the high-dimensional neuron activations within transformer blocks. GraphGhost bridges this gap by treating the model's internal state as a global information flow, mapping the "reasoning blueprints" hidden within the layers.

Methodology

GraphGhost introduces a graph-based framework to model internal interactions from two distinct perspectives: the Sample View and the Dataset View.

The Sample View

For any single prediction, GraphGhost traces dependencies backward through the model's layers. It employs Transcoders—a variant of Sparse Autoencoders—to decompose dense neuron activations into interpretable features. This process results in a directed graph that illustrates how specific input tokens flow into intermediate representations and eventually converge into the final output.

The Dataset View

By aggregating thousands of individual sample graphs, GraphGhost identifies recurring structural patterns. This global perspective reveals the "reasoning primitives" the model has internalized during training.

The GraphGhost framework generates attributed graphs for next-token prediction, providing both sample-specific and dataset-wide views of reasoning structures.

Graph Metrics for Interpretability

The framework applies classic graph theory metrics to analyze these structures:

  • In-degree: Identifies "Semantic Merging" points where multiple signals converge into a single concept.
  • PageRank: Highlights "Reasoning Triggers"—influential nodes that initiate transitions between logical steps (e.g., triggering the word "Step" or "So").

Experimental Setup

The researchers evaluated GraphGhost using models including Qwen3-0.6B, Llama 3.1-8B, and DeepSeek-distilled variants across several reasoning domains:

  • Mathematical: GSM8K and MAWPS.
  • Logical: ProntoQA and BoolQA.
  • Scientific: ARC-Easy and QASC.

Key Insights and Results

Structural Discoveries

GraphGhost reveals that Semantic Merging is Physical: tokens like "1" and "0" physically converge in middle layers to form a unified numerical representation of "10." Furthermore, the framework identifies Layer Specialization, where middle layers handle semantic merging and higher layers act as logical controllers.

Mechanistic Control

By identifying structurally critical nodes via PageRank, researchers performed surgical interventions. Muting a single high-influence node could force a model out of a repetitive loop or even switch its output language, providing causal evidence that these graphs represent functional reasoning paths.

Performance Metrics

In "Fidelity vs. Sparsity" tests, GraphGhost significantly outperformed attention-based baselines. On the challenging ARC dataset, it was the only method to maintain a fidelity threshold above 0.5, demonstrating its ability to capture deep, multi-hop dependencies.

Conclusion and Future Work

GraphGhost provides a powerful lens for viewing the internal logic of LLMs. While its fidelity depends on the quality of underlying circuit tracing, it offers a path toward more precise mechanistic understanding. Future work will focus on refining these tracers and exploring how internal reasoning structures evolve during fine-tuning and reinforcement learning.

Summary updated

BibTeX
@misc{dai2025graphghost,
  author = {Xinnan Dai and Kai Guo and Chung-Hsiang Lo and Shenglai Zeng and Jiayuan Ding and Dongsheng Luo and Subhabrata Mukherjee and Jiliang Tang},
  title = {{GraphGhost: Tracing Structures Behind Large Language Models}},
  year = {2025},
  eprint = {2510.08613},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.08613},
}
Figure