DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding

Hossein Entezari Zarch, Lei Gao, Chaoyi Jiang, Murali Annavaram

TL;DR

Large Language Models (LLMs) are notoriously slow due to their step-by-step generation process. DEL (Dynamic Exit Layer) is a new plug-and-play method that accelerates inference by dynamically tuning the "speculative decoding" process—adjusting how many layers to use for drafting and how many tokens to guess—on the fly based on the specific context. The result is a lossless speedup of up to 2.62× over standard decoding, outperforming existing static and dynamic baselines with negligible overhead.

What Problem Does This Paper Address?

LLMs generate text auto-regressively: to produce the 100th token, the model must process all 99 previous tokens through all its layers. This makes inference heavily I/O bound and slow. Speculative Decoding (SD) tries to fix this by using a tiny "draft" model to quickly guess a few tokens, which the big "target" model then verifies in a single parallel pass.

A popular version of this is LayerSkip, which reuses the first few layers of the target model itself as the draft model. However, LayerSkip usually relies on fixed hyperparameters: the "exit layer" ($E$) and the "speculation length" ($\gamma$).

The authors of this paper discovered a major flaw in this static approach: the optimal settings for $E$ and $\gamma$ are moving targets. A configuration that works for summarization might fail for coding. Even within a single sentence, some parts are "easier" to predict than others. Static settings often leave significant speed on the table because they can't adapt to the changing difficulty of the text being generated.

Methods

DEL introduces a dynamic, context-aware controller for self-speculative decoding. It consists of two main components:

  1. Dynamic Exit Layer Selection: Instead of picking one exit layer and sticking to it, DEL optimizes a new metric called Token-per-Layer (TPL). TPL calculates the expected number of accepted tokens divided by the computational cost (number of layers loaded).
  2. The "Shadow Token" Trick: To estimate which layer would have been best, DEL reuses the hidden states generated during the verification phase. It passes these through the model's output head to create "shadow tokens"—simulations of what every other possible exit layer would have predicted. This allows DEL to track the accuracy of every layer simultaneously without performing extra expensive forward passes.
  3. Dynamic Draft-Exiting: Rather than always drafting a fixed number of tokens, DEL uses a dynamic confidence threshold ($\tau$). During the drafting phase, if the model's confidence in its next guess falls below $\tau$, it stops drafting early. Crucially, this threshold is updated after every round based on how well the model has been performing recently, allowing it to be aggressive when the context is predictable and cautious when it’s not.

Datasets

The authors evaluated DEL across a diverse suite of benchmarks and models to prove its generalizability:

  • Tasks: Reasoning (AQuA-RAT, GSM8K), Language Modeling & Summarization (CNN/DailyMail, XSUM), Code Generation (HumanEval), and Translation (WMT14 De-En).
  • Models: The Llama family (Llama-2 7B/13B/70B, Llama-3 8B, Llama-3.2 1B) and CodeLlama (7B/34B).
  • Baselines: Vanilla decoding, static LayerSkip (LS), and other dynamic speculation methods like FS and DV.

Key Insights and Ideas

  • Context Sensitivity: The paper provides fascinating heatmaps showing that the "optimal" exit layer shifts significantly even within a single 64-token segment of code. This confirms that static hyperparameters are fundamentally limited.
  • Efficiency is a Ratio: The TPL metric is a key conceptual shift. It recognizes that a more accurate draft model (using more layers) isn't always better if the extra computation time outweighs the gain in accepted tokens.
  • Zero-Cost Feedback: The most elegant part of DEL is the use of "shadow tokens." By harvesting data from the verification step—which has to happen anyway—the system gets a "free" look at how every possible sub-model would have performed, enabling real-time optimization.

Key Results

  • Significant Speedups: DEL achieved overall speedups of 2.16× to 2.62× over vanilla auto-regressive decoding.
  • Outperforming SOTA: It improved upon the previous state-of-the-art speculative decoding methods (which peaked at 2.43×) by up to 0.19×.
  • Minimal Overhead: Despite the dynamic tracking, DEL adds only 0.5% to 2.2% memory overhead compared to vanilla decoding, making it highly practical for real-world deployment.
  • Lossless Quality: Because it uses the standard speculative decoding verification framework, the output distribution remains identical to the original model.

Limitations and Future Work

  • Alignment Dependency: DEL works best when the early layers of a model are well-aligned with the final output. While the authors used models fine-tuned for LayerSkip, performance on "stock" models might vary.
  • Out-of-Distribution (OOD) Prompts: The authors note that if a prompt is significantly different from the data the model was trained on, acceptance rates may drop, potentially reducing the speedup.
  • Future Directions: The authors suggest that the dynamic TPL logic could be extended to traditional speculative decoding (using two different models) or applied to more complex architectures beyond standard Transformers.

Paper Citation: Entezari Zarch, H., Gao, L., Jiang, C., & Annavaram, M. (2025). DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding. Published as a conference paper at COLM 2025. GitHub Link

Summary updated

Abstract

Speculative Decoding (SD) is a widely used approach to accelerate the inference of large language models (LLMs) without reducing generation quality. It operates by first using a compact model to draft multiple tokens efficiently, followed by parallel verification using the target LLM. This approach leads to faster inference compared to auto-regressive decoding. While there are multiple approaches to create a draft model, one promising approach is to use early-exit methods. These methods draft candidate tokens by using a subset of layers of the primary model and applying the remaining layers for verification, allowing a single model to handle both drafting and verification. While this technique reduces memory usage and computational cost, its performance relies on the choice of the exit layer for drafting and the number of tokens drafted (speculation length) in each SD round. Prior works use hyperparameter exploration to statically select these values. However, our evaluations show that these hyperparameter values are task-specific, and even within a task they are dependent on the current sequence context. We introduce DEL (Dynamic Exit Layer), a plug-and-play method that adaptively selects the exit layer and speculation length during inference. DEL dynamically tracks the token acceptance rate if the tokens are drafted at each layer of an LLM and uses that knowledge to heuristically select the optimal exit layer and speculation length. Our experiments across a broad range of models and downstream tasks show that DEL achieves overall speedups of $2.16\times$$\sim$$2.62\times$ over vanilla auto-regressive decoding and improves upon state-of-the-art SD methods, which peak at $2.43\times$, by up to $0.19\times$. The code is available at https://github.com/hoenza/DEL.
BibTeX
@inproceedings{zarch2025del,
  author = {Hossein Entezari Zarch and Lei Gao and Chaoyi Jiang and Murali Annavaram},
  title = {{DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding}},
  booktitle = {COLM},
  year = {2025},
}
Figure