arXiv(opens in a new tab)cs.CROct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.08678

Secure Speculative Decoding for Large Language Models

Yichi Zhang, Zhiqi Wang, Neil Gong, Yuchen Yang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Yichi Zhang 1^{1}, Zhiqi Wang 1^{1}, Neil Zhenqiang Gong 2^{2}, Yuchen Yang 1^{1}

1^{1}The Pennsylvania State University, 2^{2}Duke University

{yichi.zhang, zhiqi.wang, yuchen.yang}@psu.edu, neil.gong@duke.edu

Abstract—Speculative decoding accelerates inference for a large language model (LLM), referred to as the target model, by first using a smaller model, referred to as the draft model, to generate candidate tokens and then verifying them with the target model for acceptance or rejection. Prior studies primarily focused on the efficiency-utility trade-off of speculative decoding, e.g., lossy speculative decoding, leaving its security implications largely unexplored.

In this work, we bridge this gap by providing the first systematic study of the security implications of speculative decoding. Through a large-scale measurement study, we reveal a pronounced security-utility asymmetry: across a wide range of lossy speculative decoding methods, improvements in inference efficiency come at a disproportionately high cost to security, with attack success rates for jailbreak and prompt injection attacks increasing much faster than utility degrades.

We then propose SECURESD, a new theory-guided speculative decoding method that enhances security while maintaining efficiency and utility. Specifically, our theoretical analysis reveals that security degradation primarily originates from the early tokens generated by the draft model. Motivated by this insight, SECURESD applies a stricter verification criterion to draft-model tokens at early decoding positions. Extensive experiments on both security and utility benchmarks demonstrate that SECURESD significantly improves security while preserving efficiency and utility compared to existing speculative decoding methods. 1^{1}

1. Introduction

As LLMs are increasingly deployed in interactive applications, autoregressive decoding has become a major latency bottleneck because each output token typically requires a separate forward pass through a large model. As shown in Algorithm 1, speculative decoding addresses this bottleneck by using a smaller draft model to quickly generate candidate tokens for a larger LLM, referred to as the target model; the target model then verifies these candidates in parallel and either accepts them or rejects them before continuing generation [1], [2]. By accepting multiple tokens in a single decoding step, speculative decoding can substantially reduce decoding latency. This technique has moved beyond research prototypes: Google reports applying speculative decoding in multiple products, including AI Overviews in Google Search [3] and Gemma 4 models [4]. Production-oriented serving stacks such as vLLM [5], NVIDIA Triton/TensorRT-LLM [6], Hugging Face Inference [7], and SGLang [8] also provide built-in speculative decoding support.

Existing work on speculative decoding has mainly focused on improving inference efficiency while preserving utility. Recent methods increase speedup by improving draft models [9], [10], [11], [12], [13], using richer proposal structures [14], [15], [16], [17], or adopting lossy verification strategies [18], [19], [20], [21] that accept more draft tokens per decoding step. Some methods further relax the verification criterion [22], [23], [24], [25], [26], explicitly trading exact target-model behavior for higher throughput. However, these methods are still primarily evaluated through the efficiency–utility trade-off, using metrics such as speedup, average acceptance length, perplexity, task accuracy, or human preference. To the best of our knowledge, the safety and security implications of efficiency-oriented speculative decoding under adversarial inputs have not been systematically studied. This gap matters because relaxed verification may accept draft tokens that the target model would otherwise reject. In safety settings, e.g., jailbreak [27], [28], [29], [30], and security settings, e.g., prompt injection [31], such early deviations can steer the response from refusal toward compliance, causing safety and security risks that remain invisible to utility benchmarks. For simplicity, we use security to refer to both throughout the introduction.

In this paper, we bridge this gap by providing the first systematic study of the security implications of lossy speculative decoding. Across a range of speculative decoding methods, making token acceptance more aggressive improves inference efficiency with only modest degradation on standard utility benchmarks, but causes a disproportionately large increase in attack success rates on security benchmarks. In particular, jailbreak and prompt injection attacks become much more successful even when task accuracy, output quality, or other utility metrics remain relatively stable. This shows that security degradation is not simply another form of utility degradation: lossy speculative decoding can introduce small changes in the generation trajectory that are largely tolerated by general-purpose benchmarks but have much larger effects on security-critical behavior.

To understand this asymmetry, we analyze how accepted draft tokens affect autoregressive generation. Our analysis

  1. The code and benchmarks for SECURESD are publicly available at https://github.com/YichiCS/Secure-Speculative-Decoding.

shows that security degradation depends on two dimensions: (i) how far the accepted tokens deviate from the target model's original distribution, and (ii) at which token position these deviations occur in the output sequence. In particular, draft tokens accepted at early decoding positions have a disproportionate effect because they set the initial direction of the response. For adversarial prompts, an early deviation can shift generation from refusal toward compliance. This positional sensitivity explains why security can degrade much faster than utility.

Motivated by this insight, we propose SECURESD, a theory-guided and position-aware speculative decoding method that applies stricter verification to early draft tokens while retaining efficient verification later in the generation process. By correcting only the positions most responsible for security degradation, SECURESD avoids unnecessary verification overhead across the full response. Experiments on five utility and security benchmarks show that SECURESD reduces attack success rates of jailbreak and prompt injection attacks by up to 92.4%, while retaining 99.8% of the decoding speedup and keeping utility within 98.4% of existing speculative decoding methods. Ablation studies further confirm that focusing verification on early positions is key to improving the security–utility–efficiency trade-off.

Contribution. We make the following contributions:

• We provide the first systematic study of the security implications of lossy speculative decoding, revealing a strong security–utility asymmetry: attack success rates rise much faster than utility degrades.

• We explain this asymmetry through theoretical and empirical analysis, showing that early draft tokens play an important role in security degradation.

• We propose SECURESD, a theory-guided, position-aware speculative decoding method that improves security while preserving efficiency and utility.

References (86)