Explore the research collection
1 entry · Follow this search
- Paper
Library of Layers (LoL): Adaptively Ordering Transformer Layers at Runtime
Every production transformer executes its layers in one fixed order; programs, by contrast, chain the same primitives (conditionals, loops) in different orders per algorithm. Library of Layers (LoL) gives the model a single global library of transformer blocks plus a router that dynamically ORDERS them at inference time for the problem at hand. The architecture has essentially one hyperparameter - the library size - which sweeps a continuum: a small library forces heavy block reuse (depth recurrence / looping), a large library with a subset active per step behaves like sparsity (MoE), and the endpoints recover dense and depth-recurrent designs, so the authors frame LoL as one family generalizing the parameter-efficiency and FLOPs-efficiency trade-offs of all three. Results are parity results, not wins: pretrained on text (FineWeb), LoL is competitive with dense, depth-recurrent, and MoE baselines - main experiments at 360M parameters (GPT-2-Medium shape modernized with RoPE, RMSNorm, SwiGLU, bias-free attention; a 1B variant follows the Llama-3.2-1B shape), and on lm-evaluation-harness benchmarks (ARC-Easy/Challenge, HellaSwag, PIQA, GSM8K) all models sit within 2 standard errors of each other, except the vanilla full-attention model scoring notably lower on ARC-Easy. The distinctive evidence is behavioral: on synthetic sudoku and maze tasks the model uses DISTINCT layer orderings to implement different solution strategies, and the routing can be intervened on to force a chosen strategy onto a given problem instance - the ordering is a controllable computational graph, not just a learned permutation. In a multilingual setting the chosen order patterns differ systematically by language and script. And when LoL is trained on safety data, simple probes fitted to the ROUTER's outputs distinguish safe from unsafe text with high AUROC (the exact figure was not extractable from the HTML full text at catalog time) - the routing decisions themselves carry a readable signal about the input. Caveats: 360M-1B scale throughout; headline text results are parity within noise rather than improvements; the strategy evidence is on synthetic toy tasks, not natural reasoning; runtime reordering costs and behavior at frontier scale are untested. In the catalog's looped-models cluster, LoL is the generalization at the end of the line: a fixed loop is LoL with a one-block library and a hard-coded cyclic order, and MoE is the same routing idea applied across width instead of depth order - LoL routes over both WHICH blocks and IN WHAT SEQUENCE. The intervenable routing and probe-able router state are also the monitoring angle: layer-order choices are an observable, steerable intermediate that fixed-order models do not expose.