On this page
A canary deployment sits at 10% traffic. Smoke tests are green, yet one latency panel jumped right after a config flag enabled parser-v2. An automated advisor must recommend whether to revert, hold, or continue. Generating a fluent recommendation takes half a second. Earning a trustworthy one requires fetching live deployment state, smoke-test results, latency metrics, and the config diff, then spending extra test-time compute only if the fix itself requires exploring competing plans.
Standard decoding generates tokens strictly left to right. Reasoning models such as OpenAI's o1[1] and DeepSeek-R1[2] spend additional internal compute before answering, yet native internal reasoning is distinct from an external controller that invokes tools, samples competing plans, prunes invalid branches, and enforces hard evidence checks. This chapter builds that controller from first principles.
Fast answers do not guarantee safe deployment
If a model outputs "hold" before reading the metrics API, the recommendation is pure guesswork regardless of how long its hidden scratchpad ran. Single-pass decoding predicts the next token from text already in context; it cannot verify external truth on its own.
Treat hard decisions as a budgeted search and verification problem. Test-time compute is the extra FLOPs and tokens spent during inference after training finishes. Snell et al. showed that pairing a smaller model with an adaptive test-time strategy (trained revision models and verifiers) can beat a 14x larger model on matched pretraining-plus-inference FLOPs for medium-difficulty math problems, while very hard prompts and heavy query volumes still favor the larger pretrained model.[3]

A routing ceiling is a maximum budget, not a minimum spend. A simple threshold lookup needs no search tree; resolving a broken dependency graph may justify exploring several branches.
The simplest form of extra compute: one deliberate path
When fresh tool observations settle the canary verdict directly, start with one deliberate path and a finite output limit. Classic Chain-of-Thought prompting asked models to "think step by step,"[4] whereas modern reasoning APIs expose structured controls such as reasoning.effort (none, low, medium, high, xhigh on models like GPT-5.5), reasoning.mode, reasoning.context, and max_output_tokens.[5][6]
| Control | What it adjusts | Separate controls needed |
|---|---|---|
reasoning.effort | Relative internal deliberation depth | Hard token, time, or dollar caps |
reasoning.mode | Standard vs. extended execution tier | External search tree or evidence check |
reasoning.context | Carrying opaque reasoning state across turns | Authenticated tool observations in app state |
max_output_tokens | Per-call output limit (including hidden reasoning) | Shared multi-call budget or answer completion |
Keep hidden reasoning separate from outward evidence. Ask the model for concise XML milestones paired with a final answer, and let deterministic application code validate every external observation before releasing any advice.
from dataclasses import dataclass, replace
import xml.etree.ElementTree as ET
@dataclass(frozen=True)
class Observation:
deploy_id: str
revision: int
observed_at: int
canary_percent: int
smoke_passed: bool
p95_ms: float
def parse_milestones(xml_text: str) -> tuple[list[str], str]:
root = ET.fromstring(xml_text)
if root.tag != "response":
raise ValueError("expected <response> root")
steps = [n.text.strip() for n in root.findall("checkpoint") if n.text and n.text.strip()]
answer = (root.findtext("final_answer") or "").strip()
if not answer:
raise ValueError("missing final_answer")
return steps, answer
def evaluate_canary(obs: Observation | None, now: int) -> dict[str, object]:
if obs is None:
return {"release": False, "reason": "missing_observation"}
if (obs.deploy_id, obs.revision) != ("checkout-42", 7):
return {"release": False, "reason": "wrong_deploy_or_revision"}
if not (0 <= now - obs.observed_at <= 30):
return {"release": False, "reason": "stale_observation"}
if obs.canary_percent != 10 or obs.p95_ms < 0:
return {"release": False, "reason": "invalid_observation"}
if not obs.smoke_passed or obs.p95_ms >= 300:
action = "revert"
elif obs.p95_ms >= 200:
action = "hold"
else:
action = "continue"
return {"release": True, "action": action, "revision": obs.revision}
sample_xml = """<response>
<checkpoint>Canary sits at 10% traffic with green smoke tests.</checkpoint>
<checkpoint>p95 latency is 240 ms, between 200 ms hold and 300 ms revert limits.</checkpoint>
<final_answer>Hold the canary at 10% and inspect the parser_v2 flag.</final_answer>
</response>"""
milestones, final = parse_milestones(sample_xml)
obs = Observation("checkout-42", 7, observed_at=100, canary_percent=10, smoke_passed=True, p95_ms=240)
print("milestones:", len(milestones), "| final:", final)
for label, item in [("fresh_240ms", obs), ("spike_300ms", replace(obs, p95_ms=300)),
("stale_obs", replace(obs, observed_at=60)), ("wrong_rev", replace(obs, revision=6))]:
print(f"{label:12s}: {evaluate_canary(item, now=110)}")milestones: 2 | final: Hold the canary at 10% and inspect the parser_v2 flag.
fresh_240ms : {'release': True, 'action': 'hold', 'revision': 7}
spike_300ms : {'release': True, 'action': 'revert', 'revision': 7}
stale_obs : {'release': False, 'reason': 'stale_observation'}
wrong_rev : {'release': False, 'reason': 'wrong_deploy_or_revision'}A parsed milestone only checks output shape; actual release eligibility comes from the verified tool record (release=True grants an advisory response, while an automated deployment action still needs its own permission check and idempotency key).

