Final review report · NVIDIA/hyperflare-inference #695

Raw Markdown for agents: https://autobot.eidonix.com/p/65098f27-2d83-4817-a134-bb8d67460c28.md

Recommendation: Changes Requested

The 44-line production change in ignition/preparation/{tuning,tuning_replicas}.py is technically sound, deadlock-free, and cleanly scoped with zero blockers: shard-rank indexing matches the Gloo group layout, replica-local collectives remain isolated per replica, serving-replica reconciliation resets/restores shard state properly on both homogeneous and fallback paths, and non-serving replicas still exit cleanly via TuningComplete. However, two non-trivial pre-merge gaps remain: two documentation passages (docs/cli-design.md:574-578, docs/model-preparation.md:203-209, 252-260) now directly contradict the new default TP>1 --tuning-gpus behavior, and both headline claims (eliminating the 16-GPU TP=8 BindingMismatch and R -> R*TP scaling) lack end-to-end GPU confirmation or before/after measurements on ccb9f5b.

Merge Risk

Level: Low

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Update stale --tuning-gpus documentation (docs/cli-design.md:574-578, docs/model-preparation.md:203-209, 252-260)

    • docs/cli-design.md:574-576 currently states: "For TP2, --gpus 0,1 --tuning-gpus 0-5 creates three independent TP2 groups. Corresponding ranks share candidate results while collectives stay within each replica." After this PR, homogeneous TP>1 replicas share local candidate results across all replicas * tensor_parallel GPUs and adopt one global winner; corresponding-rank sharing is now only the fallback when GPUs or local catalogs differ across TP ranks.
    • docs/model-preparation.md:203-204 still scopes cross-rank candidate sharing to "Without extra tuning replicas...", and --tuning-gpus LIST (:252-260) does not mention cross-rank sharing (R * TP shard width, which invalidates prior R-shard partial checkpoints per :224-227) or serving-replica reconciliation.
    • Fix: Update both passages to reflect global R * TP local-race sharing on homogeneous replicas, corresponding-rank fallback with serving-replica reconciliation when devices or catalogs differ, and the partial-checkpoint shard-count implication.
  2. Substantiate or qualify the end-to-end GPU fix and R -> R*TP scaling claim (docs/design-review.md Principles 12 & 16; Charter #210)

    • The new CPU tests (tests/preparation/test_tuning_replicas.py) stub b12x sessions/jobs/coordinators with scripted latencies and never exercise ForwardCache._prepare_ranks or real sharded races; the PR explicitly notes that multi-GPU ignition export --tuning-gpus has not yet been re-run on ccb9f5b, and no before/after tuning wall-clock numbers back the R-way → (R * TP)-way scaling claim (the same gap that held #383).
    • Fix: Re-run the motivating multi-GPU TP>1 ignition export --tuning-gpus on ccb9f5b and report that BindingMismatch no longer occurs alongside before/after tuning wall-clock time; or, if hardware access is unavailable before merge, clearly label the BindingMismatch resolution and scaling speedup as expected rather than measured results in the PR description (docs/design-review.md Principle 16) so a maintainer can explicitly sign off on CPU-only verification.

Subtract / Simplify

  1. Drop the production-unused share_across_ranks parameter on ReplicaPreparation.__init__ (ignition/preparation/tuning_replicas.py:74, 78; ignition/preparation/tuning.py:430, 443)

    • Production must construct ReplicaPreparation before calling gather() to inspect catalogs (tuning.py:430-433), so tuning.py:443 always mutates self._replica_coordinator.share_across_ranks after construction; the constructor kwarg is only passed by the Gloo test (tests/preparation/test_tuning_replicas.py:150).
    • Fix: Initialize self.share_across_ranks = False without an unused __init__ kwarg (or pass share_across_ranks into prepare(..., share_across_ranks=False)), and have the Gloo test follow the same production contract.
  2. Remove the two mode-conditioned error-message ternaries in authorization() (ignition/preparation/tuning_replicas.py:42-46, 50-54)

    • Both 5-line ternaries branch only on prose between "tuning ranks ..." / "corresponding tuning ranks ..." and "a tuning rank finished before its peers" / "a tuning replica finished before its corresponding rank". The unified share_across_ranks=True wordings ("tuning ranks declared different candidate races" and "a tuning rank finished before its peers") are accurate in both modes (whereas the pre-PR "corresponding rank" wording would be misleading in cross-rank mode). Removing both ternaries saves 8 lines and keeps share_across_ranks scoped solely to peer selection (:34).
  3. Trim mechanical repetition in tests/preparation/test_tuning_replicas.py:159-225, 282-396

    • _FakeJob.advance (:162-224) repeats the same 6-field SimpleNamespace literal 7 times; a 2-line _step(...) helper cuts ~40 lines and makes the scripted state transitions immediately readable.
    • _make_replica_session / _FakeCoordinator (:282-396) duplicates the ~28-attribute object.__new__(RecordedPreparationSession) setup from tests/preparation/test_tuning_shards.py:179-253; extracting a shared helper prevents silent test drift when RecordedPreparationSession.__init__ gains attributes.

Nits

Dropped on verification