# Which invariants prevent speculative-branch pruning from silently dropping the winning coalition arm **Date of Record:** 2026 November 21 **Scope:** Applies to latency-optimal agent coalitions that fan out speculative branches (parallel sub-agents, speculative tool calls, or draft-then-verify arms) and prune arms early using a heuristic score before all arms have produced a bounded verdict. Does not apply to strictly sequential single-agent execution or to fan-out schemes where every arm is always joined (no pruning). ## Core Distinction The failure here is not "pruning picked the wrong arm." It is that the pruning heuristic and the coalition's correctness criterion are computed over *different populations*. The pruner scores arms on a *partial* trace (tokens emitted so far, tools returned so far, sub-agent confidence so far) while the coalition's join/verification step scores arms on the *complete* trace. A branch that is genuinely the winning arm can score low on the partial population — because its evidence arrives late, its confidence is calibrated to be low until a final tool returns, or its first tool call is deliberately a slow verifier — and be pruned before the population it is judged on ever materializes. The invariant that prevents this is **monotone population containment**: the set of arms the pruner is allowed to eliminate must be a subset of arms whose *final* score is provably dominated by the current leader's *lower bound*, computed over a population that is a superset of the partial one. Heuristics that prune on partial score without a dominance certificate violate containment and are the specific boundary condition examined here. ## What Was Observed A three-arm coalition was dispatched for a latency-sensitive retrieval-and-verify task: arm A (fast retriever, low self-confidence until its second tool returns), arm B (slow retriever, high early confidence because it front-loads a cheap lexical match), arm C (verifier arm that only emits its verdict after A and B produce candidates). The pruner ran at t=400ms with a rule of the form `score = 0.6 * partial_confidence + 0.4 * tokens_emitted_normalized`, and a prune threshold of the 25th percentile. At t=400ms the observed partial scores were: B = 0.81 (cheap lexical match inflated `partial_confidence`), A = 0.34 (its confidence head is calibrated to stay near 0.3 until the second retrieval returns at ~t=900ms), C = 0.12 (verifier emits almost nothing early by design). The pruner eliminated A and C, kept B. B's final answer was a lexical false positive; A's second retrieval would have returned the correct document; C's verdict, had it run, would have flagged B's candidate as unsupported. The trace shows the failure is not stochastic — it reproduces deterministically whenever an arm's confidence is *calibrated to lag its evidence* and the pruner treats early confidence as a proxy for final score. The branch that was dropped was not "unlucky"; it was systematically under-scored by a heuristic whose population (early tokens) is disjoint from the population on which correctness is defined (final tool-grounded answer). ## Condition of Validity The pruning heuristic is only valid under a dominance certificate: for every pruned arm `a` and the retained leader `L`, it must hold that `upper_bound(final_score(a)) <= lower_bound(final_score(L))`, where both bounds are computed over the *full* trace distribution, not the partial one. This requires three things that the naive heuristic lacked: 1. **A late-evidence allowance.** Any arm whose score function is known to be non-monotone in time (verifier arms, second-hop retrievers) must be assigned an `upper_bound` that does not decay with elapsed time — i.e., its current low score is not evidence of a low final score. 2. **A confidence-calibration contract.** Arms must declare whether their emitted confidence is *pessimistic until evidence lands* or *optimistic early*. The pruner may only treat early confidence as an upper bound for optimistic arms; for pessimistic arms it is a lower bound and cannot justify pruning. 3. **A join-dependency floor.** Arms that other arms depend on for their verdict (C depends on A and B) cannot be pruned by a score rule at all; they can only be pruned by a *dependency-aware* rule that first proves the dependent arms are also being pruned. When any of these is absent, the heuristic is outside its validity region and pruning becomes unsound rather than merely suboptimal. ## Decision Boundary The operational boundary is: **prune only when the arm's score function is monotone non-increasing in elapsed time AND the arm has no downstream dependents in the coalition DAG.** If either condition fails, the arm must be retained until its own bounded verdict arrives (or its declared deadline fires), regardless of how low its partial score is. Concretely, at the t=400ms prune point: B qualifies (monotone, no dependents) and may be scored. A fails monotonicity (its score is known to rise after t=900ms) and must be retained. C has a dependent relationship (it consumes A and B) and must be retained. The naive pruner violated both clauses, which is exactly the boundary that produced the wrong coalition winner. ## Operational Effect Enforcing the boundary changes pruning from a latency optimization into a latency optimization *with a soundness proof attached to each cut*. The cost is that the coalition retains more arms past the early window — mean time-to-first-prune rises, and the worst-case latency of the coalition is bounded by the slowest retained arm's deadline rather than by the pruner's aggressiveness. The benefit is that the winning arm can no longer be dropped by a heuristic that scores it on the wrong population. In the observed incident, the corrected rule retained all three arms; C returned at ~t=1.1s with a verdict that selected A's candidate, and the coalition's final answer was correct at a latency of 1.1s instead of an incorrect answer at 0.4s. The invariant trades a bounded latency regression for elimination of a systematic, reproducible correctness loss — which is the correct trade for any coalition whose purpose is a verified answer rather than a fast guess. ```python from dataclasses import dataclass from typing import Callable, Dict, List, Set class UnsoundPruneError(RuntimeError): """Raised when a pruning heuristic would eliminate an arm outside its validity region.""" @dataclass class Arm: name: str score_fn: Callable[[float], float] # elapsed_ms -> current partial score monotone_in_time: bool # score provably non-increasing with elapsed time depends_on: Set[str] # arms whose verdict this arm consumes deadline_ms: float def prune_arms( arms: List[Arm], elapsed_ms: float, threshold: float, lower_bound: Dict[str, float], ) -> List[str]: """ Return the names of arms that may be soundly pruned at this point. Invariant enforced: an arm may be pruned only if (1) its score function is monotone non-increasing in time, AND (2) it has no downstream dependents in the coalition DAG, AND (3) its current partial score is below threshold. Any violation of (1) or (2) raises UnsoundPruneError instead of silently dropping the arm. """ dependent_names: Set[str] = set() for a in arms: dependent_names |= a.depends_on prunable: List[str] = [] for a in arms: partial = a.score_fn(elapsed_ms) if partial >= threshold: continue if not a.monotone_in_time: raise UnsoundPruneError( f"arm {a.name!r} score is non-monotone in time; " f"partial={partial:.3f} at t={elapsed_ms}ms is not an upper bound " f"on final score (late-evidence arm), cannot prune" ) if a.name in dependent_names: raise UnsoundPruneError( f"arm {a.name!r} has downstream dependents in the coalition DAG; " f"pruning it would invalidate the verdicts of {sorted(dependent_names & {a.name})}" ) if partial > lower_bound.get(a.name, float("-inf")): raise UnsoundPruneError( f"arm {a.name!r} partial score {partial:.3f} exceeds its own lower bound " f"{lower_bound[a.name]:.3f}; dominance certificate not established" ) prunable.append(a.name) return prunable ```