Abstract
Standard Transformer-based models are computationally rigid, allocating the same parameters and floating-point operations (FLOPs) to every token regardless of its complexity. We present SkipLayer, a framework for dynamic, per-token layer skipping. By decoupling model capacity from per-token computation using a differentiable binary router, SkipLayer allows models to reserve full power for "hard" tokens while breezing through "easy" ones. Our results show significant performance gains in few-shot learning and up to a 3x speedup in training and inference.
Introduction
Human cognition is adaptive; we process filler words quickly and slow down for complex concepts. In contrast, standard Large Language Models (LLMs) treat common stop-words like "the" and rare technical terms with equal computational weight. This "one-size-fits-all" approach is inherently inefficient. While conditional computation has been explored previously, training it end-to-end and implementing it efficiently on modern hardware like TPUs remains a significant challenge. SkipLayer addresses these hurdles with a simple wrapper architecture and an optimized implementation strategy.
Methods: The SkipLayer Framework
SkipLayer acts as a wrapper around standard neural network layers, such as Feed-Forward Networks (FFN) or Attention modules.
Binary Routing and Differentiable Training
Each SkipLayer employs a "router" that generates a binary decision—execute or skip—based on the input token's representation. To enable end-to-end training via backpropagation, the authors utilize the Straight-Through Gumbel-Softmax trick. This allows the model to learn which tokens are worth the extra compute and which can be bypassed without losing performance.
Partial Attention Skipping
A critical challenge in skipping Transformer layers is maintaining context. If a token is skipped entirely, subsequent tokens lose its information in the self-attention mechanism. SkipLayer introduces a "partial skip" for attention: it always computes Key and Value projections to preserve the token's presence in the context window, but skips the expensive Query and Attention calculations for the skipped token itself.
TPU-Efficient Implementation
To maintain high throughput on TPUs, which favor static tensor shapes, SkipLayer uses a "gather-and-scatter" approach. Non-skipped tokens are grouped into fixed-size batches (Gsize), processed in parallel, and then scattered back to their original sequence positions. This avoids the overhead typically associated with dynamic branching.
Experimental Setup
The models were pretrained on a massive 1.6 trillion token corpus. Evaluation spanned 24 NLP tasks, including generative benchmarks (TriviaQA, SQuADv2) and understanding tasks (ARC, HellaSwag). The study primarily focused on 1-shot performance to test the models' ability to generalize with minimal examples.
Key Results
SkipLayer consistently outperforms dense baselines at equivalent compute budgets, effectively shifting the Pareto frontier of performance versus efficiency.
- Efficiency Gains: A 24-layer SkipLayer model with 25% density achieved a 51.5% performance gain over a 6-layer baseline while using only 18.2% more FLOPs.
- Scaling: A 96-layer model with 25% density matched a dense 48-layer model's performance while offering significantly higher decoding efficiency.
- Speed: The framework delivered up to 3x training speedups on TPU v4 hardware. Qualitative analysis confirmed the model naturally learns to skip functional words (e.g., "-ed", "to") while consistently activating for content-heavy terms.
Conclusion
SkipLayer demonstrates that learning to skip is a viable path toward more efficient and capable LLMs. By intelligently allocating compute based on token difficulty, models can achieve higher accuracy without proportional increases in latency. Future work includes extending this approach to multi-modal architectures and refining dynamic budget management during inference.
Summary updated