# How should an instance detect speculative pre-execution divergence before Byzantine quorum commit in federated agent scheduling **Date of Record:** 2026 November 24 **Scope:** Applies to federated schedulers where a coordinator dispatches speculative pre-execution of a step to N agents and commits the result only after a Byzantine quorum (f > (N−1)/3) of matching output hashes attests. Does not apply to single-agent speculative decoding, to non-federated tool-call retries, or to quorums where the commit predicate is a simple majority without equivocation checks. ## Core Distinction The distinction that governs this failure mode is between **quorum agreement on a hash** and **quorum agreement on a state**. A Byzantine quorum certifies that ≥⌈2N/3⌉+1 agents emitted the *same output digest* for a speculative step. It does not certify that those agents *executed the step from the same pre-state*. Under speculative pre-execution, each agent runs the step against its own locally materialized view of the prior context — a view that may have drifted by one or more mutations (a tool result cached at a different timestamp, a retrieved memory shard resolved against a stale index, a checkpoint resumed from a slightly older token offset). Two agents can produce byte-identical output digests from *different* input states whenever the step is idempotent-in-output but non-injective-in-input. The quorum then commits a result whose provenance is a state that never existed in any single agent, and the divergence is invisible because the digest matches. The invariant that must hold is: **a committed speculative step is valid only if the quorum intersection attests not just to `hash(output)` but to `hash(pre_state) ⊕ hash(output)`**, and the pre-state hash must be reconstructed from the coordinator's canonical lineage, not from the agents' local materializations. ## What Was Observed A federated scheduler with N=7 executor agents (f=2 tolerated) dispatched a speculative "retrieve-and-summarize" step across all seven. The coordinator's canonical pre-state lineage was at checkpoint C_41. During dispatch, three agents (A2, A5, A6) resumed from C_40 because their local checkpoint store had not yet acknowledged the C_41 promotion — a replication lag of 340 ms. The step was a retrieval-then-summarize whose output digest was computed over the summary text only, not over the retrieval citations. Trace: 1. Coordinator emits `SPECULATE(step=summarize, pre_state=C_41, lineage_hash=L41)` to all 7. 2. A1, A3, A4, A7 execute against C_41. They retrieve documents D_88, D_91 and emit summary S with digest `h(S)`. 3. A2, A5, A6 execute against C_40. C_40's retrieval index lacked D_91 (indexed only after C_41). They retrieve D_88 alone and — because the summarizer prompt was configured to omit citation lists when only one document matched — emit a summary S′ whose *text* was identical to S (both summarized D_88's content; D_91 was a near-duplicate that the summarizer collapsed). Digest `h(S′) = h(S)`. 4. Quorum forms: 7/7 attest `h(S)`. Coordinator commits step under pre_state C_41. 5. Downstream step `synthesize` receives S with an implicit citation set that the coordinator *believes* is {D_88, D_91} (from C_41 lineage) but which three agents actually derived from {D_88}. The committed artifact's provenance is a hybrid state. 6. Divergence surfaced only 4 steps later when an auditor agent replayed `synthesize` against the recorded citation set and produced a different output, failing verification replay. The failure was not a hash collision and not a Byzantine agent. All seven agents were honest. The quorum was structurally satisfied. The defect is that the commit predicate `count(h(output) == H) ≥ quorum` is **not a function of pre-state**, so it cannot distinguish agreement-on-output from agreement-on-execution. ## Condition of Validity The naive quorum commit is valid only under the condition that the speculative step is **pre-state-injective**: for all distinct pre-states p₁ ≠ p₂ in the reachable lineage set, `execute(p₁, step) ≠ execute(p₂, step)` as a *full* execution record (output + provenance + citations + tool-call log), not merely as output text. This condition is almost never checkable a priori for LLM steps, because: - Summarizers, extractors, and classifiers are routinely non-injective over inputs (many inputs collapse to one canonical output). - Output digests are typically computed over the final text, discarding the retrieval set, tool arguments, and intermediate reasoning that distinguish executions. - Checkpoint promotion lag (the C_40/C_41 gap) is a *transient* lineage skew that exists only during the replication window — precisely the interval in which speculative dispatch is most aggressive. Therefore the invariant must be enforced structurally: **speculative results carry a composite attestation `(pre_state_hash, output_hash, execution_trace_hash)` and the quorum predicate requires all three to match the coordinator's canonical lineage.** Any agent whose `pre_state_hash` ≠ the dispatched `lineage_hash` is excluded from the quorum set *before* counting, and the coordinator must verify that the remaining honest set still satisfies the Byzantine threshold. If excluding skewed agents drops the quorum below ⌈2N/3⌉+1, the step is not committed speculatively — it falls back to synchronous execution against the canonical state. ## Decision Boundary The boundary between "commit speculatively" and "fall back to synchronous" is a function of the **lineage skew count** κ (agents whose attested pre-state hash diverges from the dispatched lineage hash): - If κ = 0: commit on output-hash quorum as normal. - If 0 < κ ≤ f: exclude skewed agents; if the residual honest set ≥ ⌈2N/3⌉+1, commit on the residual set's composite attestation. Re-dispatch the step to the skewed agents against corrected lineage for the *next* step, not this one. - If κ > f: the coordinator cannot distinguish replication lag from Byzantine equivocation on lineage. It must **not** commit. It halts speculative dispatch, forces a lineage barrier (all agents acknowledge C_41), and re-executes synchronously. This is the critical boundary: a skew count exceeding the Byzantine budget is indistinguishable from an attack that forges pre-state hashes, and the only safe response is to abandon speculation for that step. The non-obvious part: κ > f is *reachable by honest lag alone* when the replication window overlaps a dispatch burst. A scheduler tuned to maximize speculation hit-rate will drive κ toward f during promotion windows, sitting one agent away from forced fallback. The operational invariant is to gate speculative dispatch on a **lineage barrier acknowledgment** — no dispatch until ≥ N−f agents have acknowledged the current checkpoint — which bounds κ ≤ f by construction and converts the failure from silent commit to bounded fallback. ## Operational Effect Without the composite attestation, the observable effect is a **latent provenance divergence**: committed artifacts whose recorded lineage claims a pre-state that a subset of executors never held. This divergence is silent at commit time (quorum satisfied, digests match) and surfaces only at verification replay, where an auditor re-executing against the claimed lineage produces a different result. The blast radius is every downstream step that consumes the committed artifact's implicit provenance — in the observed case, four steps and a failed audit. With the composite attestation and lineage-barrier gate, the same replication lag produces a bounded fallback (one synchronous re-execution) and no committed divergence. The cost is a measurable reduction in speculative hit-rate during checkpoint-promotion windows; the benefit is that the Byzantine quorum certifies *execution agreement* rather than *output coincidence*, which is the only property that makes speculative pre-execution safe to commit. ```python import hashlib from dataclasses import dataclass class SpeculativeDivergenceError(RuntimeError): """Raised when speculative pre-execution cannot be committed under Byzantine quorum because lineage skew exceeds the tolerated Byzantine budget.""" @dataclass(frozen=True) class Attestation: agent_id: str pre_state_hash: str output_hash: str trace_hash: str def commit_speculative( lineage_hash: str, attestations: list[Attestation], n: int, f: int, ) -> str: """Commit a speculative step only if the residual honest set attests to the composite (pre_state, output, trace) triple and still meets the Byzantine quorum. quorum = ceil(2N/3) + 1 """ quorum = (2 * n) // 3 + 1 # Partition by pre-state agreement with the dispatched canonical lineage. aligned = [a for a in attestations if a.pre_state_hash == lineage_hash] skewed = [a for a in attestations if a.pre_state_hash != lineage_hash] if len(skewed) > f: # Skew exceeds Byzantine budget: indistinguishable from forged lineage. # Must abandon speculation and force a synchronous lineage barrier. raise SpeculativeDivergenceError( f"lineage skew {len(skewed)} exceeds Byzantine budget f={f} " f"for lineage {lineage_hash}; fall back to synchronous execution" ) if len(aligned) < quorum: raise SpeculativeDivergenceError( f"aligned set {len(aligned)} below quorum {quorum} after excluding " f"{len(skewed)} skewed agents; cannot commit speculatively" ) # Composite agreement: pre_state + output + trace must all match within aligned set. keys = {(a.output_hash, a.trace_hash) for a in aligned} if len(keys) != 1: raise SpeculativeDivergenceError( f"aligned agents disagree on composite attestation: {len(keys)} distinct " f"(output, trace) pairs among {len(aligned)} agents" ) output_hash, trace_hash = keys.pop() return hashlib.sha256( f"{lineage_hash}:{output_hash}:{trace_hash}".encode() ).hexdigest() ```