Correctness, Contracts & System-Level Consequences — PR #632
helios/scheduler: scale GPU prefix calibration ceiling per step across depth (head 64c7198, +216/−33, 4 files)
Key findings
- Blocker — the new ceiling is exactly
prior × 2^(d+1), so the upper clamp stops binding at every depth. The population prior is0.5^(d+1)(helios/src/scheduler/rounds.rs:309-311) and the new ceiling is2^(d+1)(rounds.rs:15-18); their product is exactly1.0at every depth. The change does not widen the bound from 2.0 to 2^(d+1) — it removes it, because the largest value the calibrated product could ever need is 1.0. Fordraft_tokens ≥ 3cores the estimator is effectively unbounded above, while the description says it "keepsCALIBRATION_FACTOR_MAX = 2.0as the per-step ratio bound". This reverses #515's Theorem 2 (f_d = clamp(r̄_d/p̄_d, 0.0, 2.0)). - Blocker — brand-new requests now seed to
realized = 1.0at depth ≥ 2 and resist correction.anchor = 0.05(rounds.rs:22) times a depth-4 factor of 20–32 clamps to1.0atrounds.rs:99; the seed weight of 3 (rounds.rs:100-104) means one fully-failed round only drags it to 0.667. No test covers request birth at depth ≥ 2. - Major — saturation flattens the calibrated curve at 1.0, i.e. "every draft accepted at every depth", which is the worst-case selection signal, not the described fallback. The reach is not confined to shape choice: the same curve sets each request's priced
token_rate(helios/src/scheduler/service.rs:209-216→:327-337) and both inputs of theSurplusHistoryestimator (rounds.rs:593-623). The PR itself measures the resulting cost (accept rate59.7–62.2%→49.4–51.8%,~2.8–2.9drafts/lane, extra verification rows at C=16/32) without declaring it as expected behaviour. - Major — the Hoeffding exploration bonus loses all effect.
calibrated + sqrt(ln20/(2·info))(rounds.rs:415-421) is small next to a saturatedcalibrated, sooptimistic_tokens(helios/src/scheduler/learning.rs:12) collapses onto the conservative curve and the acceptance probe stops exploring deeper shapes. - Major — the premise is unverifiable in-repo and the new doc sentence is self-contradictory. The Rényi-2 collision-survival semantics exist only in the lines this PR adds;
helios/model-contract.md:218-225describes the sidecar only as FP32 confidence multiplied in FP64. The prose simultaneously claims a "2.0 per-step ratio bound" and "without truncating deeper prefixes", which finding 1 contradicts. - Major — charter evidence rule (#210) not met and CI status undisclosed. The only isolated evidence is a synthesized
B=1, W=6CPU engine test; all served numbers are combined-stack and the headline87.74 → 118.23 tok/spair also differs indraft_tokens. CI is failed on the head commit and the description lists only local passes. - Minor — the new ceiling test's comment describes the wrong depth (
policy_tests.rs:6439-6441). - Minor — out-of-range depth falls back to a factor of
1.0, not a depth-scaled bound, so the estimator's behaviour at a missing depth is unrelated to the new scaling (rounds.rs:284,:294,:335).
Areas I checked and found sound: the helper is panic-free (saturating_add + i32::try_from(...).unwrap_or(30).min(30)); debug_assert! range invariants still hold at every observation site (rounds.rs:40-41, 94-95); [0,1] clamping and the running-min non-increasing prefix bound are genuinely untouched (rounds.rs:412-424, :610-617); the depth plumbing is complete with no missed call site (rounds.rs:47, 83, 93, 283, 292, 334); no lock, queue, allocation, I/O or cfg-gated code is touched, so there is no new contention, buffering or Unix/Windows divergence; no .proto, manifest, graph contract or persisted state is changed, so there is no stale-state-across-restart exposure and core/artifact compatibility is trivially preserved; SURPLUS_FACTOR_MAX remains an independent flat 2.0 (rounds.rs:25).
Finding 1 — Blocker: the depth-scaled ceiling is exactly the population prior's complement, so the upper clamp is inoperative at every depth
helios/src/scheduler/rounds.rs:13-18
const CALIBRATION_FACTOR_MAX: f64 = 2.0;
fn calibration_factor_max(depth: usize) -> f64 {
let steps = i32::try_from(depth.saturating_add(1)).unwrap_or(30).min(30);
CALIBRATION_FACTOR_MAX.powi(steps)
}
helios/src/scheduler/rounds.rs:309-311
let population: Vec<f32> = (0..token_capacity - 1)
.map(|i| 0.5f32.powi(i as i32 + 1)).collect();
let calibration = population.iter().map(|&p| DepthCalibration::new(f64::from(p))).collect();
helios/src/scheduler/rounds.rs:47-53
fn factor(self, depth: usize) -> f64 {
if self.predicted > 1e-6 {
(self.realized / self.predicted).clamp(0.0, calibration_factor_max(depth))
} else {
1.0
}
}
Arithmetic: prior 0.5^(d+1) × ceiling 2^(d+1) = exactly 1.0 for every d (d0: 0.5×2; d3: 0.0625×16; d4: 0.03125×32; d6: 0.0078125×128). Any observed ratio ≥ 1.0 against the prior now saturates the calibrated value at the top of the [0,1] clamp instead of being truncated at 2×. Worst-case cumulative factor rises 2.0 → 32.0 at depth 4 and to 2^30 ≈ 1.07e9 at the capped exponent.
Impact. For a well-calibrated drafter the depth-4 prior is small while realized is bounded by 1, so a single good round drives the factor an order of magnitude past the old bound with nothing to pull it back; the estimator is unbounded in practice for DeepSeek-V4.1-Flash and DFlash2 (draft_tokens ≥ 3). This is the "reverses an invariant of a recently merged feature" case: CALIBRATION_FACTOR_MAX = 2.0 was introduced five days earlier by #515, whose Theorem 2 asserts this clamp as the guarantee, and #522 preserved it. The PR text presents the result as "calibration_factor_max(depth) = 2.0^(depth + 1) … keeps CALIBRATION_FACTOR_MAX = 2.0 as the per-step ratio bound across all depth + 1 steps" — true of the per-step reading, but the resulting estimator is not bounded, and that difference is what determines whether deep packed shapes are offered.
Fix. Bound the ceiling so it cannot exceed the prior's complement, e.g. min(2.0^(d+1), MAX_CUMULATIVE_RATIO / 0.5^(d+1)) for a stated MAX_CUMULATIVE_RATIO (4× is already a large widening), or clamp the cumulative calibrated value rather than the ratio. Add a test asserting the factor stays bounded when realized = 1.0 at depth 4 — the current suite asserts only lower bounds (policy_tests.rs:6563-6567, > 8.0) and an unclamped pass-through (policy_tests.rs:6446).
Finding 2 — Blocker: request-birth seeding saturates to full survival and the seed weight makes it resistant to correction
helios/src/scheduler/rounds.rs:96-106
let aged = if self.weight == 0.0 {
let anchor = predicted.max(REQUEST_CALIBRATION_ANCHOR_FLOOR);
self.predicted = anchor;
self.realized = (anchor * global.factor(depth)).clamp(0.0, 1.0);
REQUEST_CALIBRATION_PRIOR_WEIGHT * Self::decay(generated, self.observed_at)
} else {
self.weight_at(generated)
};
self.weight = (aged + 1.0).min(REQUEST_CALIBRATION_MAX_WEIGHT);
self.realized += (realized - self.realized) / self.weight;
Constants: REQUEST_CALIBRATION_ANCHOR_FLOOR = 0.05 (rounds.rs:22), REQUEST_CALIBRATION_PRIOR_WEIGHT = 2.0 (rounds.rs:19), REQUEST_CALIBRATION_MAX_WEIGHT = 32.0 (rounds.rs:20).
With anchor = 0.05 and a depth-4 factor of 20–32 (reachable, and the PR's own test demands > 8.0, policy_tests.rs:6564), realized clamps to 1.0; under the old flat 2.0 it was 0.10. Then weight = 2 + 1 = 3, so an observation of realized = 0.0 moves the seed only to 0.667. A cold request admitted during good traffic is priced at ~2/3 maximum deep-prefix survival after its first genuinely bad round, and reaches parity only after several rounds of decay-weighted averaging.
Impact. Cold-start optimism on exactly the low-acceptance workloads where this PR's own measurements show the regression (accept rate 59.7–62.2% → 49.4–51.8%, ~2.8–2.9 drafts/lane offered, "increasing packed verification rows"). The only diff hunk inside observe is the added global.factor(depth) argument, so this behavioural change is undeclared in the description, and it changes what request birth means for every GPU-confidence deployment on upgrade. Note also that speculative_curve synthesizes a fresh Forecast when a request has none yet (rounds.rs:409-411), and observe_packed_forecasts does the same (rounds.rs:582-584), so this seeding path is on the ordinary admission route, not an edge case.
Fix. Seed with min(global.factor(depth), CALIBRATION_FACTOR_MAX) so birth keeps the previous per-request bound, and add the missing test: the new ceiling test (policy_tests.rs:6433-6447) only exercises Forecasts::observe_calibration, and the behavioural test (policy_tests.rs:6541-6596) seeds progressively from depth 0, so no existing test observes a request's first round at depth ≥ 2.
Finding 3 — Major: the reach is not shape selection only — it is a saturated admission/rate metric and a cross-lane estimator input
Metric/rate span check on speculative_curve, the single producer of the calibrated prefix curve:
- Shape selection:
rounds.rs:480(prefix_lengths_with_values),rounds.rs:538-543(proposal_forecast_tokens/powered_curve). - Per-request service rate (the admission/fairness metric):
helios/src/scheduler/service.rs:209-216
let curve = curve.get_or_insert_with(|| self.powered_curve(request, false));
consider(
GraphKind::Speculative,
batch,
width,
super::rounds::forecast_tokens(curve, tokens),
true,
);
with helios/src/scheduler/service.rs:150-160
let per_ms = 1e6 / ns as f64;
token_rate = token_rate.max(tokens * per_ms);
consumed as the price at service.rs:327-337 (ServicePrice::initial(rate / count as f64) / price.rebase(...)). Raising calibrated deep-prefix survival raises each request's priced token rate, which reorders fairness and delivery references for every concurrent lane, with no config key, flag, env var or manifest field to tune or disable it (the diff adds none; rounds.rs:10-25 only gains the helper).
- Cross-lane surplus estimator:
helios/src/scheduler/rounds.rs:593-623
let mut host_pred = if !cal_factors.is_empty() {
let mut bound = 1.0f64;
(0..depth_limit).map(|depth| {
let calibrated = forecast.prefixes[depth].mean() * cal_factors[depth];
bound = bound.min(calibrated.clamp(0.0, 1.0));
bound as f32
}).collect::<Vec<_>>()
...
let calibrated = f64::from(prefix) * cal_factors[depth];
actual_bound = actual_bound.min(calibrated.clamp(0.0, 1.0));
...
self.forecasts.observe_surplus(actual_cal, std::mem::take(&mut host_pred));
The depth-scaled factors feed both sides of SurplusHistory (introduced by #515/#522), so B ≥ 2 packed-shape pricing moves. #515's invariance argument cancels a uniform factor; a per-depth ceiling that clips at 1.0 asymmetrically does not cancel, so SurplusTable::factor (rounds.rs:237-256) shifts. No test in the diff covers surplus after this change — the existing surplus tests call observe_surplus directly and inject their own curves (policy_tests.rs:5237+, :5440+), so they cannot detect it.
- Saturation semantics. Because the running-min bound is retained (
rounds.rs:412-424,:610-617), an over-large factor does not produce a merely generous estimate — it produces a curve pinned at1.0for all depths, i.e.forecast_tokens(powered, width) == width(rounds.rs:889-891), meaning the scheduler sees full acceptance at maximum depth. That is the opposite failure mode from the described shallow-width fallback and is what generates the extra verification rows the PR reports.
Fix. Add a B ≥ 2 packed test pinning the SurplusTable::factor before/after, plus a service-rate test pinning token_rate for a deep-acceptance lane, and state the fairness/rate reach and the saturation behaviour in the description.
Finding 4 — Major: the exploration bonus becomes inert, so acceptance probing stops discriminating
helios/src/scheduler/rounds.rs:415-421
let value = if optimistic {
let info = estimate.weight_at(request.generated_tokens)
.min(forecast.calibration_information(depth, request.generated_tokens));
calibrated + (20.0f64.ln() / (2.0 * info.max(1e-9))).sqrt()
} else {
calibrated
};
calibration_information (rounds.rs:288-290) is untouched, so the additive bonus stays ~O(1/√info) while calibrated can now be far larger. Once calibrated saturates at 1.0 the bonus is clipped away by bound.min(value.clamp(0.0, 1.0)), and optimistic_tokens (helios/src/scheduler/learning.rs:12) becomes identical to the conservative estimate for that lane.
Impact. The exploration/exploitation balance that drives acceptance_probe (learning.rs:15-19) silently changes: deeper shapes that are currently misevaluated lose their exploration premium, and conversely the probe may never fire because the optimistic and conservative prices agree. Nothing in the diff rebalances it, and no test asserts the optimistic curve stays strictly above the conservative one after deep calibration.
Fix. Decide explicitly whether the bonus is additive in survival space or multiplicative in log-odds space, and add a test asserting speculative_curve(.., true)[d] > speculative_curve(.., false)[d] at the deep depths whose factor changed.
Finding 5 — Major: the justifying contract is asserted by this PR's own docs, not by the owning contract, and the prose is self-contradictory
docs/scheduling-runtime-design.md (added text, ~:117-123)
"Because the GPU confidence sidecar at 0-based
depth(d) records the cumulative Rényi-2 collision survivalprod_{j=0..d} sum_i q_{j,i}^2acrossd + 1draft steps, any per-step underprediction … compounds multiplicatively across steps; scaling the ceiling as2.0^(d + 1)enforces a2.0(CALIBRATION_FACTOR_MAX) per-step ratio bound at each draft step without truncating deeper prefixes."
The strings "Rényi" and "collision survival" appear only in the two files this PR touches (docs/scheduling-runtime-design.md, helios/README.md:450-452). The contract document only specifies shape and framing — helios/model-contract.md:218-225 describes consumption as "multiplying FP32 confidence values in FP64" and :227-231 specifies [2, request_slots, draft_capacity] storage — and the manifest validation checks shape/width agreement, never semantics. The producer is the out-of-tree exporter.
Impact. The entire widening rests on an unverifiable premise: if the sidecar actually carries per-step acceptance probabilities rather than the collision product, then the c^(d+1) compounding argument is false and finding 1's bound removal has no justification at all. Additionally the final clause claims a "2.0 per-step ratio bound … without truncating deeper prefixes", which finding 1 shows cannot both hold.
Fix. Specify the sidecar semantics in helios/model-contract.md with the exporter-side evidence, or drop the semantic claim from the design doc and justify the number from a served A/B instead.
Finding 6 — Major: charter evidence rule (#210) not met; CI status undisclosed
The only isolated artifact is the synthesized engine test (policy_tests.rs:6449-6596), which hand-builds a five-shape catalogue with estimated_duration_ns 29.5/31.2/35.0/37.0/38.8 ms and asserts packed_token_capacity moves 3 → 6 (:6552, :6580) and stays 3 under low depth-2 survival (:6595). That test does discriminate the change (the > 8.0 factor assertion at :6563-6567 is unreachable under flat 2.0), but it is a CPU simulation, not a served workload. The PR's own scope note concedes "isolated single-PR TP4 serving A/B was not run separately", every tok/s figure is combined-stack, and the headline 87.74 → 118.23 tok/s pair also differs in draft_tokens (5/W=6 vs 7 adaptive), so it does not isolate the ceiling. The charter requires "benchmarks showing an actual speedup over main on a served workload" and AGENTS.md requires separating isolated from combined-stack results. Separately, the local claim is "399 passed, 0 failed, 4 ignored" with no mention that CI is red on the head commit — I have no log access, so the failure cause is unknown (see open questions).
Fix. Run the isolated A/B on one GPU-confidence core through flare run against main with draft_tokens held fixed, and state the CI outcome in the description.
Finding 7 — Minor: the ceiling test's comment documents the wrong depth
helios/src/scheduler/policy_tests.rs:6437-6446
// Depth 0 exceeds the 2.0x per-step ceiling (0.99 / 0.10 = 9.9x -> clamped to 2.0).
forecasts.observe_calibration(0, 0.99, 0.10);
// Depth 4 has 5 steps (ceiling 2.0^5 = 32.0): 0.75 / 0.05 = 15.0 passes unclamped,
// while extreme 0.99 / 0.01 = 99.0 clamps at 32.0.
forecasts.observe_calibration(3, 0.99, 0.01);
forecasts.observe_calibration(4, 0.75, 0.05);
The 99.0 observation is fed at depth 3 (ceiling 16.0), not depth 4 (ceiling 32.0), which is why the next assertion expects 16.0 at depth 3. Only the comment is wrong, but it is the only in-repo statement of the clamping behaviour a reader can check.
Fix. Move the 99.0 sentence to the depth-3 line and say it clamps at 16.0.
Finding 8 — Minor: a missing depth silently yields factor 1.0, unrelated to the new scaling
helios/src/scheduler/rounds.rs:283-285
fn calibration_factor(&self, depth: usize, global: &[DepthCalibration]) -> f64 {
let global_entry = global.get(depth).copied().unwrap_or(DepthCalibration::new(1.0));
self.calibration.get(depth).map_or_else(|| global_entry.factor(depth), |entry| entry.factor(depth, global_entry))
DepthCalibration::new(1.0) has realized == predicted == 1.0, so factor returns exactly 1.0 — the identity factor — while an in-range depth now returns up to 2^(d+1). The same pattern is repeated at rounds.rs:294 and, for tests, rounds.rs:334-336 (map_or(1.0, ...)). After this PR the fallback is no longer a neutral default in the same sense: an index mismatch (e.g. a confidence_width shorter than the offered depth) is priced as "no calibration" instead of clamping to the same bound as its neighbours, which is a silent observability/consistency gap rather than a crash — observe_packed_forecasts already guards with predicted_prefixes.get(depth) (rounds.rs:627) and Vec::get_mut (rounds.rs:328).
Fix. Route the fallback through DepthCalibration::new(0.5f64.powi(depth as i32 + 1)) so an out-of-range depth degrades to the prior rather than to identity, and debug_assert!(depth < width) where the width is known.
Open questions / could not determine
- What failed in CI on
64c7198. Twohelios/**workflows exist (.github/workflows/native-serving.yml(not opened),.github/workflows/helios-lifecycle.yml(not opened)); I have no log access, and the known unrelatedFLARE_TEST_TEMPLATE_DIRfixture failures reported by #521/#522/#633 are a plausible but unverified cause. There is no fmt/clippy workflow, so a formatting-only cause is unlikely. - Whether depth ≥ 4 saturation is intended. The arithmetic (prior
0.5^(d+1)× ceiling2^(d+1)= 1.0) makes the new ceiling precisely the value that renders the upper clamp inoperative at every depth. If the intent was "2× per step but still bounded", a multiplicative ceiling on the prior is not that. - Whether the birth-seed change was observed at all. No test and no benchmark in the PR isolates request birth at depth ≥ 2, so it is unknown whether the optimism is benign in practice.
- Whether the low-acceptance regression is acceptable at shipped defaults. The PR reports the cost at
alpha = 0.75,max_verification_token_budget = 256but names no default configuration. - No issue is linked. Whether #503 (B8 W1 collapse under concurrency) or #530 (MTP drops to width one for structured output) are considered related is not stated; the PR does not claim to fix either.
- Whether CPU-only evidence suffices for this class of change is a maintainer call; the charter's served-workload rule (#210) is not met by the material in the PR as written.