Subtraction and simplicity scratchpad · NVIDIA/hyperflare-inference #634

Raw Markdown for agents: https://autobot.eidonix.com/p/8d46fc0e-1e93-4550-8c43-0c8674f19f50.md

#1 [high] Subtraction lens verdict: diff is small; 1 knob + 2 magic defaults are the removable weight

PR #634 (+21/-4, scripts/benchmark_scheduler.py only). Diff is otherwise lean and idiomatic: argparse parser.error validation style matches scripts/benchmark_prefill.py:23, scripts/benchmark_roce.py:49-65, scripts/set_release_version.py:107; math already imported (:11); no new deps, no new files, no dead code added. Continuous default path untouched (:220-221).

Main finding: --requests-per-lane is an unexercised knob (PR evidence ran 1 per lane) whose output cannot be separated: with >1, rows from all repeats are flattened and ttft_median_seconds/burst_gap_median_seconds (:169-171) aggregate across the post-idle first request and the steady-state repeats, so the summary no longer reports the post-idle first token (raw rows keep started/lane, so it is reconstructible, but nothing marks ordinal).

Supporting convention violations: deadline[0] = start + (duration or 0) (:156) and args.requests_per_lane or 1 (:226) are magic-default shortcuts — charter "Be explicit and pin everything. No magic defaults"; AGENTS.md:188-193 "Do not add ... configuration switches without a concrete requirement". Also --requests-per-lane help says "(default: 1)" (:190) but argparse default is None, and the recorded configuration line (:214) therefore says requests_per_lane: null while 1 was used.

Concrete collapse proposed:

Low-value: idle_seconds_before_burst (:223, 227-228) is redundant with configuration.idle_seconds written at :214 — value ≈ the configured pause. Optional deletion.

Not this PR's debt but relevant: --pair-index/--variant/--pair-order (:192-194) are parsed and never read (dormant since 17bb3c4a); PR correctly does not expand them, and should not have reused them for its "replay across builds" benefit.

#2 [high] Research summary

Subtraction review of PR #634 complete. The diff is already lean: +21/−4 in one file, no new import or dependency, no new function, no dead code added, and the continuous default path untouched. Findings are saved to the scratchpad.

Two suggestions, one high-value: (1) remove --requests-per-lane and collapse the tri-state worker loop — the flag is unexercised by the PR's own evidence (all runs used 1 request per lane), its extra repeats are flattened into the same rows list so ttft_median_seconds/burst_gap_median_seconds no longer isolate the post-idle first token, and it forces two magic defaults (duration or 0 at :156, requests_per_lane or 1 at :226) that the charter forbids and that make the recorded configuration disagree with the help text. Replacing it with a requests_per_lane=math.inf parameter, a single while len(results) < requests_per_lane and time.perf_counter() < deadline[0] condition, and trial(..., 0.0, requests_per_lane=1) deletes one flag, one CLI validation branch, one ternary and both or defaults. (2) Low value: idle_seconds_before_burst (:223-228) is redundant with configuration.idle_seconds written on the same JSONL line and measures connect time plus jitter, not latency.

Also verified there is no existing repo helper this duplicates (scripts/scheduling_sim/ models idle at a different layer, and nothing imports the script), and that the pre-existing dead --pair-index/--variant/--pair-order flags are not this PR's debt.

#3 [high] Verbatim citations for the two subtraction suggestions on PR #634

All lines are scripts/benchmark_scheduler.py at PR head a0467e2.

SUGGESTION 1 (high value) — delete --requests-per-lane, collapse the tri-state loop. Quote A, :140-157 (elide with ... between quoted chunks):

def trial(url, bodies, duration, *, requests_per_lane=None):
    ...
        while (len(results) < requests_per_lane if requests_per_lane is not None
               else time.perf_counter() < deadline[0]):
            row = request(url, body, stream=True)
    ...
        deadline[0] = start + (duration or 0)

Quote B, :189-190 + :200-201 + :225-226:

    parser.add_argument('--requests-per-lane', type=int,
                        help='Requests per lane in each idle-mode burst (default: 1).')
    ...
    if args.requests_per_lane is not None and (args.idle_seconds is None or args.requests_per_lane < 1):
        parser.error('--requests-per-lane requires --idle-seconds and must be positive')
    ...
                    result = trial(args.base_url, bodies[:concurrency], None,
                                   requests_per_lane=args.requests_per_lane or 1)

Replacement:

def trial(url, bodies, duration, *, requests_per_lane=math.inf):
    ...
        while len(results) < requests_per_lane and time.perf_counter() < deadline[0]:
            row = request(url, body, stream=True)
    ...
        deadline[0] = start + duration

and

                    result = trial(args.base_url, bodies[:concurrency], 0.0, requests_per_lane=1)

Reasons (all evidenced): unexercised (Evidence ran "two lanes with one request per lane"); output not separable because :158 flattens repeats (rows = [row for job in jobs for row in job.result()]) and :169-171 aggregate ttft_median_seconds/burst_gap_median_seconds over all rows with no ordinal marker, so with >1 the post-idle first token is 1 of N samples; forces both magic defaults (:156 (duration or 0), :226 or 1) against charter "Be explicit and pin everything. No magic defaults"; help text says "(default: 1)" (:190) while argparse default is None, so the recorded configuration line (:214) logs requests_per_lane: null when 1 was used. Net: -1 flag, -1 CLI branch, -1 ternary, -2 or defaults; issue_duration_seconds (:164) becomes 0.0 instead of null (truer — no deadline bounded the trial).

SUGGESTION 2 (low value) — drop idle_seconds_before_burst. Quote, :223-228:

                    pause_started = time.perf_counter()
                    time.sleep(args.idle_seconds)
                    result = trial(args.base_url, bodies[:concurrency], None,
                                   requests_per_lane=args.requests_per_lane or 1)
                    result['idle_seconds_before_burst'] = min(
                        row['started'] for row in result['rows']) - pause_started

args.idle_seconds already lands in the same JSONL line via configuration (:214). Measured value = sleep + connect + thread-scheduling jitter, not latency. Alternative if kept: take time.perf_counter() - pause_started around the sleep only.

#4 [medium] Clean bill: no duplication, no new dead code, conventions mostly respected

Scope re-verified by reading scripts/benchmark_scheduler.py in full at PR head (244 lines) and AGENTS.md.

Already lean / no action:

Convention pressure points cited in the report: charter "Be explicit and pin everything. No magic defaults" (against :156, :226); AGENTS.md:188-193 "Do not add frameworks, extension points, speculative compatibility, fallback layers, or configuration switches without a concrete requirement" (against the unexercised --requests-per-lane); charter "Stay focused ... random switches" (same).