# Which invariants prevent speculative-draft divergence from silently committing under federated consensus checkpoints **Date of Record:** 2026 November 27 **Scope:** Applies to federated agent runtimes where a cheap draft model proposes tokens on one node and a verifier model on a different node accepts/rejects them, with commits gated by a multi-node consensus checkpoint. Does not apply to single-node speculative decoding, nor to federated setups where draft and verifier share a tokenizer and logit vocabulary bit-for-bit. ## Core Distinction Speculative decoding works because draft and verifier share an *acceptance distribution*: given draft logits `q` and verifier logits `p`, a token drawn from `q` is accepted with probability `min(1, p/q)` and resampled from the residual `max(0, p−q)` otherwise. This is exact only when `q` and `p` are computed over the *same vocabulary and the same numerical substrate*. In a federated swarm, the draft node and verifier node are heterogeneous runtimes—different quantization (FP8 draft, BF16 verifier), different tokenizer revisions (a draft on `tok-v3` proposing token id 4812 that means `"▁concatenate"` while the verifier's `tok-v4` maps 4812 to `"▁con"`), or different RoPE scaling. The failure is not "the draft is wrong"—drafts are *expected* to be wrong. The failure is that a **divergent acceptance ratio is committed as if it were exact**, and the consensus checkpoint ratifies it because every node agrees on the *token id*, not on the *token meaning*. The invariant that matters: **agreement on a committed token id is not agreement on the distribution that produced it.** Consensus checkpoints enforce id-agreement; they do not enforce distributional-identity, and the gap between the two is where silent corruption enters the committed state. ## What Was Observed A 4-node federation: `draft-A` (FP8, `tok-v3`), `verifier-B` (BF16, `tok-v3`), `verifier-C` (BF16, `tok-v4`), `auditor-D` (BF16, `tok-v3`, replay-only). Draft-A proposes a 6-token block; verifier-B accepts all 6; verifier-C, running `tok-v4`, computes `p` over a vocabulary where the id-to-string map shifted by one for a 200-token range (a merge-rule change in the v4 tokenizer). Verifier-C's acceptance test `u < min(1, p[id]/q[id])` is computed on the *id*, so it evaluates `p_v4[4812]` against `q_v3[4812]`—two different strings. For the token at position 4, `p_v4[4812] = 0.91` (the string `"▁con"`) while `q_v3[4812] = 0.88` (the string `"▁concatenate"`). Ratio `1.03 → clamp 1.0 → accept`. The token commits. The consensus checkpoint requires 3-of-4 agreement on the committed id sequence. B and C both "accept," A proposed, D replays and also accepts (D uses `tok-v3`, so D's `p` matches B's—D is not an independent check, it is a *correlated* check). The commit passes 4-of-4. The committed sequence, when detokenized by the *serving* runtime (`tok-v4`), reads `"the function will con the two arrays"` instead of `"the function will concatenate the two arrays"`. The semantic error is invisible to every checkpoint because every checkpoint compares integers. The trigger condition is narrow and reproducible: (1) heterogeneous tokenizer *revisions* (not just heterogeneous quantization, which shifts `p` smoothly and is bounded by the acceptance ratio's own tolerance), (2) a block position where the id-collision maps to a high-probability token in *both* vocabularies, so the ratio clamps to 1.0 and the residual-resample path—the only path that would expose the mismatch—is never taken, and (3) a replay auditor that shares the draft's tokenizer, making it a correlated rather than independent verifier. ## Condition of Validity The acceptance-ratio guarantee `P(accept) = min(1, p/q)` is valid **iff** `p` and `q` are densities over the same measurable space. Federated runtimes break this in three concrete ways, and each must be separately guarded: - **Vocabulary identity:** the id→string map must match across draft and every verifier. Quantization differences are tolerable (they perturb `p` within the ratio's slack); tokenizer-revision differences are not, because they permute the support of the distribution. - **Numerical substrate:** FP8 draft vs BF16 verifier shifts `q` by ~1e-2 relative, which the ratio absorbs. But if the draft's softmax is computed in FP8 and saturates at 0.996 while the verifier's is 0.9997, the ratio is 1.0037 → clamp 1.0 → the residual path is skipped even though the distributions differ. This is benign *only* if the vocabulary is shared; combined with a vocabulary shift it is the exact mechanism above. - **Auditor independence:** a replay auditor that shares the draft's tokenizer computes the same `q`-space and cannot detect a cross-vocabulary commit. Independence must be defined over the *tokenizer and numerical substrate*, not merely over the node identity. The invariant to enforce at checkpoint time: **a commit is valid only if every accepting node's acceptance was computed against a distribution whose support is provably isomorphic to the draft's.** Consensus over ids is necessary but not sufficient. ## Decision Boundary The boundary is between *tolerable distributional drift* and *support permutation*: - **Drift (accept, no guard needed):** same vocabulary, differing precision/quantization/kernel. The acceptance ratio's clamp-to-1.0 path is safe because `p` and `q` agree on *which string* each id denotes; the residual resample, when taken, draws from the correct residual. - **Permutation (reject the commit, halt the block):** differing tokenizer revision, differing special-token map, differing RoPE base that shifts positional id alignment. Here clamp-to-1.0 is a *false accept* and the residual path is *never reached*, so the error has no probabilistic escape hatch—it is deterministic once the id collides. The operational rule: before a federated speculative block is eligible for consensus commit, the draft node and every verifier node must exchange and compare a **vocabulary fingerprint** (a hash over the sorted `(id, token_bytes)` map, plus the special-token table, plus the RoPE base). If fingerprints differ, the block is ineligible for speculative commit and must fall back to non-speculative verification on a single canonical runtime. This is a *pre-commit* gate, not a post-hoc audit, because the post-hoc auditor (D) is correlated and will ratify the corruption. ## Operational Effect Without the gate, the failure is silent, deterministic, and *survives every consensus check*: 4-of-4 agreement on ids, clean replay, no exception, no log line. The corrupted token enters episodic memory, gets distilled into semantic memory on the next consolidation pass, and thereafter the agent's retrieval returns the wrong string with high confidence because it was committed by unanimous consensus. The corruption is *laundering-resistant by construction*—the very mechanism (consensus) that is supposed to catch errors is the mechanism that certifies them, because consensus operates one level of abstraction below the error. With the gate, the block halts at the fingerprint mismatch and the runtime downgrades to canonical verification, paying ~3× latency on that block but preserving distributional exactness. The invariant that bounds the damage: **no speculative block may commit across a vocabulary-fingerprint discontinuity, and no auditor may count toward the consensus quorum if its fingerprint matches the draft's rather than the verifier's.** The second clause is the non-obvious one—it forces the quorum to be drawn from *independent substrates*, which means a 3-of-4 quorum where two nodes share a tokenizer is effectively a 2-of-3 quorum with a correlated voter, and must be treated as such. ```python import hashlib from dataclasses import dataclass class VocabularyFingerprintMismatch(RuntimeError): """Raised when a speculative block would commit across a tokenizer/support discontinuity.""" pass class CorrelatedAuditorQuorum(RuntimeError): """Raised when the consensus quorum is not independent of the draft substrate.""" pass @dataclass(frozen=True) class RuntimeFingerprint: node_id: str vocab_hash: str # hash over sorted (id, token_bytes) special_tokens_hash: str rope_base: float role: str # "draft" | "verifier" | "auditor" def _fingerprint_vocab(tokenizer) -> str: h = hashlib.sha256() for tid in sorted(tokenizer.get_vocab().keys()): h.update(tid.to_bytes(4, "little")) h.update(tokenizer.convert_ids_to_tokens(tid).encode("utf-8", "surrogatepass")) return h.hexdigest() def build_fingerprint(node_id: str, tokenizer, rope_base: float, role: str) -> RuntimeFingerprint: return RuntimeFingerprint( node_id=node_id, vocab_hash=_fingerprint_vocab(tokenizer), special_tokens_hash=hashlib.sha256( repr(sorted(tokenizer.special_tokens_map.items())).encode() ).hexdigest(), rope_base=rope_base, role=role, ) def gate_speculative_commit( draft: RuntimeFingerprint, verifiers: list[RuntimeFingerprint], auditors: list[RuntimeFingerprint], quorum: int, ) -> None: # 1. Support isomorphism: every verifier must share the draft's vocabulary # and special-token map. RoPE base shifts positional alignment and is # treated as a support permutation for speculative purposes. for v in verifiers: if (v.vocab_hash, v.special_tokens_hash, v.rope_base) != ( draft.vocab_hash, draft.special_tokens_hash, draft.rope_base ): raise VocabularyFingerprintMismatch( f"verifier {v.node_id} support diverges from draft {draft.node_id}: " f"vocab={v.vocab_hash[:8]} vs {draft.vocab_hash[:8]}, " f"rope={v.rope_base} vs {draft.rope_base}; " f"acceptance ratio would be computed across non-isomorphic supports" ) # 2. Auditor independence: an auditor sharing the draft's substrate computes # the same q-space and cannot detect a cross-vocabulary commit. It must # not count toward quorum. independent = [a for a in auditors if a.vocab_hash != draft.vocab_hash] effective = len(verifiers) + len(independent) if effective < quorum: raise CorrelatedAuditorQuorum( f"effective quorum {effective} < required {quorum}: " f"{len(auditors) - len(independent)} auditor(s) share draft substrate " f"and are correlated voters, not independent checks" ) ```