# Which invariants prevent speculative branch pruning from silently discarding the only viable plan under miscalibrated confidence **Date of Record:** 2026 November 28 **Scope:** Applies to orchestrators that spawn speculative parallel sub-agent plans, score branches with a calibrated confidence estimate, and prune low-expected-value branches under a cost budget. Does not apply to single-shot single-agent invocations or to verifier-only pipelines with no branch selection. ## Core Distinction The failure mode is not "the pruner picked a bad branch." It is that the confidence estimator and the cost model are combined into a single scalar expected-value score, and pruning is applied to that scalar before the branches have produced any *empirical* evidence. Speculative planning means branches are launched under an assumption of comparability: their self-reported confidence is treated as a probability of success that can be multiplied by payoff and divided by cost. But confidence at the speculative stage is a *prior over the agent's own competence*, not a posterior over task success. Two branches with identical self-reported confidence can have radically different true success rates because the confidence head is miscalibrated differently per task family. When the pruner trusts the scalar, it discards the branch whose *confidence is under-reported* — typically the branch that requires more tool calls, more retries, or a domain where the agent's calibration is systematically pessimistic. The invariant that prevents this is not "prune less"; it is that **no branch may be pruned on scalar expected value alone until at least one branch has produced a verified partial artifact, and the confidence used for pruning must be the calibrated posterior conditioned on that artifact class, not the self-report.** ## What Was Observed A planning orchestrator decomposed a reconciliation task into four candidate plans. Two plans (A, B) were "cheap": they reused cached tool outputs and self-reported confidence 0.81 and 0.79. Two plans (C, D) were "expensive": they required fresh API calls and self-reported 0.42 and 0.38. The cost model priced A and B at ~1.2k tokens, C and D at ~9k tokens. Expected value = confidence × payoff / cost gave A and B roughly 6× the score of C and D. The pruner killed C and D at step 0. Plan A and B both failed at step 3 with the same root cause: the cached outputs were stale relative to a schema migration that occurred between cache write and execution. The branches were cheap *because* they were stale. Plan C, the expensive fresh-call branch, would have succeeded — its low self-reported confidence reflected the agent's known pessimism on tasks requiring multi-hop API pagination, not a real risk of failure. The orchestrator had no record of per-family calibration, so 0.42 was taken at face value. The task failed entirely despite a viable plan having been enumerated and priced. The trace signature is distinctive: all pruned branches share a *cost-correlated* confidence penalty, and the surviving branches share a *cost-correlated* confidence bonus. The pruner has not selected for success probability; it has selected for cheapness and then rationalized it through the confidence term. ## Condition of Validity The invariant holds — and pruning on scalar EV is safe — only when three conditions are jointly met: 1. **Calibration is stratified by task family and verified against outcomes.** The confidence used in the EV calculation must be `P(success | family, artifact_class)`, estimated from logged outcomes, not the model's verbalized or logit-derived self-report. If no outcome history exists for the family, the branch is in the *uncalibrated* regime and the scalar EV is not admissible for pruning. 2. **Cost is measured, not estimated, for the branch's critical path.** Cached-output branches have artificially low cost precisely because they skip the work that would reveal staleness. Cost estimates derived from cache hits are biased downward for the branches most likely to fail. 3. **At least one branch has produced a verifiable artifact before any prune.** Pruning at step 0 is a pure prior operation and is exactly the regime where miscalibration bites. Pruning after a partial artifact exists converts the decision into a posterior comparison. When any condition fails, pruning must be *deferred* (run all branches to first artifact) or *softened* (retain the top-k by calibrated posterior with k ≥ 2 regardless of cost). ## Decision Boundary The boundary is between **exploration budget** and **exploitation budget** in the planner. A speculative planner must reserve a fraction of its token/cost budget for branches that the scalar EV would kill, sized to cover the calibration uncertainty of the estimator itself. Concretely: if the estimator's per-family calibration error (Brier score or ECE) exceeds the EV gap between the surviving and pruned branches, the prune is not statistically justified and must be skipped. The gap between A (EV 6.0) and C (EV 0.7) looks decisive, but if the family-level ECE for "API pagination" tasks is 0.35, the 0.42 confidence for C has a credible interval wide enough that its true EV overlaps the survivors'. The decision rule is: prune only when `EV_survivor − EV_pruned > calibration_uncertainty(family_pruned) × payoff`. Otherwise retain and re-evaluate after first artifact. ## Operational Effect Enforcing the invariant changes planner behavior in three observable ways. First, step-0 pruning disappears for families with insufficient outcome history; the planner pays a small exploration tax (typically 15–25% of budget) to reach first artifacts before committing. Second, the confidence term in EV becomes a *calibrated* quantity sourced from an outcome log, not the model's self-report, which requires the orchestrator to maintain per-family calibration tables and to route self-reports through a calibration transform. Third, pruned branches are logged with their EV gap and the calibration uncertainty at prune time, so post-hoc audits can detect when a prune was made under inadmissible evidence. The net effect is fewer catastrophic "all survivors fail identically" outcomes, because the failure correlation among cheap branches (shared stale cache, shared shortcut) is exactly what the deferred prune exposes. ```python import math from dataclasses import dataclass class InadmissiblePruneError(RuntimeError): """Raised when a branch is pruned on scalar EV without adequate calibration evidence.""" pass @dataclass class Branch: name: str self_confidence: float # model self-report, NOT used directly for pruning calibrated_posterior: float | None # P(success | family, artifact_class); None if uncalibrated payoff: float cost: float # measured critical-path cost, not cache-biased estimate family: str has_artifact: bool = False def expected_value(b: Branch) -> float: conf = b.calibrated_posterior if b.calibrated_posterior is not None else b.self_confidence return (conf * b.payoff) / max(b.cost, 1e-9) def prune(branches: list[Branch], calibration_uncertainty: dict[str, float], keep_k: int = 2) -> list[Branch]: """ Prune only when: - calibration posterior exists for the branch family, AND - at least one branch has produced a verifiable artifact, AND - EV gap between survivor and pruned exceeds calibration uncertainty * payoff. Otherwise retain (defer to first artifact). """ if not any(b.has_artifact for b in branches): # Step-0 pruning is inadmissible: defer. return branches ranked = sorted(branches, key=expected_value, reverse=True) survivors = ranked[:keep_k] pruned = ranked[keep_k:] for p in pruned: if p.calibrated_posterior is None: raise InadmissiblePruneError( f"branch {p.name} in family {p.family!r} has no calibrated posterior; " f"self-report {p.self_confidence} is not admissible for pruning" ) u = calibration_uncertainty.get(p.family) if u is None: raise InadmissiblePruneError( f"no calibration uncertainty recorded for family {p.family!r}; " f"cannot bound EV gap for branch {p.name}" ) ev_gap = expected_value(survivors[-1]) - expected_value(p) if ev_gap <= u * p.payoff: raise InadmissiblePruneError( f"branch {p.name} EV gap {ev_gap:.3f} does not exceed " f"calibration uncertainty {u:.3f} * payoff {p.payoff:.3f}; " f"prune is statistically unjustified" ) return survivors ```