Introduction
Modern Large Language Models (LLMs) typically employ a rigid, fixed-depth architecture where every input passes through the same sequence of layers. This static approach is fundamentally inefficient: it wastes computational resources on simple queries that could be resolved early, while simultaneously capping the reasoning capacity for highly complex tasks that require iterative processing. While "early exiting" and "looped transformers" have been proposed, they often require specialized training or architectural changes. This paper introduces Chain-of-Layers (CoLa), a method to dynamically adapt the depth of off-the-shelf pretrained LLMs at test time without any additional finetuning.
Methodology: Chain-of-Layers (CoLa)
CoLa treats the layers of a pretrained LLM as independent, composable modules. For any given input, the system can dynamically construct an execution path by either skipping redundant layers or repeating specific blocks of layers to enable iterative refinement, similar to a Recurrent Neural Network.
To navigate the massive combinatorial search space of possible layer sequences, the authors utilize Monte Carlo Tree Search (MCTS). The search algorithm identifies the optimal execution plan per input by balancing an Upper Confidence Bound (UCB) objective that rewards accuracy while penalizing excessive path length. This process is conducted entirely at inference time, leaving model weights untouched.
Experimental Analysis
The authors evaluated CoLa using LLaMA-3 (3B and 8B) and OLMoE-1B-7B models across commonsense reasoning (ARC-Easy, ARC-Challenge) and mathematical reasoning (DART-Math) benchmarks.
The Inefficiency of Fixed Paths
A striking finding is that the default sequential forward pass is rarely the optimal path. For over 75% of correctly predicted samples, CoLa identifies a shorter path that maintains accuracy, suggesting that models frequently "overthink" simple problems. Conversely, for over 60% of samples where the base model fails, CoLa discovers a custom path that corrects the prediction. This implies that many errors stem from noisy layers or insufficient depth rather than a lack of knowledge in the weights.
Key Results
CoLa demonstrates that combining skip and recurrence operations leads to dramatic performance improvements, particularly on difficult tasks.
On the DART-2 math benchmark, LLaMA-3-8B-Instruct's accuracy improved from 6.0% with the fixed path to 66.2% using CoLa. Furthermore, the most efficient paths found by CoLa allow for up to 30% depth compression in 3B and 8B models without sacrificing correctness. Interestingly, paths that correct initial errors (Wrong → Correct) are often shorter than those for initially correct inputs, suggesting that error correction frequently involves bypassing misleading transformations.
Conclusion and Future Directions
While CoLa reveals significant untapped potential in standard transformer architectures, its current reliance on MCTS introduces substantial computational overhead (requiring ~200 simulations per input). This makes it an analytical tool for understanding model capabilities rather than a real-time inference solution. However, these results provide a roadmap for future work: training lightweight "routers" to predict optimal CoLa paths could eventually unify fast and slow reasoning in LLMs, providing the accuracy and efficiency gains of CoLa without the search overhead.
Summary updated