Library of Layers: models which adapt layer order per input, routing over whole transformer blocks.
This opens up a new avenue to control: the execution path the model uses. We use this to control the algorithm used to solve mazes and sudoku by only changing the layer order.
🧵 1/n
Enhancing LLM sample efficiency.
Intelligence is not how much one knows, but how rapidly one learns.
We find that if transformers periodically “sleep”, or replay their inputs N times without accepting new ones, they are able to learn from fewer tokens in context.
New paper w/ Yihe Dong, @DimitrisPapail & @ShivamGarg91462: Perturbing Inputs Improves Pretraining Distillation.
In pretraining distillation, a small student LM learns to match a larger teacher’s next-token predictions on the training text. We change one thing: for the first part of training, both models read a perturbed version of the text (for example, with noise added to the token inputs), and the student matches the teacher’s predictions on that. Then we switch back to clean text.
With the same steps and token budget, this beats standard distillation, and it also works well in data-constrained, multi-epoch settings. 🧵
After reading the MEMENTO paper (@vkontonis@DimitrisPapail) I wondered if compactions needs explicit text at all. Turns out latent compaction is possible!
AbridgeKV trains the model to compress its own output. Keeping 1/4 of the generated cache, it matches full-KV accuracy on competition math problem suite and finishes 3.2× faster on one H100. 🧵
SphereEncoder2 is out! Our 2nd-gen ImageNet model achieves SOTA image quality (FDr6 score) among all known pixel-space image generators, including diffusions.
The Sphere Encoder is a faster alternative to diffusion that produces images in a single forward pass. It's basically an autoencoder on steroids that maps 100k-dimensional random latent vectors directly to natural images. Here's some single-pass images from a model trained only on ImageNet-1K.
Came across this interesting work by Chen et al. on loss spikes in LM pretraining. They trace this late emerging spike (⌛️💣 :) to rounding errors in the output layer. Interesting part is they show why three fixes (z-loss, μ-centering and momentum SGD) help in the same way.
1/12
@engmubarak49 Really interesting! We tried some random routing at the beginning too, but were trying to do it per token. Our LoL models perform worse when picking a random path cause they're trained with a router, but perhaps there is a better version taking the best of both our papers.
Library of Layers: models which adapt layer order per input, routing over whole transformer blocks.
This opens up a new avenue to control: the execution path the model uses. We use this to control the algorithm used to solve mazes and sudoku by only changing the layer order.
🧵 1/n
📄 Library of Layers (LoL): Adaptively Ordering Transformer Layers at Runtime
by Abdellah Rahmani (@arahmani_AR), Sean McLeish (@SeanMcleish) et al.
A router selects the next block from a shared layer library at each depth, so execution order changes per input instead of staying fixed.
Key points:
• Safety probe on sequence-level routing features reaches 0.95 AUROC
• Maze strategy control hits 99.79-100% correct forced-strategy traces
• Sudoku forced routing yields 99.5-100% requested-strategy accuracy
Shows that layer order can be a learned, controllable part of transformer computation rather than a fixed architectural choice.
@KaplFer@kaitlinmaile@oswaldjoh@Google@stefanAbauer You can also grow looped transformers by progressively increasing the number of iterations during training! We explored this in Retrofitting Recurrence: https://t.co/oSauOzU7iE
Programmers build wildly different algorithms by chaining the same few primitives in different orders. LLMs can’t: every input runs through the same layers in the same order. So we built a model that re-orders its own forward pass at runtime. 🧵 1/11
@waxhn@m_elhoushi Causal within a window. Then, per depth, the windows are strided so each token is now doing causal attention with a slightly different set of tokens to the prior depth. This allows information to flow like in sliding window attention.
Library of Layers (LoL): Adaptively Ordering Transformer Layers at Runtime
Library of Layers lets models dynamically reorder a shared pool of transformer blocks during inference, achieving competitive results while enabling controllable problem-solving.
https://t.co/C4f59Mzslw
Programmers build wildly different algorithms by chaining the same few primitives in different orders. LLMs can’t: every input runs through the same layers in the same order. So we built a model that re-orders its own forward pass at runtime. 🧵 1/11
What if an LLM could adapt its layer order to each input?
What if it learned a different layer order for each classic algorithm that solves Sudoku or mazes, and you could fix that order at inference to choose which algorithm it runs?
Meet LoL in under 4 minutes 🎥 (1/3)
What if we thought of layers as flexible building blocks that can be rearranged and parsed in an optimal order conditioned on the input itself? Our new work explores this question👇
Big congrats to @arahmani_AR, @SeanMcleish, @micahgoldblum on this great work!
As someone who's bitter lesson pilled, I've always been fascinated by the idea of learning model arch through gradient descent rather than relying on inductive biases.
MoE brought sparsity and dynamic routing to FFNs within individual transformer layers. Can we do the same across layers themselves?
Congrats to @arahmani_AR and @SeanMcleish on this great work!