What Layers When: Learning to Skip Compute in LLMs with Residual Gates
Filipe Laitenberger, Dawid Kopiczko, Cees G. M. Snoek, Yuki M. Asano
TL;DR
GateSkip introduces a differentiable residual gating mechanism for decoder-only transformers to enable token-wise layer skipping, addressing the inefficiency of uniform compute. The method places a sigmoid-linear gate on each Attention/MLP branch and uses per-token budgets to rank and skip low-importance tokens, with hard skips realized at inference from smooth, trainable gates. Empirical results across Llama-3.2 and Gemma-2 demonstrate up to 15% compute savings while preserving over 90% of baseline accuracy on long-form reasoning, and gains on instruction-tuned models with near-baseline quality at roughly 50% savings; larger models show even more pronounced trade-offs. Gate activations reveal interpretable information flow, e.g., BOS tokens and punctuation acting as anchors, and GateSkip remains compatible with 4-bit quantization, speculative decoding, and pruning, making it a practical, stable adaptive-depth approach for real-world deployment.
Abstract
We introduce GateSkip, a simple residual-stream gating mechanism that enables token-wise layer skipping in decoder-only LMs. Each Attention/MLP branch is equipped with a sigmoid-linear gate that condenses the branch's output before it re-enters the residual stream. During inference we rank tokens by the gate values and skip low-importance ones using a per-layer budget. While early-exit or router-based Mixture-of-Depths models are known to be unstable and need extensive retraining, our smooth, differentiable gates fine-tune stably on top of pretrained models. On long-form reasoning, we save up to 15% compute while retaining over 90% of baseline accuracy. For increasingly larger models, this tradeoff improves drastically. On instruction-tuned models we see accuracy gains at full compute and match baseline quality near 50% savings. The learned gates give insight into transformer information flow (e.g., BOS tokens act as anchors), and the method combines easily with quantization, pruning, and self-speculative decoding.
