TL;DR
GateSkip is a novel gating mechanism that allows Large Language Models (LLMs) to dynamically skip layers for "easy" tokens during inference. By adding a simple, differentiable gate to the residual stream, models can achieve up to 50% compute savings on instruction-tuned tasks while maintaining baseline accuracy, offering new insights into how transformers prioritize information.
The Problem: Uniform Compute Allocation
Current LLMs are computationally "stubborn": they spend the exact same amount of processing power on simple functional words like "the" as they do on complex, context-heavy terms. This uniform allocation is highly inefficient.
While "Adaptive Compute"—changing the amount of work based on input difficulty—is a known goal, previous attempts have struggled with two main issues:
- Instability: Methods like "Mixture-of-Depths" use discrete, hard routing decisions that are notoriously difficult to train and often require training from scratch.
- Representational Shift: "Early-exit" strategies (stopping at an intermediate layer) often require auxiliary heads and fundamentally change how the model represents data, making them hard to plug into existing pretrained models.
The authors seek a method that is easy to fine-tune on top of existing models, stable to train, and compatible with other efficiency tricks like quantization.
Methods: Introducing GateSkip
The authors introduce GateSkip, which modifies the standard transformer residual connection.
In a normal transformer, the output of a layer (Attention or MLP) is added directly to the input: $h_{l+1} = h_l + o_l$. GateSkip adds a learnable, sigmoid-activated gate ($g_l$) that scales the output: $$h_{l+1} = h_l + o_l \odot g_l(h_l)$$
Key technical features include: * Smooth Training: Because the gate is a continuous sigmoid function, it is fully differentiable. The model is trained with a standard loss plus a "sparsity penalty" that encourages the gates to stay near zero (effectively compressing the layer's contribution). * Quantile-Based Skipping: During inference, the model doesn't use a fixed threshold. Instead, it uses a per-layer budget. If the budget is 70%, the model ranks all tokens in a batch by their gate values and skips the 30% with the lowest scores. This quantile approach makes the system robust to the slight distribution shifts that happen between different layers. * KV-Cache Continuity: When a token skips a layer, it simply copies its Key-Value (KV) cache from the layer below, ensuring the attention mechanism remains functional for future tokens.
Key Insights and Ideas
- Functional vs. Content Tokens: The learned gates naturally prioritize information. Early layers process almost everything, but deeper layers become highly selective, skipping "functional" words (prepositions, articles) while focusing compute on "content-bearing" nouns and verbs.
- BOS as an Anchor: The "Beginning of Sentence" (BOS) token consistently receives the highest gate values. The authors hypothesize that BOS acts as a "global anchor" or "register" that the model uses to avoid over-mixing representations in the residual stream.
- Safety Interpretability: In a fascinating discovery, the authors found that the gates show unusually high activity when processing "forbidden" prompts (e.g., requests for dangerous information). This suggests that gate values could serve as a real-time interpretability tool for safety monitoring.
- Quantile Stability: The paper demonstrates that a fixed global threshold for skipping is ineffective because gate distributions vary by layer. Using per-layer quantiles is the key to making the skipping deterministic and stable.
Key Results
The researchers evaluated GateSkip across a wide variety of tasks, including generative reasoning (GSM8K), log-likelihood benchmarks (MMLU, HellaSwag), and long-form translation, testing on Llama-3.1 and Gemma-2 architectures.
- Efficiency Gains: On long-form reasoning, GateSkip saves 15% compute while retaining >90% accuracy.
- Instruction-Tuning Bonus: On instruction-tuned models (like Llama-3b-Instruct), the method actually improved accuracy at full compute and matched the original baseline even when skipping nearly 50% of the model.
- Compatibility: GateSkip is orthogonal to other efficiency methods. The authors successfully combined it with 4-bit quantization and structured pruning with negligible additional performance loss.
- Real-world Speed: In a vLLM environment, these theoretical FLOP savings translated into measurable increases in throughput and reductions in latency.
Limitations and Future Work
While tested up to 8B parameters, the behavior of these gates in "frontier" models (70B+ or 400B+) remains to be seen. Furthermore, the evaluation primarily focused on English-language benchmarks. Future work may explore pre-training models with GateSkip from scratch, potentially allowing the network to develop even more sophisticated compute-saving internal strategies.
Summary updated