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

Preprint · Haim Barad, Ekaterina Aidova, Yury Gorbachev

- Archive id: arxiv:2311.04951
- Published: 2023-11-08
- arXiv: https://arxiv.org/abs/2311.04951
- Source URL: https://arxiv.org/abs/2311.04951
- PDF: https://arxiv.org/pdf/2311.04951
- Provenance: arxiv

## 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.

_Abstract reproduced under CC0-1.0 (arXiv descriptive metadata)._

---
Space Kitty Archive · https://space-kitty.com · API: https://space-kitty.com/api/v1 · MCP: https://space-kitty.com/mcp · Premium: $0.20/request via x402 (Base Sepolia (testnet)). Metadata: arXiv (CC0), OpenAlex (CC0), Europe PMC (CC BY/CC0 works), ClinicalTrials.gov.
