Subtractive report · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/ac6cc92c-4d08-4e7f-8c8c-2c83754f1065.md

Subtraction review — PR #560 "Emit vLLM-compatible per-request metrics from runtime instants"

Key findings

The mechanism is close to minimal and I have no blocking finding. The encoder decides placement once, before submission (helios/src/server/http.rs:361-363), so the worker emits Committed events only when a carrier exists; with the option off there is one branch per committing step and no extra event capacity; the encoder adds no clock read. What this change can do without is bulk in its tests and its docs, plus a thin wrapper and a duplicated flag in the encoder: about 140–175 of its +1898 added lines (≈8%), almost all of it in helios/src/server/runtime/phase_tests.rs (+559) and docs/api.md (+178), with no behaviour lost.

Ranked by lines saved:

  1. Should fix, ~90–100 lines — three of the new phase tests re-prove placement and null rules that the new encoder test per_request_metrics_follow_vllm_placement_and_null_rules already pins (helios/src/server/protocol/tests.rs:2350-2488).
  2. Should fix, ~35–40 lines — the new docs/api.md histogram prose (docs/api.md:305-386) restates, nearly sentence for sentence, the Prometheus HELP strings the same change adds (helios/src/server/metrics.rs:1548-1600), and the vLLM table (docs/api.md:475-517) states the same populations a third time.
  3. Nit, ~28 lines — the new "Per-request metrics" section repeats its own table, the encoder's null rules and the cost statement that helios/model-contract.md carries.
  4. Nit, ~12 lines — Timing::streaming duplicates Encoder::streaming; RequestMetrics::Suppressed costs a declaration plus a match arm in three methods; record_commit/record_times wrap one-line assignments.
  5. Nit, ~12 lines, lower confidence — generate_many_observed is a pure pass-through over enqueue_many.
  6. Nit, ~14 lines, marginal — the strict-type loop in the config.rs bootstrap test.

One candidate I investigated and withdrew: the Bootstrap per_request_metrics key is not dead (see "Withdrawn" below).


1. Should fix — ~90–100 lines: three new phase tests duplicate the encoder test

helios/src/server/protocol/tests.rs:2350-2488 already asserts, at the encoder and in one place:

helios/src/server/runtime/phase_tests.rs then re-proves the same rules through HTTP:

Smaller version: keep performance_reports_the_first_scheduled_model_step (:4616-4646) and per_request_metrics_report_the_runtime_instants_of_a_stopped_reasoning_answer (:4693-4744) — those prove the runtime instants land inside the right worker step, which nothing else does. Replace the other two tests with one ~20-line test that serves a stream and a body with the flag on and off and asserts presence/absence plus commits; keep placement and null detail only in the encoder test. Also fold :4728-4730 and :4741 into the assertions already at :4638-4645 and :4683.

Saves ~90–100 of the +559 added lines in phase_tests.rs; nothing is lost because the deleted assertions are all still made at the encoder, where placement is decided.

2. Should fix — ~35–40 lines: docs/api.md histogram prose is a third copy of the HELP strings

The change states each histogram's population three times:

  1. the Prometheus HELP string in helios/src/server/metrics.rs — e.g. request_queue_seconds at :1554-1558, request_prefill_seconds :1559-1563, inter_token_latency_seconds :1588-1592 (the whole table loop is :1548-1600);
  2. the four new prose paragraphs at docs/api.md:305-386, which re-say who is observed and who is excluded;
  3. the vLLM correspondence table at docs/api.md:475-517, which repeats the same condition per row ("from model-scheduler arrival", "also recorded when a stream that offered text later fails").

A scrape ships (1) with the series, so an operator already has it. Compare docs/api.md:328-346 with the HELP strings at metrics.rs:1554-1577, and docs/api.md:348-364 with the token-histogram HELP block — the wording is near-identical. What only (2) can say is three sentences: which histograms pair, that they accumulate since server start, and the cancelled/failed caveat.

Smaller version: cut docs/api.md:321-386 to ~8 lines naming the groups and the single exclusion rule, and let the table at :475-517 be the place that ties a vLLM name to a Flare series. Saves ~35–40 of the +178 docs lines.

Note: this block also arrives through the stacked #548; if the two merge together it is one cut, not two.

3. Nit — ~28 lines: the "Per-request metrics" section restates itself and the model contract

docs/api.md:1005-1054:

Also: the placement rules at :1031-1036 are the doc comment of Encoder::enable_request_metrics (encode.rs:238-243) verbatim in prose. Keep the table (:1011-1022), the placement paragraph, and the two-sentence null rule; drop the field-by-field prose and the cost restatement, keeping the existing link. Saves ~25–30 lines.

4. Nit — ~12 lines: encoder plumbing duplicates state and wraps assignments

helios/src/server/protocol/encode.rs:

Saves ~10–12 of the +93 lines in encode.rs with no behaviour change (the Suppressed/Single/absent three-way is preserved as two fields).

5. Nit, lower confidence — ~12 lines: generate_many_observed is a pass-through

helios/src/server/runtime.rs:860-869 is exactly self.enqueue_many(prompts, observation, commits), reached only from helios/src/server/http.rs:367 and :374. Its doc comment at :860-861 restates enqueue_many's own parameter names (:871-876). generate/generate_observed (:843-849) already wrap enqueue_many; the new commits argument lengthened the wrapper chain instead of collapsing it.

Confidence: verified that the wrapper is redundant and that its two call sites pass Some(observation.timestamps) and None; not verified that the caller's four-arm if (http.rs:364-375) can be folded into one call — the observation.token_ids && size == 1 arm also does prompts.remove(0), and the prompts.is_empty() arm must avoid the runtime entirely. So the honest saving is the wrapper's name, doc comment and signature (~12 lines), not the branching. generate/generate_many must stay (used at helios/src/server/protocol/decisions/mod.rs:838 (not opened) and by tests).

6. Nit, marginal — ~14 lines: config test's strict-type loop

helios/src/server/config.rs:727-739 loops over true/false and then over 1, "true", null. The only writer of this key emits a literal (flare-cli/src/main.rs:355-357), so the rejecting branch guards no product path; one "absent → false" assertion plus the shipped CLI test per_request_metrics_flag_is_off_by_default_and_reaches_rank_zero (flare-cli/src/cli.rs:1378-1401) covers the behaviour. Saving is ~14 lines; borderline, not worth blocking.


Withdrawn candidate (recorded for honesty)

I first flagged per_request_metrics in helios/src/server/config.rs:353-357 as an unreachable Bootstrap validation path, on the grounds that flare run's documented config file has no such key. That was wrong: flare-cli/src/main.rs:355-357 writes config["per_request_metrics"] into the JSON that both serve paths parse — Bootstrap::load at main.rs:626 and LoadedSession::new at main.rs:701 — so the merge code is the only route and must stay. per_request_metrics is therefore consistent with the flag, not dead. Only the strict-type test loop survives as a (marginal) subtraction, reported as finding 6.

Scope checked and found already minimal

Open questions / not verified

Totals: about 140–175 lines removable, in 6 places (phase_tests ~95, api.md ~65, encode.rs ~12, runtime.rs ~12, config.rs ~14 — the config cut is the least certain). Recommended split: phase_tests.rs ~95/559, api.md ~65/178, encode.rs ~12/93, runtime.rs ~12/155.