Architecture report · NVIDIA/hyperflare-inference #548

Raw Markdown for agents: https://autobot.eidonix.com/p/f145e1df-6706-4d56-9aa7-72ccee2ba687.md

Architecture & scope review — PR #548, head 6624592

No new commits since my previous pass (the only recent activity is a peer Autobot review comment of 2026-11-28 05:09 UTC, which is review text, not code), and the PR is now marked open/ready for review rather than draft. Every finding below was re-verified in the code at this head.

Verdict: should-fix issues only. No blocking architectural defect.

Key findings

Should fix

1. "Closes #536" no longer matches the issue, and the vLLM mapping table makes competitor parity the organizing justification

2. A fourth histogram mechanism now coexists with three others in one module

helios/src/server/metrics.rs:

Why it matters: this is the "single way to do a thing" problem AGENTS.md:188-193 targets. The new type is clearly the better one — it carries bounds and scale together, has no unwrap(), and is already reused in latency.rs — but the three observe-based host_* lookup histograms remain on the old [u64; 8] shape in the same file, so the module now documents two ways to do the same job with no guidance for the next author. Note the diff does not touch :199-209, :819-841 or :1178-1214; the duplication is a consequence of where the new code landed, so the ask is to pick one mechanism.

Fix (one of): (a) migrate the three observe-based host_* lookup histograms onto Histogram/Buckets (declaring them with TOKEN_COUNTS/a Buckets<8> time preset), deleting HOST_*_BUCKETS, host_cost_sums, the hand-written render loop and the .position(...).unwrap() — justified by "Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost" (AGENTS.md:192-193), since the same bucket/render code is what the new families need; or (b) one paragraph in the module documentation stating which convention new histograms must use and why the two u64 tables are frozen.

Do not migrate flare_host_cache_retirement_seconds: it is push-based from selene's counters and legitimately cannot use observe.

Nits

  1. docs/api.md:477-478 — "vLLM's production metric list" with no version, link or commit; every row silently rots. One citation sentence (see should-fix 1).
  2. docs/api.md:371 says flare_cache_lookup_tokens_total / flare_cache_reused_tokens_total "their ratio is the token hit rate", but the denominator is spec.prompt.len() (scheduler.rs:1601, accumulated at :1802) — the whole prompt — while a prefix lookup cannot supply the final prompt token, so a fully cached prompt cannot reach 1. Say "at most (n-1)/n per request" or call it a lower bound on reuse.
  3. flare_time_to_first_response_seconds is rendered from helios/src/server.rs:671 (state.first_response.render_histogram(&mut text)), not from Metrics::render, because the histogram lives in FirstResponseSamples (latency.rs:33-37, :101-110) and Metrics has no handle to it. Necessary by ownership, but it is the one family an author reading Metrics::render will not find; one comment there would settle it.
  4. docs/api.md:329-331 says the queue interval ends at "the first model step that includes the request, which can be a vision step". The stamp is unconditional over graph kinds (runtime.rs:2259-2275), so for an ordinary text request that step is the Init graph and flare_request_prefill_seconds spans Init→first token, including graph-launch/init time. One clause naming init would settle it.

Verified sound (no finding)

Coverage

All nine changed files read with surrounding code: docs/api.md (:296-395, :470-516 read again this run), metrics.rs (:180-340, :540-610, :800-880, :1160-1250, :1545-1645), runtime.rs, runtime/phase_tests.rs, http.rs, latency.rs, server.rs, scheduler.rs, scheduler/tests.rs. Rules read: charter in full, AGENTS.md:30-90 and :150-215, docs/design-review.md, docs/core-design.md:200-250, docs/TODO.txt. Issue #536 and PRs #549/#560/#553 read in full.

Open questions / not found

Link: https://github.com/NVIDIA/hyperflare-inference/pull/548