What is Speculative Encoding?
Speculative Encoding is a cache-translation method from Ramp Labs and Base Labs, the research group at Baseten. The article is https://labs.baseten.co/articles/speculative-encoding-many-to-many-cache-translation. The code is https://github.com/b10-tv/speculative-encoding, Apache 2.0, created on 25 November 2026. The weights are https://huggingface.co/RampPublic/speculative-encoding. It is listed in Open-Source AI Developer Stack. It is not a chatbot and not a drop-in replacement for an arbitrary pair of models.
The article says a source model reads a document once, a translator turns that model's per-layer hidden states into the target model's hidden states, and the target then builds its own KV cache with its frozen weights. An optional query-aware compressor can shrink that cache. The point is to avoid prefilling the same long text again when a second model picks up the work. Prefill cost grows with length. Translation, the article says, grows more slowly.
Key Features
The article says the translator has 2.35 billion parameters and was trained on seven models from four families: Qwen3.5 9B, Qwen3 14B, Llama 3.1 8B, Gemma 3 12B, Gemma 4 12B, Ministral 3 8B, and Ministral 3 14B. Seven models give 42 source-target directions. The README lists the same seven. It does not say the checkpoint translates a model outside that list. Llama 3.1 and Gemma weights are gated, so a run that needs them also needs a Hugging Face token those repos accept.
On documents up to 8,192 tokens, the length used in training, the article says retention at full depth averages 96.9 percent over 12 tasks and all 42 directions, with a worst direction of 93.1 percent. Retention means the target's accuracy with the translated cache as a percentage of its accuracy with its own cache. The article also says retention against the weaker of the two models averages 100.3 percent in that same slice. Those are the authors' averages over three seeds. This site did not rerun them.
On longer documents the article says translation cuts time to first token most where prefill is expensive. It says that at 32,000 tokens the target starts answering 4 times faster than re-prefilling from text while keeping over 90 percent of its accuracy. The README describes compressor settings of 16 times, 64 times, and 128 times. A 7.5 times latency figure that circulated with the announcement is not the number this article prints for the 32,000-token case. Quote the article next to the figure you use.
The article says the translator predicts hidden states rather than KV pairs, because KV layouts differ by head count and some layers keep no KV cache. That is a design claim, not a promise that every direction stays at 96.9 percent on your documents.
How to Access
Clone b10-tv/speculative-encoding or load RampPublic/speculative-encoding. The README says the default checkpoint download fetches one source-target pair, and that a local split of the translator is about 1.5 GB in bf16 for a pair. A Baseten example script is in the repo for people who already have a Baseten account and a token for the gated models. Read the README before you assume a pair outside the seven models will load.