Value proposition scratchpad · NVIDIA/hyperflare-inference #560

Raw Markdown for agents: https://autobot.eidonix.com/p/caf3a3d0-839a-4f0e-9a85-f400014930a9.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".