Skip to main content

Drafts trained on your traffic

Speculative decoding is fast only when the draft guesses what your model will write. A draft trained on public chat guesses public chat; on your traffic (your languages, your system prompts, your formats) it guesses less often. A draft trained on prompts from your traffic guesses more often. The training runs in your account, and a campaign measures the result against what you serve today before anything changes. This page covers three things:
  • where the training data comes from, and what is stored where;
  • the training job that runs in your cluster;
  • how a trained draft becomes a setup a campaign measures.

What is built and what is not

How it works

  1. Prompts stay in your account. Either you give the job a file of prompts, or the endpoint captures prompts for you after you turn capture on. Neither leaves your cluster or bucket.
  2. The job trains in your cluster. A Kubernetes Job runs a pinned trainer image on your GPU. Your model answers every prompt at temperature 0 inside the job, and the draft learns from those answers. It starts from a published draft for the same model when there is one.
  3. Numbers come back. The job writes the draft and a report beside it. The report holds counts, digests and acceptance shares, never text.
  4. You name the draft in a plan. With diagnosis_endpoint and speculative_drafts, the planner adds a setup that serves your draft. It also adds the setups your draft must beat.
  5. The judge decides. The campaign measures each setup against your current one on your traffic shape, scores answers on a task set, and confirms a gain on fresh servers. Nothing is applied until you approve.

Where the training data comes from

The draft learns from your model’s answers, not your users’ answers: EAGLE-3 drafts imitate the model they serve, so the job has the model answer each prompt again. Only prompts are needed.

A prompt file you choose (built)

Put a JSON-lines file on a volume in your cluster, one conversation per line:
Use prompts you are allowed to process this way: a sample you already keep, synthetic prompts in your format, or a public dataset of the same kind. The job reads the file read-only. The job splits off 10% as held-out prompts it never trains on and scores the draft on them.

Capture from an endpoint (designed, not built)

Capture is off by default. It is turned on per endpoint by an operator, and only on an endpoint whose traffic is served by an InferCrane agent in your cluster. The hosted gateway never captures.
A draft trained on your prompts is derived from them and can reproduce phrases it saw often. Keep it where you keep the prompts: a private Hugging Face repository in your organisation, or your bucket. Delete it when you delete the data.
Capture is not built yet. It needs a change to the agent’s data plane, so the invariant “prompts, completions, and request content never leave an agent’s machine or cluster” holds exactly as written: captured prompts stay on the operator’s volume, and nothing new goes to the control plane except the counts above.

The training job

speculator.TrainingJob is a bounded spec, not a shell command. KubernetesJob() renders it as a batch/v1 Job:
  • the trainer image, pinned by digest, which the operator allows;
  • the prompt volume mounted read-only at /data and an output volume at /output;
  • no service account token, a non-root user and no added capabilities;
  • backoffLimit: 0, so a failed run never trains twice;
  • the job’s own deadline, and deletion an hour after it ends;
  • HF_TOKEN only from a Kubernetes Secret you name, for a gated model or a private starting draft.
Defaults: method eagle3, 10% held out, 50,000 prompts, 20 million answer tokens, 1,024 tokens per answer, 3 draft tokens, 1 epoch, 1 GPU, 6 hours. Upper bounds: 200,000 prompts, 200 million tokens, 8 GPUs, 24 hours. The trainer is speculators 0.9.0 (Apache-2.0). vLLM 0.34.0 serves its output format directly, and it can start from a published EAGLE-3 draft. While training, a vLLM server in the same job computes the model’s hidden states on demand (extract_hidden_states). Nothing is stored between steps.

The report

The job writes report.json beside the draft (speculator.ReportSchema). DecodeReport refuses unknown fields, so a report cannot carry text:
  • dataset_fingerprint is the sha256 of the sorted example digests. It tells two training sets apart without holding either.
  • held_out_acceptance gives, per draft position, the share of held-out positions where the draft’s token was the model’s own, given the earlier positions were. It is an offline estimate. With the values above, a step writes about 1 + 0.81 + 0.81 × 0.66 + 0.81 × 0.66 × 0.55 ≈ 2.6 tokens. Only a campaign says whether serving gets faster.
  • artifact_digest is the sha256 of the file list: path size sha256, one line per file, sorted by path. A draft kept in a bucket is pinned by this digest.

Name the draft in a plan

Push the draft to a private Hugging Face repository in your organisation and pin its commit. Then ask for a plan from the endpoint’s diagnosis:
  • At most one trained draft and one published draft. Each must be trained against exactly the plan’s model and commit: a draft reads that model’s hidden layers.
  • Drafts need diagnosis_endpoint. The records enter the proposal’s input and its digest; the files never do.
  • A private draft is downloaded by the server with the same model_secret_reference_id as the model.

What the plan measures

Rule drafts.supplied (rule set diagnosis-technique-rules-v11) adds these setups: A setup another rule already chose keeps that rule’s place. Each draft setup removes whatever speculation your current setup had before it adds the draft:
A plan skips a draft, and says why, in these cases:
  • the server runs SGLang or a pinned custom image (only vLLM flags are reviewed);
  • the draft is in a bucket (not served yet);
  • the model is 1B parameters or smaller;
  • the draft record names no pin, or a pin to another engine version or GPU (see below).
Speculation can change what the model writes, so every draft setup needs a task score against your current setup (how a campaign checks answers).

Use it without InferCrane’s control plane

Every step runs from the CLI on your own machine, against any vLLM server, on any provider. Nothing is sent anywhere.
candidates asks the trained-draft technique for its candidates in the technique contract, the same answer the optimizer gets. A candidate names the draft by its artifact digest, carries the starting setup’s flags with the draft’s speculation in place of its own, and predicts a low-load speed range from the offline acceptance in the report. The judge, not the prediction, decides.

Pinned, with a fallback

A draft record is pinned to the engine version and GPU where it was built and qualified (pinned). On another engine version or GPU the technique proposes nothing and the starting setup serves unchanged, until the draft is qualified there. The same holds when the draft’s files are missing: a setup without its draft is the starting setup. The training job maps onto the artifact store’s provenance (optimizedartifact.Plan: tool vllm-speculators, exact version, builder image digest, the dataset fingerprint as the calibration digest, quality review required), and a finished report maps onto its attestation (repository, immutable revision, manifest digest). The draft is not built through acceleratorlab. That lab runs builds in InferCrane’s own sandboxes, and a build that reads your prompts runs in your account (the technique contract refuses anything else).

Licences

What a result can and cannot say

  • The campaign compares each setup with your current one on the traffic shape you replay. With a prompt corpus, the text is real; without one, acceptance on your content stays unknown (see how a campaign measures candidates).
  • A draft is trained on traffic up to a date. When your traffic changes, its acceptance falls. Check produced_at, and train again when a stay-optimized check shows acceptance dropping.
  • Every trained-draft result carries the evidence the technique’s manifest requires, draft-acceptance: acceptance read from vLLM’s own speculation counters over the measured runs, in a file whose sha256 the technique record holds. A record without it, or from a harness commit with uncommitted changes, is “not shown”. Like every technique’s result, it is also “not shown” until a fresh machine has measured the gain again (fresh-machine-confirmation).
  • Company figures for this technique are company-reported. Together AI reports 1.23x to 1.45x over its base speculator; Fireworks AI reports a 76% against 29% hit rate. They are not InferCrane measurements, and no InferCrane page compares with them as if they were.