HomeNews

EPFL Library of Layers Lets Transformers Reorder at Runtime

Avilasha
Avilasha
•
Nov 3, 2026 5:24 PM
•
0
 min read
Select Emergent as your Preferred news source
EPFL Library of Layers Lets Transformers Reorder at Runtime

💡 TL;DR

  • EPFL and NYU researchers release Library of Layers, a transformer architecture that picks its own layer order per input at inference time.
  • Forcing learned routing paths makes a 360M model execute sudoku strategies with near 100% accuracy, proving fine-grained control over internal reasoning.
  • Router probabilities separate safe from unsafe text with 0.95 AUROC, matching dense baselines on GSM8K and ARC with open-source code now available.

EPFL, NYU, Columbia, and University of Maryland researchers have released Library of Layers (LoL), a transformer architecture that dynamically selects and orders its own blocks during inference. Officially released on November 3, 2026, the paper by Sean McLeish and co-authors demonstrates that a 360M-parameter model can learn distinct layer orderings for different reasoning strategies and execute them with near-perfect accuracy when researchers override the routing mechanism.

The architecture replaces fixed transformer layer stacks with a small router that picks the next block from a shared global library for each input window. A single hyperparameter controlling library size spans the full spectrum from dense models to mixture-of-experts to depth-recurrent architectures.

How Library of Layers Works

Traditional transformers process every input through the same fixed sequence of layers. Library of Layers instead maintains a shared pool of blocks and uses a lightweight router to select which block runs next based on the current input state. This dynamic ordering happens at inference time, allowing the model to adapt its internal computation path to the problem at hand.

The router outputs a probability distribution over the library at each step. Researchers can either let the model choose autonomously or force a predetermined path through the block library. This intervention capability proved central to the team's experiments on algorithmic reasoning and safety classification.

Strategy Control in Sudoku and Mazes

The team trained LoL on five sudoku-solving strategies, each with its own trace syntax showing intermediate steps. After training, they extracted a mode routing path through the router for each strategy. Forcing that learned path at inference produces the requested strategy's trace with close to 100% accuracy.

The same approach worked on 8x8 mazes solved with breadth-first search, depth-first search, A*, bidirectional search, and dead-end filling. Every strategy shares identical output syntax, with only the cell exploration order differing. The model learns distinct routing patterns for each algorithmic approach and can execute any of them on demand.

Safety Classification From Router Probabilities

A ridge regression trained on router probabilities over a 50M-token held-out set separates safe from unsafe text with an AUROC of 0.92 at the window level and 0.95 at the sequence level. The router's internal state encodes enough information about content safety to function as a strong classifier without additional training of the base model.

At 1B parameters on math data, LoL stays within 2 standard errors of a vanilla dense baseline on ARC, HellaSwag, PIQA, and GSM8K. The vanilla full-attention model scores substantially lower on ARC-Easy, suggesting that dynamic routing preserves benchmark performance while adding interpretability and control.

Open-Source Release and Implications

Code is available at github.com/arahmani1/library-of-layers, joining the steady stream of open-source AI research released this quarter. The repository includes training scripts, evaluation harnesses, and the intervention framework that forces specific routing paths.

The research demonstrates that transformers can learn not just what to compute but how to organize that computation internally. By making layer ordering a learned, controllable variable rather than a fixed architectural choice, Library of Layers opens new directions for interpretability research and adaptive inference systems. The ability to steer a model through different reasoning modes by manipulating router probabilities suggests a new class of alignment and control techniques that operate below the token level.

What This Means

Library of Layers proves that transformer architectures can dynamically restructure their own computation graphs at runtime without sacrificing performance on standard benchmarks. The near-perfect strategy control in sudoku and maze experiments shows that internal routing patterns correspond to meaningful algorithmic differences, not random variation. For researchers working on model interpretability and safety, the router probability signal offers a new window into what a model is doing before it generates tokens, with potential applications in content filtering and alignment research.

About the writer

Growth & Marketing professional driving customer acquisition and business growth.

Start Building
on Emergent today
Try Emergent