Comparing complete candidates: Best-of-N sampling
When multiple mitigations look plausible, generate complete candidates with nonzero temperature and select the best survivor using an exact checker or learned verifier.
Why this helps: a worked example
Suppose a single attempt produces a valid mitigation plan with probability . Across independent draws, the probability that at least one candidate succeeds is:
Two sharp limits apply in production. First, 0.832 is candidate-set coverage, not returned accuracy: the system only wins if the verifier can recognize the winning candidate, and shared prompts often correlate model errors so draws are not truly independent. Second, optimizing a proxy reward model too hard backfires: Gao et al. showed that as Best-of-N grows, proxy scores keep climbing while true ("gold") reward peaks and then drops (reward overoptimization).[7] Whenever an exact constraint check exists, filter with the exact check before ranking by proxy score.
For very small (such as ), direct floating-point 1 - (1 - p)**n loses precision because 1 - p rounds to 1.0. Computing -math.expm1(n * math.log1p(-p)) avoids catastrophic cancellation.
import math
def coverage(p: float, n: int) -> float:
if n == 0 or p == 0.0:
return 0.0
if p == 1.0:
return 1.0
return -math.expm1(n * math.log1p(-p))
candidates = [
{"id": "A", "path": ["api", "legacy_adapter", "database"], "proxy_score": 0.96},
{"id": "B", "path": ["api", "feature_flag", "database"], "proxy_score": 0.82},
]
allowed = {("api", "legacy_adapter"), ("legacy_adapter", "database"),
("api", "feature_flag"), ("feature_flag", "database")}
blocked = {("api", "legacy_adapter")}
def valid_path(path: list[str]) -> bool:
edges = set(zip(path, path[1:]))
return path[0] == "api" and path[-1] == "database" and edges <= allowed and not (edges & blocked)
eligible = [c for c in candidates if valid_path(c["path"])]
winner = max(eligible, key=lambda c: c["proxy_score"], default=None)
print(f"coverage(p=0.30, N=5): {coverage(0.30, 5):.3f}")
print(f"stable_rare_coverage(p=1e-20, N=100): {coverage(1e-20, 100):.1e}")
print("winner_after_exact_check:", winner["id"], f"(proxy={winner['proxy_score']})")coverage(p=0.30, N=5): 0.832
stable_rare_coverage(p=1e-20, N=100): 1.0e-18
winner_after_exact_check: B (proxy=0.82)Even though candidate A scored 0.96 on the learned proxy, it traverses a blocked legacy edge and drops out, letting valid candidate B win.
Self-consistency: Best-of-N without a reward model
When outputs normalize to comparable answers (numbers, SQL results, labels), self-consistency samples traces and returns the majority answer without needing a reward model.[8] Voting amplifies accuracy when correct answers cluster more tightly than mistakes, but it fails whenever the model repeats the same systematic error across samples.
Where beam search fits
Token-level beam search keeps the top- highest-probability partial continuations at each step. It batches cleanly on GPUs, yet its top- branches often collapse into minor phrasings of one hypothesis. Use it as a pruning baseline rather than a substitute for diverse multi-step exploration.
When one path isn't enough: exploring a tree
The canary is held, and profiling links the spike to parser-v2. Now the agent must pick a safe dependency fix satisfying Python runtime floors, API compatibility, and security advisories. If a branch pins parser-v2 and later discovers a removed runtime API, it has to backtrack.
Tree of Thoughts (ToT) turns multi-step planning into explicit tree search over intermediate states: generate candidate next actions, reject hard constraint violations immediately, score surviving states, and expand only promising branches.[9]

