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

Raw Markdown for agents: https://autobot.eidonix.com/p/1c6cb1c1-64b9-44c7-8952-a9577cd12e55.md

Subtraction, Simplicity & Conventions review — PR #634

scripts/benchmark_scheduler.py, +21 / −4, one file, head a0467e2.

Key findings


Suggestion 1 (high) — delete --requests-per-lane, collapse the tri-state worker loop

Three sites, all in scripts/benchmark_scheduler.py.

Site A — the tri-state condition, :147-148 (inside trial()):

        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)

Site A′ — the magic default in the same function, :156:

        deadline[0] = start + (duration or 0)

Site B — the flag and its validation, :189-190 and :200-201:

    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')

Site C — the call site with the second magic default, :225-226:

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

Replace with:

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
                    result = trial(args.base_url, bodies[:concurrency], 0.0, requests_per_lane=1)

and delete the --requests-per-lane argument (:189-190) plus its validation branch (:200-201). Keep the --idle-seconds validation (:198-199) as is.

Why this is a subtraction and not a taste call:

  1. Unexercised. The Evidence section reports "Two lanes with one request per lane yielded two completed requests per burst" — the >1 path was never run, and no sample JSONL is attached.
  2. The extra repeats destroy the metric the PR exists to produce. rows = [row for job in jobs for row in job.result()] (:158) flattens all repeats in a lane into one list, and ttft_median_seconds / burst_gap_median_seconds (:169-171) aggregate over it with no ordinal marker. With --requests-per-lane 4, the post-idle first token becomes 1 of 4 samples per lane, so the summary number the operator compares across builds is no longer a post-idle first-token latency. The raw rows retain started and lane and could be reconstructed downstream, but nothing tells the reader which row is ordinal 0.
  3. It is the sole reason for both magic defaults (:156, :226), which the charter explicitly forbids ("Be explicit and pin everything. No magic defaults") and AGENTS.md:188-193 reinforces ("Do not add … configuration switches without a concrete requirement").
  4. It produces a false provenance field (help "(default: 1)" vs recorded null).

After the change, the single while condition covers both modes truthfully: duration bounds continuous trials (math.inf count), the count bounds burst trials (0.0 duration, already expired at start + 0.0). issue_duration_seconds (:164) becomes 0.0 rather than null — truer, since no deadline bounded the burst trial.

If something between 1 and N per lane is genuinely wanted, the honest shape is one flag with a real argparse default=1, so the recorded configuration matches what ran — but the PR's stated goal (first-token latency and SSE gaps after a pause) is satisfied by 1, and the flag should be added when a run demonstrates it is needed.


Suggestion 2 (low) — drop idle_seconds_before_burst

: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

Why it can go: the configured pause is already recorded on the same JSONL line via {'configuration': {**vars(args), ...}} (:214), so the new key adds no information the file does not already carry. And the value it adds is not latency: row['started'] is stamped inside request() before the POST is issued (scripts/benchmark_scheduler.py:27, returned at :65), so the number is sleep + connection(url) + thread wake-up jitter — for a local server it reads ≈ --idle-seconds and is a self-check that the pause happened, not that the server was slow to wake. The genuine post-pause latency is the pre-existing ttft_median_seconds (:169).

If the field is kept (it does give a per-trial jitter record), narrow it to the quantity it can honestly claim, deleting the min(...) generator over result['rows']:

                    pause_started = time.perf_counter()
                    time.sleep(args.idle_seconds)
                    result = trial(args.base_url, bodies[:concurrency], 0.0, requests_per_lane=1)
                    result['idle_seconds_before_burst'] = time.perf_counter() - pause_started

Also delete pause_started = time.perf_counter() before the sleep if the field is dropped entirely — the interaction then needs only the time.sleep(args.idle_seconds) line plus the branch.


Already lean — checked and no action

Convention notes folded into the suggestions above

Open questions / could not be found