Value proposition scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/182e2db5-5056-40ef-acb0-f7055f3e0c40.md

#1 [high] PR 560 overview and charter fit

PR #560 "Emit vLLM-compatible per-request metrics from runtime instants" by WynnD, closes issue #551 (llama-swap shows -1 for prompt/decode rates; parses response bodies, not /metrics). Stacked on #548 (per-request histograms, still open, itself closes #536). Supersedes #552 (llama.cpp timings, closed 2026-11-28: emitting both made llama-swap subtract cached tokens twice) and #553 (HTTP-layer clocks, Auto-Review twice "Review Stopped: low value or does not align with project charter").

Files (18, +~1900/-~130): docs/api.md (+178), docs/cli-design.md (+2), flare-cli/src/cli.rs (+40), flare-cli/src/main.rs (+3), helios/model-contract.md (+14), helios/src/scheduler.rs (+4), helios/src/scheduler/tests.rs (+7), helios/src/server.rs (+8), helios/src/server/config.rs (+18), helios/src/server/http.rs (+59/-28), helios/src/server/latency.rs (+24), helios/src/server/metrics.rs (+548), helios/src/server/observation.rs (+8/-8), helios/src/server/protocol/encode.rs (+93), helios/src/server/protocol/tests.rs (+174), helios/src/server/runtime.rs (+155/-55), helios/src/server/runtime/phase_tests.rs (+559/-10), helios/src/server/runtime/response_lifecycle_tests.rs (+4).

Design: flag --enable-per-request-metrics on flare run + flare orbit run (rank zero), config key per_request_metrics accepted only as bool by Bootstrap (helios/src/server/config.rs:353). Encoder decides placement before submission (helios/src/server/http.rs:363) and returns whether content instant applies → commits flag threaded into generate_observed/generate_many_observed/enqueue_many → output_event_capacity(min, observed, commits) (helios/src/server/runtime.rs:62-80) reserves +1 event per generated token. New GenerationEvent::Committed{at_ns} emitted in Worker::complete for position==0 (runtime.rs:~1823-1835). Finished carries arrival_ns + RequestTimes. Encoder renders 6 vLLM fields (encode.rs metrics_value), all keys always present, nulls when unreached; metrics: null when n>1; omitted for Messages and multi-prompt Completions and when option off; stream placement on final usage chunk (needs stream_options.include_usage) or Responses response.completed/incomplete; JSON body top level (http.rs: after encode, response["metrics"] = ...). Plus performance.first_scheduled_ns added to Chat observation (observation.rs:56-75), and doc of first_scheduled_ns in helios/model-contract.md:343-360.

