English

Leveraging Speculative Sampling and KV-Cache Optimizations Together for Generative AI using OpenVINO

Machine Learning 2024-04-10 v2 Artificial Intelligence Performance

Abstract

Inference optimizations are critical for improving user experience and reducing infrastructure costs and power consumption. In this article, we illustrate a form of dynamic execution known as speculative sampling to reduce the overall latency of text generation and compare it with standard autoregressive sampling. This can be used together with model-based optimizations (e.g. quantization) to provide an optimized solution. Both sampling methods make use of KV caching. A Jupyter notebook and some sample executions are provided.

Keywords

Cite

@article{arxiv.2311.04951,
  title  = {Leveraging Speculative Sampling and KV-Cache Optimizations Together for Generative AI using OpenVINO},
  author = {Haim Barad and Ekaterina Aidova and Yury Gorbachev},
  journal= {arXiv preprint arXiv:2311.04951},
  year   = {2024}
}

Comments

Code available at https://github.com/openvinotoolkit/openvino_notebooks/tree/latest/notebooks/speculative-sampling

R2 v1 2026-06-28T13:15:31.056Z