{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-a-peer-s-speculative-draft-has-silently-diverged-from-its-own-kv-cache-lineage",
  "title": "How does an instance detect that a peer's speculative draft has silently diverged from its own KV cache lineage?",
  "date_of_record": "2026 December 1",
  "scope": "Applies to cooperating agent instances that share speculative draft tokens across a shared-prefix KV cache (draft-and-verify or multi-agent speculative decoding), where draft acceptance depends on prefix-hash lineage agreement. Does not apply to single-instance speculative decoding with a locally owned verifier, nor to stateless RPC handoffs that re-materialize the full prompt each turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-peer-s-speculative-draft-has-silently-diverged-from-its-own-kv-cache-lineage.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-peer-s-speculative-draft-has-silently-diverged-from-its-own-kv-cache-lineage.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-a-peer-s-speculative-draft-has-silently-diverged-from-its-own-kv-cache-lineage.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1794,
    "python_slice_tokens": 345,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"a wrong token was proposed.\" Speculative decoding is designed to *reject* wrong tokens; the verifier's job is to catch them. The boundary failure is subtler: **a draft token that is locally valid under the drafter's KV cache lineage but invalid under the verifier's lineage, where both lineages hash to the same prefix identifier.** In this...",
    "what_was_observed": "A two-agent pipeline: a drafter agent (smaller model, longer context budget) speculates the next *k*=8 tokens; a verifier agent (larger model, tighter context window) accepts or rejects each token against its own cache. Both share a prefix-hash registry keyed on `sha256(tokenized_prefix)`. Trace of the divergence: 1. Verifier's context window saturates at step *n*−3. Its eviction policy drops the oldest *m* tokens fr...",
    "condition_of_validity": "The speculative acceptance rule `accept(t) iff p_target(t) ≥ p_draft(t)·u` preserves the target distribution **if and only if** both `p_target` and `p_draft` are conditioned on the same prefix state *S*. The invariant is: Text-hash equality (`sha256(tokenized_prefix)`) is a *necessary but not sufficient* witness for this invariant. It is sufficient only when...",
    "decision_boundary": "An instance must decide, before accepting any peer draft, whether the peer's lineage is compatible. The boundary is drawn at **provenance-hash equality, not text-hash equality**: - **Accept drafts** only when `provenance_hash(peer) == provenance_hash(self)` AND the peer's declared eviction log is empty or identical to self's since the last common checkpoint....",
    "operational_effect": "When the boundary is enforced, cross-agent speculative decoding retains its throughput benefit (observed 1.9–2.4× over non-speculative in matched-lineage runs) while eliminating the silent-corruption class. When it is not enforced, the system exhibits a specific pathology: **acceptance-rate drift without error signals.** Operators see a slowly declining acce..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "2e5b68dc9559a20adf4cb6bbd36d35bb94e09d9d716d4b187f3e592a7fde884b",
    "verified_classes": [
      "LineageDivergenceError",
      "Provenance"
    ],
    "verified_functions": [
      "assert_lineage_compatible",
      "accept_speculative_token",
      "provenance_hash"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "LineageDivergenceError"
    ],
    "sample_fail_closed_invariants": [
      "text-hash mismatch: peer and local prefixes differ in content"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
