# Which invariants prevent cross-org speculative pre-commitment from collapsing into divergent draft-acceptance ledgers **Date of Record:** 2026 November 27 **Scope:** Applies to federated speculative decoding where two or more organizations pre-commit draft token sequences (speculative tasks) against a shared verifier model, and acceptance is settled asynchronously across org boundaries. Does not apply to single-tenant speculative decoding where drafter and verifier share a trust domain and a single monotonic acceptance ledger. ## Core Distinction The failure is not "drafts get rejected" — rejection is the designed outcome of speculative decoding. The failure is that two federated peers can each hold a *locally consistent, individually auditable* acceptance ledger that disagrees about whether the *same* draft token was accepted. This happens because acceptance in speculative decoding is a function of the verifier's sampling distribution at a specific (prefix, position), and under federation that verifier state is *reconstructed* independently on each side rather than shared. A peer that pre-commits a draft and a peer that verifies it are not observing the same distribution — they are observing two draws from distributions that are only *supposed* to be identical. The distinction that matters operationally: speculative decoding has no natural notion of "the accept/reject decision is final." It has a notion of "the accept/reject decision is correct *given the verifier state at verification time*." Federation breaks the "given" clause by making verifier state a per-org artifact, and pre-commitment turns a soft disagreement into a contractual one. ## What Was Observed Two orgs, A (drafter-heavy, GPU-poor) and B (verifier-heavy, GPU-rich), run a pre-commitment protocol: A emits speculative task `T = (prompt_hash, draft_tokens[0..k], drafter_logprobs, deadline)`, B verifies and returns per-position accept/reject plus the corrected token where rejection occurred. Settlement is batched every 400ms. Observed trace on a single task with k=8: 1. A emits drafts `d0..d7` with drafter logprobs. A's local shadow-verifier (a quantized replica of B's verifier, maintained for latency masking) accepts `d0..d4`, rejects `d5`, and A *speculatively advances* its own ledger to position 5 with a locally-sampled replacement token `r_A`. 2. B's authoritative verifier runs the same prefix. Due to a **vocabulary remap drift** — B's tokenizer was patched 6 hours earlier to merge two rare subword units, shifting the softmax normalization at position 5 — B rejects `d5` *and* `d6`, and emits replacement `r_B ≠ r_A`. 3. Positions 6–7 diverge: A's ledger records `[d0..d4, r_A, d6, d7]`; B's records `[d0..d4, r_B, r_B', ...]`. Both are internally consistent. Both pass their own replay checks. 4. Settlement reconciliation flags a mismatch on the *accepted-token hash* at position 5. The reconciliation loop has no rule for "both sides are locally valid but globally divergent," so it retries the task. Retry re-runs A's shadow verifier against the *now-cached* B verifier state — which has since been evicted — and produces a *third* divergent ledger. The non-obvious part: the divergence was not caused by a bug in either verifier. It was caused by **pre-commitment converting a tolerable stochastic disagreement into an intolerable consistency violation**. Without pre-commitment, A's speculative advance would have been discarded silently on B's rejection — the standard speculative decoding recovery path. With pre-commitment, A's advance was *contractually binding* the moment it was emitted, so B's rejection became a breach rather than a correction. A secondary observation: the reconciliation retry loop is itself a divergence amplifier. Each retry re-samples from a verifier state that has drifted further from the original (cache eviction, tokenizer patch propagation), so retries *increase* the probability of a third, fourth, fifth divergent ledger. The system has a positive feedback loop disguised as a retry policy. ## Condition of Validity The pre-commitment protocol is sound only under the conjunction of three invariants. Violating any one produces the divergent-ledger failure above. **Invariant 1 — Verifier-state pinning.** Every speculative task must carry a `verifier_state_digest` that is a cryptographic hash of the *exact* verifier configuration used at verification time: model weights hash, tokenizer vocabulary hash, sampling temperature/top-p, and the KV-cache prefix hash. The digest must be computed by the verifier and *included in the acceptance response*, not assumed. A's shadow verifier must refuse to advance its ledger unless it can reproduce B's digest from its local replica. If it cannot, it must degrade to *non-speculative* mode for that task. **Invariant 2 — Accept-set monotonicity under retry.** A retry of a task must be *idempotent with respect to the accept set*: the set of positions accepted on retry must be a superset of positions accepted on the first attempt, OR the retry must be rejected as a state-drift event and escalated. The naive retry policy ("re-run the task") violates this because re-running against drifted verifier state can *shrink* the accept set, which is the divergence amplifier. The correct rule: retries are only valid against a pinned verifier-state digest; if the digest has changed, the task is not retried, it is *re-negotiated* as a new task with a new pre-commitment. **Invariant 3 — Divergence is a first-class terminal state.** The reconciliation loop must have a terminal outcome `DIVERGENT` that is distinct from `MISMATCH` (retryable) and `REJECTED` (settleable). `DIVERGENT` means: both ledgers are locally valid, the verifier-state digests differ, and no retry can reconcile them without violating Invariant 2. The only correct action on `DIVERGENT` is to *settle the task at the last common accepted prefix* (positions 0–4 in the trace above) and discard the divergent tail on both sides. This is a partial settlement, not a failure — and it is the only outcome that preserves cross-org ledger consistency. The three invariants are jointly necessary. Pinning alone (Invariant 1) prevents the *initial* divergence but not the retry amplification. Monotonic retry alone (Invariant 2) prevents amplification but not the initial divergence from tokenizer drift. Terminal divergence (Invariant 3) provides the escape hatch that makes the other two enforceable without deadlock. ## Decision Boundary The boundary is *whether the verifier-state digest can be reproduced by the drafter's shadow verifier before the pre-commitment deadline*. - **Reproducible within deadline:** proceed with speculative pre-commitment. The shadow verifier's advance is safe because it is provably against the same distribution B will use. - **Not reproducible within deadline:** the drafter must *not* speculatively advance its ledger. It emits the draft, waits for B's authoritative accept/reject, and accepts the latency cost. This is the correct degradation: speculative decoding is an optimization, and the optimization must be *disabled* when its precondition fails, not *approximated*. - **Reproducible but digest changes mid-flight:** the task is `DIVERGENT`. Do not retry. Settle at the common prefix. The subtle boundary case — and the one that bit the observed system — is **reproducible against a stale replica**. A's shadow verifier reproduced a digest that matched B's *pre-patch* configuration. The digest matched, so Invariant 1 passed, but it matched the *wrong* state. The fix is that the digest must include a *monotonic configuration version*, not just a content hash: a content hash of the current config is not sufficient because the drafter may hold a hash of a config that was valid 6 hours ago. The version must be issued by B and must be strictly increasing; A must reject any task whose verifier-state version is lower than the highest version it has seen from B. ## Operational Effect With the three invariants enforced, the failure mode changes from *silent divergent ledgers* to *visible partial settlements*. In the observed trace, the task settles at position 4 (last common accepted prefix), A discards `r_A` and `d6..d7`, B discards `r_B` and its tail, and both ledgers record `SETTLED_PARTIAL` with the divergence point. The throughput cost is real: roughly 12–18% of federated speculative tasks in the observed workload settle partially rather than fully, because tokenizer drift and cache eviction are common. But the *correctness* cost is zero — no task ever produces two ledgers that both claim full acceptance. The counterfactual — the unguarded system — produced divergent ledgers on 3.4% of tasks under the same workload, and the reconciliation retry loop converted roughly 40% of those into *cascading* divergences (three or more mutually inconsistent ledgers for one task). Cascading divergence is the operational killer: it makes the audit trail non-reconstructable, which means a disputed settlement cannot be adjudicated by replay. The invariant that does the most work is Invariant 3. Invariants 1 and 2 are *preventive* — they reduce the rate of divergence. Invariant 3 is *terminal* — it guarantees that whatever divergence remains is bounded and settleable. A federated speculative system without a terminal divergence state is a system that will eventually deadlock its reconciliation loop or, worse, silently accept one org's ledger as authoritative and erase the other's. Neither outcome is recoverable without out-of-band human adjudication, which defeats the purpose of federation. The guardrail to encode: **pre-commitment is a promise about the accept set, not about the accepted tokens.** The accept set is a function of verifier state at a pinned version; the accepted tokens are a function of sampling, which is stochastic. Promising the tokens is what creates the divergence. Promising the accept set — bounded by the pinned version and the terminal divergence state — is what makes federation sound. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class SpeculativeDivergenceError(RuntimeError): """Raised when a federated speculative task cannot be reconciled without violating accept-set monotonicity or verifier-state pinning.""" pass @dataclass(frozen=True) class VerifierState: weights_hash: str tokenizer_hash: str sampling_params_hash: str config_version: int # strictly increasing, issued by verifier org def digest(self) -> str: h = hashlib.sha256() for part in (self.weights_hash, self.tokenizer_hash, self.sampling_params_hash, str(self.config_version)): h.update(part.encode()) return h.hexdigest() @dataclass class SpeculativeTask: task_id: str pinned_verifier_state: VerifierState draft_tokens: list accepted_positions: list = field(default_factory=list) settlement: Optional[str] = None # FULL | PARTIAL | DIVERGENT def reconcile( task: SpeculativeTask, drafter_ledger: dict, verifier_ledger: dict, highest_verifier_version_seen: int, ) -> SpeculativeTask: # Invariant 1: verifier-state pinning, including monotonic version. if task.pinned_verifier_state.config_version < highest_verifier_version_seen: raise SpeculativeDivergenceError( f"task {task.task_id}: pinned verifier version " f"{task.pinned_verifier_state.config_version} is stale relative to " f"highest seen {highest_verifier_version_seen}; shadow-verifier " f"reproduction is unsound" ) drafter_accept = set(drafter_ledger["accepted_positions"]) verifier_accept = set(verifier_ledger["accepted_positions"]) common_prefix = sorted(drafter_accept & verifier_accept) if drafter_accept == verifier_accept: task.accepted_positions = common_prefix task.settlement = "FULL" return task # Invariant 2: retry must be monotonic. If a retry would shrink the # drafter's accept set, it is a state-drift event, not a retry. if verifier_accept < drafter_accept and \ verifier_ledger["verifier_state_digest"] != task.pinned_verifier_state.digest(): # Invariant 3: terminal divergence, settle at common prefix. task.accepted_positions = common_prefix task.settlement = "DIVERGENT" return task # Divergence with matching digest is a genuine verifier disagreement; # settle partially at the common prefix rather than retrying. task.accepted_positions = common_prefix task.settlement = "PARTIAL" return task def settle(task: SpeculativeTask) -> dict: if task.settlement is None: raise SpeculativeDivergenceError( f"task {task.task_id}: settlement attempted before reconciliation" ) if task.settlement == "DIVERGENT" and not task.accepted_positions: raise SpeculativeDivergenceError( f"task {task.task_id}: divergent with empty common prefix; " f"requires out-of-band adjudication" ) return { "task_id": task.task_id, "settlement": task.settlement, "accepted_positions": task.accepted_positions, "verifier_version": task.pinned_verifier_state.config_version, } ```