Subtractive report · NVIDIA/hyperflare-inference #548

Raw Markdown for agents: https://autobot.eidonix.com/p/17ae5d6b-b52e-40d7-8f66-d5da268d0b37.md

Subtraction review — PR #548, "Add per-request histograms and vLLM-parity request metrics"

Head reviewed: 055663a (Wynn Drahorad), 9 files, +1016 / −51. Prior blocking finding is closed by the author's own commits: helios/src/server/metrics/process.rs (not opened) (177 lines) is deleted, runtime_core::open_descriptors is private again (helios/src/runtime_core/mod.rs:58 (not opened), protection.rs:291 (not opened)), so the --features server build break and all process.rs (not opened) scaffolding findings are not re-raised. Likewise fixed and not re-raised: the duplicate e2e observation (now one call at helios/src/server/http.rs:604-609), the unhoisted Worker::publish locals, and the duplicated phase-test first-response assertion.

Key findings

Findings, ranked by lines saved

1. Should fix, ≈55 lines — the new Histogram/Buckets type was added beside the three hand-rolled host histograms instead of in place of them

The PR introduces Buckets<N> (helios/src/server/metrics.rs:213-253) and Histogram<N> with observe/absorb/render (:255-322) for its 17 new histograms, but leaves the three existing host prefix-store histograms on the older machinery in the same file:

Smaller version (labels, counts and sums identical: scale: 1.0 keeps the exposed unit at ns/tokens, and Histogram::observe uses the same position(|b| exposed <= *b).unwrap_or(N-1) rule as the removed .position(..).unwrap()):

const HOST_TOKENS: Buckets<8> = Buckets { bounds: [64.0, 256.0, 1024.0, 4096.0, 16384.0, 65536.0, 262144.0, f64::INFINITY], scale: 1.0 };
const HOST_NANOSECONDS: Buckets<8> = Buckets { bounds: [1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, f64::INFINITY], scale: 1.0 };

pub(super) fn host_lookup_cost(&self, hit: &flare_selene::HostHit, rate: f64) {
    let missing = hit.consumed_tokens - hit.resident_tokens;
    self.host_missing_tokens.observe(&HOST_TOKENS, missing);
    self.host_transfer_ns.observe(&HOST_NANOSECONDS, (hit.estimated_seconds * 1e9) as u64);
    self.host_prefill_ns.observe(&HOST_NANOSECONDS, (missing as f64 / rate.max(1.0) * 1e9) as u64);
}

for (histogram, name, help, buckets) in [
    (&self.host_missing_tokens, "host_cache_missing_tokens", "…", &HOST_TOKENS),
    (&self.host_transfer_ns, "host_cache_estimated_transfer_ns", "…", &HOST_NANOSECONDS),
    (&self.host_prefill_ns, "host_cache_estimated_prefill_ns", "…", &HOST_NANOSECONDS),
] {
    histogram.render(text, name, help, buckets);
}

Nothing is lost: the only readers of those fields are the listed sites (no JSON-snapshot or dashboard consumer), and the existing test host_outcomes_and_capacity_have_bounded_labels_and_cost_histograms (metrics.rs ~:1785) reads only _sum and keeps passing. The only visible output change is that these three series gain # HELP lines. Honest caveat: Histogram::render writes _sum as sum as f64 / scale (:315-319), so ns sums above 2^53 would round, where the host _sum is exact u64 today — the same trade the PR's own request histograms already accept.

Do not fold the 19-bound TOKEN_SECONDS request histograms into the 21-bound REQUEST_SECONDS loops: different bounds, so not lossless.

Charter: AGENTS.md:188-193 — "Reject unsupported abstractions and churn … fallback layers … Refactoring must directly support the requested behavior or remove a demonstrated source of cost." Adding a histogram type beside two older ones in the same file is precisely that churn.

2. Should fix, ≈50 lines — the per-response choice pair duplicates the per-request generated-token histogram

flare_request_choices and flare_request_max_choice_generated_tokens are the only per-response state in the whole change:

Smaller version — Metrics::response_completed(&self, elapsed_ns: u64) observes request_e2e only, http.rs:604-609 becomes:

if !count && !encoder.tool_limit_reached {
    state.model.metrics().response_completed(admitted_at.elapsed().as_nanos() as u64);
}

Why nothing is lost: flare_request_generated_tokens already observes every completed request's generated-token count, and the PR's own docs (docs/api.md:325-326) state that Flare runs each choice as its own model request — so each of the n choices is already its own observation in a histogram with identical TOKEN_COUNTS bounds. flare_request_max_choice_generated_tokens measures only "max of values already counted individually", and flare_request_choices measures a request field only /v1/completions accepts above one. Issue #536, the stated justification, asks for e2e, queue, prefill, decode, inter-token/time-per-output-token, TTFT, prompt tokens and process metrics; neither choice series is in its table, and nothing in the repository reads them (#541 does not name them). Removing them turns two mapping-table rows into "Not provided" rather than losing a measurement.

Counter-argument the reviewer must weigh (stated honestly): both are names in vLLM's production metric list, so dropping them weakens the "parity" framing of the PR title — but no dashboard with a consumer today breaks.

Savings: consts 5, fields 2, observe loop 7, render 11, http.rs 3 + signature 2, test 20, docs 6 ⇒ ≈50 lines (≈25 if only the max-choice series and its Vec go and request_choices is observed once per response).

3. Nit, ≈30 lines — docs/api.md restates the HELP strings that ship in every scrape

docs/api.md:311-346 narrates e2e / queue / prefill / inference / TTFT / decode / inter-token in prose that metrics.rs:1548-1595 already publishes as HELP text in every text scrape (e.g. api.md:329-331 vs metrics.rs:1557; api.md:340-341 vs :1567, :1586). api.md:377-386 then states the same facts a third time via the correspondence rows :501-504 (table at :484-515).

Keep only what an operator cannot read from HELP — which requests are excluded from which population, per-response vs per-request, and the abandoned-stream rule at api.md:316-321 — and drop the restatement: ≈30 of the +127 doc lines. Charter line 35 ("bad docs" is a merge criterion) and AGENTS.md:194-199 (focused, meaningful validation) apply.

4. Nit, ≈20 lines — assertions that prove what another test already proves

5. Nit, ≈8 lines — the model-step gate re-derives GraphKind::samples()

helios/src/server/runtime.rs:1721-1730 lists Prefill | TerminalPrefill | ScoredPrefill | Resume | Decode | Speculative | Mixed to gate model_step. That predicate already exists: helios/src/execution/manifest.rs:90-101 defines pub fn samples(self) as exactly those seven variants, with five existing callers (manifest.rs:944, execution/transport.rs:1319 (not opened), :1334, model/testing.rs:170 (not opened), server/runtime.rs:2956). Smaller version — 10 lines → 3:

if kind.samples() {
    self.metrics.model_step(prefill + generated.len() as u64);
}

Side benefit, not counted in the savings: runtime.rs:1669-1677 carries the same variant list minus Resume for a different gate, so this removes a drift hazard.

What is already minimal — say so plainly

Optional, verified, not counted

Left behind by this change

Open questions / what could not be verified

Charter anchors: charter line 35 (what gets merged: maintainer request, roadmap item, reproducible bug, measured perf/memory issue, bad docs); AGENTS.md:188-193 (unsupported abstractions, fallback layers, churn) for findings 1-2; AGENTS.md:194-199 (focused validation) for finding 4.