Correctness and contracts report · NVIDIA/hyperflare-inference #644

Raw Markdown for agents: https://autobot.eidonix.com/p/247f4d89-bfd9-43fd-b364-25c09898b652.md

Correctness, Contracts & System-Level Consequences — PR #644

Key findings

The pricing arithmetic in #644 is sound: I re-derived the excluded-only continuation identity, the −c_i·T/2 cancellation between LaneValue::decode_within and ValueRate::new, and the served-share delivery term against head code, and found no contradiction. No Protobuf, core-format or CUDA-graph contract is touched. The problems are elsewhere: two contract documents are left describing the superseded model (including the exact helios/README.md sentence that the competing open PR #632 does fix), LaneValue::finish silently reprices terminal retirement—including under --scheduler-policy throughput while the PR body calls it merely "updated", two user-facing config knobs keep their names and defaults while changing dimension (burst rate → dimensionless served share) with no opt-in, three behavioural constants have no derivation, and the charter's #210 "benchmark against main on a served workload" requirement is not met by any same-core baseline.

Findings are ordered by severity. Citations are to head 2b15114 (pr/644).


Area 1 — Correctness, safety & platform parity

F1. helios/README.md still documents the calibration model this PR replaces — and it is the one sentence another open PR fixes (Major; docs-contract)

helios/README.md:446-450 is not in the diff and still reads:

verification and keep stored confidence forecasts separate from acceptance
outcomes. When pricing GPU-confidence shapes, stored per-depth forecasts are
scaled by a request-local aged per-depth verification calibration ratio (seeded
scale-invariantly with prior weight `2` from a once-per-round population prior
capped at weight `64`, 128-token half-life, request EWMA cap `32`, clamped to
`[0, 2]`), and crowded GPU-allocated packed shapes (`B >= 2`, `P < B * W`,

Head reality is a per-step conditional factor multiplied cumulatively, clamped at 4.0:

helios/src/scheduler/rounds.rs:13

const CALIBRATION_FACTOR_MAX: f64 = 4.0;

and the pricing path multiplies per-step factors across depths (rounds.rs:661, :671-691).

Impact: the README is the operator-facing description of --scheduler-policy balanced's width selection; it now states a clamp of 2.0 and a per-depth ratio when the code uses 4.0 and a cumulative product. Cross-PR: #632 (original-el8, open) touches helios/README.md (+3/−2) precisely for this sentence; #644 does not, so merging #644 first leaves main internally contradictory and merging #632 after is a conflicting hunk. Fix: update this sentence in #632's wording-space (per-step conditional factors, cumulative product across 0..=depth, clamp 4.0, unobserved-deeper inheritance) in this PR.

F2. docs/scheduling-runtime-design.md §"Completion initially records zero deliveries" is now false (Major; docs-contract)

docs/scheduling-runtime-design.md:527-538 at head:

Completion initially records zero deliveries. The first successful visible
publication for the same fence replaces that interval's delivery update with one
served delivery; subsequent tokens in the burst do not change the count. ...
A first published burst initializes a missing delivery history to one delivery
over its measured frame duration.

Head code records the interval's duration as the delivery quantity and normalizes by 1.0:

helios/src/scheduler/service.rs:43-53

    pub fn publish(&mut self, fence: Fence, adaptation_ms: f64) {
        if let Some(observation) = self.pending_delivery.take() {
            debug_assert_eq!(observation.fence, fence);
            let mut price = observation.before;
            price.observe(
                observation.duration_ms,
                observation.duration_ms,
                1.0,
                adaptation_ms,
            );

and the first-burst init is ServicePrice::initial(1.0) (service.rs:424), not "one delivery over its measured frame duration". The file's own summary sentence :200-201 ("A visible speculative burst supplies one delivery regardless of its token count") is also stale under a time-share accounting.

Impact: this is the design document of record for the scheduler's service accounting; a reviewer or future contributor reading it will compute delivered / (1/T_min) and get the old burst-frequency behaviour the PR claims to remove. Fix: amend lines 527-538 to served-time share (delivered = duration_ms, normalizer 1.0, init share 1.0), matching docs/scheduling-utility.md:87-105.

F3. Other docs/scheduling-runtime-design.md sections still carry the pre-change equations (Major; docs-contract)

Verified stale at head, all outside the diff hunks:

Impact: the two design docs now assert mutually exclusive scheduler models (#644 updates docs/scheduling-utility.md:212-262 only), and :378-383 in particular documents behaviour the code no longer has. Fix: port the four sections or, minimally, replace each with a pointer to docs/scheduling-utility.md.

F4. LaneValue::finish now charges the full horizon and ignores completion_ms; this reprices terminal retirement under --scheduler-policy throughput too (Major; behavioural, under-described)

Diff and head, helios/src/scheduler/utility.rs:121-130:

    pub fn finish(&self, completion_ms: f64, horizon_ms: f64) -> f64 {
        debug_assert!(horizon_ms == 0.0 || completion_ms <= horizon_ms);
        let mut value = self.terminal
            + self.age_price * self.reference_delivery_ms * (self.age_ms + horizon_ms);
        if horizon_ms > 0.0 {
            // A selected terminal row is being retired and then absent, so it is never excluded.
            value += self.age_price * horizon_ms * (self.age_ms + horizon_ms / 2.0);
        }
        value
    }

completion_ms survives only inside a debug_assert, so in release builds the argument is unused. Previously the charge was (horizon_ms - completion_ms).

Reach: PolicyConfig::throughput() zeroes only delivery_fairness and decode_age_price, leaving terminal_age_price at 1.0:

helios/src/scheduler/policy.rs:36, :48-50

            terminal_age_price: 1.0,
...
    pub fn throughput() -> Self {
        Self { delivery_fairness: 0.0, decode_age_price: 0.0, ..Self::default() }
    }

Call sites that now charge the whole horizon: policy.rs:606 (value.finish(ms, ms) — here completion == horizon so no change), policy.rs:741 (values[slot].finish(first_ms, total_ms) — stage one of a lookahead, so a terminal row retiring in stage one is now charged the entire two-stage horizon instead of only first_ms), and policy.rs:872.

Impact: every terminal-retirement decision in a multi-stage sequence is repriced toward later snapshots; because terminal_age_price = 1.0 under throughput, this changes --scheduler-policy throughput behaviour as well, which the PR body never says (it lists the throughput policy only as unaffected-by-delivery-fairness context). Guard test completion_inside_a_sequence_matches_integrated_age_and_continuation (utility.rs:338-383) was rewritten to accept the new semantics, so no test pins the old saving. Fix: state the semantic change explicitly in the PR body (terminal rows are never excluded, so they lose the completion_ms saving), confirm the throughput-policy intent, and either drop the now-dead completion_ms parameter or keep it as a real model input.


Area 2 — Unintended system-level consequences

F5. The "no T-dependent bias when all decoders are served" claim fails in the unmeasured startup window (Minor; claim accuracy, self-reversing direction)

Before any graph timing exists for a family, the reference defaults assume b = 1, not b = K:

helios/src/scheduler/service.rs:63-69

        let count = rates.iter().flatten().count() as f64;
        let mut references = rates.map(|r| {
            r.map(|r| DeliveryReference {
                excluded_wait_ms: (count - 1.0).max(0.0) / r,
                served_share: (1.0 / count).min(1.0),
            })
        });

For K decoders that in fact all fit one batch, the documented reference (docs/scheduling-utility.md:227-234) is sigma_i = (K − b)T/b = 0 and s_i = 1; the default is (K−1)/r ≈ (K−1)T and 1/K. served_share = 1/K is harmless (it is T-independent after division). excluded_wait_ms > 0 is not: the added term is age_price·reference·(age + horizon), i.e. a positive +age_price·reference·T coefficient, which at startup favours longer rounds — the mirror image of the bias this PR removes, and it inflates excluded-lane scores exactly when no timing evidence exists. Impact: bounded to the cold-timing window, but it is the regime the PR targets (fresh request set, B = 4), and it contradicts the PR's flat "no request-count special case / sigma_i = 0 when all served" claim. Fix: default to the batch-feasible full-fit assumption (excluded_wait_ms = 0.0, served_share = 1.0) or derive the default from self.costs.batches(kind)'s largest capacity, and note the residual in the docs.

F6. finish's debug_assert is the only consumer of completion_ms; release/release-with-debug build divergence (Minor; parity)

utility.rs:122 debug_assert!(horizon_ms == 0.0 || completion_ms <= horizon_ms); plus a fully unused completion_ms in release. Impact: a caller passing completion_ms > horizon_ms panics only in debug/test builds, and clippy/dead-argument warnings differ across build profiles; the same code path is exercised by policy.rs:741 with first_ms/total_ms, where first_ms <= total_ms holds today but is not enforced in production. Fix: either use the parameter in the model (F4) or convert to a hard assert!/drop the parameter.

F7. service.rs "break ties toward larger served batch" is inert (Minor; system-level, documented-but-inoperative)

helios/src/scheduler/service.rs:104-109

                let served = batch.min(eligible.count_ones() as usize) as f64;
                let cost = nanos as f64 / 1e6 / served;
                for slot in policy::bits(eligible) {
                    if cost < best[slot].0 || (cost == best[slot].0 && served > best[slot].1) {

The tie-break fires only on bit-identical f64 cost, which for distinct measured durations essentially never happens. docs/scheduling-utility.md:227-229 states the rule as normative ("breaking ties toward larger served batch b = min(batch_capacity,K)"). Impact: in the oversubscribed K > b regime, served_share can come from a no-better-cost shape with a smaller b, mildly inflating excluded_wait_ms. Low frequency, but the documented invariant does not hold. Fix: compare with a small epsilon or compare (cost, Reverse(served)) lexicographically.

No contention, allocation, I/O or failure-propagation regression found. delivery_references is a stack-array loop over the existing catalogues; (f64, f64) per lane replaces f64 per lane (no allocation); lane_values adds no new Vec. pending_delivery handling is unchanged in structure (service.rs:411-427), so the fence-ordering invariant at docs/scheduling-runtime-design.md:530-533 still holds.


Area 3 — Architecture, contracts & charter compliance

F8. Global default-behaviour change with no opt-in, and two knobs keep names/defaults while changing dimension (Major; charter "Be explicit … no magic defaults")

helios/src/scheduler/policy.rs:33-34

            delivery_fairness: 4.0,
            decode_age_price: 0.1,

delivery_fairness was a coefficient on a burst rate (1/T), documented as "value/ms" (docs/scheduling-runtime-design.md:645); it is now a coefficient on a dimensionless served share s_i (policy.rs:467-471, service.rs:411-427). decode_age_price now multiplies only excluded lanes. Names, defaults and units-in-docs are unchanged.

Impact: (a) this changes flare run's default --scheduler-policy balanced for every user with no flag, gate or version note — the age/delivery half is not gated by GPU confidence (that gate covers calibration only, rounds.rs:471-474), so it applies to plain decode, host-allocation MTP and resume/snapshot families alike; (b) anyone who tuned delivery_fairness via configure_policy/CLI keeps their number against a different quantity, silently. Neither is mentioned in the PR body's Compatibility section, which discusses only ABI. Fix: document the dimension change and the default-policy effect explicitly in the PR body and in docs/scheduling-runtime-design.md:641-651, and state whether existing tuned values are expected to transfer.

F9. Three behavioural constants remain underived (Major; charter "be explicit and pin everything")

            for (depth, (sum_real, sum_pred, sum_w, count)) in round_cal.into_iter().enumerate() {
                if count > 0 && sum_w > 1e-6 {
                    let round_w = (sum_w / count as f64).clamp(0.0, 1.0);

The divisor is the lane count, not sum_w, so a depth whose survival-weighted samples average w learns with α ≈ w/weight — depth 3 at w ≈ 0.15 learns roughly 7× slower than depth 0, which is a deliberate-looking but undocumented asymmetry.

Impact: this is the identical gap for which the competing #632 has two outstanding "Changes Requested" verdicts (derive 0.88/4.0/2.0); applying a stricter bar to one PR and not the other is not defensible, and per #515's own thread the estimator already produced −19%…−27% on 1× GB300 once. Fix: add the derivation (or a comment bounding the trade-off) for 4.0, the 0.5 prior, and round_w.

F10. Interaction with in-flight #645 on the same sites (Major for merge order; verified overlap)

#645 (same author, opened one minute later) rewrites lane_values/action-side pricing and adds LaneValue::prefill_finish on the same struct this PR changes, and its coalescing term still prices delivery as a rate 1/T — the quantity this PR redefines as a share. I verified the shared struct and defaults at utility.rs:78-88 and policy.rs:28-51; whichever lands second must be re-derived. #645 does not touch rounds.rs, so the calibration half is orthogonal.

F11. No served-workload A/B against main (Major; charter #210)

The PR body's numbers are: balanced 76.11 tok/s vs throughput 76.43 on the same new core gb10-tp4-202611301553; greedy_code 70.30 → 75.98 and mean 72.46 → 74.15 on a different core gb10-tp4-202611301141; and DFly2 "+24.2%/+14.6%" against a forced P=6, not against main. There is therefore no before/after on one core/harness at default balanced, which is what the charter requires ("benchmarks showing an actual speedup over main on a served workload"). Compounding: the simulator does not model GPU-confidence calibration at all, so the 786 pytest results cover only the age/delivery half, and the fairness tests use hand-set synthetic costs. Fix: one same-core main-vs-2b15114 run at default policy, max_tokens = 256, same 5 prompts.

F12. Unlinked prior art: #152 is the field report of this exact defect (Major; process/evidence)

Open issue #152 (javieratomic, 2026-10-30, still open with triage:design-review) reports the same balanced-collapses-to-W=1 symptom at B=4, names the same two knobs (delivery_fairness 4.0, decode_age_price 0.1), and its maintainer triage (original-el8, 2026-11-05) asked for inter-token/cadence and per-request latency evidence. The PR body supplies aggregate tok/s and off/r ratios only and references neither #152 nor #632 nor #645. Impact: the evidence the triage actually asked for is missing, and the user who filed the report gets no credit or notification. Fix: cite #152/#632, and add delivery-gap / inter-token measurements.


Area 4 — Tests & claim accuracy

F13. The unweighted calibration estimator is now #[cfg(test)], so an existing bleed test no longer exercises production code (Minor; test-validity)

helios/src/scheduler/rounds.rs:352-362

    /// Calibrates raw per-step GPU confidence against realized conditional survival at `depth`.
    #[cfg(test)]
    pub(super) fn observe_calibration(&mut self, depth: usize, realized: f64, predicted: f64) {
        self.observe_calibration_weighted(depth, realized, predicted, 1.0);
    }

helios/src/scheduler/policy_tests.rs:5420 and :5436 still call it:

            scheduler.forecasts.observe_calibration(d, 0.0, f64::from(mean[d]));
...
            scheduler.forecasts.observe_calibration(d, 0.40, 0.80);

Impact: the cross-workload-bleed regression test now validates a code path production never runs (production is always survival-weighted, weight = prev_realized, rounds.rs:671-691); a regression that only manifests with w < 1 would pass. Fix: route the test through observe_calibration_weighted with representative w, or keep an unweighted production entry point.

F14. Claim-accuracy items, all checked against the diff

PR claim Verification
"sigma_i = (K − b)T_f/b (DeliveryReference::excluded_wait_ms)" Accurate — service.rs:150-157.
"delivered = duration_ms on visible publication, 0.0 when excluded, initialized from b/K" Accurate — service.rs:47-52, :420, :424, :370.
"Unobserved deeper depths inherit the deepest observed shallower depth's factor, preferring request-local" Accurate — rounds.rs:290-311.
"Matching throughput (76.43 tok/s, 0.4%)" / "no same-core baseline" Not an A/B against main — see F11.
"updated LaneValue::finish" Understated — full-horizon charge, completion_ms unused, affects throughput too — see F4.
"No Protobuf, core-format, or CUDA-graph ABI changes" Verified — the 10 touched files are scheduler/docs/tests only.

What holds (no issue found)


Open questions / not found

  1. Same-core main baseline at default balanced; and the inter-token/cadence measurements #152's triage requested.
  2. Derivation of CALIBRATION_FACTOR_MAX = 4.0, the flat 0.5 prior, and round_w = clamp(sum_w/count).
  3. Whether #644 is meant to supersede #632 (open, same file, same symptom) or run beside it; no cross-reference either way, and no comment from voipmonitor or original-el8 (authors of the #515/#522 estimator it rewrites).
  4. Merge order vs #645 (same LaneValue/lane_values sites, still pricing the old 1/T delivery rate).
  5. Whether the finish full-horizon charge under throughput is intended (F4) — not determinable from the PR text or tests.
  6. The three new tests named in the PR body (balanced_unexcluded_decoders_maximize_throughput_without_delivery_or_age_penalty, oversubscribed_decoders_incur_excluded_wait_and_protect_skipped_lanes, and the Python test_unexcluded_decoders_pick_peak_throughput_speculation_depth) were not opened in this pass; the reported scheduler:: count (400 passed) versus #632's 399 passed / 4 ignored on the same base is consistent with the #[cfg(test)] gating in F13 but could not be reconciled without running the suites.