Calibration expansion, stage 2: shape lattice, Qwen3.5-35B-A3B class, HybridEP fix, per-table certificates - #852
Draft
bradhilton wants to merge 20 commits into
Draft
Conversation
Runs one model's calibration cells over an explicit list of parallel shapes (TP, CP, EP[, ETP]) on a 4x H200 node, one torchrun per shape with world size TP x CP and expert parallelism pinned per shape (the provider otherwise defaults EP to the visible GPU count for MoE models). Mounts both Ellavox corpora so Qwen3.5- and Qwen3-tokenized real-data cells can run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Under expert parallelism each measured row now carries TrainerRank's configured per-rank row high-water mark and the live HybridEP buffer's token capacity per rank, so MoE evidence records the dispatch capacity it ran with. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Expert-parallel shapes instantiate the HybridEP token dispatcher, which the GPU image does not ship; the recipe now builds it from ART's vendored source during setup, as src/art/megatron/setup.sh does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…on stacks Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
When the unsplit forward does not fit and admission tries a split rung, the forced candidate label (a layout of the whole tree) has no match in the sub-forward's family and TrainerRank raises ValueError. The calibration run now records that as an admission failure instead of crashing the cell; a split run is not a comparable measurement in any case. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
TrainerRank sized the HybridEP buffer from the near-balanced extent (2x the mean rank load) and never passed the plan's actual per-rank maximum, although _ensure_hybridep_capacity accepts it. Cost-aware context-parallel plans can put more tokens on one rank (a 2-history Ellavox group at CP4/EP4 planned 12,546 rows against a 7,168-row buffer) and the forward failed with "HybridEP communication rows must be in [1, 7168]". The planned counts are identical on every rank, so every rank sizes the buffer the same way. Found by the Qwen3.5-35B-A3B calibration campaign; validated by re-running that cell on GPU (no CPU-testable path: needs an initialized EP group). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Renames the dense class's manifest and certificate to carry the table id and parametrizes the certificate and manifest tests over CALIBRATED_TABLES. A manifest now names the fixed recipes it was run from and/or the shape-lattice launches (recipe, model, shapes, cell specs) of the generic lattice recipe, which the manifest test expands into cell keys (EP/ETP suffixes, full-model layer counts) and requires to equal the manifest; exclusions must carry a reason and campaign labels must name a recipe campaign or a launch. The dense certificate is regenerated against the renamed manifest (same table hash). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s from it The manifest lists the four lattice launches (CP separated from EP), the 88 cells they produce and the 15 cells this class cannot measure on one node, each with its reason (issues #848 and #851, memory refusals). The fitter's --exclude-cells accepts @manifest for exactly those keys. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Second calibrated table, fitted with the same ten terms on 73 cells (3,658 within-cell pairs) over a shape lattice that separates context from expert parallelism: 97.3% pairwise ordering, median regret 0%, p95 2.4%, max 4.9%, gates passing on every shape including EP2/EP4; the 13 odd-Ellavox held-out cells reach 96% / max 0.9%. The version-1 fallback this class used before loses up to 35% on the large Ellavox groups. Admitted only for this geometry at the eight measured shapes. Fitter: candidates are fitted in canonical (cell, label) order because the regret coordinate search is order-dependent and equivalent optima exist, so a refit from the certificate reproduces the export; `integerize` repairs the rounded table on the integer grid only when rounding costs a ranking (it did for this class: three CP4 heterogeneous cells flipped; the dense table's rounding preserved its loss and is unchanged). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Hidden 2,048 dense attention is a measured control class now, so the example of an unmeasured width must not coincide with it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 04:21 — with
GitHub Actions
Inactive
Dense-control evidence: attention-only models on real data at CP4 are ranked by the exchange-wave count and rank imbalance of the context-parallel plan, which the O(segments) features cannot see. Qwen3-1.7B and Qwen3-8B are not certified (gates fail at CP4), and the certified Qwen3-4B geometry shows a 35% regret cell on real data at TP1 x CP4 that the dense campaign never measured. Offline, two CP-plan features let the 1.7B class pass every gate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 07:51 — with
GitHub Actions
Inactive
A full five-shape dense lattice on Qwen3.5-27B ran ~13 h of cells after setup and was cut by the 42000 s deadline, losing the run. The GPU pod policy allows up to 604800 s. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 15:17 — with
GitHub Actions
Inactive
… Qwen3-4B at TP1 x CP4 Three new calibrated tables from the shape-lattice campaign, each admitted only where the per-shape gates pass: dense-attn-h2048 (Qwen3-1.7B) and dense-attn-h4096 (Qwen3-8B) at TP1 x CP1/CP2 and TP2 x CP1 (42 cells; pairwise 96.5% / 99.9%, max regret 1.0% / 1.1%), dense-attn-h5120 (Qwen3-14B) also at TP2 x CP2 (56 cells; 99.9%, max 1.0%). TP1 x CP4 (and TP2 x CP2 for the two smaller classes) is measured but excluded with the reason: the ten-term score cannot see the context-parallel exchange schedule there and misranks the recurring real-data groups. CalibratedTable gains `withheld` pairs: measured, fitted, not admitted. The dense table withholds Qwen3-4B x TP1 x CP4, where the shipped table's regret reached 35% on a real-data group against version 1's 15%; its coefficients and certificate hash are unchanged (58 fitted cells), and the manifest now also records the 16-cell blind-spot launch as excluded evidence. The certificate test binds withheld pairs to the manifest. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 15:54 — with
GitHub Actions
Inactive
The context-parallel chunk assignment search prices about sixty candidate assignments per packed row, each with per-rank torch mask operations; on a real-data 4-rank row that cost 17-27 ms per row, all of it on the planning critical path. The evaluator now prices a whole batch of candidate moves in one call: numpy mask algebra over candidates, ranks, sources and waves, and the cost formulas and stage simulations vectorized term by term in the same arithmetic order. The improving-move search submits all moves of a step as one batch (cache-aware). Results are identical: the pre-rewrite evaluator is kept as the scalar reference in tests/unit/test_context_parallel_plan_evaluation.py (randomized instances including the long-row torch path), and the old and new searches agree on owners, waves and evaluation for all 446 real calibration candidates at CP2 and CP4. Median search time 18.3 ms -> 4.1 ms (mean 24.0 -> 4.6 ms). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ucture On attention classes at TP1 x CP4 the ten-term score cannot see the context- parallel plan a layout produces, which decides the recurring real-data groups (an extra remote wave costs 2.4 / 1.8 / 0.6 ms per layer on 1.7B / 8B / 14B at equal load; the CP planner's own model prefers it, #854). It still shortlists well, so these shapes are now admitted through a two-stage selection: `ReRanker` on `CalibratedTable.reranked_shapes` keeps the three cheapest layouts of the search plus the depth-one anchor under a shortlist table fitted on every measured shape, prices each by the plan it produces (`summarize_prefix_tree_plan`: remote wave count and largest per-rank token load, through the planning-bundle cache so the selected layout's plan is reused) and selects the lowest score; ties keep the cheaper layout. `select_scoring` returns the re-ranker on re-ranked shapes only; the runtime derives the plan structure with its production topology and config. Certified per class on TP1 x CP4 (certificate `reranker` block, bound by the certificate test which recomputes the two-stage selection from the recorded aggregates): every clear measured winner shortlisted; two-stage regret max 2.6% / 0.8% / 4.1% (held-out 0.7% / 0.8% / 0.4%); never more than 2% worse than the cheap-only or version-1 selection; planning cost of the shortlist (mean 2.6% / 1.6% / 1.0% of cell time) below the mean execution saved. The direct tables are unchanged. The harness records the CP plan structure and the version-1 score per candidate; the fitter gains `--rerank-shapes`, `--shortlist-size`, `--incumbent`, `evaluate_two_stage` and the gates above. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 4, 2026 17:11 — with
GitHub Actions
Failure
Validation runs of the two-stage selection alone (CP4 cells only) are read from their timed automatic rows; with --rerank-shapes such a set would leave the direct fit without cells and fail inside the least-squares solver. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 18:14 — with
GitHub Actions
Inactive
Fourth calibrated class, attn-moe-h2048-h200-bf16, from the EP-deconfounding lattice (112 cells; three CP1 cells fail the single-GPU memory admission of issue #848; no CP>1/EP1 segfaults on this model). Admitted directly at TP1 x CP1, TP2 x CP1 and TP2 x CP1 with EP2 (39 cells; pairwise 99.9%, max regret 2.2%) and at TP1 x CP4 with EP2 through the two-stage re-ranker (14 cells; max 2.1%, every clear winner shortlisted, planning 1.0% of cell time against 1.3% saved), where version 1 lost up to 10.7%. The class's timings carried sporadic 10-20 s stalls on about 4% of measured rounds and a few percent of drift across rounds; TP1 x CP2 (EP1/EP2) and TP1 x CP4 (EP1/EP4) are measured but not admitted because neither selection passed its gates on that evidence (recorded per cell in the manifest). A sixteen-round re-measurement of those shapes is running. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 21:41 — with
GitHub Actions
Inactive
Fifth calibrated class, dense-gdn-h5120-h200-bf16, from a two-half shape lattice (70 cells; four CP1/CP2 cells incomplete or lost to the single-GPU memory admission of issue #848, one TP2 x CP2 cell lost to an NCCL collective timeout during warm-up). The ten terms rank this GDN class at CP4 as they do the 35B GDN MoE class, so it is admitted directly at TP1 x CP1/2/4 and TP2 x CP1 (52 cells; pairwise 97.0%, max regret 3.4%, held-out 1.8%) without a re-ranker. TP2 x CP2 fails its gates marginally (p95 5.1%, one clear miss) and keeps version 1, which on this class chose a layout 112% slower than the best on the largest Ellavox group at CP4. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 4, 2026 23:23 — with
GitHub Actions
Inactive
The capacity fix earlier in this branch passes required_capacity (the maximum planned rows per rank) to _ensure_hybridep_capacity; the Megatron-only unit test still asserted the old keyword set. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
temporarily deployed
to
trainer-rank-gpu-validation
September 5, 2026 02:02 — with
GitHub Actions
Inactive
…measurement The eight-round timings of TP1 x CP2 (EP1/EP2) and TP1 x CP4 (EP1/EP4) carried sporadic 10-20 s stalls; re-measured with sixteen rounds the stalls persist on about 4% of rounds but shrink to about 2x and the medians hold. The class is now admitted directly at TP1 x CP1, TP1 x CP2 (EP1, EP2) and TP2 x CP1 (EP1, EP2) (67 cells; pairwise 96.3%, max regret 2.2%) and at TP1 x CP4 with EP1, EP2 and EP4 through the two-stage re-ranker (42 cells; max 2.1%, every clear winner shortlisted, planning 1.1% of cell time against 1.4% saved), where version 1 lost up to 13%. The manifest records the sixteen-round launch; the re-measured shapes' cells come from it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 5, 2026 05:06 — with
GitHub Actions
Active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #844 (stage 1). Stage 2 of the expanded calibration campaign: the shape-lattice recipe, the first new certified execution class (Qwen3.5-35B-A3B, GDN + MoE), two product fixes found by the campaign, and the per-table certificate machinery. Dense controls are still running and will land as follow-up commits or a follow-up PR.
Campaign machinery
dev/trainer_rank_cost_calibration_lattice.sky.yaml: one model over an explicit lattice of (TP, CP, EP[, ETP]) shapes on a 4×H200 node, one torchrun per shape, EP/ETP pinned (the provider defaults EP to the visible GPU count for MoE models), HybridEP built in setup, faulthandler on. Both Ellavox corpora mounted.dev/trainer_rank_cost_calibration_{manifest,certificate}_<table>.json); the manifest names the fixed recipes and/or lattice launches (model, shapes, cell specs) it was run from, and the manifest test expands them into cell keys (EP/ETP suffixes, full-model layer counts) that must equal the manifest. The dense files are renamed; the dense certificate is regenerated against the renamed manifest with the same table hash.integerizerepairs the rounded table on the integer grid only when rounding costs a ranking (it did for the 35B class; the dense table is unchanged);--exclude-cells @manifesttakes exactly the manifest's listed exclusions; per-model, per-shape and per-family gate reports.Product fixes
_configure_hybridep): sized from the near-balanced extent only; cost-aware CP plans can put more rows on one rank (a 2-history Ellavox group at CP4/EP4 planned 12,546 rows against a 7,168-row buffer and failed). Now sized for the busiest rank's planned rows, identical on every rank. Validated on GPU by re-running that cell.New class:
gdn-moe-h2048-h200-bf16(Qwen3.5-35B-A3B)Lattice separating CP from EP: EP1 at CP1/2/4 and TP2, EP2 at CP2/CP4/TP2, EP4 at CP4, on the six synthetic families and the eight Ellavox groups. 88 lattice cells, 15 excluded with reasons (#848 CP1 cells, #851 CP4/EP1 Ellavox cells), 73 certified cells, 3,658 within-cell pairs, 13 odd-Ellavox held-out cells.
The same ten terms fitted to their own table suffice; no expert-parallel term was needed (per-shape gates pass on EP2/EP4). The version-1 fallback this class used before loses up to 35% on the large Ellavox groups at CP2/EP2, and the dense table applied to this class loses up to 14%.
Dense controls: measured, not certified
All three dense controls measured cleanly (70 of 70 cells each, no admission failures) but none passes the gates with the ten terms, and every failure is at CP4 on real data, always driven by the same few Ellavox groups:
Root cause: layouts with near-identical features produce very different context-parallel plans, e.g.
depth_oneon one Ellavox group at CP4 needs four exchange waves with rank loads 7168/3584/1536/790 whileuniform_depth_2needs two waves with 6656/2560/2048/1751, a 25% time difference the O(segments) features cannot express. The dense certificate had no attention-plus-real-data cells at CP4; a targeted check of the certified Qwen3-4B geometry on those groups at TP1 × CP4 shows the shipped dense table has a 35% regret cell there (the version-1 score reaches 15% on another group; neither is adequate). This is documented as a known limitation in the design brief and README.Offline, adding CP-plan-derived features (exchange waves × layers, maximum rank load × layers, derived by running the CP planner per candidate at about 25–40 ms each on CPU) makes the 1.7B class pass every gate (98.1%, max 2.9%) and lifts the 8B held-out gates to passing; a slightly richer per-wave cost model is likely needed to pass every class. That is a planner design change (a CP-plan-aware re-rank of the top candidates after the cheap score) to decide with Codex, not something to slip into this PR. The three dense-control manifests and certificates are parked outside the tree until then; those classes keep the version-1 score. Qwen3.5-27B is still running and will need a follow-up launch for the shapes cut by the pod deadline.
Dense attention classes: certified at their passing shapes (per review)
Following Codex's review of the CP4 blind spot, the three attention controls ship as shape-restricted tables and the dense table withholds one pair:
dense-attn-h2048-h200-bf16dense-attn-h4096-h200-bf16dense-attn-h5120-h200-bf16CalibratedTable.withheld: measured, fitted, not admitted pairs. The dense table withholds Qwen3-4B × TP1×CP4 (35% worst cell vs version 1's 15%); its coefficients and certificate hash are unchanged, and the manifest records the 16-cell real-data blind-spot launch as excluded evidence. The certificate test binds withheld pairs to the manifest.Two-stage selection at CP4 and the CP search speedup
_evaluate_plans): the search's plan evaluator prices a batch of candidate moves in one vectorized numpy pass, results identical to the previous evaluator on all 446 real calibration candidates (the old evaluator is the reference intests/unit/test_context_parallel_plan_evaluation.py). Median 18.3 ms → 4.1 ms per packed row, also on the production plan-build path of every CP>1 micro-batch.ReRanker+CalibratedTable.reranked_shapes; on TP1×CP4 the attention tables' ten-term score shortlists 3 layouts (+ depth-one anchor) and the plan structure (remote waves, max rank tokens viasummarize_prefix_tree_plan) selects. Certified per class (certificatererankerblock, recomputed by the certificate test):automaticrows, 14 CP4 cells per class, 4× H200; the harness-recorded plan structure and version-1 scores matched the certificates' features on all 124 candidates per class):Before this change the same cells cost the shipped/version-1 selection up to 26% (1.7B), 14% (8B) and 17% (14B).
Fourth class:
attn-moe-h2048-h200-bf16(Qwen3-30B-A3B)112 cells over the EP-deconfounding lattice (3 CP1 cells fail the #848 memory admission; no #851 segfaults on this model). The eight-round timings of CP2 (EP1/EP2) and CP4 (EP1/EP4) carried sporadic 10–20 s stalls on ~4% of rounds, so those shapes were re-measured with sixteen rounds (stalls persist at ~4% but shrink to ~2×; medians hold). Admitted directly at TP1×CP1, TP1×CP2 (EP1/EP2), TP2×CP1 (EP1/EP2) (67 cells, 96.3% pairwise, max 2.2%) and at TP1×CP4 with EP1/EP2/EP4 through the re-ranker (42 cells, max 2.1%, every clear winner shortlisted, planning 1.1% of cell time vs 1.4% saved); version 1 lost up to 13% at CP4 on this class.
Fifth class:
dense-gdn-h5120-h200-bf16(Qwen3.5-27B)70 cells over TP1×CP1/2/4, TP2×CP1, TP2×CP2 (4 CP1/CP2 cells incomplete under the #848 memory admission, 1 TP2×CP2 cell lost to an NCCL timeout). Clean timings; the ten terms rank this GDN class at CP4 (like the 35B GDN-MoE class), so no re-ranker: admitted at CP1, CP2, CP4, TP2 (52 cells; 97.0% pairwise, max regret 3.4%, held-out 1.8%). TP2×CP2 fails its gates marginally (p95 5.1%) and stays on version 1. Version 1 was worst here: on the largest Ellavox group at CP4 it picked a layout 112% slower than the best (4,084 ms vs 1,927 ms).