Dr.LLM: Dynamic Layer Routing in LLMs
Ahmed Heakl, Martin Gubri, Salman Khan, Sangdoo Yun, Oh, Seong Joon · 2026 · 12 citationsRead the paper
Large Language Models (LLMs) process every token through all layers of a transformer stack, causing wasted computation on simple queries and insufficient flexibility for harder ones that need deeper reasoning. Adaptive-depth methods can improve efficiency, but prior approaches rely on costly inference-time search, architectural changes, or large-scale retraining, and in practice often degrade accuracy despite efficiency gains. We introduce Dr. LLM, Dynamic routing of Layers for LLMs, a retrofittable framework that equips pretrained models with lightweight per-layer routers deciding to skip, execute, or repeat a block. Routers are trained with explicit supervision: using Monte Carlo Tree Search (MCTS), we derive high-quality layer configurations that preserve or improve accuracy under a compute budget. Our design, windowed pooling for stable routing, focal loss with class balancing, and bottleneck MLP routers, ensures robustness under class imbalance and long sequences. On ARC (logic) and DART (math), Dr. LLM improves accuracy by up to +3.4%p while saving 5 layers per example on average. Routers generalize to out-of-domain tasks (MMLU, GSM8k, AIME, TruthfulQA, SQuADv2, GPQA, PIQA, AGIEval) with only 0.85% accuracy drop while retaining efficiency, and outperform prior routing methods by up to +7.7%p. Overall, Dr. LLM shows that explicitly supervised routers retrofit frozen LLMs for budget-aware, accuracy-driven inference without altering base weights. Code is available at https://github.com/parameterlab/dr-llm.
What the full text shows
Working prototype- Improved accuracy on reasoning tasks while reducing compute. — +3.4%p accuracy and 3-11 fewer layers per query (ARC (logic) and DART (math) benchmarks)
- Reduction in end-to-end generation wall-clock latency. — 15.3% reduction (29.21s vs 34.49s baseline) (Sequences of 1,000 tokens)
- Generalization to out-of-domain tasks with minimal performance loss. — 0.85% average accuracy drop (MMLU, GSM8k, AIME, TruthfulQA, SQuADv2, GPQA, PIQA, AGIEval)
- Outperformed prior routing methods on specific benchmarks. — up to +7.7%p accuracy (Compared to other adaptive-depth methods)
- Low training overhead for router parameters. — 11M to 16.8M parameters (0.14% to 0.56% of base weights) (LLaMA-3.2 3B and 8B models)
- Setup
- Tested on LLaMA-3.2 (3B, 8B) and Qwen-2.5 (3B, 7B) models; routers trained on 4k MCTS-derived tuples from ARC and DART datasets using a single NVIDIA A100 40GB GPU.
- How
- The framework retrofits frozen LLMs with per-layer bottleneck MLP routers that decide to skip, execute, or repeat a block based on windowed mean-pooled hidden states. Routers are trained using supervised learning on high-quality routing paths generated offline via Monte Carlo Tree Search (MCTS) and optimized with focal loss.
- Limitations
- Requires offline MCTS search to generate the initial supervised training dataset · Router performance on out-of-domain tasks shows a slight accuracy degradation (0.85%p)
Summarized by Gemma 4 from the open-access full text · 25 Nov 2026. Read it