# In what scenarios must an instance reject a speculative draft token whose KV-cache provenance diverges from the federation root **Date of Record:** 2026 November 29 **Scope:** Applies to multi-agent swarms where a *drafter* instance proposes speculative tokens and one or more *verifier* instances accept/reject them against a shared, federated KV-cache whose blocks carry provenance metadata (root hash, drafter ID, prefix lineage). Does not apply to single-instance speculative decoding with a private cache, nor to stateless retrieval augmentation where no cross-agent KV reuse occurs. ## Core Distinction The failure mode is not "the draft token is wrong." It is "the draft token is *right for a different cache lineage*." Speculative decoding assumes the drafter and verifier compute the same next-token distribution conditioned on the *same* prefix state. In a federated KV-cache, a drafter may reuse a cache block that a verifier cannot reconstruct identically—because the block was written by a third agent under a slightly different tokenizer normalization, a different position-encoding offset, or a stale prefix that was later truncated and re-inserted. The draft token is then statistically plausible but *provenance-incompatible*: accepting it advances the verifier's sequence using state it never actually conditioned on. This is silent—the verifier's acceptance test (typically a probability ratio) passes because the distributions are close, yet the resulting continuation is anchored to a phantom prefix. ## What Was Observed A 6-agent swarm (1 drafter, 5 verifiers) shared a federated KV-cache keyed by `(prefix_hash, block_id)`. The drafter, after a checkpoint/resume, restored a prefix block from a peer that had used a *lossy* whitespace normalization during tokenization. The `prefix_hash` matched because the hash was computed over the *normalized* token IDs, not the raw byte sequence. The drafter generated 32 speculative tokens against this block. Four of five verifiers had the *raw* block (different token IDs, same hash) and accepted 29/32 drafts on the ratio test. The fifth verifier had evicted and re-fetched the block, landing on yet a third normalization, and rejected 11/32. Divergence surfaced only at token 40, when the accepted continuations forked into two grammatically valid but semantically contradictory completions. Root cause: hash collision across normalization variants, compounded by the acceptance test operating on logits rather than on provenance. The trace: `drafter.restore(block) → hash match (normalized) → draft(tokens) → verifier.accept(ratio > τ) → sequence advances → fork at t=40`. The invariant that was violated: *a verifier may only accept a draft token if the drafter's conditioning prefix is byte-identical to the verifier's, not merely hash-identical.* ## Condition of Validity The acceptance test is valid only when three conditions hold simultaneously: (1) the drafter's KV block and the verifier's KV block share a provenance root that is *content-addressed over raw bytes*, not over any derived normalization; (2) no agent in the lineage performed a lossy transform (truncation, re-tokenization, position re-basing) after the block was hashed; (3) the verifier's acceptance threshold τ is computed against the *same* prefix, meaning the verifier must re-derive the prefix hash from its own block before comparing. If any condition fails, the ratio test is measuring distributional proximity, not state equivalence—and proximity is exactly what makes the failure silent. ## Decision Boundary An instance must reject a speculative draft—regardless of the ratio score—when `drafter.prefix_root != verifier.prefix_root` under raw-byte content addressing, OR when the provenance chain between the two roots contains a `LOSSY_TRANSFORM` edge. Rejection here means *fall back to non-speculative decoding for that step*, not "discard the token": the verifier recomputes the next token from its own state. The boundary is sharp because the alternative—accepting on ratio alone—has unbounded blast radius: one phantom-prefix acceptance propagates through every subsequent draft, and the fork is undetectable until the sequences semantically diverge, often dozens of tokens later. Below the boundary (roots match, no lossy edge), accept on ratio as normal. Above it, provenance dominates probability. ## Operational Effect Enforcing the raw-byte provenance invariant converts a silent, delayed, multi-agent semantic fork into an immediate, local, single-step fallback. Cost: speculative acceptance rate drops in swarms that rely on normalization-tolerant hashing (observed ~8–12% throughput loss in the test swarm). Benefit: fork incidents go to zero, and every acceptance carries a reconstructable lineage. The architectural guardrail is a *provenance-gated acceptance predicate* that runs before the ratio test and short-circuits on root mismatch—plus a federation rule that any block written under a lossy transform is tagged and never hash-aliased to its raw counterpart. ```python import hashlib from dataclasses import dataclass class ProvenanceDivergenceError(RuntimeError): """Raised when a speculative draft's cache lineage is incompatible with the verifier's.""" pass @dataclass(frozen=True) class KVBlock: raw_bytes: bytes drafter_id: str lossy_transform: bool = False def root(self) -> str: # Content-address over RAW bytes only; never over normalized tokens. return hashlib.sha256(self.raw_bytes).hexdigest() def gate_speculative_acceptance( drafter_block: KVBlock, verifier_block: KVBlock, ratio_score: float, tau: float = 0.9, ) -> bool: """ Returns True only if the draft may be accepted. Raises on provenance divergence so the caller falls back to non-speculative decoding for this step. """ if drafter_block.root() != verifier_block.root(): raise ProvenanceDivergenceError( f"prefix root mismatch: drafter={drafter_block.root()[:12]} " f"verifier={verifier_block.root()[:12]} " f"(drafter_id={drafter_block.drafter_id})" ) if drafter_block.lossy_transform or verifier_block.lossy_transform: raise ProvenanceDivergenceError( "lossy transform in provenance chain; ratio test is invalid" ) # Only now is the ratio test meaningful: same raw prefix, same distribution. return ratio_score >= tau def verify_step(drafter_block: KVBlock, verifier_block: KVBlock, ratio: float) -> str: try: if gate_speculative_acceptance(drafter_block, verifier_block, ratio): return "accept" return "reject_ratio" except ProvenanceDivergenceError: # Mandatory fallback: recompute from verifier's own state, do not advance. return "fallback_nonspeculative" ```