speculative-encoding

b10-tv

A Python tool that translates hidden document states from one LLM into another model's compressed KV cache for vLLM inference.

PythonCreated

What is b10-tv/speculative-encoding?

speculative-encoding is a Python library that translates a source LLM's hidden document states into a target LLM's KV cache, allowing another model to answer questions from the injected cache via vLLM or Hugging Face.

A single shared translator supports seven models—Qwen3 14B, Qwen3.5 9B, Llama 3.1 8B, Gemma 3 12B, Gemma 4 12B, and Ministral 3 8B and 14B—across all 42 translation pairs, with an optional query-aware compressor that shrinks the cache by 16x, 64x, or 128x.

ML engineers building multi-model inference pipelines or low-latency RAG systems can use speculative-encoding to share precomputed document context across heterogeneous LLMs.