QSpec: Speculative Decoding with Complementary Quantization Schemes

Juntao Zhao, Wenhao Lu, Sheng Wang, Lingpeng Kong, Chuan Wu · DOI

Abstract

Large Language Model (LLM) inference often faces a trade-off between the high quality of weight-only quantization (e.g., W4A16) and the high speed of joint weight-activation quantization (e.g., W4A4). We present QSpec, a training-free speculative decoding framework that bridges this gap. By using W4A4 as a fast "drafter" and W4A16 as a high-precision "verifier" within a single model, QSpec achieves up to 1.64× speedup while maintaining the accuracy of 16-bit activation baselines.

Introduction

Quantization is essential for deploying large-scale models on memory-constrained hardware. However, current methods force a choice between performance and efficiency. Weight-only quantization (W4A16) preserves model quality but remains bottlenecked by memory bandwidth during autoregressive generation. Conversely, joint weight-activation quantization (W4A4) leverages low-precision hardware kernels for significant throughput gains but suffers from a "quality collapse," particularly in complex reasoning tasks like mathematics and coding.

Existing speculative decoding solutions typically require auxiliary draft models, which introduce additional memory overhead and require expensive retraining or distillation. QSpec addresses these challenges by introducing a "draft-verify" pipeline that utilizes a single weight-quantized model in two complementary execution modes.

The QSpec Framework

QSpec operates as a plug-and-play framework that requires no extra training or auxiliary models. It leverages the observation that while W4A4 may lack absolute precision, its top-1 token predictions remain highly similar to those of W4A16, making it an effective candidate for speculative drafting.

Overview of QSpec compared to standard quantization schemes. QSpec combines the speed of W4A4 drafting with the precision of W4A16 verification.

Draft-Verify Pipeline

The QSpec execution cycle consists of two primary phases:

  1. Draft Phase (W4A4): The model generates a sequence of speculative tokens using 4-bit activations. This phase is highly efficient, utilizing fast low-precision compute kernels.
  2. Verify Phase (W4A16): The drafted tokens are verified in a single parallel pass using 16-bit activations. This batch processing is significantly faster than sequential generation and ensures the final output matches the high-fidelity W4A16 baseline.

KV Cache Overwriting

A critical innovation in QSpec is the management of the Key-Value (KV) cache. Since both the draft and verify phases share the same model weights, the KV cache can be reused. During the verification phase, the high-quality W4A16 activations generate "golden" KV cache entries that overwrite the lower-quality entries produced during the W4A4 draft phase. This mechanism ensures that subsequent drafting rounds always begin from a high-fidelity state, preventing error accumulation.

Experimental Evaluation

QSpec was evaluated across diverse benchmarks, including general commonsense tasks (WikiText-2, PIQA) and rigorous multi-step reasoning tasks (GSM8K, MATH, HumanEval).

Performance and Fidelity

Results demonstrate that QSpec effectively recovers the accuracy lost by aggressive W4A4 quantization. For instance, on the MATH benchmark, where W4A4 accuracy typically collapses to ~12-15%, QSpec restores performance to the ~24% level of the W4A16 baseline. In terms of throughput, QSpec achieves speedups ranging from 1.32× to 1.64× over standard W4A16 across various Llama model scales (3B to 13B).

Scalability

Unlike tree-based speculative decoding methods that may incur significant memory overhead as batch sizes grow, QSpec’s shared-weight architecture is highly efficient for high-throughput serving. In batched settings (batch sizes 8-32), QSpec outperformed state-of-the-art methods like EAGLE by up to 1.55× while maintaining zero additional memory overhead.

Conclusion and Future Work

QSpec demonstrates that efficiency and quality in LLM quantization can be decoupled through speculative decoding. By using a single model in dual precision modes, it provides a training-free path to accelerated inference without compromising reasoning capabilities. Future work includes exploring adaptive drafting lengths based on model confidence and integrating QSpec into production serving frameworks like vLLM to further optimize real-world deployment.

Summary updated

BibTeX
@misc{zhao2024qspec,
  author = {Juntao Zhao and Wenhao Lu and Sheng Wang and Lingpeng Kong and Chuan Wu},
  title = {{QSpec: Speculative Decoding with Complementary Quantization Schemes}},
  year = {2024},
  eprint = {2410.11305},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.11305},
}
Figure