One model, two depths
Speculative decoding needs a cheap draft of the next few tokens. Medusa adds heads and EAGLE adds a draft layer; LayerSkip uses the model's own first layers. It trains a model so that its shared final norm and LM head can read the output of any layer, which makes the first layers a small language model inside the large one. Decoding then drafts with those layers and verifies with the full model. There is no second model to store, and the draft and the verifier share one key-value cache.
The page records Meta's LayerSkip release of Llama 3.2 1B (16 layers, 1.24 B parameters), a base model continually pretrained with LayerSkip's recipe, completing a short list greedily in float32 on the Mac's GPU. It drafts three tokens per step with layers 1–3 and verifies with all 16.
Early exit
Exiting after layer means sending its hidden state straight to the final norm and the LM head , skipping the layers above:
In an ordinary model the early layers' outputs are not meant to be read this way, and the guesses are poor; the Logit lens tab shows this on GPT-2. The Early exit after every layer panel shows the token each layer of this model would predict at every position of the answer, with the full model's token marked. Over the whole answer, layer 3 already names the full model's token 44 % of the time and layer 8 57 %, rising to 92 % at layer 15.
Training for early exit
LayerSkip makes the early exits usable with two changes to training. Layer dropout skips a layer's residual branch at random, with zero with probability , and the rate grows from nothing at the first layer to a maximum at the last:
so that later layers learn not to be indispensable. An early-exit loss adds the cross-entropy of every layer's exit through the same LM head , with per-layer weights that sum to one and grow with depth:
A curriculum switches the exits on gradually or in rotation, because supervising every layer at every step slows training and costs the last layer accuracy.
Self-speculation
Each step drafts tokens by running only layers and the LM head, one token at a time. Verification then runs layers once over the last accepted token and the drafts together. It does not repeat the draft's work: the drafts' keys and values in layers are already in the shared cache, and their states after layer feed layer directly, so verification adds only the last draft's first layers. A draft is kept when it equals the full model's argmax, up to the first mismatch, and the full model's own next token follows. The Self-speculation panel draws one step as layers × tokens; the Verify panel shows the full model's argmax along the drafts.
What it saves here, and what it costs
The 96-token answer takes 55 steps and equals plain greedy decoding. Only 24 % of the 165 drafts are kept, 1.75 tokens per step: 31 steps keep no draft, 13 keep one, 6 keep two and 5 keep three. Counted in layer passes, one decoder layer run over the tokens of one forward, self-speculation uses 1,391 against greedy's 1,536: 1.10 tokens per full-model forward, 9 % fewer passes.
On this Mac that saving does not turn into speed. A step took 30 ms drafting and 38 ms verifying on average, against 30 ms for a greedy token, so self-speculation measured 25.4 tokens per second against greedy's 33.6: for a 1 B model the extra forwards each step launches cost more time than the layers it skips. The paper, on larger Llama models and on GPUs, reports speed-ups of up to 2.16× on CNN/DM summarisation, 1.82× on coding and 2.0× on TOPv2 semantic parsing.
Which exit layer?
The Which exit layer? panel re-decodes the same answer with every exit layer from 1 to 15. Deeper exits draft better (85 % of drafts kept when exiting after layer 14, against 24 % after layer 3) but each draft costs more, and fewer layers are left for verification to save. Only exits after layer 1 or layer 3 give more than one token per full-model forward here. At exit layer 3, fewer drafts per step are better on this answer: one draft gives 1.21 tokens per full forward, two 1.19, three 1.10, and four or more fall below one.
Where it came from
Early exit is older than LayerSkip: the Depth-Adaptive Transformer (Elbayad et al., 2020) and CALM (Schuster et al., 2022) let easy tokens leave the network early, at the cost of exactness, and LayerDrop (Fan et al., 2020) trained models to tolerate missing layers. Draft & Verify (Zhang et al., 2023) introduced self-speculative decoding by skipping intermediate layers of an unmodified model. LayerSkip (Elhoushi et al., 2024) combined a training recipe that makes early exits accurate with exact self-speculation that reuses the draft's cache and states. The Medusa and EAGLE tabs draft with added weights instead; the Tuned lens tab learns a small map per layer so that early layers read out better without retraining the model.
Papers
- LayerSkip: Enabling Early Exit Inference and Self-Speculative Decoding The method on this page: layer dropout, an early-exit loss through one shared LM head, and self-speculative decoding that reuses the draft's cache.
- Draft & Verify: Lossless Large Language Model Acceleration via Self-Speculative Decoding Self-speculative decoding by skipping intermediate layers of an unmodified model to draft, then verifying with the whole model.
- Confident Adaptive Language Modeling Early exit per token in a language model, with confidence measures and calibrated thresholds that bound the change in output.
- Depth-Adaptive Transformer Exits at different depths per token, trained with a loss over all exits; LayerSkip's per-layer loss scale builds on it.
- Reducing Transformer Depth on Demand with Structured Dropout LayerDrop: dropping whole layers during training so that a shallower network can be taken out at inference, the idea behind layer dropout.
- The Llama 3 Herd of Models The Llama 3 family; this page's checkpoint is Llama 3.2 1B continually pretrained with LayerSkip's recipe.
- Fast Inference from Transformers via Speculative Decoding The draft-then-verify scheme that self-speculation runs inside a single model.
See also
- TransformerLooped Looped transformer · Ouro
- TransformerMTP Speculative decoding with the model’s own multi-token prediction layer · MiMo-7B
- InterpretabilityLogit lens Logit lens · reading every layer with the unembedding
- InterpretabilityLenses Lenses compared · the logit lens and the tuned lens on the same stream