Skip a Layer or Loop It? Learning Program-of-Layers in LLMs
Ziyue Li, Yang Li, Tianyi Zhou
Abstract
Large language models (LLMs) perform inference by following a fixed depth and order, non-recurrent execution of all layers. We reveal the wide existence of training-free, flexible, dynamic "program-of-layers (PoLar)", where pretrained layers can be packed as modules and then skipped or looped to form a customized program for each input. For most inputs, substantially shorter program executions can achieve the same or better accuracy, while incorrect predictions of the original LLM can be corrected by alternative programs with fewer layers. These observations indicate that inference admits multiple valid latent computations beyond the standard forward pass. To efficiently achieve PoLar in practice, we propose a lightweight PoLar prediction network, which learns to generate execution programs that dynamically skip or repeat pretrained layers for each input. Experiments on mathematical reasoning benchmarks demonstrate that PoLar consistently improves accuracy over standard inference and prior dynamic-depth methods, often while executing fewer layers, and that these gains persist under out-of-distribution evaluation. Our results suggest that fixed-depth execution captures only a narrow subset of an LLM’s latent reasoning capacity.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Faster Depth-Adaptive Transformers cites Reducing Transformer Depth on Demand with Structured Dropout
- Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't cites Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computation
Cited by top-tier papers1
Builds on10
- Reducing Transformer Depth on Demand with Structured DropoutAngela Fan, Edouard Grave, Armand JoulinICLR 2020 · 695 citations
- FastBERT: a Self-distilling BERT with Adaptive Inference TimeWeijie Liu, Peng Zhou, Zhiruo Wang, Zhe Zhao et al.ACL 2020 · 257 citations
- Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level ComputationSangmin Bae, Yujin Kim, Reza Bayat, Sungnyun Kim et al.NeurIPS 2025 · 143 citations
- ShortGPT: Layers in Large Language Models are More Redundant Than You ExpectXin Men, Mingyu Xu, Qingyu Zhang, Qianhao Yuan et al.ACL Findings 2025 · 60 citations
- Faster Depth-Adaptive TransformersYijin Liu, Fandong Meng, Jie Zhou, Yufeng Chen et al.AAAI 2021 · 44 citations
Related papers
- DiffSkip: Differential Layer Skipping in Large Language ModelsXuan Luo, Weizhi Wang, Xifeng YanACL Findings 2025 · 3 citations
- Dr.LLM: Dynamic Layer Routing in LLMsAhmed Heakl, Martin Gubri, Salman Khan, Sangdoo Yun et al.ICLR 2026 · 11 citations
- D-LLM: A Token Adaptive Computing Resource Allocation Strategy for Large Language ModelsYikun Jiang, Huanyu Wang, Lei Xie, Hanbin Zhao et al.NeurIPS 2024 · 39 citations
- Position-Aware Depth Decay Decoding (D³): Boosting Large Language Model Inference EfficiencySiqi Fan, Xuezhi Fang, Xingrun Xing, Peng Han et al.ACL Findings 2025 · 4 citations
- Offloaded Reasoning: Efficient Inference for Large Language Models via Modular Reasoning and RefinementIshan Jindal, Jayant Taneja, Chandana Badrinath, Vikas Kapur et al.EMNLP Findings 2025
