Opened by a workflow run, Dec 2, 2026 4:25 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: jcartu (CONTRIBUTOR; 3 merged / 3 closed / 10 open in 180 days, mostly docs and small Helios fixes; Discord jcartu)
Motivation: Every time the scheduler prices a candidate shape it rebuilds each decoding lane's speculative survival curve — including a powf per depth even at the default exponent of 1.0 — and planning runs on the model worker thread that cannot poll completions while it plans. Because request and forecast state do not change during a pass, one curve per lane can be computed once and reused, which removes redundant allocations and powf calls without changing any score.
Scale: +502 / −51 lines in 3 files (policy.rs +177/−46, policy_tests.rs +294, rounds.rs +31/−5)
Proposal:
- New
CurveCache(8-slot[Option<Vec<f64>>; REQUEST_LANES]plus anoptimistictag guarded bydebug_assert_eq!) allocated once percandidates()pass and threaded throughmixed_candidates_with_curves,packed_round_candidates_with_curves,add_candidate,continuation_candidate,prerequisite_value,next_progressandphase_plan. cached_expected_tokensreturnsf64::from(tokens != 0)for 0/1-token lanes and otherwiseforecast_tokensover the cached or freshly built curve;lane_value_for_tokens_withinkeeps its 6-argument signature and delegates through the cache.powered_curvereturns the survival vector unchanged whenadaptive_verification_alpha == 1.0(the default) and increments a#[cfg(test)]thread-localCURVE_EVALUATIONScounter.- Four new tests: one-curve-per-lane for the waiting
Initpass, formixed_candidates, zero curves for a decode-only pass, and bit-exact cached-vs-uncached candidate keys/score.to_bits()at alpha 1.0 and 0.6. - Wrapper methods (
mixed_candidates,packed_round_candidates) keep their signatures by allocating a per-call cache;lane_valuewidened topub(super)for the new test. Touches: helios/src/scheduler/policy.rs— candidate pricing and the pass-wide cache (highest risk:next_progressis restructured, not merely threaded).helios/src/scheduler/rounds.rs—powered_curvealpha short-circuit,proposal_forecast_tokenswidth<=1 return, packed-round limit<=1 skip, test counter.helios/src/scheduler/policy_tests.rs— ~294 lines of new count and equivalence tests only. Related items:- #547 Scheduler: candidate pricing rebuilds each decoding lane's speculative curve for every shape it prices (open): the issue this fixes, filed by shieldstar together with a full patch that #693 reimplements.
- #188 Remove repeated work from scheduler planning (merged): direct predecessor that introduced once-per-lane curves in
packed_round_candidates/next_progress/service_rates, and reported live tok/s evidence #693 lacks. - #540 Retain bounded timing-refresh and acceptance credit across idle (merged): where shieldstar's
CURVE_EVALUATIONScounter and reuse tests first appeared; the counter did not survive intomain. - #571 (open), #621 (open), #334 (open), #306 (open): concurrent edits to policy.rs/policy_tests.rs/rounds.rs (not opened) that will conflict textually.
- #681 helios/scheduler: use active cohort mean in coalescing horizon (merged): merged the same day into the same policy.rs region.
Link: https://github.com/NVIDIA/hyperflare-inference/pull/693
Autobot comments: The description understates the change:
next_progressis restructured (mixed-shape pricing moves inside the speculative branch with an earlyreturn, and the resume branch hard-codesvalue.decode(1.0, …)), and themixed_candidateswrapper tags its cacheoptimistic = falseeven when called withoptimistic = true— harmless today only because the optimistic branch never reads the cache. Thepow@@GLIBC_2.29 5.48%profile is inherited from #547, whose own text says the binary was stripped, from a downstream tree, with no call graph, sopowcannot be attributed to this path; the CPU table has no harness or command line andhelios/benches/holds onlytemplate.rs(not opened), so it is not reproducible from the PR, and the baselines (c513e46a) predate the rebase ontocc0a49d2. Charter rule (#210) anddocs/design-review.md:106-115rule 12 ask performance PRs for served-workload Helios-service measurements; the PR explicitly claims none.resize_prefill/add_prefill_candidateandcoalescing_prefill_log_bonusstill callpowered_curveuncached, so coverage is partial. Zero comments, zero reviews, no labels, no CI on the head commit; shieldstar, who filed the issue and its patch, is not credited and has not commented.
Classify intake
Selected: triage:review, performance, area:scheduling
Threshold: 65%
Triage
- [✓]
triage:review: 95.3% -
triage:validation: 4.2% -
triage:design-review: 0.4% -
none: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 98.2% -
community: 62.2% -
duplicate: 43.8% -
bug: 1.4% -
enhancement: 1.4% -
documentation: 0.0%
Area
- [✓]
area:scheduling: 98.0% -
area:memory: 1.6% -
area:selene: 1.4% -
area:caching: 1.1% -
area:preparation: 1.1% -
area:kernels: 1.0% -
area:api: 0.6% -
area:engram: 0.6% -
area:orbit: 0.4% -
area:rocenante: 0.2% -
area:packaging: 0.1%
Model
-
model:deepseek-v4.1: 4.2% -
model:inkling-small: 1.4% -
model:deepseek-v4: 0.7% -
model:kimi-k3.1: 0.3% -
model:glm-5.3: 0.2% -
model:qwen3.8-flash-next: 0.1% -
model:qwen3.8-27b: 0.0% -
model:nemotron-3.5-bolt: 0.0% -
model:muse-glimmer: 0.0% -
model:mimo-v2.6: 0.0% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +performance, +area:scheduling
Value Proposition
Value Proposition — PR #693
Charter alignment. The change sits in exactly the layer the charter protects: Helios scheduling, model-agnostic, no per-model branch, no new flag, config, or default (adaptive_verification_alpha stays 1.0). It is a genuine "smallest footprint in shared code" fix to the thread #188 already documented as unable to poll completions while planning. The description has the charter's four required parts and honestly discloses unrun checks. The mismatch is evidential: the charter (#210) and design-review rule 12 require a served-workload speedup, and this PR supplies host-CPU microbenchmarks with no published harness, measured against c513e46a before the rebase onto cc0a49d2. The 5.48% pow figure is inherited from #547, which itself says the binary was stripped, from a downstream tree, with no call graph — it cannot be attributed to powered_curve.
Novelty & status. Not obsolete: #188 covered packed_round_candidates/next_progress/service_rates, but mixed_candidates, continuation_candidate, prerequisite_value and the alpha-1 shortcut are still uncached on main, and neither CURVE_EVALUATIONS nor the #540 zero-duration reuse survives. Not superseded: no open PR competes on this optimization (#571, #621, #334, #306 only collide textually). So it is additive — but it reimplements, without credit, the complete patch shieldstar already published in open issue #547. That conflicts with "Respect contributors" and leaves #547 open with triage:validation.
Value vs maintenance cost. Beneficiaries are speculative-serving users on the scheduler hot path; the strongest evidence is the fixture-level equality test (cached_lane_pricing_matches_uncached…, exact score.to_bits() equality across alpha 1.0/0.6, widths 0–8, waiting Init, Mixed, packed, ties, and plan() winners), which is credible but weaker than #188's ~210k-plan trace comparison. Costs are real: +502/−51 in the highest-churn scheduler file (seven same-file merges in weeks, #681 merged the same day), an undeclared next_progress restructure that now hard-codes decode(1.0, …) and early-returns, a latent CurveCache::new(false) tag bug in the optimistic mixed_candidates path, a re-introduced CURVE_EVALUATIONS counter a prior review asked to delete, partial coverage (prefill paths still uncached), and zero reviews, labels, or CI checks.
Worth it with changes: credit and coordinate with #547 before proceeding; delete the counter; fix the optimistic tag; disclose the next_progress restructure explicitly; and either publish a re-runnable benchmark re-measured on cc0a49d2 or reframe the PR as a behaviour-identical cleanup without a speedup claim. The engineering is sound; the packaging is not yet up to the project's bar.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Subtraction and simplicity
PR #693 is a sound optimization but not a lean diff: the same computation is expressed twice, dead state was added, and a test-only counter returns that a prior review asked to delete.
Option<&mut CurveCache>plus itsNone => expected_speculative_tokensfallback (policy.rs:1387-1404) is marshalled through four functions for exactly one production site — the mixed resized-candidate decode leg at policy.rs:1997. Corrected from my Working notes: the None arm is reachable, but only there. Make the parameter unconditional, build one cache perresize_prefill/add_prefill_candidate, and theNonearm, theexpected_speculative_tokensresidual and three of the sixlane_value*wrappers disappear (~40 lines).CurveCache.optimistic+ itsdebug_assert_eq!(policy.rs:98-130) is dead state that nothing reads — the optimistic mixed branch bypasses the cache (policy.rs:1770) — and it is already inconsistent (CurveCache::new(false)at policy.rs:1714 vsnew(optimistic)at rounds.rs:844). Delete the tag; do not patch 1714.- The
tokens <= 1→f64::from(tokens != 0)guard is written twice, in policy.rs:1393-1395 and rounds.rs:626-631, and duplicates whatforecast_tokensalready returns (rounds.rs:1016-1019). State it once. CURVE_EVALUATIONS(rounds.rs:10-14, :634-636) plusis_cachedand three call-count tests re-add what #540's review asked to delete; after this PR's alpha-1 shortcut the counter counts clones, notpowf. Keep the bit-equality test (policy_tests.rs:9567-9781) only (~100 test lines saved).- Minor: a restated comment (policy.rs:1641 vs :98-99) and inconsistent
pub(super)vs private across the_with_curveswrapper pair.
Already lean: the alpha-1 fast path, the limit <= 1 skip, the slot-indexed fixed array; no AGENTS.md structural violation.
Open: rounds.rs lines taken from the dossier rather than re-read; whether expected_speculative_tokens has other callers; whether the next_progress restructure (policy.rs:946-1012) is needed at all — reverting it would be the biggest subtraction.
Correctness and contracts
The optimization is arithmetically sound — both short-circuits and the alpha==1.0 fast path are exact, cache indexing cannot panic, and no locking, I/O, metric-span or platform parity surface is touched — but the PR has one Major contract gap and five Minor correctness/claim issues.
Findings, most important first:
- Major — charter/design-review rule 12 evidence gap: the 2.61x/5.40x/4.54x table is host-CPU only, pre-rebase (c513e46a), with no harness or fixtures, while the repo already ships the required served measurement (
scripts/benchmark_scheduler.py:4) which the PR did not run.docs/design-review.md:106-115explicitly requires "actual Helios service measurements"; the PR concedes "No standalone GPU serving throughput or latency improvement is claimed." - Minor —
mixed_candidatesbuilds the cache with the wrong mode tag:CurveCache::new(false)(policy.rs:1714) whilepacked_round_candidatesusesCurveCache::new(optimistic)(rounds.rs:844). Since the only lookup also hardcodesfalse(policy.rs:1399), the advertiseddebug_assert_eq!guard (policy.rs:117-122) provably never fires. - Minor — undeclared
next_progressrestructure: the non-empty-speculation branch nowreturns early (policy.rs:980) and the residual Mixed decode arm hardcodesvalue.decode(1.0, …)(policy.rs:1009) wheremaincomputed a conditional curve forecast (main policy.rs:959-968). Correct today only because of an invariant documented nowhere. - Minor — new per-call allocation reversed:
next_progressnow allocates a fresh[Option<Vec<f64>>; 64](≈1.5 KB) viaCurveCache::new(false)(policy.rs:958) on every uncachedprerequisite_valuepath, wheremainlazily allocated twoOption<Vec<f64>>(main policy.rs:908, 932). - Minor —
CURVE_EVALUATIONSre-added after the #540 review asked for its deletion, and it counts curve construction, notpowf(rounds.rs:635-636, incremented before the alpha fast path at :638), so at default alpha an "evaluation" is aVecclone with nopowf. - Minor — scope-of-claim gap: the new "evaluate each lane curve at most once" comment (policy.rs:1641) covers only
candidates;coalescing_prefill_log_bonusstill builds one curve per decoding lane perlane_valuescall (policy.rs:663) andresize_prefillstill prices uncached (policy.rs:1993-1999), neither disclosed.
Verified sound: forecast_tokens algebra (rounds.rs:1017-1019) makes the tokens<=1/width<=1 returns exact; powf(p,1.0)==p makes the alpha fast path (rounds.rs:638-640) bit-identical; the packed limit <= 1 { continue; } (rounds.rs:892-894) drops no ranking entry; one cache per &self pass cannot go stale and slot indices are bounded by REQUEST_LANES.
Open: whether shieldstar (#547's author, whose patch this reimplements) endorses it — no comment and no credit; whether the 21-workload simulator run satisfies docs/design-review.md:195-203, which asks for the learning.py (not opened)/64-seed catalog; and the re-added counter's rationale.
Final review
Recommendation: Changes Requested
The core optimization is mathematically exact, low-risk, and well-placed in the model-agnostic Helios scheduling layer: caching per-slot powered survival curves across RequestScheduler::candidates, short-circuiting tokens <= 1 / limit <= 1, and returning early at adaptive_verification_alpha == 1.0 preserve bit-identical candidate scores and scheduling decisions. However, four verified issues should be addressed before merging: missing contributor attribution to @shieldstar (who published this design and patch in #547), performance-claim and CI evidence gaps relative to docs/design-review.md rules 12 and 16 (pre-rebase unreproducible microbenchmarks, omitted profile caveats, and no CI run on a9f7dd7), a mismatched CurveCache::new(false) mode tag in mixed_candidates, and an avoidable next_progress restructure that unconditionally constructs a 1,544-byte stack CurveCache on every speculative call to work around Option<&mut CurveCache>.
Merge Risk
Level: Low
- Changes are confined to pure
&selfscheduler candidate pricing inhelios/src/scheduler/{policy,rounds}.rs(plus unit tests); no locks, I/O, channels,unsafe, wire/protobuf schemas, captured-graph contracts, exported-core formats, or config defaults change (adaptive_verification_alpharemains1.0athelios/src/scheduler/policy.rs:41). - Both width short-circuits (
policy.rs:1393-1395,rounds.rs:627-629,rounds.rs:892-894) and thealpha == 1.0fast path (rounds.rs:638-640) are exact identities offorecast_tokens(rounds.rs:1017-1019) andf64::powf(p, 1.0), andCurveCacheindexing (r.handle.slot as usizeinto[Option<Vec<f64>>; REQUEST_LANES]withREQUEST_LANES == 64athelios/src/execution/manifest.rs:18(not opened)) matches existing per-slot arrays. - Main operational caveats are the absence of CI checks on head
a9f7dd7and heavy churn inpolicy.rs/policy_tests.rs(textually overlapping open PRs#571,#621,#334,#306).
Walkthrough
helios/src/scheduler/policy.rs: AddsCurveCache(:98-130) wrapping[Option<Vec<f64>>; REQUEST_LANES]plus anoptimistic: booldebug_assert_eq!guard; creates one pass-scoped cache incandidates(:1642) shared acrossmixed_candidates_with_curves,packed_round_candidates_with_curves,add_candidate,continuation_candidate,prerequisite_value, andnext_progress(and a per-call cache inmixed_candidatesand#[cfg(test)] phase_plan); addscached_expected_tokens(:1387-1404) with atokens <= 1short-circuit andcached_lane_value*wrappers (:1425-1524); restructuresnext_progress(:896-1013) around a local fallbackCurveCache.helios/src/scheduler/rounds.rs: Short-circuitswidth <= 1inproposal_forecast_tokens(:626-631) andadaptive_verification_alpha == 1.0inpowered_curve(:634-645); adds#[cfg(test)]thread-localCURVE_EVALUATIONS(:10-14,:635-636); splitspacked_round_candidates_with_curves(:842-850) to accept a sharedCurveCacheand skipslimit <= 1lanes (:892-894).helios/src/scheduler/policy_tests.rs: Adds threeCURVE_EVALUATIONScall-count tests (:9488-9564) and one exact-equality test (cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha,:9566-9780) checkingscore.to_bits()parity atalpha = 1.0and0.6, widths0..=8, 1-remaining-token lanes, waitingInit,Mixed, packedSpeculative, tie-breaking, optimistic probes, andplan()winners.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure arithmetic refactor with no
unsafe, external input parsing, or prompt-injection attempts in the PR description or comments. - [WARN] Charter & value fit: Right architectural layer (model-agnostic Helios scheduling), but conflicts with Charter "Respect contributors" (no attribution to
@shieldstarfor #547's patch) and Charter #210 /docs/design-review.md:106-115, 147-162(pre-rebase unreproducible CPU speedup table without served-workload evidence or #547's profile caveat). - [WARN] Related / duplicate / conflict check: Additive over
#188and#540with no competing open optimization PR, but directly reimplements@shieldstar's complete patch in open issue#547without credit and touches high-churn files shared by open PRs#571,#621,#334,#306. - [WARN] Tests & verification evidence: All four new tests exercise real
RequestSchedulerpaths and use thread-localCURVE_EVALUATIONSreset per call (thread-isolated), and the PR reports full Layer 1/2/3 local runs; however, zero CI checks have run on heada9f7dd7, and the reported microbenchmark numbers predate the rebase ontocc0a49d2with no harness in the repo.
Blockers
None.
Should Fix
-
Credit
@shieldstarfor the original #547 diagnosis, patch design, and tests (Charter: "Respect contributors").- Issue
#547(opened byshieldstar/ Discordshieldstarx) includes a complete, ready-to-apply patch implementing this exact architecture (cached_lane_value, per-pass cache incandidates/phase_plan, per-call cache inmixed_candidates,powered_curvealpha == 1.0fast path,CURVE_EVALUATIONS, and the exact same three test names inpolicy_tests.rs). PR #693 only writesFixes #547with no attribution. - Fix: Add explicit credit (e.g.,
Co-authored-by:or an attribution note in the PR description and commit message) acknowledging@shieldstar's#547patch and tests.
- Issue
-
Align performance claims and verification evidence with
docs/design-review.md:106-115, 147-162(and run CI ona9f7dd7).- The PR leads with a 3-fixture CPU speedup table (
2.61x,5.40x,4.54x) measured against a pre-rebase baseline (c513e46a, not the rebased basecc0a49d2), with no benchmark harness, fixture script, or command in the PR (helios/benches/contains onlytemplate.rs) and no served-workload measurement (scripts/benchmark_scheduler.pywas not run). - The "Why" section cites
#547's5.48%pow@@GLIBC_2.29sample without#547's explicit caveat that the binary was stripped, from a downstream tree, and lacked a call graph sopowcould not be split betweenpowered_curveand otherpowfsites (such ashelios/src/scheduler/rounds.rs:571, 594, 873). - No GitHub Actions CI checks have run on head
a9f7dd7. - Fix: Either (a) re-measure on the current base with a reproducible command/harness and add a served-workload A/B run via
scripts/benchmark_scheduler.pyif keeping a performance speedup claim, or (b) reframe the PR honestly as a behaviour-preserving de-duplication cleanup (dropping the pre-rebase speedup table as a headline claim) and include#547's stripped-binary / no-call-graph caveat on the5.48%profile figure. Ensure CI passes on the head commit.
- The PR leads with a 3-fixture CPU speedup table (
-
Fix mismatched
CurveCache::new(false)mode tag inmixed_candidates(helios/src/scheduler/policy.rs:1707-1716).mixed_candidates(..., optimistic: bool)constructsCurveCache::new(false)atpolicy.rs:1714, unlikepacked_round_candidates(helios/src/scheduler/rounds.rs:844,CurveCache::new(optimistic)). Production does callmixed_candidates(..., true)fromacceptance_probe(helios/src/scheduler/learning.rs:19).- Today it avoids tripping
CurveCache::get_or_insert_with'sdebug_assert_eq!(policy.rs:119-122) only becausemixed_candidates_with_curvesbypassescurveswhenoptimisticis true (policy.rs:1770, callingself.optimistic_tokens(...)uncached on every mixed shape), which also wastes a 1,544-byte stackCurveCacheconstruction on every optimistic call and leaves a latent assertion trap if that branch ever usescurves. - Fix: Construct
CurveCache::new(optimistic)atpolicy.rs:1714(and consider caching theoptimisticbranch throughcurvesor sharing one optimistic cache inlearning.rs:17-19if desired, or only creating the cache when!optimistic).
-
Remove the unnecessary
next_progressrestructure and unconditional 1,544-byte stackCurveCacheworkaround (helios/src/scheduler/policy.rs:896-1013).- Every production caller of
prerequisite_value(policy.rs:1015) ->next_progress(policy.rs:896) arrives fromcached_lane_value(:1587) orcached_lane_value_within(:1274) withcurves == Some(...); allNonecallers (:1171, 1545, 1756, 1993, 1997) pass prefill or decode/speculative kinds and never reach_ => self.prerequisite_value(...)at:1522. - Because
next_progresstakesOption<&mut CurveCache>instead of&mut CurveCache,:958-959unconditionally constructslet mut local_curves = CurveCache::new(false);(64 * 24 + 8 = 1,544bytes zero-initialized on the stack and dropped via a 64-slot loop) even whencurvesisSome(...), duplicates themixed_catalogloop (:969-979vs:982-1011), adds an earlyreturnat:980, and leaves:1008-1009hardcodingvalue.decode(1.0, ...)via an undocumented control-flow coupling to:946(omitted from the PR description). - Fix: Change
prerequisite_value(:1021) andnext_progress(:900) to takecurves: &mut CurveCachedirectly (or unwrap/pass&mut CurveCachefrom the_ =>arm if keepingOptiononcached_lane_value_for_tokens_within), deletelocal_curves, delete the duplicatedmixed_catalogloop and early return (:969-980), and keepmain's singlemixed_catalogloop withif self.speculative_widths.is_empty() { 1.0 } else { self.cached_expected_tokens(r, self.speculative_tokens(r, width), Some(curves)) }.
- Every production caller of
Subtract / Simplify
- Eliminate
Option<&mut CurveCache>and collapse the six lane-value wrappers (helios/src/scheduler/policy.rs:1387-1524).- The
Optionplumbing acrosscached_expected_tokens,cached_lane_value_for_tokens_within,prerequisite_value, andnext_progress(and theNone => self.expected_speculative_tokens(...)arm at:1402) serves only one production decode site:resize_prefillatpolicy.rs:1997(all other uncached callers at:1171, 1545, 1756, 1993are prefill-only and never touchcurves). - Threading a
&mut CurveCache(or a local cache inresize_prefill) removesOption<&mut CurveCache>, removeslocal_curvesinnext_progress, and lets the six-wrapper family (lane_value,cached_lane_value,cached_lane_value_within,lane_value_for_tokens,lane_value_for_tokens_within,cached_lane_value_for_tokens_within) collapse to the minimal cached pair + prefill helper (~35-45 lines deleted, while keepingexpected_speculative_tokensinrounds.rs:622for its real production caller athelios/src/scheduler.rs:2483).
- The
- Trim redundant call-count test scaffolding (
helios/src/scheduler/policy_tests.rs:9488-9564,policy.rs:126-129).cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha(policy_tests.rs:9655-9662) already assertsCURVE_EVALUATIONS == wide_decoders.len()on a superset fixture (waitingInit,Mixed, packedSpeculative, and a 1-remaining-token lane). Whilecost::ENTRY_LOOKUPS(helios/src/scheduler/cost.rs:18(not opened)) provides an in-repo precedent for#[cfg(test)]counters, note that a prior Autobot review of#540flaggedCURVE_EVALUATIONSfor removal and the three standalone counting tests (:9488-9564) largely overlap the fourth test; consolidating or justifying them keeps test surface leaner.
Nits
helios/src/scheduler/rounds.rs:571, 594(prefix_lengths_with_values,host_prefix_ranking) still call.powf(self.policy.adaptive_verification_alpha)unconditionally without thealpha == 1.0fast path (unlikerounds.rs:638and:872).helios/src/scheduler/rounds.rs:626-631(proposal_forecast_tokens) only has one caller (expected_speculative_tokensat:622, passingoptimistic = false), whilelearning.rs:11-13(optimistic_tokens) callsforecast_tokens(&self.powered_curve(request, true), width)directly without thewidth <= 1short-circuit; routingoptimistic_tokensthroughproposal_forecast_tokens(request, width, true)(or inliningproposal_forecast_tokens) would remove the deadoptimisticparameter.- Note in the PR description that
select_plan()still computes per-lane curves outsidecandidates()inlane_values()(service_ratesatservice.rs:337, 387andcoalescing_prefill_log_bonusatpolicy.rs:663) and on resized mixed prefills (resize_prefillatpolicy.rs:1997), so the "at most once" guarantee is specifically percandidates()pass (as accurately commented atpolicy.rs:1641).
Dropped on verification
- Correctness lens #2 ("no lookup ever passes
true, the assertion is decorative everywhere" / "only production callers ofmixed_candidates/packed_round_candidatesare insidecandidates") and Subtraction lens #2 ("Nothing reads an optimistic curve back out of the cache"): False. Verified athelios/src/scheduler/learning.rs:18-19:acceptance_probecalls bothpacked_round_candidates(..., true)andmixed_candidates(..., true)in production, androunds.rs:844, 895createsCurveCache::new(true)and callscurves.get_or_insert_with(slot, true, ...)to read and reuse optimistic curves. Retained only the verifiedmixed_candidatesbug atpolicy.rs:1714(CurveCache::new(false)). - Correctness lens #4 ("new ≈1.5 KB per-call heap allocation on prefill pricing
:1545andresize_prefill:1993-1999,Option<Vec<f64>>is 16 bytes"): False on both mechanism and reachability.CurveCacheis stack-allocated (64 * 24 + 8 = 1,544bytes;Option<Vec<f64>>is 24 bytes with niche optimization, not 16 bytes), and neitheradd_prefill_candidate(:1545) norresize_prefill(:1993-1999) ever reaches_ => prerequisite_value->next_progress. Replaced with the verified root issue:policy.rs:958unconditionally zero-initializeslocal_curveson the stack on the cachedSome(curves)path insidenext_progress. - Discovery Dossier ("
CurveCacheis 8 slots"): False. Verifiedpub const REQUEST_LANES: usize = 64;athelios/src/execution/manifest.rs:18(not opened) (8 was the unit-test fixture slot count). - Subtraction lens #1 ("
expected_speculative_tokensloses its only in-scheduler caller and becomes dead code"): False. Verified a live production caller athelios/src/scheduler.rs:2483(submitted-step expected-token accounting) plus 5 test callers (policy_tests.rs:1994, 4252, 4407, 9632,tests.rs:4114(not opened)). - Subtraction lens #5 ("make
packed_round_candidates_with_curvesprivate likemixed_candidates_with_curves"): False / would not compile.packed_round_candidates_with_curvesis defined inscheduler::rounds(rounds.rs:849) and called from sibling modulescheduler::policy(policy.rs:1644), sopub(super)visibility is required. - Correctness lens #6 (framing
policy.rs:1641as an over-broad claim because ofcoalescing_prefill_log_bonusandresize_prefill): Overstated. Both the PR description andpolicy.rs:1641explicitly scope the "at most once" claim to acandidatespass (andcoalescing_prefill_log_bonusat:663andresize_prefillat:1997already evaluate at most once per lane, not per shape). Demoted to a brief clarifying nit. - Correctness lens #5 / Subtraction lens #4 (claiming
CURVE_EVALUATIONSmeasures a weakened proxy because of thealpha == 1.0fast path, and implying maintainer rejection in#540): Partially overstated. Even atalpha == 1.0,powered_curverunsspeculative_curve(allocating aVec<f64>and computing calibration bounds/curves), so boundingpowered_curvecalls still verifies cache reuse; and#540's removal ofCURVE_EVALUATIONSwas an Autobot review comment before#540was narrowed toRefreshState::idle, whilecost::ENTRY_LOOKUPS(cost.rs:18(not opened)) is an existing in-repo precedent. Kept only as a calibratedSubtract / Simplifynote on test overlap. - Subtraction lens #5 (duplicate doc comment at
policy.rs:1641vspolicy.rs:98): Low-signal, dropped.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 99.6% -
triage:validation: 0.2% -
triage:design-review: 0.1% -
triage:integration: 0.0% -
none: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with. decide malicious: all_clear (100%): No malicious content found
explore
Author: jcartu (CONTRIBUTOR; Discord jcartu)
Motivation: When the scheduler prices a possible batch shape it recomputes each decoding lane's speculative "survival curve", and a single planning pass can price the same lane many times — wasted CPU on the worker thread that is not polling the GPU. The PR caches each lane's curve once per pass, so scoring is identical but less work.
Scale: +562 / −68 lines in 4 files
Proposal:
- Adds
CurveCache— per-slot[Option<Vec<f64>>; 64]with anoptimisticmode tag — and threads one shared cache through acandidates()pass. - Short-circuits
tokens <= 1/limit <= 1(exact identities) and skipspowfwhenadaptive_verification_alpha == 1.0, the default. - Collapses the lane-value wrappers into
prefill_lane_value/cached_lane_value*, keeping test-only shims. - Adds four treating-correctness tests using a
#[cfg(test)]CURVE_EVALUATIONScounter (evaluation-count bounds plusscore.to_bits()parity at alpha 1.0 and 0.6). - Reframes itself as a behaviour-preserving dedup refactor: the pre-rebase CPU speedup table was deleted and the speedup claim withdrawn. Touches:
helios/src/scheduler/policy.rs(+196/−57)helios/src/scheduler/rounds.rs(+47/−10)helios/src/scheduler/policy_tests.rs(+317/−0) andlearning.rs(+2/−1) Related items:- #547 Scheduler: candidate pricing rebuilds each decoding lane's speculative curve… (open): the origin issue; its full patch is this change, by shieldstar, now credited
- #188 Remove repeated work from scheduler planning (merged): direct predecessor; the served-workload evidence bar this PR does not meet
- #540 Retain bounded timing-refresh and acceptance credit across idle (merged): where the
CURVE_EVALUATIONScounter was added and a review asked for it to be deleted - #571 (open), #621 (open), #334 (open), #306 (open): same-file PRs that will conflict textually
- #210 Qwen3.8 Flash Next DFlash2 … served measurements (closed): the charter's served-evidence rule
Link: https://github.com/NVIDIA/hyperflare-inference/pull/693
Autobot comments: Amendments only. Head moved
a9f7dd7→000a6ac8, labelsarea:scheduling, performance, triage:reviewwere added, an Autobot review was posted at 21:56 ("Changes Requested", 0 blockers / 4 should-fix) and the author replied at 22:49 claiming all findings fixed. Verified fixed: attribution to @shieldstar is now the second line of the description;mixed_candidatesbuildsCurveCache::new(optimistic)(policy.rs:1705) and routes the optimistic branch throughcached_expected_tokens(policy.rs:1760-1766);next_progresstakes&mut CurveCache(policy.rs:896-901) with onemixed_catalogloop, so the earlier undeclared restructure is gone; wrappers collapsed. Still true: zero CI checks on either head (all test counts are self-reported), no served-workload measurement (charter #210 / design-review rule 12) — less pressing now that no speedup is claimed, but theperformancelabel remains and the motivatingpow@@GLIBC_2.29 5.48%sample is one #547 itself says is unattributable;service_rates,coalescing_prefill_log_bonusandresize_prefillstay uncached (now disclosed); theCURVE_EVALUATIONScounter a #540 review asked to delete is re-added; and #547 is still open and still needs explicit closure.
Classify intake
Selected: triage:review, performance, area:scheduling
Threshold: 65%
Triage
- [✓]
triage:review: 99.9% -
none: 0.0% -
triage:validation: 0.0% -
triage:design-review: 0.0% -
triage:integration: 0.0% -
triage:investigate: 0.0% -
triage:partial: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 85.2% -
community: 50.0% -
duplicate: 20.2% -
bug: 4.7% -
enhancement: 1.1% -
documentation: 0.1%
Area
- [✓]
area:scheduling: 99.6% -
area:caching: 3.3% -
area:selene: 1.1% -
area:preparation: 0.7% -
area:memory: 0.5% -
area:kernels: 0.5% -
area:engram: 0.2% -
area:orbit: 0.1% -
area:rocenante: 0.1% -
area:api: 0.0% -
area:packaging: 0.0%
Model
-
model:deepseek-v4.1: 14.8% -
model:deepseek-v4: 2.6% -
model:kimi-k3.1: 1.4% -
model:nemotron-3.5-bolt: 0.7% -
model:glm-5.3: 0.4% -
model:inkling-small: 0.3% -
model:qwen3.8-flash-next: 0.2% -
model:mimo-v2.6: 0.2% -
model:muse-glimmer: 0.1% -
model:qwen3.8-27b: 0.1% -
model:gemma4: 0.1%
Apply Labels (Intake)
No label changes
Subtraction and simplicity
Subtraction/simplicity lens on PR #693 (head 000a6ac8). The diff is materially leaner than the version the posted review saw — the Option<&mut CurveCache> wrappers, duplicated mixed_catalog loop, stack fallback cache and mislabelled CurveCache::new(false) are genuinely gone, verified in code. What remains is duplication around the new abstraction, not bloat.
Findings, high value first:
- F1 (high) —
adaptive_verification_alpha == 1.0identity written four times inrounds.rs::571-577,:599-605,:645-656(all three new in this PR) and the pre-existing:882-885. Onefn powered(&self, p: f64) -> f64helper collapses all four, ~−15 lines. - F2 (high) — the PR adds a curve cache but leaves three hand-rolled/uncached rebuild sites:
service.rs:322/337andservice.rs:352/386-387(let mut curve = None;+get_or_insert_with), and the inline uncached expansion atpolicy.rs:1999-2007inresize_prefill. Replacing them withCurveCache::new(false)+cached_expected_tokens/cached_lane_valueis shorter than today's code and would close three of the four gaps the description discloses as limitations. - F3 (med) —
width <= 1 ⇒ f64::from(width != 0)stated three times, thoughforecast_tokens(rounds.rs:1027-1030) already yields it by construction; new copies atrounds.rs:637-642andpolicy.rs:1389-1398. - F4 (med) — test-only
CURVE_EVALUATIONSthread-local (rounds.rs:10-14, increment at:646-647inside the optimized function) plus three count-only tests andCurveCache::is_cached; the bit-exactness parity test (policy_tests.rs:9568-9804) needs none of it.AGENTS.md:194-199. - F6 (low) —
cached_lane_value(policy.rs:1436-1446) is a one-line forwarder supplying a literal0;F5(mode passed twice) is recommended to stay because thedebug_assert_eq!caught a real bug.
Positives: main's local [Option<Vec<f64>>; REQUEST_LANES] cache deleted; ignored duration_ns arguments dropped via prefill_lane_value.
Open: are F2's sites deliberately excluded (no reason given)? Does the performance label stay? No CI on the head; baseline c513e46a unreadable in this checkout.
Correctness and contracts
Correctness/contracts review of #693 @ 000a6ac8: no correctness defect found in the caching refactor itself. Every substitution I traced is an exact identity, and the change is pure &self pricing — no locks, I/O, threads, unsafe, wire/protobuf, captured-graph, config-default or sampled-span changes.
Findings that stand:
- Major — charter #210 /
docs/design-review.md:106-115rule 12 (served-workload evidence) unmet while the PR keeps theperformancelabel and still opens on the inheritedpow@@GLIBC_2.295.48% sample that #547 says cannot be attributed to this path. - Major — Layer 2 simulator obligation (
docs/design-review.md:195-206,learning.py(not opened) screening + 64-seed catalog) unmet; only eight pytest suites (837 tests) were run. - Major — the "at most one curve per lane" claim is unobservable for two real configurations: with
speculative_fixed_widthset the packed path bypassesCurveCache/powered_curveentirely (rounds.rs:874-892), and the GPU-allocation path callsspeculative_curvedirectly (rounds.rs:566-577,599-605);CURVE_EVALUATIONSonly increments insidepowered_curve(rounds.rs:646-647). The scope note names onlylane_values()andresize_prefill. - Minor — the
optimisticmode guard isdebug_assert_eq!(policy.rs:119-122), compiled out in release, whilecached_lane_value_for_tokens_withinhardcodesfalseatpolicy.rs:1506; a future optimistic leak would silently mis-price. - Minor —
CURVE_EVALUATIONSre-adds what a #540 review asked to delete (rounds.rs:10-14), now with no stated rationale beyond these four tests.
Open: whether CI will ever run on 000a6ac8; who closes #547 and whether shieldstar endorses; whether the performance label should stay.
Re-review
Recommendation: Ready To Merge
Commit 000a6ac cleanly resolves all four Should Fix findings, the Subtract / Simplify wrapper/loop collapse, and the Nits from the previous review on a9f7dd7: @shieldstar (#547) is properly credited, the unreproducible pre-rebase CPU speedup table is removed in favor of an honest behavior-preserving framing with #547's profile caveat and explicit scope note, mixed_candidates now constructs CurveCache::new(optimistic) and routes optimistic decoders through cached_expected_tokens(..., true, curves), and next_progress / lane-value helpers now take &mut CurveCache directly with no local stack fallback or duplicated mixed_catalog loop. Every substitution (tokens <= 1, width <= 1, limit <= 1, adaptive_verification_alpha == 1.0, prefill_lane_value, and resize_prefill) is a verified bit-exact identity with no concurrency, memory, or hot-path regressions; ensure CI passes on 000a6ac before merging since all reported Layer 1/2/3 runs are currently self-reported.
Merge Risk
Level: Low
- Pure
&selfarithmetic deduplication confined tohelios/src/scheduler/{policy,rounds,learning,policy_tests}.rs; introduces no locks, channels, I/O,unsafe, wire/protobuf changes, captured-graph op contracts, exported-core format changes, or config default changes (adaptive_verification_alpharemains1.0athelios/src/scheduler/policy.rs:41). CurveCache(helios/src/scheduler/policy.rs:100-130,[Option<Vec<f64>>; REQUEST_LANES]withREQUEST_LANES == 64athelios/src/execution/manifest.rs:18, ~1,544 bytes) is stack-scoped per pricing pass (matching the stack array previously allocated inpacked_round_candidates), cannot retain stale state across passes, and strictly reduces per-passVec<f64>allocations andpowfcalls while preservingscore.to_bits()parity.- Main operational caveats are that zero CI checks have run on head
000a6acyet, andpolicy.rs/policy_tests.rsoverlap textually with open PRs#571,#621,#334, and#306.
Walkthrough
helios/src/scheduler/policy.rs: Adds pass-scopedCurveCache(:100-130) with anoptimistic: booldebug_assert_eq!guard; allocates one ordinary cache incandidates(:1633) shared acrossmixed_candidates_with_curves,packed_round_candidates_with_curves,add_candidate,continuation_candidate,prerequisite_value, andnext_progress(and a per-call cache inmixed_candidatesat:1705and#[cfg(test)] phase_planat:2126). Extractsprefill_lane_value(:1407-1434), addscached_expected_tokens(:1389-1405, short-circuitingtokens <= 1) andcached_lane_value*(:1436-1515), updatesmixed_candidates_with_curves(:1760-1775) to reuse the mode-matched cache for both ordinary and optimistic decoders, and keepsresize_prefill(:1997-2008) equivalent viaprefill_lane_valueandexpected_speculative_tokens(LaneValue::decodedelegates todecode_within(..., 0.0, ...)athelios/src/scheduler/utility.rs:108-110).helios/src/scheduler/rounds.rs: Adds#[cfg(test)]thread-localCURVE_EVALUATIONS(:10-14,:646-647, followingcost::ENTRY_LOOKUPSathelios/src/scheduler/cost.rs:15-19); addswidth <= 1short-circuit toproposal_forecast_tokens(:637-642) andadaptive_verification_alpha == 1.0fast paths topowered_curve(:645-656),prefix_lengths_with_values(:571-576), andhost_prefix_ranking(:599-605); threads&mut CurveCacheintopacked_round_candidates_with_curves(:860-906) and skipslimit <= 1lanes (:903-905).helios/src/scheduler/learning.rs: Marksoptimistic_tokens#[cfg(test)]and routes it throughproposal_forecast_tokens(request, width, true)(:11-14).helios/src/scheduler/policy_tests.rs: Adds three thread-isolated call-count tests (:9489-9566) and one bit-exactness parity test (cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha,:9569-9803) exercisingscore.to_bits()parity acrossalpha = 1.0and0.6, widths0..=8, 1-remaining-token lanes, waitingInit, ordinary and optimisticMixed, packedSpeculative, tie-breaking, andplan()selection.
Pre-merge Checks
- [PASS] Security / malicious screen: Pure arithmetic memoization with no
unsafe, external input handling, or prompt-injection content in the PR description or comments. - [PASS] Charter & value fit: Right model-agnostic Helios scheduling layer, credits
@shieldstar(#547), withdraws the unsupported speedup claim, and discloses profile caveats and out-of-scope call sites perdocs/design-review.md:106-115, 147-162(maintainers can optionally remove theperformancelabel if desired). - [WARN] Related / duplicate / conflict check: Additive over
#188and#540and fixes#547with credit, but touches high-churn files shared by open PRs#571,#621,#334, and#306. - [WARN] Tests & verification evidence: All four new tests exercise real
RequestSchedulerpaths and reset thread-localCURVE_EVALUATIONSper call (thread-isolated, order-independent), and the PR reports full Layer 1 (--release+ debug), Layer 2 (837 simulatorpytestcases), and Layer 3 (TLC2 lifecycle conformance) runs; however, zero CI checks have run on head000a6acyet.
Blockers
None.
Should Fix
None.
Subtract / Simplify
- Optional — inline one-line
cached_lane_valueforwarder (helios/src/scheduler/policy.rs:1436-1446): It has only two production call sites (policy.rs:1578,:1767) and one test caller (policy_tests.rs:9653), and exists only to passpreceding_ns = 0tocached_lane_value_within. Inlining0at those callers removes ~11 lines and one wrapper hop (fine to keep if preserving symmetry withmain's formerlane_value/lane_value_withinpair).
Nits
- Scope-note precision: Inside
packed_round_candidates_with_curves, two pre-existing subpaths still evaluaterequest.acceptance.curveper distinct(shape.drafts, shape.width)pair rather than sharingCurveCache:fixed_prefixeswhenspeculative_fixed_width.is_some()(helios/src/scheduler/rounds.rs:874-888) andhost_prefix_rankingunder host prefix allocation (!gpu_alloc,helios/src/scheduler/rounds.rs:933-934,:592-618, which now benefits from thealpha == 1.0fast path). Mentioning these alongsidelane_values()andresize_prefillwould make the description's scope note completely exhaustive. - Optional optimistic cache sharing in
acceptance_probe(helios/src/scheduler/learning.rs:18-20):acceptance_probecallspacked_round_candidates(..., true)andmixed_candidates(..., true)back-to-back, building two separate optimisticCurveCaches; they could share oneCurveCache::new(true)ifmixed_candidates_with_curvesis madepub(super).
Dropped on verification
- Correctness & Contracts Finding 1 (Major — Charter #210 / Rule 12 violation for
performancelabel and#547powsample): Dropped — at000a6ac, the PR withdrew its CPU speedup table, explicitly claims no standalone GPU serving improvement, and reproduces#547's stripped-binary / no-call-graph caveat on the5.48%sample, satisfyingdocs/design-review.md:106-115, 147-162. Re-blocking on a maintainer-appliedperformancelabel after Round 1's reframing guidance was followed would move the goalposts. - Correctness & Contracts Finding 2 (Major — missing
scripts/scheduling_sim/learning.py(not opened) 64-seed catalog): Dropped —docs/design-review.md:201-206requires thelearning.py(not opened) screening + 64-seed catalog specifically for "Changes to timing estimation or funded refresh" or divergences from the simulator's qualified policy. This PR changes neither timing estimation nor funded refresh norscripts/scheduling_sim/, and preserves bit-identical candidate pricing; the author already ran all 8 scheduling simulatorpytestsuites (837 tests) and Layer 3 TLC2 lifecycle conformance. - Correctness & Contracts Finding 3 (Major — GPU prefix allocation &
materializebypassing cache / unobservable bound): Partially false / over-scoped, dropped —round_lengths_optimistic(helios/src/scheduler/rounds.rs:541-549, called bymaterializeatpolicy.rs:2025) returnsceilingsearly whengpu_prefix_allocationorspeculative_fixed_width.is_some()is true (never reachingprefix_lengths_with_values), and insidepacked_round_candidates_with_curves(rounds.rs:896-935), GPU prefix allocation does useCurveCacheand skipshost_prefix_ranking. The verified pre-existingrequest.acceptance.curvesubpaths (fixed_prefixesand host-allocatedhost_prefix_ranking) are noted above as a minor scope-note nit. - Correctness & Contracts Finding 4 (Minor —
debug_assert_eq!mode guard / two-arrayCurveCache): Dropped — all callers ofcached_lane_value*(policy.rs:1276, 1480, 1578, 1767) are verified non-optimistic (false), debug-mode tests exercise the assertion, and doublingCurveCachefrom ~1.5 KiB to ~3 KiB for a hypothetical future caller violatesAGENTS.md:188-193. - Correctness & Contracts Finding 5 & Subtraction F4 (
CURVE_EVALUATIONSthread-local counter): Dropped —#[cfg(test)] thread_local!matches the existing repo convention inhelios/src/scheduler/cost.rs:15-19(ENTRY_LOOKUPS, tested incheckpoints.rs:1403 (not opened), 1541, 2634), compiles to zero instructions in release builds, is reset before each measurement (thread-isolated), and cannot be replaced byCurveCache::is_cached(which is local to internal passes and cannot distinguish 1 vs 256 evaluations). The#540review dropped a side-patch counter from an unrelated idle-refresh PR, not as a ban on planning-work bound counters. - Subtraction F1 (
powered(&self, probability: f64)scalar helper across 4rounds.rssites): Dropped — replacingif alpha == 1.0 { return curve; }/if alpha == 1.0 { curve }inpowered_curve(rounds.rs:649-655) andhost_prefix_ranking(rounds.rs:601-605) withcurve.into_iter().map(|p| self.powered(p)).collect()would regress an O(1) zero-copyVecreturn into an O(depth) per-element loop + branch. - Subtraction F2 (using
CurveCacheinservice.rs:322/352andpolicy.rs:1999-2007): Dropped —service_rates(helios/src/scheduler/service.rs:321-395) prices a single request, so replacing 24–48 B ofOption<Vec<f64>>with a 1,544 BCurveCacheper request regresses stack initialization overhead, and removingif tokens > 0(service.rs:336, 382) would corruptdelivery_ratewhentokens == 0. Inresize_prefill(policy.rs:1999-2007),bits(candidate.mask & !(1 << slot))visits each slot at most once, so a localCurveCachewould have a 0% hit rate while adding 1,544 B of stack initialization. - Subtraction F3 (removing one of the
width <= 1short-circuit guards): Dropped — both 3-line guards (rounds.rs:638-640inproposal_forecast_tokensandpolicy.rs:1396-1398incached_expected_tokens) are load-bearing on distinct call graphs (scheduler.rs:2483/policy.rs:2004vs cached pricing) to avoid building curves for 0/1-token lanes. - Dossier claim that
Fixes #547will not auto-close#547: Dropped —#547is an issue, soFixes #547in the PR description will auto-close it upon merge to the default branch.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 93.1% -
triage:validation: 4.6% -
none: 1.9% -
triage:design-review: 0.3% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
No label changes Decision to Test: no (65%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.