Keep completed valid plans in a separate pool from unfinished frontier nodes so another expansion round never overwrites a finished solution.
When revisiting branches beats a fixed beam
Breadth-first beam search is easy to batch on GPUs, but pruning is irreversible. When search depth varies sharply or verifier calls are expensive, Monte Carlo tree search (MCTS) lets the controller revisit promising earlier nodes using the AlphaZero PUCT selection rule:[10]
Here is the estimated value of taking action from state , is the model prior, and are parent and child visit counts, and balances exploration against exploitation. For example, with , , , , and , .
import mathfrom dataclasses import dataclass
EXPANSIONS = {
"start": ["Pin parser v2", "Pin parser nightly", "Keep parser v1"],
"Pin parser v2": ["A.1 add compatibility shim", "A.2 call removed API"],
"Keep parser v1": ["C.1 patch sanitizer", "C.2 defer security fix"],
}
SCORES = {
"Pin parser v2": 0.74, "Pin parser nightly": 0.12, "Keep parser v1": 0.81,
"A.1 add compatibility shim": 0.70, "A.2 call removed API": 0.18,
"C.1 patch sanitizer": 0.96, "C.2 defer security fix": 0.39,
}
INVALID = {"Pin parser nightly", "A.2 call removed API", "C.2 defer security fix"}
COMPLETE = {"A.1 add compatibility shim", "C.1 patch sanitizer"}
@dataclass
class Node:
text: str
score: float
parent: "Node | None" = None
def path(self) -> list[str]:
return [self.text] if self.parent is None else self.parent.path() + [self.text]
def beam_tot(width: int = 2, min_score: float = 0.35, max_depth: int = 2) -> list[str] | None:
frontier, completed = [Node("start", 1.0)], []
for _ in range(max_depth):
kids = [Node(ch, SCORES[ch], n) for n in frontier for ch in EXPANSIONS.get(n.text, [])]
valid = sorted((k for k in kids if k.text not in INVALID and k.score >= min_score),
key=lambda n: n.score, reverse=True)
completed.extend(k for k in valid if k.text in COMPLETE)
frontier = [k for k in valid if k.text not in COMPLETE][:width]
if not frontier:
break
best = max(completed, key=lambda n: n.score, default=None)
return best.path() if best else None
def puct(q: float, p: float, n_parent: int, n_child: int, c: float = 1.0) -> float:
return q + c * p * math.sqrt(n_parent) / (1 + n_child)
print("beam_winner:", beam_tot())
print(f"puct(A: Q=.45, P=.25, n=2 | N=9): {puct(0.45, 0.25, 9, 2):.3f}")
print(f"puct(B: Q=.60, P=.10, n=0 | N=9): {puct(0.60, 0.10, 9, 0):.3f}")beam_winner: ['start', 'Keep parser v1', 'C.1 patch sanitizer']
puct(A: Q=.45, P=.25, n=2 | N=9): 0.700
puct(B: Q=.60, P=.10, n=0 | N=9): 0.900Notice that C.2 defer security fix clears the 0.35 proxy score (0.39) yet is still pruned because hard constraints always run ahead of proxy scores.
Who judges the plans? Verifiers and reward models
Search only improves accuracy if the selector recognizes valid plans. Use deterministic checkers (unit tests, type checkers, dependency solvers, schema checks) whenever they exist. Where objective checkers are unavailable, learned verifiers fill the gap in two forms:
- Outcome Reward Model (ORM): Trained on final-answer correctness; cheaper to annotate, yet it only scores after an entire trajectory finishes.
- Process Reward Model (PRM): Trained on intermediate step labels (such as PRM800K's 800,000 step labels[11]), enabling early pruning mid-trajectory before wasted tokens accumulate.
How a PRM works
For a binary correctness head over hidden state after step , the step probability is:
where is the sigmoid function. Treat raw outputs as ranking signals until held-out calibration checks confirm probability accuracy. Step labels come from human annotators, Monte Carlo completion rates ( simulated trajectories reaching a verified answer), or vetted teacher models.
Pruning only saves compute when evaluated online during generation. In the generator loop below, step 3 fails both the exact API check and the PRM threshold, halting execution before step 4 is ever requested:
requested = []
def step_stream():
for step, prm_score, exact_ok in [
("Parse manifest", 0.92, True),
("Pin parser v2", 0.74, True),
("Call removed API", 0.15, False),
("Recommend deployment", 0.85, True),
]:
requested.append(step)
yield step, prm_score, exact_ok
def run_with_pruning(stream, min_score: float = 0.35):
checked = []
for step, score, exact_ok in stream:
checked.append((step, score, exact_ok))
if not exact_ok or score < min_score:
return "pruned", checked
return "completed", checked
status, trace = run_with_pruning(step_stream())
print(f"status: {status} | steps_requested: {len(requested)} of 4")
for step, score, ok in trace:
print(f" {step:22s} score={score:.2f} exact_ok={ok}")status: pruned | steps_requested: 3 of 4
Parse manifest score=0.92 exact_ok=True
Pin parser v2 score=0.74 exact_ok=True
Call removed API score=0.15 exact_ok=FalseORM vs PRM at a glance
| Feature | Outcome Reward Model (ORM) | Process Reward Model (PRM) |
|---|---|---|
| Scoring unit | Complete solution | Individual reasoning step |
| Feedback density | Sparse (one label per trace) | Dense (one label per step) |
| Search utility | Reranks finished candidates | Prunes broken branches mid-generation |
| Labeling cost | Lower per trace | Higher; requires step labels or Monte Carlo traces |

A correct answer can hide a broken evaluator
An evaluator that sees the final answer can rationalize broken intermediate steps. Sun et al. tested Valid-Answer-Invalid-Reasoning (VAIR) math traces and found that even a frontier model (GPT-5.4) scored only 47.9% grading flawed derivations that happened to end on the right number, driven by answer confirmation bias.[12]
Test every learned verifier against four diagnostic slices before letting it steer search:
| Diagnostic test | Failure exposed |
|---|---|
| Valid answer, flawed intermediate step | Judge trusts endpoint and rationalizes bad reasoning |
| Wrong answer, sound early steps | Judge rejects reusable partial prefixes |
| Hide final answer until step verdicts lock | Final-answer leakage into step grading |
| Perturb final answer with identical trace | Verdict flips on the endpoint rather than the proof |
Training reasoning models with RL
Reinforcement learning improves the base generator directly so it requires less external search at test time. DeepSeek-R1 popularized Group Relative Policy Optimization (GRPO), which removes the separate value-critic network required by PPO by sampling a group of outputs per prompt, scoring each with exact verifiers or reward models, and updating weights relative to the group mean reward.[2] Better RL training raises single-pass accuracy, yet production systems still need difficulty routing, hard budgets, exact checks, and KV capacity planning.
Putting it together: a production reasoning agent
Combine routing, search, verification, and safe progress streaming into one coherent runtime.
What the system must handle
One agent serves easy runbook lookups, medium canary triage, and hard dependency resolution. Candidate state, tool results, and verification verdicts live outside the model's hidden scratchpad so every tier obeys the same evidence requirements. Define target concurrency, quality lift over single-pass baselines, p95 latency, and per-request cost per lane before tuning multipliers.
Architecture overview
A single gateway and difficulty router dispatch requests into three lanes: a fast single pass, a medium Best-of-3 lane, and a capped tree-search lane. All three converge at one verifier before any advisory leaves the system.


The difficulty router
A lightweight router assigns each query a strategy and shared token budget covering both generator and verifier outputs. In production, train a fast classifier on prompt length, tool requirements, historical verifier failure rates, and domain tags, evaluating both under-routing misses and over-routing cost. Under-routing may cause a slower retry or abstention, but it never weakens the downstream evidence check.
Escalation is a measured policy
Snell et al. demonstrated that no single inference strategy wins across every difficulty level.[3] An inference scheduler escalates only when the first pass is weak, the task is verifiable, and extra compute pays for itself: stop immediately on exact completion, escalate to Best-of-3 for ambiguous verifiable cases, escalate to tree search when backtracking matters, and hand off unverifiable high-impact requests to tools or human review.
Every live branch also needs explicit stop conditions: repeated semantic state, token cap, wall-clock deadline, or a verifier score plateau where recent steps fail to beat the earlier best.

Reserving the request budget
Checking token spend after parallel calls return lets bursts overrun the budget. Reserve each call's worst-case output allowance up front so spent + reserved <= cap holds at every step. When call A reserves 1,500 tokens from a 4,000-token cap and finishes using 900, settling it returns 600 unused tokens so call C can proceed. If a call times out with unknown backend usage, keep its reservation locked until usage or cancellation reconciles.
class TokenBudget:
def __init__(self, cap: int):
self.cap, self.spent = cap, 0
self.pending: dict[str, int] = {}
self.finished: dict[str, int] = {}
@property
def available(self) -> int:
return self.cap - self.spent - sum(self.pending.values())
def reserve(self, call_id: str, maximum: int) -> bool:
if call_id in self.pending or call_id in self.finished or maximum > self.available:
return False
self.pending[call_id] = maximum
return True
def settle(self, call_id: str, used: int) -> None:
if call_id in self.finished:
return
maximum = self.pending[call_id]
if used > maximum:
raise ValueError("backend exceeded reserved maximum")
self.pending.pop(call_id)
self.finished[call_id] = used
self.spent += used
def stop_reason(tokens: int, cap: int, elapsed_ms: int, deadline_ms: int,
repeated: bool, scores: list[float]) -> str:
if repeated:
return "repeated_state"
if tokens >= cap:
return "token_cap"
if elapsed_ms >= deadline_ms:
return "wall_clock_cap"
if len(scores) >= 4 and max(scores[-3:]) <= max(scores[:-3]):
return "score_plateau"
return "continue"
budget = TokenBudget(4_000)
r = [budget.reserve("a", 1_500), budget.reserve("b", 1_500), budget.reserve("c", 1_500)]
budget.settle("a", 900)
r.append(budget.reserve("c", 1_500))
print("reservations:", r, f"| spent={budget.spent}, reserved={sum(budget.pending.values())}, free={budget.available}")
print("plateau_check:", stop_reason(2500, 4000, 1800, 3000, False, [0.72, 0.70, 0.71, 0.69]))
print("improving_chk:", stop_reason(900, 4000, 500, 3000, False, [0.61, 0.64, 0.60, 0.59]))reservations: [True, True, False, True] | spent=900, reserved=3000, free=100
plateau_check: score_plateau
improving_chk: continueKV cache limits live branch width
Test-time search stresses GPU memory just as hard as compute. Every live token in a full-attention transformer stores key and value vectors at every layer, multiplying across concurrent search branches.
KV cache pressure
For a uniform full-attention model with layers, KV heads (smaller than query heads under grouped-query attention (GQA)), head width , and element width bytes:
For an 80-layer model with 8 KV heads, , and BF16 ():
One 16,384-token (16k) branch consumes 5.0 GiB of KV memory. Without sharing, eight live branches consume 40.0 GiB before model weights or activations.
Prefix sharing and paged KV storage
Sibling branches in Best-of-N and tree search share the same prompt and early tool context. vLLM's PagedAttention allocates KV memory in non-contiguous blocks with copy-on-write sharing,[13] while SGLang's RadixAttention indexes reusable prefixes in a radix tree.[14]
If eight 16k branches share a 12,288-token stem and diverge for 4,096 tokens each, total distinct slots drop from down to , cutting KV memory from 40.0 GiB to 13.75 GiB (roughly 14 GiB). Free a shared KV page only after both its branch reference count reaches zero and any in-flight GPU reads finish.

def kv_gib(layers: int, kv_heads: int, head_dim: int, bytes_per_elem: int, total_slots: int) -> float:
bytes_per_tok = 2 * layers * kv_heads * head_dim * bytes_per_elem
return (bytes_per_tok * total_slots) / (1024 ** 3)
unshared = kv_gib(80, 8, 128, 2, total_slots=8 * 16_384)
shared = kv_gib(80, 8, 128, 2, total_slots=12_288 + 8 * 4_096)
print(f"8x16k unshared KV: {unshared:.2f} GiB")
print(f"12k stem + 8x4k: {shared:.2f} GiB (saved {(1 - shared / unshared):.1%})")
# Safe progress stream exposes verified milestones while stripping internal verifier scores.
raw_events = [
{"type": "progress", "content": "checked canary status", "internal_score": 0.82},
{"type": "progress", "content": "verified latency thresholds", "internal_score": 0.91},
{"type": "final_answer", "content": "Hold canary at 10% and inspect parser_v2.", "internal_score": 0.88},
]
public_stream = [{"type": e["type"], "content": e["content"]} for e in raw_events]
print("public_stream_keys:", [sorted(e.keys()) for e in public_stream])8x16k unshared KV: 40.00 GiB
12k stem + 8x4k: 13.75 GiB (saved 65.6%)
public_stream_keys: [['content', 'type'], ['content', 'type'], ['content', 'type']]Compression needs value awareness; recurrent depth changes architecture
Prefix sharing deduplicates stems, yet surviving suffixes still grow. Lossy KV eviction can cap memory, but dropping rare high-magnitude value states triggers repetitive loops; Value-Aware Stochastic KV Cache Eviction (VaSE) protects those critical value entries and adds stochastic eviction to avoid collapse.[15] Recurrent-depth models take an architectural approach instead, looping a shared latent block per token with shared KV state and speculative decoding rather than emitting thousands of visible chain-of-thought tokens.[16]
| Mitigation | Works on standard checkpoints? | Primary risk |
|---|---|---|
| Prefix sharing + paged KV | Yes, with runtime support | Incompatible keys or cross-tenant reuse |
| Value-aware KV eviction | Sometimes, with custom attention | Evicting reasoning-critical constraints |
| Recurrent depth | No; requires purpose-trained model | Different training and serving stack |
First update vs final-answer latency
Long hidden thinking inflates raw time-to-first-token (TTFT). Streaming status updates fixes perceived responsiveness, yet a fast status message can hide a 25-second final answer. Track model TTFT, first-update latency, and final-answer latency separately.
A sample capacity plan
Using the 320 KiB/token rate above, logical KV memory scales steeply with branch width before accounting for model weights, workspaces, or concurrency:
| Workload | Live branches | Context per branch | Unshared KV |
|---|---|---|---|
| Single path | 1 | 8,192 tokens | 2.5 GiB |
| Best-of-4 | 4 | 8,192 tokens | 10.0 GiB |
| Tree search | 8 | 16,384 tokens | 40.0 GiB |
Streaming safe updates
Stream strategy selection, budget usage, and summaries derived strictly from completed tool checks. Strip raw scratchpads and uncalibrated internal_score floats from user-facing streams so downstream clients never confuse an internal ranking heuristic for verified confidence.
When reasoning is the wrong tool
Before adding search, ask whether extra inference can uncover evidence or only generate more text:
- Source-of-truth lookups (such as a runbook threshold) need direct retrieval, not multi-branch thinking.
- Missing observations need tool calls; longer thought cannot invent a telemetry panel you never queried.
- Open-ended copywriting without an objective rubric rarely justifies PRM tree search.
- Latency-critical or huge batch jobs can lose far more in tail latency or dollar cost than a marginal accuracy gain returns.
Overthinking: when more thinking lowers accuracy
More thinking tokens are not monotonically better. Ghosal et al. showed that forcing longer reasoning chains on DeepSeek-R1 distilled models raises accuracy up to a point and then degrades it as output uncertainty grows, while parallel traces with majority voting beat forced sequential extension at the same token budget.[17] Stop as soon as exact checks pass or verified progress plateaus.
Why a bigger model isn't enough
| Lever | Cost shape | Flexibility |
|---|---|---|
| Larger base model | Higher steady-state cost on every request | Fixed after deployment |
| Test-time compute | Extra latency and tokens on hard requests only | Dynamic per prompt via router and budgets |
Test-time search amplifies an existing capability; it cannot conjure knowledge the base model lacks completely. When a small model has near-zero pass rate even across many samples, upgrade the base model or add external tools instead of multiplying search depth.[3]
Common pitfalls
"Higher temperature will reveal a great answer if I sample enough"
Diversity without a reliable verifier only produces more creative errors. Raise temperature only when an exact checker or calibrated verifier can separate valid traces from fluent mistakes.
"Tree search is always better than single-path reasoning"
Running tree search on easy queries burns latency and GPU memory with zero accuracy lift. Route by difficulty and escalate only when the first pass falls short.
"More thinking always improves the answer"
Overthinking turns valid initial answers into second-guessed mistakes. Stop on exact check completion, enforce hard token and wall-clock caps, and keep the highest-ranked completed survivor.
"One budget policy can serve every request"
Uniform ceilings starve hard debugging tasks while letting trivial FAQs burn deep budgets. Set token caps, branch width, and wall-clock limits per difficulty tier.
"Users need raw chain-of-thought to trust the system"
Raw scratchpads are verbose, unstable, and unsafe to parse downstream. Stream concise progress milestones grounded in actual tool calls and keep internal search traces private.
"Reasoning quality comes only from prompts"
Prompt tweaks plateau quickly on multi-step constraints. Separate the levers: base model competence, search algorithm, verifier accuracy, KV prefix sharing, and stop criteria.
"Stop criteria are an optional cleanup detail"
Without repeated-state detection, depth limits, and shared reservations, cyclic branches exhaust tokens and wall-clock deadlines silently. Enforce hard stops before every expansion and return only completed, checked plans.
Defending the design
Evaluation rubric
- Foundational: Derive the 240 ms hold vs. 300 ms revert decision from fresh revision-7 observations, and separate advisory output from production execution permissions.
- Intermediate: Run exact constraint checks ahead of proxy scores, isolate completed solutions from unfinished frontier nodes, and maintain
spent + reserved <= capacross retries and timeouts. - Advanced: Derive 40.0 GiB vs. 13.75 GiB of logical KV memory, explain reference-count and in-flight read safety for KV page reuse, and design a cost-matched evaluation comparing single-path against Best-of-3.
Follow-up questions
- Incomplete frontier at depth 1: If a dependency beam returns zero completed plans at depth 1, never relabel the best partial pin as complete. Expand another level only if remaining budget allows; otherwise abstain or hand off.
- Proving Best-of-3 earns its cost: Freeze evidence snapshots, split distinct incidents across dev and held-out sets, and compare single-path vs. Best-of-3 at matched total generator-plus-verifier cost, reporting accuracy, abstentions, latency, and false verifier acceptance separately.