Representing and navigating hierarchy is a fundamental primitive of reasoning. Large language models have demonstrated proficiency in a wide variety of tasks requiring hierarchical reasoning, but there exists limited analysis on how the models geometrically represent the necessary latent constructions for such thinking. To this end, we develop H-probes, a collection of linear probes that extract hierarchical structure, specifically depth and pairwise distance, from latent representations. In synthetic tree traversal tasks, the H-probes robustly find the subspaces containing hierarchical structure necessary to complete the tasks; furthermore, in comprehensive ablation experiments, we show that these hierarchy-containing subspaces are low-dimensional, causally important for high task performance, and generalize within- and out-of-domain. Furthermore, we find analogous, though weaker, hierarchical structure in real-world hierarchical contexts such as mathematical reasoning traces. These results demonstrate that models represent hierarchy not only at the level of syntax and concepts, but at deeper levels of abstraction -- including the reasoning process itself.
Figures & tables
Figure 1: Example of our experimental procedure, in which the model (R1-distilled Qwen 14B) correctly solves a two-step tree traversal problem as we probe its internal hierarchical representations. Left, we show the (abridged) prompt and model response, with the node tokens in the final “PATH” output manually highlighted by their depth in the binary tree. Right, we plot the model’s layer-31 latent space activations for those node tokens, projected to the first 2 principal components of the hierarchical subspace identified by our H-probes framework; each activation is labeled by its corresponding node token, color-coded by tree depth, connected by solid lines to activations corresponding to the same tree node (i.e., with multiple visitations), and annotated by arrows to adjacent nodes in the tree traversal.
Figure 2: Distance and depth is well-described by the learned H-probes framework in terms of both mean squared error (MSE) and Pearson correlation. Here we show layer-wise probe performance for the 14B-parameter reasoning model; MSE and Pearson correlation is impressive across layers, but especially for layers ∼25 -35.
Figure 3: Subspaces identified by both the distance and depth probes are highly similar when trained on five distinct subsets of the tree traversal dataset, indicating that H-probes find universal hierarchical structure. Left, the mean cosine similarity between distance probe subspaces is measured; right, the cosine similarity between linear directions identified by depth probes.
Figure 4: Out-of-distribution transfer from probes trained on depth 1–2 trees to held-out examples from depth 3–4 trees. Distance transfers strongly, while depth transfer is weaker, but still above baseline. Note that, for MSE, the tree depth likely skews errors due to the larger tree structure.
Figure 5: H-probes performance co-occurs with task success. Left, the overall task accuracy and probe performance per-model across the reasoning model sizes (1.5B, 7B, 14B); right, the per-example partial accuracy and probe performance, aggregated across the same model sizes (and with circular markers indicating the number of examples in each bin).
Figure 6: Ablating the distance probe subspace affects model accuracy to a similar extent as ablating the top principal components, indicating that the hierarchical structure identified by H-probes is causally important.
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 7: PCA component sweep for the 14B reasoning model. Increasing the number of retained principal components improves probe fidelity up to k=50 , but also makes the resulting ablation less targeted, as measured by mean absolute logit shift. We use k=10 as an interpretable low-dimensional operating point.
Model
p=2 best MSE
p=3 best MSE
p=4 best MSE
p=5 best MSE
DeepSeek-R1-Distill-Qwen-1.5B
1.2986
1.2435
1.2447
1.2303
DeepSeek-R1-Distill-Qwen-7B
0.5689
0.5858
0.5856
0.5846
DeepSeek-R1-Distill-Qwen-14B
0.4081
0.4024
0.4017
0.4022
Qwen1.5-1.8B-Chat
1.3691
1.3186
1.3028
1.3036
Qwen1.5-7B-Chat
1.4391
1.3662
1.3446
1.3371
Qwen1.5-14B-Chat
1.3504
1.2782
1.2557
1.2514
Appendix
Table 1: Best test distance MSE across layers for each projection dimension p (PCA10 preprocessing).
Model
Exact Acc.
Partial Acc.
DeepSeek-R1-Distill-Qwen-1.5B
0.227
0.360
DeepSeek-R1-Distill-Qwen-7B
0.705
0.790
DeepSeek-R1-Distill-Qwen-14B
0.885
0.901
Qwen1.5-1.8B-Chat
0.025
0.251
Qwen1.5-7B-Chat
0.071
0.347
Qwen1.5-14B-Chat
0.179
0.420
Appendix
Table 2: Traversal accuracy across all models (exact and partial). Reasoning models substantially outperform non-reasoning models.
Model
Depth MSE (test, best layer)
Pearson r (test, best layer)
DeepSeek-R1-Distill-Qwen-1.5B
0.5194
0.3949
DeepSeek-R1-Distill-Qwen-7B
0.4493
0.4158
DeepSeek-R1-Distill-Qwen-14B
0.4796
0.3656
Qwen1.5-1.8B-Chat
0.6312
0.2054
Qwen1.5-7B-Chat
0.6101
0.3038
Qwen1.5-14B-Chat
0.5538
0.3380
Appendix
Table 3: Best-layer depth probe performance: test-set MSE and Pearson r . Depth probes are trained via ridge regression ( λ=0.01 ) on PCA10-projected activations.
Figure 8: Representative examples of hierarchical representations identified by our H-probes framework, demonstrating that models geometrically represent tree structure even in complicated traversals requiring backtracking (i.e., visitations of the same node multiple times). Top, we highlight one example; left, the model’s latent activations projected to the distance probe subspace and, right, we include the ground-truth tree. Bottom, we display six other examples, chosen due to their high quality despite complicated traversals. All examples are annotated by arrows between traversal steps, solid lines between activations corresponding to the same node (e.g., as occurs from backtracking), and color-coded by tree depth.
Figure 9: Layer-sweep logit shifts under ablation of the H-probe subspace versus baselines.
Figure 10: Layerwise probe statistics; reasoning 1.5B and 7B; distance and depth metrics over layers
Figure 11: Layerwise probe statistics; reasoning 14B and chat 1.8B; distance and depth metrics over layers
Figure 12: Layerwise probe statistics; chat 7B and 14B; distance and depth metrics over layers
Figure 13: Layer-sweep logit shifts; reasoning 1.5B and 7B; node-logit sensitivity across layers
Figure 15: Ablation results; reasoning 1.5B; accuracy and node-logit effects under probe and control ablations
Figure 16: Ablation results; reasoning 7B; accuracy and node-logit effects under probe and control ablations
Figure 17: Ablation results; chat 1.8B; accuracy and node-logit effects under probe and control ablations
Figure 18: Ablation results; chat 7B; accuracy and node-logit effects under probe and control ablations
Figure 19: Ablation results; chat 14B; accuracy and node-logit effects under probe and control ablations
Figure 20: Exact-only ablation results on GSM8K for the 14B reasoning model (left) and the 14B chat model (right). In both models, ablating the distance-probe subspace degrades performance on originally correct examples more than a rank-matched random control, indicating that the hierarchical structure identified by H-probes remains causally relevant beyond the synthetic tree setting.
Figure 21: Layer-wise H-probe performance on GSM8K for the 14B reasoning model (left) and the 14B chat model (right). In both models, probes recover nontrivial depth and pairwise-distance structure above shuffled baselines, though the signal is weaker and less uniform than in the controlled tree-traversal setting.
Figure 22: Similarity of distance subspaces and depth directions across five disjoint GSM8K subsets for the 14B reasoning model (left) and the 14B chat model (right). The recovered structures remain broadly stable across splits in both models.
Category
Accuracy
n
Fundamental binary
39.29%
84
Fundamental multiple
65.41%
159
JSON
42.86%
28
Code
52.38%
21
Formula
43.47%
681
Paper
26.55%
27
Appendix
Table 4: DeepSeek-R1-Distill-Qwen-14B on 1,000 uniformly sampled questions from HiBench. The strongest category was Fundamental multiple-tree reasoning, which motivated the focused probe and ablation follow-up on leaf and common_ancestor .
Baseline
Probe
Random
Zero
Overall (leaf + common_ancestor, n=165 )
Accuracy
21.21%
20.00%
21.21%
0.00%
common_ancestor only ( n=82 )
Accuracy
40.24%
40.24%
42.68%
0.00%
Exact retention
—
51.52%
72.73%
0.00%
Inexact rescue
—
32.65%
22.45%
0.00%
Appendix
Table 5: HiBench ablation results for DeepSeek-R1-Distill-Qwen-14B on leaf and common_ancestor . The probe ablation disrupts originally correct answers on common_ancestor more than random ablation, indicating that the learned subspace is behaviorally relevant, but the net accuracy change is small. We hypothesize this is because of a concurrent rescue of incorrect answers. We note that the leaf subtask had near-floor baseline accuracy and is not interpretable causally.