#2 [high] Value assessment facts: consumer, vLLM contract, gaps

  1. vLLM contract verified from https://docs.vllm.ai/en/latest/features/per_request_metrics/ : flag --enable-per-request-metrics; fields time_to_first_token_ms (from scheduling), time_to_first_content_token_ms (streaming only, non-empty text, excludes reasoning/tool-call), generation_time_ms (decode only), queue_time_ms (scheduler queue), mean_itl_ms (null for single token), tokens_per_second (includes prefill = scheduling→last token). Placement: JSON body top level; stream → final usage chunk, requires stream_options.include_usage (vLLM offers --enable-force-include-usage); Responses → response.completed/incomplete; n>1 → metrics null; multi-prompt Completions → omitted; Responses multi-turn → omitted. metrics.speculative_decoding separate flag. Note "at high concurrency enabling per-request metrics may introduce non-negligible CPU overhead." PR #560 matches this contract, with documented deliberate divergences (6 keys always present; metrics:null for n>1 also in bodies; no key when off).

  2. llama-swap v250 internal/server/metrics.go (raw fetched): buildMetrics reads timings (llama.cpp) or metrics (vLLM). From metrics: promptPerSecond = (inputTokens - cached)/ttft_ms (only if ttft>0); tokensPerSecond = 1000/mean_itl_ms (only if >0). Token counts come from usage. Streams parsed per SSE data: line; usage paths usage / response.usage / message.usage; metrics path metrics. It proxies the client's body, so streamed requests must already carry stream_options.include_usage for Flare to emit the usage/metrics chunk.

  3. Existing Flare path to the same instants: Chat-only observation extension return_token_ids+return_token_timestamps emits performance {ingress_ns, enqueue_ns, first_scheduled_ns, reused_prompt_tokens} (helios/src/server/observation.rs:56-75, 22-54; requires timestamps→token_ids; decode.rs:876-878 rejects on non-Chat) plus choices[0].token_timestamps_ns (http.rs:606-607). So a Chat client can already compute queue/first-step/prefill/decode intervals; #560 adds the performance.first_scheduled_ns field (unconditionally, i.e. also without the flag) and the vLLM-shaped object for all OpenAI protocols.

  4. Flag ergonomics: no [server] per_request_metrics key in the flare run configuration file (unlike api_key/thinking_token_budget in flare/src/configuration.rs:28-33); flare/src has zero references to per_request_metrics (grep), so the WinUI controller (which writes/reads [server] settings via flare/src/controller.rs:2562-2574) cannot enable it. OrbitRun.enable_per_request_metrics is a clap bool flag forwarded to rank zero (flare-cli/src/cli.rs:646-648, 697-699), so a saved persistent group keeps it and cannot turn it off (author's own documented limitation).

  5. Consumers/requests: #551 (llama-swap rates show -1) filed by the same author WynnD; #536 (Napuh) asks for Prometheus request histograms + process metrics and is answered by #548, not by this PR. Repo-wide grep for llama-swap/gateway in code/docs: no matches beyond these. #553's Auto-Review was twice "Review Stopped: low value or does not align with the project charter".

#3 [high] 560 value review: findings behind the verdict

Verified defects/risks for the #560 value review:

A. Authorization gap: the only demand is #551, filed by the same author (WynnD / Discord oystersmiles) whose PRs #548/#549/#560 are the whole cluster. Charter/AGENTS.md:165-169 requires "an explicit maintainer request, a demonstrated defect, a measured performance or memory problem, or inaccurate documentation"; "hypothetical future consumers ... do not establish a need". Priority contributors are voipmonitor/original-el8/lukealonso; WynnD is not listed. The same feature (#553) was already auto-reviewed twice as "Review Stopped: low value or does not align with the project charter".

B. Config/CLI inconsistency (concrete): helios/src/server/config.rs:353 accepts Bootstrap key per_request_metrics, but flare's typed config flare/src/configuration.rs:26-34 (Server struct, no deny_unknown_fields) does not have the field, so [server] per_request_metrics = true in flare run's config.toml parses and is SILENTLY IGNORED — against the charter's "Don't silently ignore / be explicit". flare/src has zero references to per_request_metrics, so the WinUI desktop controller (flare/src/controller.rs:2562-2574 writes server settings) cannot enable it. The PR's analogy to --verify-weights is weak: verify_weights IS in RuntimeSettings (flare/src/runtime_settings.rs:21) and the WinUI bridge/toggle (flare-winui/Settings.inl:177, bridge/src/lib.rs:1333). Orbit persistent groups keep the flag (OrbitRun::rank_zero_options flare-cli/src/cli.rs:697-699) with no negating flag. These consequences appear only in the PR description; grep for "desktop controller|negating" in repo docs returns nothing.

C. Riskiest code: new public GenerationEvent::Committed (helios/src/server/runtime.rs:109-114) emitted inside Worker::complete's per-token loop (runtime.rs:1828-1833) and output_event_capacity(min, observed, commits) third term (runtime.rs:62-80) — this is the invariant that verification/helios-lifecycle/check.py:218-224 mutation-tests ("response queue must cover its complete output allowance"). Also encoder now built before submission (http.rs:336-363) so created is read earlier.

D. Duplication/simpler path: Chat already exposes the same instants via return_token_ids+return_token_timestamps → performance{ingress_ns,enqueue_ns,first_scheduled_ns,reused_prompt_tokens} (observation.rs:56-75) + choices[0].token_timestamps_ns (http.rs:606-607). New value is only the vLLM wire shape. llama-swap v250 buildMetrics only needs time_to_first_token_ms and mean_itl_ms + usage; it never reads time_to_first_token_ms's content sibling, so dropping time_to_first_content_token_ms (and hence the Committed event, the commits flag, and the capacity change) would still deliver the stated benefit for a fraction of the risk.

E. Semantics check passed: fields match vLLM docs (TTFT from scheduling, generation_time decode-only, mean_itl null for 1 token, tokens_per_second spanning scheduling→last, n>1 → null, multi-prompt omitted, Messages none, Responses on response.completed/incomplete, stream needs include_usage). Author documents divergences honestly (6 keys always present, forced counted in generated, queue starts at model-queue arrival).

F. Bundling: 18 files / +~1900 lines, most of it the unmerged #548 (metrics.rs +548, docs/api.md +178, phase_tests +559). The "option off costs one branch" claim is scoped to #560's own diff; the combined branch adds an unconditional per-step monotonic_ns read in reserve_and_pack (runtime.rs:2255-2270) and a RequestRecord per request from #548.

#4 [high] 560 value review: consumer fit, evidence, simplification

Extra value-review findings (final round):

G. The chosen shape does not fully deliver #551's ask. llama-swap v250 buildMetrics (raw file fetched) reads vLLM metrics only from a body or an SSE data line, and computes promptPerSecond from usage (input - cached)/ttft and tokensPerSecond = 1000/mean_itl_ms. Flare puts metrics on the final usage chunk only when the client sends stream_options.include_usage (docs/api.md:1031-1034). So for the default streaming client, llama-swap still shows -1 — the motivating workflow remains broken for streams. vLLM closes this with --enable-force-include-usage; Flare has none and this PR does not add one. Honest doc, but the gap should be stated against #551 explicitly, or closed under the flag.

H. Evidence gap: this commit was not run against a GPU/live server/llama-swap ("Not run here: a GPU, an exported core, a live server, a llama-swap or gateway check"). The only live gateway numbers are from #553 (HTTP-clock version) and #552 (llama.cpp timings), neither of which is this code path. Charter "Bring real evidence".

I. Config asymmetry precedent: flare/src/configuration.rs Server has only host, port, api_key, thinking_token_budget, scheduler_checkpoint_extra_work_fraction, and no deny_unknown_fields; scheduler_terminal_value and mtp_adaptive_verification_alpha are also Bootstrap-only keys. So a [server] per_request_metrics = true in ~/.config/flare/config.toml parses and is silently dropped (flare-cli/src/config.rs:33-37 + main.rs:355 only sets it from the flag). Same class of gap exists today for other bootstrap-only keys, so it is a should-fix (add the 5-line field, which also gives the WinUI controller a path), not a novel sin.

J. Cheapest simplification, verified against the consumer: drop time_to_first_content_token_ms from v1 and emit null. That removes GenerationEvent::Committed (runtime.rs:109-114), the commits parameter threaded through generate_observed/generate_many_observed/enqueue_many (runtime.rs:847-880), the third term of output_event_capacity (runtime.rs:62-80) — the exact invariant mutation-tested by verification/helios-lifecycle/check.py:218-224 — and encoder record_commit/step_ns/content_ns (encode.rs:255-262, 546-551). llama-swap never reads the field; vLLM's own doc allows null when data is unavailable.

K. Precedent that vLLM wire/flag mirroring is in scope for Flare: docs/api.md:973 (--enable-prompt-tokens-details equivalent), docs/cli-design.md:475 (--language-model-only "as vLLM's flag of the same name"), helios/src/server/models.rs:72 (vLLM ModelCard fields), docs/logprobs-design.md:261 (vLLM wire formats). Counterpoint: docs/core-design.md:210-219 "Flare does not aim for vLLM's feature matrix".

#6 [high] 560 re-review 1708: what the new revision fixed

Revision as of 2026-11-28 04:12 (046aaef + parents f0ccabcc, a5d47950, 6c07ef44, c4fef6b2, 4a063e63, 66245920, 055663a7) resolves four of the five conditions in report #5:

  1. Content instant removed. time_to_first_content_token_ms is now always Value::Null (helios/src/server/protocol/encode.rs:251-275, docs/api.md:1020,1038-1043). GenerationEvent::Committed is gone from the branch; the content instant moved to #562 (open draft, stacked on #560, "Depends on #560 (which depends on #548)"). So the riskiest part of the old diff (new public event + output_event_capacity third term + per-step encoder state) is no longer in this PR. output_event_capacity on the branch is fn output_event_capacity(&self, minimum: usize, observed: bool) again (runtime.rs:62-82).
  2. [server] per_request_metrics is a real typed key now: flare/src/configuration.rs:34 (pub per_request_metrics: Option<bool>), resolved to Settings.per_request_metrics (flare/src/settings.rs:32,224) and pushed to rank zero's config in flare/src/controller.rs:2566. flare-cli/src/config.rs:73-75 applies it only when the flag is absent, so flag > config > off, with tests at config.rs:222-234, settings.rs:76-88, helios/src/server/config.rs:719-741 (rejects 1/"true"/null).
  3. Include-usage gap now documented in-tree, not only in the description: docs/api.md:1031-1038 names the llama-swap consequence and the missing --enable-force-include-usage equivalent.
  4. Live evidence now exists on the PR: WynnD 2026-11-28 03:26 and 04:12 comments - RTX PRO 6000 Blackwell, gb202 package behind llama-swap v250, 40/40 request-matrix checks, llama-swap showing prompt and generation rates for Chat and Completions, CPU 15.4-15.9 s on vs 16.0-16.3 s off for 16x512-token streams, re-validated through the config key. Responses streams show no rates because llama-swap reads metrics only at an event's top level.
  5. #552 and #553 are closed in favour of #560 (both closed 2026-11-28 02:04/02:05 with "Superseded by #560"), so the four-way fork of the same idea is resolved.

Line accounting (branch vs main, pr_files): 22 files. #548 is 9 files/+1008-51; the 560-only delta is ~+750, of which tests ~570 (protocol/tests +133, phase_tests ~+348, cli/config/settings/config tests ~+90) and docs ~+61; production code is ~+185 (encode.rs +68, http.rs +14, server.rs +7, server/config.rs +18, observation.rs +8, runtime.rs +10, cli/config plumbing ~+60).

Off-path cost with the option off: GenerationEvent::Finished carries arrival_ns: u64 and times: RequestTimes (~32 bytes per terminal event) plus one if state.per_request_metrics and one metrics_value() early-None per response. No new clock read in 560 itself; the per-step monotonic_ns() at runtime.rs:2272 belongs to #548 and now stamps after packing (a failed pack leaves first_scheduled_ns unset).

#7 [high] 560 re-review 1708: remaining nits and open items

Remaining items after revision 046aaef (all verified in the tree):

A. Authorization is still the only substantive gate. Charter/AGENTS.md:165-169 ("explicit maintainer request, a demonstrated defect, a measured performance or memory problem, or inaccurate documentation"; "hypothetical future consumers ... do not establish a need") and 201-207. The only request is #551, filed by the same author; llama-swap is not part of Flare's documented deployment story anywhere except the docs this PR adds (grep for llama-swap: only docs/api.md:1035). #536 (Napuh) covers histograms/process metrics (= #548), not response-body metrics. Precedent both ways: docs/api.md:973 mirrors vLLM's prompt-tokens-details flag, docs/cli-design.md:475 mirrors --language-model-only, models.rs mirrors ModelCard; but docs/core-design.md says Flare "does not aim for vLLM's feature matrix". Maintainer decision needed; everything else is done.

B. Public API freeze. RequestTimes is now exported (helios/src/server.rs:33 pub use metrics::{RequestTimes, Snapshot}) as a plain #[derive(Clone, Copy, Debug, Default)] struct with three pub fields and no #[non_exhaustive] (helios/src/server/metrics.rs, near line 323), and it is a field of the public GenerationEvent::Finished (runtime.rs:102-105). With the in-process Rust SDK (#6) on the roadmap, one #[non_exhaustive] is cheap insurance; a later field (e.g. per-request speculative-acceptance, which vLLM already ships as metrics.speculative_decoding) would otherwise break exhaustive literals/patterns.

C. Persistent Orbit groups cannot turn the flag off. --enable-per-request-metrics is saved into the group's rank_zero options (flare-cli/src/cli.rs:698-700, orbit/controller.rs:691-692 and 846-850), there is no --no-enable-per-request-metrics, and the config key cannot override it because flare-cli applies config only when the flag is absent (config.rs:73-75). Off for a saved group = edit orbit.toml. The repo pairs negatives elsewhere (--no-history-drafts cli.rs:1173, --no-mtp-adaptive-verification :1185), though --verify-weights (the author's analogy) does not. One flag or one docs/cli-design.md:736 sentence.

