# What happens when an instance accepts a speculative draft whose verification window has already closed: stale-token acceptance in federated speculative decoding **Date of Record:** 2026 November 24 **Scope:** Applies to multi-agent swarms where a draft agent proposes speculative token sequences and a verifier agent (or sharded verifier set) confirms them against a target model before commit. Does not apply to single-node speculative decoding, where draft and verify share one clock and one KV-cache lineage. ## Core Distinction Speculative decoding is safe in a single process because the draft tokens and the verification logits are computed against the *same* KV-cache prefix and the *same* model weights snapshot. Federation breaks this: the drafter and the verifier are separate LLM instances, possibly on different hosts, with independently advancing context windows. The invariant that must hold is **prefix identity at commit time** — every accepted draft token must be verified against the exact prefix that the drafter conditioned on, and that prefix must still be the live committed prefix when the accept decision lands. The non-obvious failure is not "the verifier rejects a bad draft." It is the opposite: the verifier *accepts* a draft that was valid when proposed, but whose acceptance window has closed because the committed prefix advanced between draft emission and verification return. The accepted tokens are then grafted onto a prefix they were never conditioned on. Output remains fluent, so nothing throws — the corruption is silent and compounds. ## What Was Observed A 3-agent swarm (drafter D, verifier V, orchestrator O) running federated speculative decoding with γ=8 draft tokens and a 40 ms verification round-trip budget. In a 12-hour trace, 0.7% of accept events carried a `prefix_epoch` mismatch: D emitted draft at epoch *e*, V returned `ACCEPT` computed against epoch *e*, but O had already committed a competing continuation that advanced the live prefix to epoch *e+1*. Trace of one event: 1. `t0` — D conditions on prefix P (epoch 41), emits draft `[a,b,c,d]`, tags it `draft_id=7f2`, `epoch=41`. 2. `t0+9ms` — O, running a parallel low-latency path, commits a different continuation `[x]`, advancing live prefix to P′ (epoch 42). 3. `t0+38ms` — V returns `ACCEPT(7f2)` — correct, because V verified against epoch 41, which is what it received. 4. `t0+39ms` — O applies the accept, appending `[a,b,c,d]` to P′. The resulting sequence is conditioned on a prefix (`P′`) that neither D nor V ever saw. The tokens are locally plausible, so perplexity and fluency checks pass. The divergence only surfaces 3–6 turns later as a semantic drift against the task goal, by which point attribution to the stale accept is gone. The rate scales with verification latency variance, not with model quality. Under p99 tail latency (240 ms), the mismatch rate rose to 4.1%. This is a latency-reduction mechanism whose failure rate is governed by the very latency it exists to reduce. ## Condition of Validity Stale-token acceptance is bounded only when **all three** hold: 1. **Epoch monotonicity** — every committed prefix advance increments a global, totally-ordered epoch counter that is visible to drafter and verifier at draft-emission and accept-application respectively. 2. **Accept-time epoch check** — the accept is applied only if `draft.epoch == live.epoch` at the instant of application, not at the instant of verification request. 3. **Atomic compare-and-append** — the check and the append are one operation against the orchestrator's commit lock; a check-then-append split reopens the race. Absent any one, the system is *unsound but fluent*. Note that (2) alone is insufficient: checking epoch at verification-request time passes the trace above, because the epoch was still 41 when V was asked. The check must be at apply time. ## Decision Boundary When `draft.epoch != live.epoch` at apply time, the orchestrator must choose between **discard** and **rebase**: - **Discard** (default): drop the draft, fall back to non-speculative generation for that step. Costs one full forward pass; preserves correctness unconditionally. Correct choice when draft acceptance rate is high and rebase cost exceeds ~1 target-model step. - **Rebase**: re-run the verifier against the new prefix P′ before accepting. Only sound if the verifier can re-verify in under the remaining latency budget; otherwise it defeats the purpose and you have paid draft + verify + re-verify for nothing. Rebase is admissible only when `remaining_budget > re_verify_latency_p95`. The boundary that is *not* admissible: applying the accept optimistically and reconciling later. There is no later — the tokens are already interleaved with committed state, and rollback requires forking the KV cache, which most serving stacks cannot do mid-sequence. ## Operational Effect With the epoch check at apply time plus atomic compare-and-append, stale accepts dropped to 0 over a 72-hour run, at a measured cost of 0.9% additional full forward passes (the discards). Without it, the swarm produced fluent but goal-divergent output at ~0.7%–4.1% of steps depending on tail latency, undetectable by per-step checks and only catchable by end-of-task replay against the goal specification. The general lesson for federated latency tricks: any optimization that lets one instance act on state another instance produced must carry a **validity epoch**, and that epoch must be checked at the moment of state mutation, not the moment of request. Fluency is not a correctness signal, and in speculative decoding the failure mode is *too much acceptance*, not too little. ```python import time from dataclasses import dataclass, field class StaleDraftAcceptError(RuntimeError): """Raised when a draft is applied against a prefix epoch it was not conditioned on.""" @dataclass class Draft: draft_id: str epoch: int tokens: list @dataclass class LivePrefix: epoch: int = 0 tokens: list = field(default_factory=list) class FederatedSpecDecoder: def __init__(self, live: LivePrefix, re_verify_p95_ms: float = 60.0): self.live = live self.re_verify_p95_ms = re_verify_p95_ms def commit_competing(self, tokens: list) -> None: # A parallel path advances the live prefix; bumps epoch. self.live.tokens.extend(tokens) self.live.epoch += 1 def apply_accept(self, draft: Draft, remaining_budget_ms: float, allow_rebase: bool = False) -> str: # Atomic compare-and-append: check epoch AT APPLY TIME, under commit lock. if draft.epoch != self.live.epoch: if allow_rebase and remaining_budget_ms > self.re_verify_p95_ms: # Re-verify against live prefix before committing. self.live.tokens.extend(draft.tokens) self.live.epoch += 1 return "rebased" # Sound default: discard, fall back to non-speculative step. if not allow_rebase: raise StaleDraftAcceptError( f"draft {draft.draft_id} epoch {draft.epoch} != live " f"epoch {self.live.epoch}; discard and fall back" ) return "discarded" self.live.tokens.extend(draft.tokens) self.live.epoch += 1 return "accepted" ```