← AUTOMATER NEWSROOM

Ramp Labs and Baseten Open-Source Speculative Encoding: One 2.35B Translator Passes Context Between Seven Models Without a Re-Prefill

Ramp Labs and Base Labs released code and weights for a single 2.35B MoE that turns one model's hidden states into another model's KV cache. It works across 7 models and 42 directions. Here is what it does, what the numbers mean and how to try it.

Diagram: a source model reads a document once and feeds a shared 2.35B MoE translator. The translator produces KV caches for three target models: Llama 3.1 8B, Gemma 4 12B and Ministral 3 14B. Below, a red panel says text handoff forces each model to re-prefill the context. A green panel lists the reported results: 96.9% retention up to 8k tokens, about 4x faster first token at 32k, and 7 models, 4 families and 42 directions.Diagram: a source model reads a document once and feeds a shared 2.35B MoE translator. The translator produces KV caches for three target models: Llama 3.1 8B, Gemma 4 12B and Ministral 3 14B. Below, a red panel says text handoff forces each model to re-prefill the context. A green panel lists the reported results: 96.9% retention up to 8k tokens, about 4x faster first token at 32k, and 7 models, 4 families and 42 directions.
How speculative encoding replaces repeated prefill: one source read and one shared translator produce caches for several target models. Figures are self-reported by Ramp Labs and Base Labs. Original illustration.

Multi-agent systems usually pass context between models as text. Each model that receives the text has to prefill it again: it runs every token through its own layers to rebuild a key-value (KV) cache the previous model had already computed. On November 25, Ramp Labs and Base Labs, Baseten’s research arm, released speculative encoding, a way to skip that repeated work. One shared network translates the context directly from one model’s internal states into another’s. They published a paper, an Apache-2.0 repository and a Hugging Face checkpoint, not just results.

Base Labs paper page showing the Ramp Labs and Base Labs logos above the numbered Introduction section, which explains that receiving models must re-prefill text and introduces speculative encoding.
Base Labs (labs.baseten.co): the Introduction of Speculative Encoding: Many-to-Many Cache Translation, by Ramp Labs and Base Labs. It states that pairwise translators need n(n−1) networks, and reports 96.9% retention across 42 directions on documents up to 8k tokens and 4x faster answering at 32k tokens. · Original source

What actually shipped

The Base Labs paper describes a 2.35B-parameter mixture-of-experts translator. It is trained on seven frozen 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. It covers all 42 source-to-target directions. Earlier cache-to-cache methods trained one translator per model pair, so a system with n models needed n(n−1) of them. Here one network is shared, and each model adds only thin projections and biases.

The translator does not write KV entries directly. It predicts the target’s hidden states, and the target computes its own keys and values from them with its frozen weights. The authors say this keeps the cache in a space the target model understands. It also sidesteps differences in head counts, positional encodings and linear-attention layers that keep no KV cache at all. The encoder turns the source’s states into a “memory” once, and any target can decode that memory later.

The b10-tv/speculative-encoding repository contains:

  • a CLI and Python API
  • a vLLM connector and a Hugging Face path for answering from the injected cache
  • the RampPublic/speculative-encoding checkpoint, with the translator and a 128x query-aware compressor
  • a run_on_baseten.py job for Baseten GPUs

Ramp Labs’ announcement framed the target audience plainly: “Multi-agent swarms shouldn’t have to read context more than once.”

The numbers, and what they cover

All results below come from the authors. No independent replication exists yet.

Setting Reported result
Documents up to 8,192 tokens (the training length), all 42 directions 96.9% of the target’s native accuracy; worst direction 93.1%
Tasks not seen in training vs. tasks seen in training 97.4% vs. 96.5% retention
32k-token documents About 4x faster time to first token than re-prefill, over 90% retention
128k tokens, full depth 2.5x faster, retention down to 83%
128k tokens, reduced decoder depth (L′ = 8 or 4) 6.1x and 7.5x faster, costing 1–2 more retention points
Compressor at 128k, 64x 4.3 points better than the full translated cache

The headline “up to 7.5x” is the most aggressive setting at 128k tokens, where retention is already in the low 80s. Baseten’s own post cites a more conservative “up to 4x faster” with 96% accuracy. That is a fairer planning number.