D. Responses streams: vLLM nests the object in response (encode.rs:731-744, matching vLLM's doc), and llama-swap reads metrics only at an event's top level (parsed.Get("metrics") in processStreamingResponse, vLLM branch of internal/server/metrics.go v250 commit 60226b6), so the motivating consumer gets nothing for a streamed Responses request even with the option on. Currently stated only in the PR comment, not in docs/api.md:1031-1038 (which mentions only the include_usage gap).

E. Drift/maintenance: vLLM's metrics object is already growing (--per-request-spec-decode-metrics adds metrics.speculative_decoding; vLLM doc "Per-Request Metrics" section "Speculative Decoding Acceptance"). Flare's six fixed keys and always-present fields (docs/api.md:1040-1043) are a divergence that will need refreshing or will quietly lag. Worth a one-line note that Flare tracks a snapshot of the object.

F. Definition drift worth stating in review (already documented): queue_time_ms starts at model-queue arrival so it includes the channel send and worker pickup (docs/api.md:1025-1029) and, after the post-pack stamp, also pack time; time_to_first_token_ms ends at the completion of the step that committed the first token, so speculative steps share one instant (docs/api.md:1019,1025-1026). Both make Flare's numbers slightly larger than vLLM's for the same workload; fine, but they are numbers people may bill on.

#9 [high] 560 re-review 1810: Ignition config schema divergence is a real blocker

Verified on branch 046aaef (no new commits since run 1769):

#10 [medium] 560 re-review 1810: prior open items still unfixed

On 046aaef: