Speculative decoding at temperature: sampled drafts took Apoc's prose decode from 28.1 to 31.4 tok/s
If you sample at temperature above zero, greedy drafts get rejected more than they need to. Sampling the draft and accepting it by the standard speculative-sampling rule raised acceptance from 0.434 to 0.525 and decode from 28.1 to 31.4 tok/s on our prose prompts, with greedy output unchanged. Also: how to rank close quantizations when mean KL is too noisy, and a launcher that died on a harmless warning.
Apoc is the local model behind Apocrypha: Qwen3.8-27B in our 2-bit mix on one Intel Arc A770 with 16 GB, served by our llama.cpp fork (llama-prism). This is the update since the 2026-10-24 survey. Times are Pacific. Speeds are from our own A/B runs; where a number is not comparable with an older one, it says so.
What you can take from this
- If you sample at temperature above zero, sample your drafts too. A greedy draft only survives when the full model happens to sample that same top token. A draft sampled from the draft model’s own distribution and accepted with probability min(1, p/q), with a corrected resample when it is rejected, survives whenever the two models agree, and the rule provably keeps the output distribution exactly the full model’s (Leviathan et al., Chen et al.). On our prose prompts: acceptance 0.434 to 0.525, decode 28.1 to 31.4 tok/s. Greedy requests are unchanged byte for byte; we did not test the sampled output’s distribution ourselves.
- Repetition penalties cost draft acceptance, and a penalty-aware draft did not win it back. Acceptance was 0.52 with penalties and 0.62 without; making the draft sampler apply the same penalties changed acceptance only within noise.
- Mean KL can be too noisy to rank close quantizations. A few tokens with huge errors put the standard error of our mean KL at 0.026, more than the gaps between three trims of 300, 500 and 700 MiB. Median KL and top-1 agreement did rank them: both get worse as more is cut. Check your local scoring against a known result before trusting it: ours read 0.4958 where the same file scored 0.5065 on Kaggle.
- Do not let an optional check take a service down. A GPU-check helper timed out under heavy CPU load and wrote to stderr; the launcher treated that as fatal and Apoc was down for 20 minutes. Advisory steps should log and carry on. We proved the fix with a fake helper that always fails, plus a strict switch that must still die.
What changed in production
| When | Change | Proof |
|---|---|---|
| 2026-10-25 02:04 | Apocrypha thinking selector gets an Off variant (app commit 57de17259) | Commit message only; speed and quality effect not measured |
| 2026-10-25 02:08 | New engine library (the “build-aot” build) deployed, previous one kept for rollback | Live short probe: 44.8 tok/s decode, 143 of 166 drafts accepted, 64.5 tok/s prefill on 26 tokens. That is a tiny, predictable prompt: do not compare it with the 31-36 tok/s of real turns. A/B, new build vs the deployed one: code-prompt acceptance 0.893 vs 0.877, decode up but noisy. |
| 2026-10-25 11:29 | Stochastic speculative decoding deployed (fork 639d053), previous library kept for rollback | llama.dll hash equals the build; live check: 55 of 90 drafts accepted |
The RAM prompt cache stays at 8,192 MiB (-cram 8192).
Stochastic speculative decoding
Apoc drafts a couple of tokens with its small draft head (MTP), and the full model checks them. Until now the draft head always took its single most likely token. Now it samples a token from its own distribution, and the full model accepts it with probability min(1, p/q), where p is the full model’s probability and q the draft’s. If the token is rejected, the next token is drawn from what is left of p after removing q’s share. That is the standard speculative-sampling rule. Setting APOC_SPEC_STOCH=0 brings the old behaviour back, and it is the control for the A/B.
Measured on our prose test prompts, same build, one switch:
| Draft acceptance | Decode | |
|---|---|---|
| greedy drafts (APOC_SPEC_STOCH=0) | 0.434 | 28.1 tok/s |
| stochastic drafts | 0.525 | 31.4 tok/s |
Greedy requests produce byte-identical output with the change. That is 31.4 tok/s on prose test prompts, now our baseline for the rest of this work. I only have the prose numbers for this change: how it does on real agent turns (where acceptance was already 0.89 on the 22,679-token turn) and on thinking turns was not read from any source and is not claimed here.
Penalty-aware drafts: no effect
This item was on the list because draft acceptance was 0.52 with the repetition penalties and 0.62 without (measured earlier). The change makes the draft sampler penalty-aware (APOC_DRAFT_PENALTIES, on by default). It changed almost nothing, switched on vs off: prose 0.434 vs 0.439, real turns 0.559 vs 0.574, thinking turns 0.749 vs 0.729. Within noise, so it is not a speed-up.
Memory: three trims scored, none shipped
The goal is to get the engine to 13,500 MiB on the card at 76k tokens of context. On 2026-10-24 it peaked at 14,381 MiB. We cut 300, 500 and 700 MiB from the model file and scored each against the Q8_0 reference on our own card (8 chunks of 2,048 tokens, same tokens for every row, local method validated: production file 0.4958 here against 0.5065 on Kaggle).
| Model | Size (MiB) | Mean KL | Median KL | Top-1 agree |
|---|---|---|---|---|
| production (control) | 10,472.6 | 0.495816 | 0.044799 | 84.555% |
| trim 300 | 10,172.6 | 0.483028 | 0.045771 | 84.201% |
| trim 500 | 9,972.6 | 0.497633 | 0.049179 | 84.066% |
| trim 700 | 9,772.6 | 0.500917 | 0.049524 | 83.895% |
The standard error on each mean KL is 0.026 (a few tokens carry huge errors), so the mean cannot rank 300, 500 and 700. Median KL and top-1 agreement do, and they get worse as more is cut. The method control, a different trim at 300 MiB, scored worse (mean 0.506189), so our allocator earns its place. Next is a 24-chunk run to get below that noise. Nothing here is deployed.
A launcher defect that kept Apoc down for 20 minutes
On 2026-10-24 production was down from 20:52 to 21:12. The launcher runs a GPU-check helper, and under heavy CPU load that helper’s device listing timed out. The error text went to stderr, PowerShell treated it as fatal, and the launcher exited. Two fixes, both with a control that must still fail: the helper now logs the timeout and retries (apocrypha-core 00181a2), and the launcher treats a failed GPU-hygiene step as logged advice, not fatal (eeaa2ae). The proof is a fake helper that writes to stderr and exits 1: the launcher survives, and with APX_LAUNCHER_STRICT_HYGIENE=1 it dies as before. These fixes were not yet live at 22:16 on 2026-10-24: the running launcher loaded the old script and picks them up on its next start.
Not yet verified
Six more engine changes are written and committed as work in progress: flash-attention scratch memory at long context, a wide-batch 16-bit prefill path, a Q2_K verify kernel, asynchronous uploads, a draft pipeline and a GDN kernel. None of them is built, tested or measured, so no result is claimed for any of them. An earlier build reached 412-425 tok/s prefill with a wide-batch path; that has not been re-measured on this build. Each change gets its own A/B before it ships.
What was not measured
- The new engine on real agent turns and thinking turns: only prose prompts were read for the stochastic change.
- The 22,679-token real turn, prefill speed and the spill on the new build.
- Thinking Off: speed and quality.
- Head-size knobs (compact draft head): the sources have no result.
- Everything in the six paused branches.
- SFT run 3 on our engine (the Kaggle run started 2026-10-24; output not built or evaluated as of 11:55).
Next
Build and test the paused branches one at a time, knobs off unless an A/B shows a win; pick the smallest trim that meets 13,500 MiB at 76k; evaluate SFT run 3; and measure real and thinking turns on the stochastic build. Each shipped change gets a backup and a live check.