Speeding Up Local LLM Inference Without Upgrading GPUs: Speculative Decoding

    This article explores how speculative decoding accelerates local large language model (LLM) inference without requiring hardware upgrades. It covers the underlying mechanisms of draft and target model collaboration, key metrics like average acceptance length, and best practices for choosing draft models, setting draft lengths, and managing concurrent requests to optimize latency and throughput.

    I. What Problem Does Speculative Decoding Solve?

    When running large language models (LLMs) locally, the first reaction for many is to add VRAM, upgrade the GPU, or further compress model weights. While these methods are effective, they are not always economical. Particularly in scenarios where quantization is already applied and hardware cannot be upgraded immediately, there is still room to optimize the inference framework.

    Speculative decoding is a technique that alters the token generation workflow. It does not change the final output generated by the target model. Instead, it introduces a smaller, faster draft model to predict subsequent content, allowing the target model to focus on verifying these predictions in batches.

    In simple terms, the traditional generation process is:

    1. Target model generates Token 1
    2. Target model generates Token 2
    3. Target model generates Token 3
    4. Target model generates Token 4

    Speculative decoding attempts to change this to:

    1. Draft model sequentially predicts multiple tokens
    2. Target model performs a single computation to verify these tokens in batch
    3. Accept correct parts, correct incorrect parts

    If the draft model’s prediction quality is high, a single verification by the target model can advance multiple positions, naturally increasing the generation speed.

    II. Why LLM Inference is Often Bottlenecked by Memory Bandwidth

    A complete LLM inference process can generally be divided into two phases: prefill and decode.

    1. Prefill Phase

    After a user inputs a prompt, the model processes the entire text at once, calculating intermediate results for each layer while establishing the Key-Value Cache (KV Cache).

    This phase can typically process multiple tokens in parallel, making it easier to utilize the matrix computation resources of the GPU. The longer the input, the greater the computation required during the prefill phase, but hardware parallelism is also more easily leveraged.

    2. Decode Phase

    Once the model begins generating responses, the processing method changes. Each round typically adds only one new token, writes it to the KV Cache, and continues to predict the next token.

    For large-scale models, generating each new token requires reading a massive amount of model weights and combining them with the existing cache to complete the computation. Even if the mathematical operations required for a single token are not extreme, weight transfers and cache access still incur significant overhead.

    This means the decode phase is often limited by memory access and VRAM bandwidth, not just the number of compute units. Having more compute cores on the GPU does not necessarily translate to proportionally faster single-token generation speeds.

    The core value of speculative decoding is precisely to reduce the number of independent decoding rounds the target model has to execute.

    III. How Draft and Target Models Collaborate

    Suppose a user inputs an incomplete sentence. The draft model proposes several candidate tokens based on the current context:

    1. Candidate sequence: Token1, Token2, Token3, Token4

    Subsequently, the target model reads the same context and obtains the probability distribution for these positions through a single forward computation. The system checks the candidate results one by one according to established rules:

    • If Token1 matches the target model’s sampling distribution, it is accepted;
    • If Token2 also matches, continue accepting;
    • If Token3 does not match, subsequent drafts are rejected starting from this position;
    • The target model is responsible for generating a corrected result at the rejection point;
    • Token4 and subsequent candidates are typically no longer used because they depend on incorrect context.

    It is important to note that the draft model is not the final arbiter. It is only responsible for proposing candidates; the target model still determines the final output. Therefore, when correct acceptance and sampling rules are met, speculative decoding can preserve the target model’s original output distribution rather than simply replacing the large model with a small one.

    This is the fundamental difference from “directly switching to a small model”: directly switching models usually sacrifices some capability, whereas the goal of speculative decoding is to reduce wait times while preserving the target model’s quality.

    IV. Key Metric for Acceleration: Average Acceptance Length

    In speculative decoding, more drafts are not always better. What truly matters is the average acceptance length.

    For example, if the draft model proposes 5 tokens per round:

    • An average acceptance of 4 means a single target model verification can advance a long sequence;
    • An average acceptance of 2 may yield limited benefits;
    • An average acceptance of 1 means the extra overhead from the draft model might offset the acceleration effect;
    • If frequent total rejections occur, the overall speed might even drop below standard decoding.

    A simplified model can be used to understand the gain:

    1. Total gain ≈ Target model single-round verification cost
    2. ÷ (Draft generation cost + Target model verification cost)
    3. × Average accepted token count

    Actual performance is also affected by batching, cache access, scheduling overhead, sampling strategies, and hardware architecture, but average acceptance length remains the most intuitive evaluation metric.

    Generally, the following content is more likely to achieve a high acceptance rate:

    • Structurally stable program code;
    • Formatted JSON or table outputs;
    • Common phrasing and highly repetitive text;
    • Templated responses with clear context constraints.

    The following scenarios may lower the acceptance rate:

    • Highly random creative generation;
    • High-temperature sampling;
    • Sudden topic shifts;
    • Content requiring complex reasoning or multi-step planning;
    • Large discrepancies in training distribution between the draft and target models.

    V. How to Choose Draft Length

    Draft length is a crucial parameter in engineering implementation. It represents how many tokens the draft model attempts to predict each time.

    If the length is too short, the target model’s verification frequency remains high, failing to adequately reduce the number of decoding rounds for the large model. If the length is too long, it may introduce three types of problems:

    First, the draft model needs to spend more time generating candidates, increasing extra cost.

    Second, the longer the candidate sequence, the more likely errors will occur in the middle. Once an early token is rejected, subsequent candidates lose their value.

    Third, overly long candidate sequences may increase cache management and scheduling complexity, causing actual gains to fall below theoretical values.

    Therefore, actual systems typically do not use a fixed, absolute optimal value but adjust dynamically based on runtime status. For example, the acceptance rate of recent rounds can be continuously monitored:

    1. If acceptance rate is high:
    2. Increase draft length appropriately
    3. If acceptance rate drops:
    4. Decrease draft length
    5. If multiple consecutive rounds are entirely rejected:
    6. Pause speculative decoding or switch draft model

    This adaptive strategy is more robust than simply pursuing longer drafts.

    VI. How to Choose the Right Draft Model

    The draft model must simultaneously meet two conditions: “fast enough” and “accurate enough.”

    1. Model Size Should Not Be Too Large

    If the draft model itself takes a long time to run, it will undermine the benefits of speculative decoding. Its primary value is not to independently produce high-quality answers, but to predict short sequences the target model might generate at a low cost.

    2. Output Distribution Should Be Close to the Target Model

    The more similar the draft model is to the target model, the higher the probability that candidate tokens will be accepted. This similarity applies not only to vocabulary and language style but also to training data distribution, instruction formats, special token rules, and generation habits.

    3. Task Fit is More Important Than Parameter Size

    A larger draft model is not always better. For code generation, a lightweight model suited for coding tasks might outperform a larger general model with domain bias; for structured output, a draft model capable of understanding format constraints is also more valuable.

    4. Comprehensive Consideration of Device Placement

    The draft model can be placed on the same accelerator as the target model, or on other compute units depending on hardware resources. However, if data transfer latency between devices is too high, or if the draft and target models frequently contend for VRAM bandwidth, the overall effect may degrade.

    VII. Speculative Decoding and Concurrent Requests

    Low latency for single requests and high throughput for multiple requests are not the same problem.

    In a single-request scenario, speculative decoding primarily reduces the time required for a single response, making it suitable for interactive Q&A, code completion, and local assistants.

    In concurrent scenarios, the system must also consider batching and scheduling. When multiple requests are generating simultaneously, the target model can merge the verification work of different requests, but the draft model also generates additional computation. Performance then depends on:

    • Number of requests;
    • Input length per request;
    • Output length;
    • VRAM usage of draft and target models;
    • Dynamic batching strategies;
    • KV Cache capacity and reuse efficiency.

    When concurrency is low, reducing single-request wait time is usually more important; when concurrency is high and hardware resources are near saturation, the benefits of speculative decoding may shrink. Therefore, during deployment, one should not only look at the peak speed of a single request but also separately measure time to first token, continuous generation speed, overall throughput, and VRAM usage.

    VIII. Key Metrics to Monitor During Implementation

    To determine whether speculative decoding is truly effective, it is recommended to record at least the following metrics:

    1. Average Acceptance Length: The average number of tokens accepted by the target model per round.
    2. Candidate Acceptance Rate: The ratio of accepted tokens to the total draft tokens.
    3. Draft Generation Time: The time spent by the draft model predicting each round.
    4. Target Model Verification Time: The time required to batch-verify candidates.
    5. Single Request Generation Speed: E.g., tokens generated per second.
    6. Time to First Token (TTFT): The wait time users experience before seeing the first token after making a request.
    7. Concurrent Throughput: The number of tokens or requests completed per unit of time.
    8. VRAM Usage: The resource pressure when both models and multi-channel KV Cache are running simultaneously.

    If the acceptance rate is very low, prioritize checking model compatibility and sampling parameters; if the acceptance rate is good but speed improvement is insignificant, the draft model might be too slow, device bandwidth might be insufficient, or scheduling overhead might be too high.

    IX. When Not to Use Speculative Decoding

    Speculative decoding is not a universal acceleration switch for all tasks.

    When the output is extremely short, the initialization and scheduling costs of the draft model may exceed the time saved; when the generated content is highly random, candidate tokens are likely to be rejected by the target model; when the target model is already fully utilizing hardware resources through efficient batching, introducing a draft model may also cause resource contention.

    Additionally, if an application has strict requirements for output distribution, randomness, and reproducibility, it is necessary to confirm the compatibility between the speculative process and the sampling strategy, rather than judging the results solely based on theoretical acceptance rates.

    X. Conclusion

    The essence of speculative decoding is using a fast model to handle “prediction” and the target model to handle “verification.” It does not reduce the parameter size of the target model or change its final decision-making. Instead, it reduces repetitive single-token decoding processes by processing multiple candidate positions in a single verification.

    Whether this technology yields significant benefits primarily depends on four factors: whether the draft model is fast enough, whether candidate tokens match the target model, whether the average acceptance length is sufficiently high, and whether runtime scheduling is efficient.

    For developers looking to improve local inference experiences on existing hardware, rationally choosing a draft model, dynamically adjusting draft length, and monitoring acceptance rates based on real business data is often more worth trying than blindly upgrading hardware. Ultimately, end-to-end metrics should be the standard, achieving a balance among latency, throughput, VRAM usage, and output consistency.