Library of Layers (LoL): Adaptively Ordering Transformer Layers at Runtime
Not on the map. Why?
Abstract (arXiv)
Computer programmers chain together the same reusable computational primitives, for example, conditional statements or loops, but in different orders to implement different algorithms. In contrast, existing language model architectures always execute their layers in the same order. We introduce Library of Layers (LoL), an architecture that dynamically orders its layers during inference to solve the problem at hand. LoL has a single hyperparameter, the size of its global library of transformer blocks, that allows it to transition seamlessly between parameter reuse and sparsity, generalizing the parameter-efficiency and FLOPs-efficiency tradeoffs of dense, depth-recurrent, and mixture of experts architectures in one unified family. We show that LoL achieves competitive performance with all three above baselines when pretrained on text data. On synthetic sudoku and maze data, we observe that the model employs distinct layer orderings to implement different solution strategies, and we can intervene on routing to force a model to apply a specific solution strategy to a problem instance. In a multilingual natural language setting, we find that LoL chooses different layer order patterns based on language and script. Similarly, we train LoL on safety data and fit probes to its router outputs, finding that these probes distinguish safe from unsafe text with high AUROC. LoL provides a path toward a future in which models dynamically compose their own computational graph, enabling more efficient and controllable reasoning.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Builds on 46 of its 61 references that are in the map. Submitted 2 Nov 2026.
Builds on
46 of 61 references.
References · 46
- 2017Attention Is All You Needcited by 62,125
- 2021Training Verifiers to Solve Math Word Problemscited by 11,055
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,433
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 5,336
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 5,132
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,388
- 2017Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layercited by 3,767
- 2021Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsitycited by 3,272
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 3,052
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,890
- 2017FiLM: Visual Reasoning with a General Conditioning Layercited by 2,620
- 2020GLU Variants Improve Transformercited by 2,000
34 more
- 2019Root Mean Square Layer Normalizationcited by 1,624
- 2026DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligencecited by 1,363
- 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,356
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 744
- 2025Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approachcited by 526
- 2024LayerSkip: Enabling Early Exit Inference and Self-Speculative Decodingcited by 354
- 2025Reasoning with Latent Thoughts: On the Power of Looped Transformerscited by 303
- 2024Mixture-of-Depths: Dynamically allocating compute in transformer-based language modelscited by 294
- 2023Looped Transformers as Programmable Computerscited by 283
- 2024Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Expertscited by 236
- 2024OpenMathInstruct-2: Accelerating AI for Math with Massive Open-Source Instruction Datacited by 224
- 2023AI Deception: A Survey of Examples, Risks, and Potential Solutionscited by 211
- 2025Mixture-of-Recursions: Learning Dynamic Recursive Depths for Adaptive Token-Level Computationcited by 189
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 186
- 2025FineWeb2: One Pipeline to Scale Them All -- Adapting Pre-Training Data Processing to Every Languagecited by 181
- 2024You Only Cache Once: Decoder-Decoder Architectures for Language Modelscited by 175
- 2021Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networkscited by 128
- 2024Looped Transformers for Length Generalizationcited by 119
- 2026Parcae: Scaling Laws For Stable Looped Language Modelscited by 92
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 89
- 2025Teaching Pretrained Language Models to Think Deeper with Retrofitted Recurrencecited by 76
- 2024MoEUT: Mixture-of-Experts Universal Transformerscited by 68
- 2022A Generalist Neural Algorithmic Learnercited by 63
- 2025Safety Pretraining: Toward the Next Generation of Safe AIcited by 54
- 2025DataDecide: How to Predict Best Pretraining Data with Small Experimentscited by 51
- 2025Nemotron-CC-Math: A 133 Billion-Token-Scale High Quality Math Pretraining Datasetcited by 44
- 2025Gemstones: A Model Suite for Multi-Faceted Scaling Lawscited by 25
- 2026Fast-weight Product Key Memorycited by 15
- 2024Mixture-of-Modules: Reinventing Transformers as Dynamic Assemblies of Modulescited by 12
- 2024Rethinking Deep Thinking: Stable Learning of Algorithms using Lipschitz Constraintscited by 10
- 2026Towards Looped Models Done Right, Part I: Topology, Input Injection, Recurrent-State Designcited by 8
- 2026Code2LoRA: Hypernetwork-Generated Adapters for Code Language Models under Software Evolutioncited by 7
- 2026Do Transformers Need Three Projections? Systematic Study of QKV Variantscited by 5
- 2026Mixture of Layers with Hybrid Attentioncited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Relaxed Recursive Transformers: Effective Parameter Sharing with Layer-wise LoRA
- 2026Skip a Layer or Loop It? Learning Program-of-Layers in LLMs
- 2026Adaptive Loops and Memory in Transformers: Think Harder or Know More?
- 2025LLMCache: Layer-Wise Caching Strategies for Accelerated Reuse in Transformer Inference
- 2025When Fewer Layers Break More Chains: Layer Pruning Harms Test-Time Scaling in LLMs
- 2026LEAP: Layer-wise Exit-Aware Pretraining for Efficient Transformer Inference
- 2026Aletheia: Gradient-Guided Layer Selection for Efficient LoRA Fine-Tuning Across Architectures
- 2021Greedy-layer Pruning: Speeding up Transformer Models for Natural Language Processing