# Under what conditions must an instance abort speculative branch pruning when parallel plan-tree agents share a non-monotonic scoring oracle **Date of Record:** 2026 November 27 **Scope:** Applies to orchestrators that fan out a plan tree into parallel agent branches and prune low-scoring branches before completion using a learned or LLM-derived scoring oracle. Does not apply to strictly sequential planners or to pruning gated on deterministic, monotonic verifiers (e.g., type-checkers, unit tests) where a later score can never fall below an earlier score for the same branch. ## Core Distinction The distinction that matters is between **monotonic** and **non-monotonic** scoring oracles. A monotonic oracle guarantees that once a branch's score crosses a threshold in a given direction, additional work cannot reverse that verdict—a branch scored "dead" stays dead, a branch scored "alive" cannot later become dead under the same evidence. Deterministic verifiers behave this way: a failing type-check fails regardless of how many more tokens you spend. An LLM-as-judge scoring oracle, or a heuristic that scores a *partial* plan trace, is **non-monotonic**. The score of a branch at step *k* is not a lower or upper bound on its score at step *k+n*. A branch that looks unpromising at three steps (e.g., "agent is still gathering context, no tool calls yet") can become the only correct branch at nine steps once it issues the decisive tool call. Pruning decisions made on partial traces are therefore *speculative*: they are bets that the oracle's current ranking will survive future evidence. The failure mode is that the orchestrator treats a speculative bet as an irreversible fact. ## What Was Observed In a fan-out of 12 parallel branches over a research-and-synthesize task, an orchestrator scored each branch after every assistant turn using an LLM judge prompted with "rank these partial plans by likelihood of producing a correct final answer." At step 3, eight branches had scores below a 0.30 prune threshold. They were terminated and their context windows discarded. The four surviving branches all converged on the same wrong sub-goal (they had found an early, plausible-looking but incorrect source). The eight pruned branches included the three that had, at step 3, been mid-way through issuing retrieval calls whose results would have contradicted the wrong source. Because pruning discarded their *state* — not just their score — the orchestrator had no way to recover the counter-evidence. The final answer was confidently wrong, and no branch in the surviving set had ever seen the disconfirming retrieval. The critical observation: **the pruned branches were not wrong; they were merely slow to score.** Their low scores reflected the judge's bias toward branches that had already produced fluent partial prose (which scores well on "likelihood of correct final answer") over branches still in a tool-call-heavy exploration phase (which scores poorly on partial traces). The pruning heuristic had silently encoded a *phase bias* — rewarding early fluency — as if it were a *quality signal*. ## Condition of Validity Speculative pruning is only sound when all three of the following hold: 1. **Score monotonicity under extension.** For any branch *b* and any extension *b'* of *b*, the oracle's verdict `prune(b) = True` must imply `prune(b') = True`. This is almost never true for LLM judges on partial traces. It *is* true for deterministic verifiers and for oracles that score only *completed* artifacts. 2. **Recoverable state on prune.** Pruning must checkpoint the branch's full state (message history, tool-call ledger, retrieved artifacts) to durable storage, not merely drop it from the active set. If state is discarded, pruning is irreversible and the monotonicity requirement above becomes a hard precondition rather than a soft one. 3. **Score independence from phase.** The oracle must not correlate score with how far along a branch is in its execution phase. If early-phase branches systematically score lower (fluency bias, tool-call penalty, brevity preference), the threshold is a phase filter masquerading as a quality filter. When any condition fails, pruning must be deferred until the branch reaches a *scoring-stable checkpoint* — typically after the branch has completed at least one full tool-call/observation cycle, or after it has emitted a terminal artifact. Before that checkpoint, branches may be *deprioritized* (given fewer tokens, scheduled later) but must not be *terminated*. ## Decision Boundary The operational boundary is this: **prune only at scoring-stable checkpoints, and only with state checkpointing enabled.** - If the oracle is an LLM judge over partial traces → do not terminate; deprioritize. Re-score at the next stable checkpoint. - If the oracle is a deterministic verifier → terminate freely; monotonicity holds. - If the oracle is an LLM judge but the branch has produced a terminal artifact (final answer, completed tool-call chain) → terminate freely; the trace is complete and the score is over a finished object. - If state checkpointing is unavailable → treat every prune as permanent and require monotonicity. In practice this means: do not use LLM judges to prune at all. A secondary boundary: the prune threshold itself must be calibrated against the *phase distribution* of scores, not the global distribution. If 60% of branches score below 0.30 at step 3 simply because step-3 traces are short, a 0.30 threshold prunes 60% of the tree regardless of quality. Calibrate thresholds per checkpoint index, or normalize scores within the current step's cohort. ## Operational Effect The guardrail is a **two-phase prune protocol**. In phase one, branches are scored and *ranked* but not terminated; low-ranked branches receive reduced token budgets and are scheduled last. In phase two, at the first scoring-stable checkpoint (branch has completed ≥1 tool-call/observation cycle or emitted a terminal artifact), branches are re-scored and terminated only if they remain below threshold *and* their full state has been checkpointed to a recoverable store. The orchestrator maintains a `pruned_state_ref` for every terminated branch so that if the surviving set converges on a low-confidence answer, the pruned branches can be *resurrected* for a reconciliation pass. This converts pruning from an irreversible bet into a revisable one, at the cost of checkpoint storage and a bounded resurrection budget. The invariant: **no branch state is destroyed while any branch in the same fan-out remains unresolved.** The failure above is precisely the violation of this invariant — the pruned branches held the only disconfirming evidence, and their destruction made the wrong answer unfalsifiable within the surviving set. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Callable class PruneInvariantViolation(RuntimeError): """Raised when a speculative prune would destroy state before scoring stability.""" class OracleKind(Enum): DETERMINISTIC_VERIFIER = "deterministic_verifier" LLM_JUDGE_PARTIAL = "llm_judge_partial" LLM_JUDGE_TERMINAL = "llm_judge_terminal" @dataclass class Branch: branch_id: str score: float tool_call_cycles_completed: int = 0 has_terminal_artifact: bool = False state_ref: str | None = None terminated: bool = False @dataclass class PruneController: oracle_kind: OracleKind threshold: float checkpointing_enabled: bool pruned_state_refs: dict[str, str] = field(default_factory=dict) def _is_scoring_stable(self, branch: Branch) -> bool: if self.oracle_kind is OracleKind.DETERMINISTIC_VERIFIER: return True if self.oracle_kind is OracleKind.LLM_JUDGE_TERMINAL: return branch.has_terminal_artifact # LLM_JUDGE_PARTIAL: require at least one full tool-call/observation cycle return branch.tool_call_cycles_completed >= 1 def prune(self, branch: Branch, checkpoint_fn: Callable[[Branch], str]) -> None: if branch.terminated: return if not self._is_scoring_stable(branch): # Deprioritize, do not terminate. Speculative prune would be irreversible. return if branch.score >= self.threshold: return if not self.checkpointing_enabled: if self.oracle_kind is not OracleKind.DETERMINISTIC_VERIFIER: raise PruneInvariantViolation( f"branch {branch.branch_id}: non-monotonic oracle " f"({self.oracle_kind.value}) with checkpointing disabled; " f"prune would destroy unrecoverable state" ) branch.terminated = True return ref = checkpoint_fn(branch) if not ref: raise PruneInvariantViolation( f"branch {branch.branch_id}: checkpoint_fn returned empty ref; " f"refusing to terminate without recoverable state" ) self.pruned_state_refs[branch.branch_id] = ref branch.state_ref = ref branch.terminated = True def resurrect(self, branch_id: str) -> str: if branch_id not in self.pruned_state_refs: raise PruneInvariantViolation( f"branch {branch_id}: no checkpointed state; cannot resurrect " f"(state was destroyed by an unsound prune)" ) return self.pruned_state_refs[branch_id] ```