Three more caveats:

  • The long-document speedups were measured on one H200 with vLLM, with the source memory already computed. They compare target-side time to first token, not end-to-end pipeline time.
  • Long-document retention was scored on multiple-choice questions.
  • Retention falls as documents grow beyond the 8k training length. The authors say they hope to fix this in future work.

The practical consequence is still concrete. Cross-family handoffs no longer require a full prefill, the translator’s cost grows linearly with document length while prefill grows quadratically, and the paper reports that retention holds up across families.

Who should care

This matters most for teams running routers or multi-agent pipelines that move long context between open-weight models. The paper names two patterns:

  • A router switches models mid-task without the new model rereading everything.
  • One agent asks another a question and receives only the part of its context that answers it, through the query-conditioned compressor.

If you already split work across subagents, or have followed the argument that late tokens cost far more than early ones, this targets the same bill from a different direction.

It does not help hosted frontier APIs, because you cannot inject a cache into Claude or GPT. It also does not cover arbitrary models: the checkpoint supports exactly the seven listed above, and adding a model means training its projections.

Trying it

The README suggests a CPU smoke test with tiny random models before you spend GPU time. Its answers are deliberately noise; the run only checks that the pipeline works:

uv sync
uv run python examples/quickstart_cpu.py

On a Linux CUDA machine with vLLM 0.24, a real run encodes a document with one model and answers with another:

uv run python -m speculative_encoding.cli encode \
  --source qwen3-14b --target llama31-8b --document contract.txt \
  --question "Who signed the agreement?" --compressor 128 \
  --out encoded/ --name contract
uv run python -m speculative_encoding.cli answer --folder encoded/ --engine vllm

Setup details from the README:

  • vLLM 0.24 needs a small transformers compatibility patch.
  • Qwen 3.5 needs extra linear-attention kernels.
  • Gated Llama and Gemma weights require a Hugging Face token.
  • A split checkpoint loads about 1.5 GB per pair in bf16.
  • MultiTargetEncoder reads a document once and fans it out to several targets.
  • encode_memory stores the encoder output, which is 5–7x smaller than the raw hidden states.
  • answer_hf(item, native=True) gives you the baseline answer to compare against. Use it before trusting any translated answer in production.

One README warning matters for agent builders. Token-level handoff of a model’s own generated text is wired up, but “translation quality is unmeasured,” because the translator was trained only on document-prefill rows. Measure that path yourself before relying on it in a relay.

Serving is not finished yet

The vLLM integration still has rough edges. An RFC opened the day after release, vLLM issue #70051, says the project’s connector added a 5 ms time.sleep inside get_num_new_matched_tokens(). The sleep stops vLLM’s scheduler polling from starving the background translation thread. The RFC proposes a new scheduler wait state that reserves no GPU blocks while external KV is being prepared. It is under discussion, not merged. Until something like it lands, expect some scheduler overhead when many translated requests are waiting at once.

Translated caches are also derived from your documents. Store and isolate them with the same care as any shared KV cache; cross-tenant cache exposure has already happened in production inference stacks.

Why the idea is gaining ground

The same day, Stanford’s Hazy Research published Plato’s Key. It reports that a closed-form rotation plus one scale lets one LLM use another’s factual-recall representations: a median 41% transfer accuracy, against 55% when a model swaps in its own state. That is a much narrower test, but it points the same way. Model internals are interchangeable enough for systems to start passing them around. Speculative encoding is the first open, runnable many-to-many version for long context. The next step is checking whether its reported retention holds on your own documents and handoffs.

Sources

  1. Speculative Encoding: Many-to-Many Cache Translation | Base Labs
  2. GitHub - b10-tv/speculative-encoding: Translate one LLM's document states into another LLM's KV cache, with query-aware compression, served through vLLM · GitHub
  3. Ramp Labs on X: "Multi-agent swarms shouldn't have to read context more than once. Introducing speculative encoding, one 2.35B MoE that directly translates between any model's hidden states. Across 7 models, it keeps 96.9% of base accuracy and cuts prefill latency by up to 7.5× on long documents." /
  4. Baseten on X: "If your agents use more than one model (multi-agent systems or swarms) for a task, you have to process the same context every time a new model picks up the task. Our research team at @baselabs collaborated with @RampLabs to translate between models instead, introducing a new method c…
  5. [RFC]: Async Pre-Allocation Wait State in Scheduler for External KV Transfer and Lookup · Issue #70051 · vllm-project/vllm · GitHub
  6. Plato’s Key · Hazy Research