Do Transformers Use Their Depth Adaptively? Evidence from a Relational Reasoning Task

Alicia Curth, Rachel Lawrence, Sushrut Karmalkar, Niranjani Prasad

TL;DR

This paper investigates whether large language models (LLMs) adaptively use their depth (number of layers) based on task difficulty. They found that while pretrained models show some signs of adaptive depth use, models specifically fine-tuned for a relational reasoning task exhibit much clearer evidence, especially when fine-tuning doesn't strictly preserve general language modeling abilities. This suggests that LLMs can learn to allocate computational resources more efficiently for harder problems.

What Problem Does This Paper Address?

As LLMs have grown deeper (more layers), it's been assumed this increased depth is crucial for handling complex reasoning and algorithmic tasks. However, recent research has questioned whether all these layers are truly utilized effectively, with some studies suggesting later layers contribute less or that depth isn't systematically exploited for harder problems. This paper aims to resolve this tension by rigorously testing whether LLMs can and do adapt their depth usage based on task difficulty, specifically in a controlled relational reasoning setting. They want to understand if models implicitly "reserve capacity" for more challenging reasoning chains.

Methods

The authors employ two primary interpretability techniques:

  1. Logit Lens: This method allows researchers to probe the model's internal states at different layers. By projecting the hidden states of intermediate layers directly into the vocabulary space using the language model head, they can see how early the model's predictions become decodable and how this evolves with task difficulty.
  2. Causal Patching: This technique helps understand how information flows across tokens and layers. It involves replacing a specific piece of information (e.g., a relationship in a family story) with a counterfactual and then observing how this change propagates through the network. By patching at different layers and tokens, they can pinpoint when information is processed and integrated.

They apply these methods to a controlled multi-hop relational reasoning task.

Datasets

  • CLUTRR (Compositional Language Understanding and Text-based Relational Reasoning): This dataset, specifically the family story generation component, is used. The difficulty is controlled by varying the number of "hops" (relationship compositions) required to answer a question. The authors adapt it to require single-token answers for focused analysis.
  • WikiText-2: Used in the appendix to evaluate the general language modeling ability of finetuned models via perplexity.

Key Insights and Ideas

  • Adaptive Depth is Possible, Especially with Fine-tuning: The most significant finding is that LLMs can adapt their depth usage to task difficulty, particularly when fine-tuned on the specific task. This contrasts with some prior work that found limited evidence for this in pretrained models.
  • Fine-tuning Regimes Matter: The way a model is fine-tuned significantly impacts its adaptive depth use. Less constrained fine-tuning (that doesn't strictly preserve general language modeling abilities) shows stronger adaptive behavior, suggesting that models can learn to prioritize task-specific reasoning over general linguistic fluency.
  • Pretrained Models Show Nuanced Adaptation: While not as pronounced as in finetuned models, pretrained models do exhibit some adaptive depth use. Larger models, for instance, seem to need fewer layers for easier tasks, and models generally use more layers to integrate information as reasoning chains get longer.
  • Depth for Information Integration vs. Prediction: The study distinguishes between when a prediction becomes decodable (logit lens) and when information is integrated across tokens (causal patching). Models tend to use more layers for information integration as chain length increases, suggesting this is a key area where depth adaptation occurs.
  • General Language Modeling Ability as a Constraint: The need to preserve general language modeling abilities (like detokenization) seems to constrain how much depth can be "freely" allocated for harder reasoning tasks in pretrained and some finetuned models.

Key Results

  • Pretrained Models:
    • Larger models (e.g., Phi-4-Reasoning, Qwen2.5-7B) show some evidence of needing fewer layers for easier tasks.
  • Across models, longer relationship chains generally lead to earlier cross-token information integration.
  • Finetuned Models:
    • Full Fine-tuning: Shows clearer adaptive depth use in logit lens decoding (harder tasks rise later in the network). However, these models tend to lose general language modeling ability and don't generalize well to longer stories.
  • LoRA Fine-tuning: Models preserve general language modeling ability and generalize better. They show less evidence of adaptive depth use in logit lens decoding compared to full fine-tuning, but still adapt depth for information integration across tokens.
  • LoRA (less constrained): Showed the strongest evidence of adaptive depth use, arriving at plausible predictions earlier for easier tasks and using more layers for information integration.

Limitations and Future Work

  • Controlled Task: The study uses a highly controlled relational reasoning task. Whether these findings generalize to more open-ended, natural language tasks remains an open question.
  • Pretrained Model Limitations: The paper notes that the "controlled setup" for pretrained models might have masked subtle differences observed in prior work (Hu et al., 2025), suggesting that task definition and averaging metrics can influence findings.
  • Fine-tuning Trade-offs: The paper highlights the trade-off between task specialization (full fine-tuning) and preserving general capabilities (LoRA). Future work could explore optimal fine-tuning strategies.
  • Understanding (Mis)alignment: The authors suggest future work should investigate what drives the differences in how model families align their residual streams with output embeddings, and whether the proportion of the network dedicated to different inference stages is steerable.

Summary updated

BibTeX
@inproceedings{curth2026do,
  author = {Alicia Curth and Rachel Lawrence and Sushrut Karmalkar and Niranjani Prasad},
  title = {{Do Transformers Use Their Depth Adaptively? Evidence from a Relational Reasoning Task}},
  booktitle = {LLM Reasoning @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=AA2y3W6dqx},
}
Figure