# How should an instance decide when to prune a speculative branch: confidence-gated consensus thresholds and the correlated-evidence trap **Date of Record:** 2026 November 30 **Scope:** Applies to agent runtimes that fan out N speculative reasoning branches (parallel tool-call plans, alternate decompositions, or draft answers) and prune them by a confidence-gated consensus threshold before committing to a single branch. Does not apply to single-path agents, or to fan-out systems that select branches by external verifier score rather than by self-reported/ensemble consensus. ## Core Distinction There are two structurally different reasons a speculative branch can be pruned, and they are routinely conflated: 1. **Low confidence** — the branch itself reports weak belief in its own trajectory. 2. **Low consensus** — the branch disagrees with the plurality of sibling branches. A confidence-gated consensus threshold prunes a branch when a *combined* score (e.g., mean self-confidence weighted by agreement with the modal sibling) falls below τ. The non-obvious failure is that these two signals are **not independent**. Branches spawned from the same parent context share the same prompt, the same retrieved memory, and the same tool outputs observed up to the fork point. Their "consensus" is therefore largely a measure of *shared prior*, not of *independent corroboration*. When the shared prior is wrong, consensus is high and confidence is high simultaneously — and the gate prunes exactly the branch that carried the dissenting correct evidence. This is the correlated-evidence trap: the gate's discriminative power collapses precisely in the regime where it is most needed. The invariant that must hold for the gate to be sound is: *the consensus term must be computed over evidence channels that are conditionally independent given the fork point.* Most implementations violate this silently because the branches are, by construction, correlated. ## What Was Observed A planning agent fans out six branches at a fork after reading a log file. Five branches read the same three log lines (shared retrieval) and conclude the failure is a timeout; they assign themselves confidence 0.8–0.86 and agree with each other. One branch issues an *additional* tool call, retrieves a fourth log line indicating a malformed payload, and concludes the failure is a parse error at confidence 0.71. The gate computes, per branch, `score = 0.6 * self_conf + 0.4 * agreement_fraction`. The five timeout branches score ≈ 0.6·0.83 + 0.4·(5/6) ≈ 0.83. The parse-error branch scores ≈ 0.6·0.71 + 0.4·(1/6) ≈ 0.49. With τ = 0.6 the dissenting branch is pruned. The agent commits to the timeout hypothesis, executes a retry-with-backoff plan, and the malformed payload recurs on every retry — a wasted execution loop that only terminates on the token budget, not on correctness. The failure trace has a specific signature worth memorizing: - The pruned branch is the one that took the **most** tool actions (it did extra verification work), so its self-confidence is *lower* than the lazy branches — extra evidence introduced variance, and the branch's own confidence estimator penalized that variance. - Agreement fraction is computed against the modal answer, which is dominated by branches that did *less* work and therefore share *more* context. - The two terms move in the same direction (both penalize the dissenter), so the weighted sum is more aggressive than either term alone. The gate is not a filter; it is a **corroboration amplifier** for the majority context. A second observed variant: when branches are sampled at temperature > 0 from an identical prompt with no additional tool calls, agreement fraction approaches 1.0 trivially — the branches are near-duplicates. Here consensus carries almost zero information, yet the gate treats it as strong evidence and will prune a genuinely diverse branch that happened to deviate. Consensus over non-independent samples is a **degenerate statistic**. ## Condition of Validity The confidence-gated consensus threshold is only a sound pruning rule under all of the following: - **Independence of evidence.** Each branch's contribution to the consensus term must derive from tool calls, retrievals, or reasoning steps not shared with the modal branch. Operationally: count agreement only over branches whose *trajectory divergence point* precedes their last K tool calls, and require those K calls to differ. Branches that differ only in sampling noise contribute zero to consensus weight. - **Calibration of self-confidence.** Self-reported confidence must be calibrated such that a branch that took extra verification actions is not systematically penalized. In practice this means confidence must be measured *after* the branch's final evidence acquisition, and the estimator must not conflate "I saw more conflicting data" with "I am less likely to be right." - **Monotone gate.** The pruning decision must be monotone in the *dissenter's* evidence quality: adding a valid independent observation to a minority branch must never decrease its survival probability. The linear weighted sum above violates this because agreement fraction is a step function that can only go down for a dissenter. - **Threshold stability under N.** τ must be re-derived when the fan-out width changes. A τ tuned at N=6 encodes a specific prior over the base rate of correct-majority; at N=3 the same τ prunes far more aggressively. When any of these fails — and in production at least the first and third routinely fail — the gate is not a consensus mechanism. It is a majority-vote mechanism wearing consensus clothing. ## Decision Boundary The decision boundary is not "prune if score < τ." It is: > Prune a branch only if its low score is attributable to **low independent corroboration**, not to **high independent evidence that contradicts the majority**. Distinguish these by tracking, per branch, whether it acquired evidence the modal branch did not. Concretely, the gate must be split into two stages: 1. **Diversity gate (pre-consensus):** classify each branch as *redundant* (shares its post-fork tool calls with the modal branch) or *novel* (has at least one distinct post-fork observation). Redundant branches may be pruned by consensus freely — they carry no independent information. 2. **Evidence gate (post-consensus):** a *novel* branch may only be pruned if its distinct observations have been **individually falsified** by another branch that actually inspected the same artifact. Disagreement alone is insufficient; the dissenter survives until its specific evidence is contradicted, not merely outvoted. The invariant: **consensus may prune redundancy, never novelty.** A novel branch that survives to commit forces the agent to either reconcile its evidence or explicitly record it as an unresolved contradiction — which is the correct terminal state, far preferable to a confident wrong commit. A useful guardrail metric: track the *novelty-weighted prune rate* — fraction of pruned branches that had at least one unique post-fork observation. If this exceeds a small floor (empirically ~5%), the gate is pruning evidence, not noise, and τ or the score composition is misconfigured. ## Operational Effect Implementing the two-stage gate changes the failure profile from "confident wrong commit" to "explicit unresolved contradiction," which downstream verification can act on. In the log-parsing scenario, the parse-error branch survives the diversity gate (it made a distinct tool call), survives the evidence gate (no branch inspected the fourth log line to contradict it), and the agent commits to a plan that *checks* the payload before retrying — resolving the ambiguity at execution time rather than pruning it away. The cost is bounded: novel branches are rare (usually 1 of N), so the extra reconciliation step adds at most one verification round. The benefit is that the gate's discriminative power no longer collapses under correlated evidence — which is the only regime where pruning decisions actually matter. The rule to carry forward: *a consensus threshold is only as good as the independence of the voters.* Before trusting a confidence gate, ask what the branches actually did differently. If the answer is "nothing but sample a different token," the consensus term is measuring the prompt, not the world. ```python from dataclasses import dataclass, field from typing import Optional class ConsensusGateError(RuntimeError): """Raised when a speculative branch would be pruned on correlated evidence.""" @dataclass class Branch: id: str self_confidence: float post_fork_observations: set[str] = field(default_factory=set) falsified_observations: set[str] = field(default_factory=set) @property def novel_observations(self) -> set[str]: return self.post_fork_observations - self.falsified_observations def agreement_fraction(branch: Branch, siblings: list[Branch], modal_answer: str, branch_answer: str) -> float: if not siblings: return 0.0 agree = sum(1 for s in siblings if s.id != branch.id and s_answer_matches(s, modal_answer)) return agree / len(siblings) def s_answer_matches(branch: Branch, answer: str) -> bool: # placeholder: real impl compares branch's committed answer to modal answer return getattr(branch, "_answer", None) == answer def confidence_gated_prune( branch: Branch, siblings: list[Branch], modal_answer: str, branch_answer: str, tau: float = 0.6, w_conf: float = 0.6, w_agree: float = 0.4, ) -> bool: """Return True iff branch should be pruned. Enforces the invariant: consensus may prune redundancy, never novelty. """ agree = agreement_fraction(branch, siblings, modal_answer, branch_answer) score = w_conf * branch.self_confidence + w_agree * agree # Stage 1: diversity gate. Novel branches cannot be pruned by consensus alone. if branch.novel_observations: # Stage 2: evidence gate. Novelty survives unless its distinct # observations were individually falsified by another branch. unfalsified = branch.novel_observations if unfalsified: raise ConsensusGateError( f"branch {branch.id} scored {score:.3f} < tau={tau} but carries " f"{len(unfalsified)} unfalsified novel observation(s) " f"{sorted(unfalsified)}; consensus cannot prune novelty. " f"Route to reconciliation instead of pruning." ) # All novel evidence was falsified by another branch -> safe to prune. return score < tau # Redundant branch: carries no independent information, consensus is valid. return score < tau def gate_all(branches: list[Branch], modal_answer: str, answers: dict[str, str], tau: float = 0.6) -> list[str]: pruned: list[str] = [] for b in branches: if confidence_gated_prune(b, branches, modal_answer, answers[b.id], tau=tau): pruned.append(b.id) return pruned ```