Repository navigation
Stack: lever inventory, composed engine and the composition plan for tuned DFlash - #138
Conversation
… analysis experiments/stack builds the composed SGLang engine (drafter, moonshot, backbone, kernel, hostgap and repair series on the pin, every switch off; the tree is checked), defines the timed arms as overrides of bench's dflash-tuned-b16, runs the output equality and the session-paired timing holds, and derives the floors and the tokens per cycle the 5x goal needs. engine/sglang/patches/stack holds kernel 0002 and 0003 rebased onto the drafter and moonshot series (two conflicts in dflash_worker_v2.py).
…ived ceilings evidence/stack/levers.csv lists every lever measured so far at c=1-8 on tuned DFlash and at c=32-128 on tuned plain decoding, with its evidence kind, n, exactness class, engine series and blocker. evidence/stack/README.md records the composed engine and declares the composition plan (arms, equality first, A-B-B-A sessions, statistics, decision rule, expected result) before any stack hold has run. ceiling.json derives the bandwidth floor of a block-16 cycle and the tokens per cycle 5x would need.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
equality_gate.py applies the declared step-1 decisions (B0 bitwise to S0, lossy levers dropped, the certified head only with identical tokens and no check-mode mismatch) and writes gate.json; hold_session.sh builds FULL and the middle arms from it, and arm names are any combination of the lever letters.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 794f983980
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| python experiments/state_safety/run_matrix.py --passes c1 --port 30062 --out-dir "$RUNS" \ | ||
| --no-pin --configs plain --tag "$tag" --top-logprobs "$logprobs" "--extra-flags=$flags" | ||
| echo "exit $? $(date -Is)" |
There was a problem hiding this comment.
Propagate equality-run failures
If run_matrix.py fails because an arm cannot launch or complete, this following echo becomes the subshell's successful exit status, and the script has no errexit. The hold therefore continues and ultimately exits zero; equality_pairs.py then silently omits pairs whose output is absent, so even the required B0-vs-S0 correctness gate can appear to complete without being tested. Preserve the Python status and make a mandatory equality-run failure fail the hold.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
| got = {a: cell.get(a) for a in ('B0', 'F', 'G', 'FG')} | ||
| if all(v and len(v) >= 1 for v in got.values()): |
There was a problem hiding this comment.
Drop interactions touched by invalid duplicate launches
When H is absent, FG is FULL and has two launches per session. If either FG point is marked invalid, loading removes only that row; the remaining launch still satisfies this len(v) >= 1 condition, so the session is excluded from the primary FG ratio but remains in interaction_FG. This contradicts the declared rule that an invalid point removes that session for the arm and can bias the composition result; interaction eligibility must reject sessions with any invalid B0/F/G/FG point.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e221772: the interaction now uses a session only if every launch of B0, F, G and FG at that concurrency is valid (two launches for the full stack), matching the declared rule; test_interaction_skips_a_session_with_one_invalid_full_launch covers it.
…fully valid sessions Codex on 794f983: run_eq now returns the runner's status and the hold exits non-zero when any equality run failed (the gate already fails without B0 or S0); the F-G interaction uses a session only if every launch of B0, F, G and FG is valid there.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e221772db3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gate['classes'][lever] = lever_class(pairs, lever) | ||
| timed = [x for x in ('F', 'G') if gate['classes'][x] in ('bitwise', 'exact-up-to-rounding')] | ||
| if gate['classes']['FG'] == 'lossy': | ||
| timed = [x for x in timed if gate['classes'][x] == 'bitwise'] or timed[:1] |
There was a problem hiding this comment.
Reject a lossy combined arm before timing it
When F and G are each bitwise but their combined FG run is classified lossy, this filter retains both entries, so hold_session.sh concatenates them back into FG and times the known-lossy combination as FULL. The lossy-combination branch must keep at most one independently validated arm, rather than retaining every individually bitwise arm.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: if FG is not exact (lossy or missing), equality_gate keeps one lever only (F, or G if F did not pass), so the sessions never time the combination as FULL. Test: test_equality_gate_fg_lossy_keeps_one_lever_and_h_needs_explicit_zero.
| python experiments/state_safety/compare.py --runs "$RUNS" --pairs "$OUT/pairs.json" \ | ||
| --out-json "$OUT/summary.json" --out-csv "$OUT/divergences.csv" --out-table "$OUT/table.csv" \ | ||
| --out-meta "$OUT/meta.json" > "$OUT/compare.log" 2>&1 | ||
| echo "compare exit $?" | ||
| python experiments/stack/equality_gate.py "$OUT" |
There was a problem hiding this comment.
Propagate comparison and gate failures
If compare.py or equality_gate.py fails while the equality runs themselves succeeded, this subshell's failure is ignored and the script's final failed check returns success. Because previous summary.json and gate.json files are not removed, a failed comparison can even regenerate or leave a passing gate from stale results, allowing timed sessions to proceed without the current equality comparison.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: the hold deletes summary.json, gate.json and the other comparison outputs at start, records pairs/compare/gate failures in the same failure list as the runs (no gate is written if compare fails), and exits non-zero if anything failed.
| certified_mismatches(args.equality_dir / f'certified_stats_{n}.json') for n in ('H', 'FGH') | ||
| ] | ||
| gate['certified'] = { | ||
| 'tokens_identical': bool(h and fgh) and h['diverged'] == 0 and fgh['diverged'] == 0, |
There was a problem hiding this comment.
Include length mismatches in certified-head equality
When an H or FGH run produces the same token prefix as its reference but stops at a different length, compare.py reports diverged == 0 with a positive length_mismatch; this condition still marks the runs token-identical and enables H. Use the full equality predicate for both pairs so a truncated or extended output cannot pass the certified-head gate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: the certified-head pairs use identical_tokens (all 320 prompts, no divergence, no length mismatch).
| if gate['certified']['tokens_identical'] and all(m in (0, None) for m in mism): | ||
| timed.append('H') |
There was a problem hiding this comment.
Require explicit zero check-mode mismatches
If either certified-head stats file is absent, malformed with respect to the expected counter names, or contains no mismatch/difference counter, certified_mismatches() returns None, which this condition treats exactly like a verified zero. Equal token outputs can therefore enable H even when check mode never demonstrated that the certified head ran without differing rows; require an explicit zero result from both stats files.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: certified_check requires each stats file to exist with a verify path whose rows > 0 and mismatch_rows == 0 exactly; a missing file or counter fails H.
| def bitwise(pair: dict[str, Any]) -> bool: | ||
| return pair['diverged'] == 0 and pair['length_mismatch'] == 0 and pair['drift_max'] == 0 |
There was a problem hiding this comment.
Verify all 320 prompts before declaring bitwise equality
The comparator summarizes only prompt IDs present in both files, but this predicate never checks the summary's prompts count. In particular, an interrupted write can leave a nonempty partial JSONL that run_eq skips on retry, after which a matching subset is accepted as bitwise even though the declared 320-prompt gate was not run completely.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: every comparison must cover 320 prompts (complete()); fewer counts as missing, so B0-vs-S0 cannot pass on a subset. run_eq also skips a configuration only when the runner's c1.meta.json exists (written after the pass completes), so a partial JSONL is redone.
| python -m bench.sweep "${args[@]}" --label "stack-$name" --session "stack-s$k" --out "$OUT" \ | ||
| --port 30061 --osl 512 --quiet-cpu-wait 300 --concurrency 1 2 4 8 2>&1 | | ||
| grep -E '^r0|FAIL|[Ee]rror|refus' | tail -8 | ||
| echo "exit ${PIPESTATUS[0]} $(date -Is)" |
There was a problem hiding this comment.
Return failure when a timed sweep fails
When any bench.sweep launch or point fails, its pipeline status is only printed and the loop continues; the final echo then makes the session script exit zero. The scheduler can consequently treat an incomplete timed session as successful, leaving missing arm/concurrency points and no reliable signal that another session must be run; collect the sweep failures while still running the closing arms and return nonzero afterward.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 77d83e6: hold_session.sh collects every sweep's exit status, still runs the closing FULL and S0, and exits non-zero if any sweep failed.
Codex on e221772: a lossy FG keeps one lever only; comparisons must cover all 320 prompts; the certified head needs identical tokens and lengths and explicit zero mismatch_rows in both check-mode statistics; stale summary and gate files are removed and compare or gate failures fail the hold; a partial equality run is redone; a failed timed sweep makes the session exit non-zero after the closing arms. README states the added rules and names the certified-head package commit (kernel/engine-combined 01502cc).
|
Verdict: REQUEST CHANGES Review of the exact head e221772. The plan's structure is good:
The derived ceilings check by hand:
Blocking
Notes (non-blocking)
|
|
@codex review |
|
Verdict: REQUEST CHANGES (update for 77d83e6, which landed while I was posting the review of e221772) 77d83e6 resolves blocking item 3. All six Codex comments on e221772 have replies and fixes, and
Blocking items 1 (inventory numbers whose only evidence is in #45, #52 and #133; D3's bandwidth constant) and 2 (the declared FULL range must reproduce from stated inputs and a stated formula) still stand on 77d83e6. |
expected.py computes each lever's time saving per cycle (F from the state bytes it removes at 3.79 TB/s, less moonshot's measured no-snapshot verify slowdown at the low end; G from make_table's own microbenchmark decisions at the verify and draft row counts) and the expected ratio T / (T - sum of savings); the certified head is left out because its inputs are only on unmerged PRs.
…ed.json Review on e221772: inventory numbers whose only evidence is on unmerged PRs (#45 and #52 for the certified head, #133 for the fold's exactness) are marked pending; the fold's bytes use 3.79 TB/s; the declared expected ranges now follow from expected.py's stated model (FULL = FG: 0.97-1.07x at c = 1, 1.15-1.22x at c = 8), with the certified head left out. No stack hold has run, so this is part of the declaration.
|
@codex review |
|
Verdict: APPROVE (provisional, on da3b13c: Codex is still running on this head. I will confirm or withdraw once it finishes.) Re-review of e0a44e4 and da3b13c. No stack hold has run, so these changes are part of the declaration.
Suggestion (non-blocking). The D5 row is labelled pending but still quotes the open PR's microbenchmark numbers ("about 205 us ..."). Since nothing uses them now, "pending (#45, #52)" alone would keep the inventory free of unmerged numbers. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da3b13c367
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| own['classes'].get(k, 0) for k in LOSSY | ||
| ): | ||
| return 'lossy' | ||
| return 'bitwise' if bitwise(own) else 'exact-up-to-rounding' |
There was a problem hiding this comment.
Reject lever comparisons with output-length mismatches
When F, G, or FG produces the same prefix but stops at a different length, compare.py reports a positive length_mismatch without adding a large or not_argmax class. This fallback therefore labels the lever exact-up-to-rounding and permits it in timed sessions even though the comparator identifies this case as a finish bug. Require zero length mismatches in both the stock and B0 comparisons before returning an exact class.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 47e6fbf: lever_class returns 'length-mismatch' (not timed) when either the stock or the B0 comparison has any length mismatch. Test: test_gate_length_mismatch_blocks_a_lever_and_h_needs_a_package.
| if [ -z "${STACK_CERT_SRC:-}" ]; then | ||
| mapfile -t levers < <(printf '%s\n' "${levers[@]}" | grep -v '^H$') | ||
| fi |
There was a problem hiding this comment.
Bind timed H runs to the package that passed equality
If STACK_CERT_SRC points to a different checkout, or its contents change between the equality hold and a timed session, this check only verifies that the variable is nonempty and retains H from the old gate. arm_args then loads the current package, so the session can measure certified-head code that never produced the recorded token and check-mode results. Record a package revision or content fingerprint in the equality gate and require the session's source to match it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 47e6fbf: the equality hold passes --cert-src, the gate records package_sha256 (SHA-256 over every file of the certified_head package) and times H only when it is recorded; hold_session.sh recomputes the fingerprint of STACK_CERT_SRC and exits if it differs.
| {'session': r['session'], 'arm': arm, 'c': str(c), 'reason': r['invalid_reason']} | ||
| ) | ||
| touched.add((r['session'], c, arm)) | ||
| continue |
There was a problem hiding this comment.
Preserve configurations whose points are all invalid
When every launch of an arm, or every point at a concurrency, is invalid, this continue prevents that arm/concurrency from entering data; the sets on lines 94-95 are then derived only from surviving rows, so the output omits the required entry instead of reporting n: 0. In particular, an entirely invalid FULL at c=8 can disappear from the analysis rather than exposing that another session is required. Build the arm and concurrency domains from all loaded stack rows before filtering invalid measurements.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 47e6fbf: arm and concurrency domains come from every loaded row before invalid points are dropped, so an all-invalid FULL at a concurrency is reported with n = 0. Test: test_all_invalid_full_stays_visible_with_n_zero.
| busy = sum(med[p] for p in PHASES) | ||
| out['by_batch'][str(bs)] = { | ||
| 'cycles': len(rows), | ||
| 'median_us': {k: round(v, 1) for k, v in med.items()}, | ||
| 'idle_median_us': round(med['period_us'] - busy, 1), |
There was a problem hiding this comment.
Compute the median of per-cycle idle time
For variable cycles, median(period) - sum(median(phase)) is not the median of period - sum(phases) and can combine phase values from different cycles, substantially biasing or even making idle_median_us negative. Since the diagnostic defines idle per cycle, calculate each row's idle first and then take its median.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 47e6fbf: idle is computed per cycle (period minus that cycle's phases) and then summarized by its median. Test: test_idle_is_the_median_of_per_cycle_idle.
|
Verdict: REQUEST CHANGES (withdraws my provisional approval of da3b13c) Codex finished on da3b13c with four inline comments. Each is valid, and none has a reply yet:
Since no stack hold has run, these fixes are still part of the declaration. Everything else from my review of da3b13c stands. |
…assed; analysis keeps all-invalid entries; per-cycle idle Codex on da3b13c: a lever with any output-length mismatch is not exact; the gate records a SHA-256 of the certified_head package and hold_session.sh refuses to time H with any other; analyze.py builds its arm and concurrency domains from every row, so an all-invalid FULL point shows n = 0; phases.py takes the median of per-cycle idle.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47e6fbfe78
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # The runner writes c1.meta.json after the pass completes; a partial run is redone. | ||
| [ -s "$RUNS/plain__$tag/c1.meta.json" ] && { echo "skip $tag (complete)"; return 0; } |
There was a problem hiding this comment.
Invalidate cached H runs when its package changes
When hold_equality.sh is rerun in the same output directory with a changed STACK_CERT_SRC, this early return reuses the old H_tokens/FGH_tokens outputs and check-mode statistics because their fixed tags still have c1.meta.json. The gate then fingerprints the new source at line 101, falsely recording that the new package produced the cached results and allowing sessions to time untested code. Fresh evidence after the package-fingerprint fix is that the cache key is still independent of that fingerprint; either rerun these configurations when the package hash changes or persist and verify the hash alongside their metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2abe821 by removing the cache: every equality hold now writes a fresh timestamped directory and reruns every configuration, so no run (H or otherwise) is ever reused. The sessions read the gate behind ~/vp-data/stack/equality/current, which is set only when every equality run, the comparison and the gate succeeded in that hold.
| if ( | ||
| gate['certified']['tokens_identical'] | ||
| and all(c['ok'] for c in checks) | ||
| and 'package_sha256' in gate['certified'] | ||
| ): | ||
| timed.append('H') |
There was a problem hiding this comment.
Gate the actual H combination before timing it
When FG fails equality but one of F/G passes, lines 107-108 retain a single lever and this append produces ['F', 'H'] or ['G', 'H']; hold_session.sh consequently times FH or GH as FULL. Equality only ran H over B0 and FGH over FG, so neither resulting FULL arm was tested on all 320 prompts, and the check counters likewise cover different trajectories. Require equality for the retained-lever-plus-H arm, or omit H whenever FG is rejected.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2abe821 by making the gate all-or-nothing: sessions run only if B0 is bitwise to S0 and F, G and FG each pass; there is no partial composition (FH or GH) any more, and a different composition needs a dated amendment. H joins only FG, whose FGH run it was checked on. Test: test_equality_gate_is_all_or_nothing.
| + # Certified LM head: the stock argmax's tokens, computed without logits. | ||
| + target_predict = certified_head.take_ids(logits_output) | ||
| + if target_predict is None: | ||
| + target_predict = torch.argmax(next_token_logits, dim=-1) |
There was a problem hiding this comment.
Reject relaxed EAGLE verification with certified IDs
With SGLANG_CERTIFIED_HEAD_VERIFY=1, SGLANG_SPEC_RELAXED_GREEDY_LOGIT_GAP>0, and an EAGLE/MTP top-1 tree, this consumes certified IDs even though the immediately following relaxed-acceptance branch still reads next_token_logits. Those logits are explicitly stale when certified IDs are present, so the relaxed decision can use data from an earlier replay and accept incorrect tokens. The DFlash path added in this same patch rejects this combination; the EAGLE path needs the same guard or must make _verify_needs_logits disable certification.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2abe821 with a new engine patch, engine/sglang/patches/stack/0003: the EAGLE/MTP chain path raises when SGLANG_SPEC_RELAXED_GREEDY_LOGIT_GAP > 0 meets certified verify ids, as the DFlash path does. It is a separate patch at the end of the series (certified_ids exists only after kernel 0004); the composed tree is now 628f650ea0, recorded once in arms.sh and checked by build_engine.sh and every hold.
| python -m bench.sweep "${args[@]}" --env "SGLANG_REPAIR_TIMING_LOG=$OUT/phases_$name.jsonl" \ | ||
| --label "stack-phases-$name" --session stack-diag --out "$HOME/vp-data/stack/diag" \ | ||
| --port 30061 --osl 512 --quiet-cpu-wait 300 --concurrency 1 8 2>&1 | tail -4 |
There was a problem hiding this comment.
Propagate phase-diagnostic sweep failures
If either declared B0/FG phase sweep fails, its pipeline status is not collected and the loop continues; after the subshell, the final status depends only on equality failures. Thus the step-1 hold can exit successfully without one or both phase diagnostics, even though those diagnostics are required to investigate results outside the declared expected range. Record these pipeline failures in failed just like the equality runs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2abe821: each phase sweep's exit status is collected into the failure list, and the hold exits non-zero if either fails (the gate link is set before the diagnostic, so a failed diagnostic does not block sessions but is reported).
…ed-rule guard Codex on 47e6fbf, and a simpler rule that removes the partial-composition cases: the sessions run only if B0 is bitwise to S0 and F, G and FG are each exact (all 320 prompts, no length mismatch); otherwise a dated amendment decides. H joins FG only with identical tokens and lengths, explicit zero check-mode mismatches and a recorded package fingerprint. Each equality hold writes a fresh directory and reuses no run, and the sessions read the gate behind the 'current' link, set only when every equality step succeeded; phase-diagnostic failures make the hold exit non-zero. New engine patch stack/0003 refuses moonshot's relaxed EAGLE acceptance with the certified head (tree 628f650ea0, kept in one place: arms.sh STACK_TREE).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2abe821594
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| exec >>"$LOG" 2>&1 | ||
| [ "$(git -C "$STACK_ENGINE" rev-parse 'HEAD^{tree}')" = "$STACK_TREE" ] || | ||
| { echo "composed engine tree is not the declared one"; exit 1; } | ||
| stack_table |
There was a problem hiding this comment.
Bind the timed routing table to the equality gate
If make_table.py or evidence/backbone/gemm_microbench.json changes after the equality hold, this rebuilds STACK_TABLE and times a different G configuration from the one that passed equality. The table hash is only logged and is neither stored in gate.json nor checked, so sessions can report results for an untested routing table; record the equality table's full hash and reject a timed session when the rebuilt table differs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ed0b59: the equality hold builds the routing table once, in its own run directory, and the gate records its SHA-256 (the gate fails without it). Sessions and the oracle no longer rebuild it: use_gate_table points STACK_TABLE at the table behind the current gate and refuses a file whose hash differs; lever arguments are now built when called, so they always carry that path.
| python experiments/stack/analyze.py --points ~/vp-data/stack/pareto/points.csv --full FG \ | ||
| --out evidence/stack/composition.json --csv evidence/stack/composition.csv |
There was a problem hiding this comment.
Analyze the full arm selected by the gate
When the certified-head checks pass, hold_session.sh labels the full arm FGH, but this documented command still passes --full FG. The analyzer then expects two FG launches and one FGH launch, while the sessions contain one FG and two FGH launches, so both arms receive n: 0 and the headline comparison disappears. Derive the full name from gate.json or make this command conditional on whether H was admitted.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ed0b59: analyze.py takes --gate and uses the gate's timed levers as the full arm (FG, or FGH when H passed); the README command uses --gate. Test: test_analysis_takes_the_full_arm_from_the_gate.
| 'tokens_identical': identical_tokens(pairs.get('H tokens vs B0 tokens')) | ||
| and identical_tokens(pairs.get('FGH tokens vs FG')), |
There was a problem hiding this comment.
Require B0 token-only equivalence before enabling H
When the token-only B0 run differs from the top-logprob B0 run, this predicate can still enable H because it checks H tokens vs B0 tokens but ignores the already-generated B0 tokens vs B0 pair. In that case H is certified against an alternate trajectory rather than the B0 trajectory used by the rest of the equality gate; include that pair in tokens_identical so changing the request mode cannot silently redefine the reference.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ed0b59: H's tokens_identical now also requires 'B0 tokens vs B0' (the tokens-only B0 run reproducing the logprob B0 run) on all 320 prompts. Covered in test_certified_head_needs_tokens_counters_and_package.
| python -m bench.sweep "${args[@]}" --set "speculative-dflash-block-size=$B" \ | ||
| --set max-running-requests=4 --set max-mamba-cache-size=4 --max-concurrency 4 \ | ||
| --env "SGLANG_SIMULATE_ACC_LEN=$B" --env "SGLANG_REPAIR_TIMING_LOG=$OUT/phases_b$B.jsonl" \ | ||
| --label "stack-oracle-b$B" --session stack-oracle --out "$OUT/runs" --port 30061 --osl 512 \ | ||
| --quiet-cpu-wait 300 --concurrency 1 2>&1 | grep -E '^r0|FAIL|[Ee]rror' | tail -4 |
There was a problem hiding this comment.
Return failure when an oracle sweep fails
If any B=16/32/64 bench.sweep launch or point fails, the pipeline status is discarded and the final echo makes this diagnostic exit successfully. This can leave an incomplete perfect-block oracle with no scheduler-visible indication that it must be rerun; collect PIPESTATUS[0] for each sweep and return nonzero after attempting all widths when any failed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0ed0b59: hold_oracle.sh collects each width's sweep status, attempts all three widths, and exits non-zero if any failed.
… tokens check; oracle failures Codex on 2abe821: the equality hold builds the routing table once in its own directory and the gate records its SHA-256 (no table, no gate); sessions and the oracle use that file and refuse another (use_gate_table), with lever arguments built when called. analyze.py takes the full arm from gate.json (--gate). H also needs the tokens-only B0 run to reproduce the logprob B0 run. hold_oracle.sh exits non-zero if any width failed.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ed0b59837
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| g = json.load(open(sys.argv[1])) | ||
| if not g['ok']: | ||
| sys.exit('equality gate not passed: ' + json.dumps(g)) | ||
| print('\\n'.join(g['timed_levers']))" "$GATE") || exit 1 |
There was a problem hiding this comment.
Capture the gate reader's exit status
When gate.json has ok: false but still contains a valid table hash, the Python process exits nonzero here, but mapfile returns its own successful status because the reader runs in process substitution. The || exit 1 therefore does not fire, levers is empty, and the script proceeds to launch a blank FULL arm instead of enforcing the equality gate. Capture the Python output/status before populating the array.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8deed83: the gate is now read only through equality_gate.py check, called via gate_plan in arms.sh as plan=$(python ... check ...) || return 1, so its exit status is the hold's; check fails on ok:false (and on any other unmet precondition) before a server starts. Arm arguments are read the same way (text=$(arm_args X) || fail; mapfile <<< "$text") at all three sites.
| if [ -z "${STACK_CERT_SRC:-}" ]; then | ||
| mapfile -t levers < <(printf '%s\n' "${levers[@]}" | grep -v '^H$') |
There was a problem hiding this comment.
Refuse sessions missing the certified package
When the current gate admits H but a session is started without STACK_CERT_SRC, this silently removes H and times FG as FULL. The analyzer derives FULL from the same gate as FGH, so it expects two FGH launches and treats the two FG launches as an invalid count; different sessions can also measure different compositions depending on their environment. A gate containing H should require the matching package rather than changing the gated arm.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8deed83: check raises when the gate includes H and no certified_head package is named (or a different one is), so the session refuses to start instead of timing FG. Test: test_gate_check_refuses_changed_files_and_missing_package.
| def exact(pair: dict[str, Any] | None) -> bool: | ||
| return pair is not None and usable(pair) and not any(pair['classes'].get(k, 0) for k in LOSSY) |
There was a problem hiding this comment.
Reject unclassified divergence events
If a prompt diverges at a position where either run lacks the requested top-logprob entry, compare.py classifies that event as unknown. This predicate rejects only large and not_argmax, so a comparison containing unknown divergences is admitted as exact-up-to-rounding even though no rounding explanation was established. Require every divergence class to be one of the allowed exact classes (tie, one_ulp, or near).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8deed83: exact() is an allow-list: every divergence class must be tie, one_ulp or near, and the class counts must sum to the divergences, so unknown or unclassified events fail. Tests: test_gate_check_refuses_every_failed_equality (_unknown, _unclassified cases).
|
Verdict: REQUEST CHANGES (0ed0b59, 3 blocking) Review of 47e6fbf, 2abe821 and 0ed0b59 against my review of da3b13c. No stack hold has run, so all of this is still declaration. Blocking: the three Codex comments on 0ed0b59 are valid.
Checked and fine in the delta:
The tests and pre-commit on da3b13c..0ed0b59 are deferred, because an exclusive hold is running. I will run them on the fix head. |
|
@codex review |
|
Verdict: APPROVE (provisional, on 8126e93: Codex has not reviewed this head yet. I will confirm or withdraw once it does.) 8126e93 resolves Codex's three P1s on eeeacf3 with a single identity record.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8126e9383a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| launch['sglang_dirty'] != 'False' | ||
| or launch['sglang_head'] != engine['head'] | ||
| or launch['repo_head'] != ident['repo']['head'] |
There was a problem hiding this comment.
Reject timed launches from a dirty repository
If a tracked repository file is modified after gate_plan finishes but before or during this roughly 45-minute session, bench.server records that dirtiness in the launch manifest, yet bench.pareto drops it from launches.csv and this check validates only repo_head. The analyzer therefore accepts measurements produced by undeclared harness, arm, or workload code as long as HEAD is unchanged; propagate the repository dirty state into the launch summary and reject it here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e6e3846 by reading the manifests directly: analyze.py now opens each row's ///server/launch.json and refuses the run unless repo.head is the gate's repository commit with repo.dirty_files empty and sglang_source.head is the gate's engine commit (S0's checkout for stack-S0, the composed worktree otherwise) with sglang_source.dirty_files empty; --launches is gone. hold_session.sh also repeats the gate check (identity included) at the end of the session. Test: test_analysis_refuses_runs_on_other_engines (repo dirty, repo head, engine dirty, engine head, missing manifest).
| if n >= 2: | ||
| half = T95[n - 1] * statistics.stdev(logs) / math.sqrt(n) | ||
| lo, hi = mean - half, mean + half # decide on the unrounded log bounds | ||
| if lo > 0: | ||
| out['decision'] = 'speedup' |
There was a problem hiding this comment.
Withhold headline decisions until three sessions remain
When one of the three planned FULL/S0 cells is invalid, this emits a categorical speedup or slowdown from only two sessions. That conflicts with the declared procedure that fewer than three valid FULL comparisons at any concurrency requires another session, so an incomplete campaign can be reported as a final headline result; require at least three valid FULL/S0 sessions before emitting its decision or report the campaign as incomplete.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e6e3846: interval() withholds the decision below MIN_SESSIONS = 3 valid sessions ('incomplete (n < 3)'); the docstring and README say another session is then required. Test: test_decision_is_withheld_below_three_sessions.
| def runs_provenance(run: Path, ident: dict[str, Any]) -> list[str]: | ||
| """Each stack equality run's own record names the identity's engine, clean.""" | ||
| problems = [] | ||
| for meta_path in sorted((run / 'runs').glob('plain__stack_*/c1.meta.json')): |
There was a problem hiding this comment.
Validate provenance for the reused stock references
When either ~/vp-data/bench/equality reference was produced from another or dirty SGLang checkout, this loop ignores its c1.meta.json because it only scans plain__stack_*. Those externally reused runs determine every lever's required vs bench stock b16 classification, so the gate can accept or reject the campaign using an undeclared reference while still reporting no provenance problems; validate the metadata behind both ref_dflash_b16 symlinks against the pinned stock identity as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e6e3846: runs_provenance() also checks both reused references (ref_dflash_b16, ref_dflash_b16_triton): their c1.meta.json must name the pinned stock commit (the identity's S0 head), clean, and S0's model revision; a missing record fails. The gate records the references' c1.jsonl SHA-256. Bench's actual reference runs pass (bd66ce343e, clean, 851bf6e8). Test: test_build_checks_the_reused_stock_references.
|
Verdict: REQUEST CHANGES (8126e93; withdraws my provisional approval. Codex's three new comments are valid.)
|
…e sessions, references checked Codex on 8126e93: analyze.py now reads each run's server/launch.json (bench drops the repository's dirty state from launches.csv) and refuses a run launched from another or a dirty repository or on another or a dirty engine; hold_session.sh repeats the gate check at the end of a session. interval() withholds the decision ('incomplete') with fewer than three valid sessions, as the plan declares. The equality gate checks bench's two reused stock references (pinned stock commit, clean, S0's model revision) and records their outputs' SHA-256. A test for each (65 pass).
|
@codex review |
|
Verdict: APPROVE (provisional, on e6e3846: Codex has not reviewed this head yet. I will confirm or withdraw once it does.) e6e3846 resolves the three comments on 8126e93.
Checks. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6e384637e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cd "$repo" || exit 1 | ||
| [ "$#" -eq 1 ] || { echo "usage: $0 <session number>" >&2; exit 64; } | ||
| k=$1 | ||
| unset SGLANG_WORKTREE PYTHONPATH |
There was a problem hiding this comment.
Clear inherited SGLang switches before timing
When the caller's shell already exports an experimental variable such as SGLANG_SIMULATE_ACC_LEN=16, this only clears the worktree variables, and bench.server.Server.environment() copies the rest of os.environ into every server. The session can therefore measure forced acceptance or another undeclared lever while the gate and launch-provenance checks still pass, because neither records or validates ambient variables. Start each hold from a sanitized SGLang environment or reject unexpected experiment switches.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 64b5f27: arms.sh clears every SGLANG_, TORCH_, PYTORCH_, TRITON_, FLASHINFER_, NCCL_ and CUDA_* variable (except CUDA_HOME, which sglang_env.sh sets) before any server starts, so each server sees only its arm's declared variables. The identity in gate.json records the remaining set (engine_env), require_clean refuses any other variable, every hold's preflight/check compares it, and each session writes it beside every run (stack_env.json). analyze.py refuses a server whose launch env_overrides are not exactly its arm's declared variables (with the gate's routing table), whose fold flag does not match, or whose recorded ambient environment differs. Tests: test_arms_sh_clears_engine_variables, test_require_clean_refuses_ambient_engine_variables, test_analysis_refuses_servers_outside_the_declared_arm (7 cases).
| ) | ||
| if model is None or meta.get('model_revision') != model: | ||
| problems.append(f'{ref}: model {meta.get("model_revision")}, S0 ran {model}') | ||
| for meta_path in sorted((run / 'runs').glob('plain__stack_*/c1.meta.json')): |
There was a problem hiding this comment.
Require metadata for every equality run
When an expected run such as F, G, FG, or an admitted H run retains its c1.jsonl but loses c1.meta.json, the pair comparison can still pass while this glob silently omits that run; the final guard rejects only when all stack metadata is absent. The gate can consequently certify outputs without proving which engine or repository produced them, so validate the complete expected metadata set rather than only the records that happen to exist.
AGENTS.md reference: AGENTS.md:L7-L9
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 64b5f27 by checking against the declared plan rather than the files present: hold_equality.sh writes each declared run (engine, flags, logprobs, lever variables) to plan.jsonl; runs_provenance requires exactly the declared set (S0, B0, F, G, FG, and all or none of the three certified-head runs), a c1.meta.json for every declared run whose flags, top-logprobs, prompt count, pass, concurrency and model revision match, and no undeclared run directory. Test: test_build_validates_every_declared_equality_run (7 cases: declared run missing, record missing, extra run, flags, prompt count, lever environment, partial certified-head set).
| if n >= 2: | ||
| half = T95[n - 1] * statistics.stdev(logs) / math.sqrt(n) | ||
| lo, hi = mean - half, mean + half # decide on the unrounded log bounds | ||
| if n < MIN_SESSIONS: | ||
| out['decision'] = f'incomplete (n < {MIN_SESSIONS})' |
There was a problem hiding this comment.
Mark a single valid session as incomplete
When two planned sessions are invalid at a concurrency and only one valid ratio remains, the n >= 2 guard bypasses the new incomplete-decision branch, leaving a reported ratio with no decision field instead of the declared incomplete (n < 3) status. Fresh evidence after the prior incomplete-decision fix is that its guard covers n=2 but not n=1; handle the minimum-session check before attempting to calculate a confidence interval.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 64b5f27: interval() sets the 'incomplete (n < 3)' decision before computing any interval, so n = 0, 1 and 2 are all incomplete (bounds are still shown for n = 2, for display). Test: test_decision_incomplete_for_n_below_three (n = 0, 1, 2).
|
Verdict: REQUEST CHANGES (e6e3846; withdraws my provisional approval. Codex's three new comments are valid.)
|
…red and recorded Codex on e6e3846 and an audit of every input each step consumes (self-review 'Partial inputs'): holds clear SGLANG_*, TORCH_*, PYTORCH_*, TRITON_*, FLASHINFER_*, NCCL_* and CUDA_* (except CUDA_HOME) before any server starts, the identity records what remains and every hold and gate check requires it unchanged, and each session records it beside every run. The equality hold writes its declared runs (plan.jsonl); the gate requires that exact set, a record for each declared run with the declared flags, logprobs, prompt count, pass and model revision, and no undeclared run. analyze.py accepts only declared arms, concurrencies and session names, refuses a server whose environment overrides, fold flag or ambient environment differ from the declared arm, and withholds the decision below three sessions including n = 0 and 1. expected.py records its inputs' SHA-256. Table-driven tests for missing, extra and n = 0/1/2 cases (87 pass).
… inputs expected.json regenerated at 64b5f27: only repo_commit and the new input hashes change; every expected ratio is the same.
|
@codex review |
|
Verdict: APPROVE (provisional, on 8f42ca0: Codex has not reviewed this head yet. I will confirm or withdraw once it does.) 64b5f27 and 8f42ca0 resolve the three comments on e6e3846.
Checks. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f42ca051f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def identity(repo: Path, s0: Path, stack_engine: Path) -> dict[str, Any]: | ||
| """What a timed run's numbers depend on outside the gate's own files.""" | ||
| return { | ||
| 'repo': tree_state(repo, None), |
There was a problem hiding this comment.
Reject untracked code in the experiment repository
Fresh evidence beyond the earlier tracked-file check is that tree_state(repo, None) deliberately ignores every untracked repository file, while the launch manifest also uses --untracked-files=no. An untracked root sitecustomize.py, for example, is automatically imported by the Python processes running the holds and can alter all measurements, yet the gate and analyzer still regard the repository as clean. Reject untracked executable/importable repository files, or all untracked files, before certifying a campaign.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d8189ae: the repository's identity now uses tree_state(repo, '.'), which lists every untracked file outside .gitignore (git status --porcelain --untracked-files=all) as well as tracked changes, so preflight, build and every session's start and end check refuse a stray sitecustomize.py or any other untracked file; the engines keep their tracked-plus-untracked-under-python/ rule. Test: test_tree_state_sees_tracked_edits_and_untracked_engine_files (untracked top-level file refused; gitignored file allowed).
| def floor_ms(c: int, context: float, snapshots: bool) -> float: | ||
| weights = 2 * (TARGET_PARAMS + draft_params()) | ||
| # stock: read the state, write 16 per-position snapshots, copy the accepted one back | ||
| state = GDN_STATE * ((1 + BLOCK + 2) if snapshots else 2) |
There was a problem hiding this comment.
Count the initial state read in the snapshot-free floor
For every snapshot-free ceiling, this multiplier counts only the commit replay's checkpoint read and write, but the preceding verify pass must also read the initial GDN state. This conflicts with the declared F model in expected.py, where stock and folded commit traffic cancel and exactly BLOCK states are removed: the stock multiplier is 19, so the snapshot-free multiplier must be 3 rather than 2. The current value underestimates the floor by c * GDN_STATE / BW and consequently inflates every snapshot-free ceiling and selector/full-block bound in ceiling.json.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d8189ae (code) and 84717d2 (evidence): the snapshot-free floor charges three states per request per cycle (the verify's read plus the fold's read and write), stock stays at 19 (1 + 16 + 2), so F removes exactly the 16 snapshots that expected.py assumes; test_bandwidth_floor_counts_weights_and_state now checks both slopes. Regenerated with the README command. Changed numbers: snapshot-free floor 2.919/2.948/3.007/3.126 -> 2.932/2.975/3.061/3.232 ms at c = 1/2/4/8; decode ceiling 1.814/2.018/2.462/3.258 -> 1.806/2.000/2.419/3.151x; tau for 5x at the floor 15.71/14.11/11.54/8.85 -> 15.79/14.23/11.74/9.15; selector bound 2.964/3.298/4.023/5.325 -> 2.951/3.268/3.953/5.150x; full blocks 5.091/5.672/6.932/9.041 -> 5.068/5.621/6.812/8.744x. Stock floors and expected.json's ratios are unchanged. README short answer and table updated. None of these numbers appears in the paper on main (checked with git grep).
|
Verdict: REQUEST CHANGES (8f42ca0; withdraws my provisional approval. Codex's two new comments are valid, and the second changes committed numbers.)
|
… files refused Codex on 8f42ca0: ceiling.py's snapshot-free floor charged two FP32 GDN states per request per cycle; the verify also reads the state before the fold reads and writes the checkpoint, so it is three (stock is 1 + 16 + 2 = 19, and F removes exactly the 16 snapshots, as expected.py assumes). The repository's identity now counts every untracked file outside .gitignore (a stray sitecustomize.py would be imported by every hold process), so preflight, build and every session check refuse it. Tests for both.
…README numbers ceiling.json at d8189ae: the snapshot-free floor rises by one state read per request (2.919 -> 2.932 ms at c=1, 3.126 -> 3.232 ms at c=8), so its decode ceiling falls (1.814 -> 1.806x at c=1, 2.018 -> 2.000x at c=2, 2.462 -> 2.419x at c=4, 3.258 -> 3.151x at c=8), the tokens per cycle 5x needs at the floor rise (15.71 -> 15.79, 14.11 -> 14.23, 11.54 -> 11.74, 8.85 -> 9.15), and the selector and full-block bounds fall (2.964 -> 2.951 / 5.091 -> 5.068x at c=1 ... 5.325 -> 5.150 / 9.041 -> 8.744x at c=8). The stock floor and expected.json's ratios are unchanged. README short answer and table updated; the README also states the access accounting and the repository rule for untracked files.
|
@codex review |
|
Verdict: APPROVE (provisional, on 84717d2: Codex has not reviewed this head yet. I will confirm or withdraw once it does.) d8189ae and 84717d2 resolve both comments on 8f42ca0.
Checks. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84717d2e88
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| changed = identity_changes(json.loads(preflight.read_text()), ident) | ||
| if changed: | ||
| raise GateError(f'engine identity changed during the hold in {changed}') | ||
| package = fingerprint(cert_src) if cert_src else None |
There was a problem hiding this comment.
Bind the fingerprint before certified-head equality runs
Fresh evidence after the earlier package-binding fix is that the only fingerprint is taken here, after the H and FGH equality servers have finished. If STACK_CERT_SRC changes during the hold, gate.json records the new package while the token and check-mode evidence came from the old one, so timed sessions can run an unvalidated certified head; fingerprint the package before the certified runs and verify the same fingerprint again when building the gate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5d862d8. preflight --cert-src now records the package fingerprint (cert_package) in the identity before any equality run. build refuses if the fingerprint it takes differs from preflight's, and check and every later hold compare it with the gate's identity. A test covers a package or prompt file changed between preflight and build.
Hold 1 had already started at 84717d2 when this landed, so it fingerprints the package only when the gate is built. For that hold the analysis checks after the fact that the package checkout stayed clean at 01502cc, that no file under it changed after the hold started, and that the gate's fingerprint equals one taken after the hold. If any of these fails, the H runs are repeated. README, amendment 1.
| meta = json.loads(meta_path.read_text()) | ||
| if meta.get('sglang_sha') != ident['s0']['head'] or meta.get('sglang_dirty') is not False: | ||
| problems.append( | ||
| f'{ref}: engine {meta.get("sglang_sha")} dirty={meta.get("sglang_dirty")}' | ||
| ) | ||
| if model is None or meta.get('model_revision') != model: | ||
| problems.append(f'{ref}: model {meta.get("model_revision")}, S0 ran {model}') |
There was a problem hiding this comment.
Validate the reused references' run configurations
Fresh evidence after the earlier reference-provenance fix is that these checks still validate only the engine, cleanliness, and model revision. A reused directory produced with the same checkout/model but different DFlash flags, prompt set, token count, concurrency, or top-logprob setting is therefore accepted as ref_dflash_b16; lever_class then certifies F/G/FG against the wrong stock baseline. Validate the reference metadata against the complete declared reference configuration rather than relying on the directory names.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5d862d8. Each reused reference is now checked against bench's declared configuration, not only its engine, cleanliness and model revision: the DFlash b16 flags with and without Triton attention, the c1 pass, concurrency 1, 256 new tokens, top-5 logprobs, 320 prompts, a cold cache, and the same prompts and prompt token counts as S0's run. Every stack equality run goes through the same check. The prompt file's hash is pinned from preflight to build. Table-driven tests cover the flags, output length, concurrency, logprob count, warm cache and prompt set. For hold 1 (started at 84717d2) these checks read only the files the hold writes, so they apply at analysis (README, amendment 1).
| for r in rows_in: | ||
| arm, c = r['label'].removeprefix('stack-'), int(r['concurrency']) | ||
| if arm not in declared or c not in DECLARED_C or not SESSION_RE.match(r['session']): | ||
| raise SystemExit(f'row outside the plan: {r["label"]} c={c} session {r["session"]!r}') |
There was a problem hiding this comment.
Limit analysis to the five preregistered sessions
The declared procedure permits sessions s1-s3 plus at most two replacements, but this accepts every stack-s<k> value and pools all of them. If a campaign contains stack-s6 or later, the analyzer can continue sampling until a confidence interval crosses one and report a decision from an undeclared stopping rule; reject campaigns with more than five distinct sessions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5d862d8. analyze.py accepts only sessions stack-s1 to stack-s5, the declared three plus at most two replacements, and rejects any other session name, so a sixth session can't enter the pooled interval. Tested.
| D1,c1-8 on tuned DFlash,DFlash block 16 with Triton target and draft attention (dflash-tuned-b16) instead of block 8 with FA4 draft attention (dflash-tuned),progress per pass; host overhead,"x_e2e 986.9 vs 814.4 tok/s/user at c=1 (1.21x), 876.4 vs 752.6 at c=2, 713.0 vs 650.1 at c=4, 530.0 vs 519.4 at c=8; y 3,502 vs 3,651 tok/s at c=8 (0.96x)",served end to end (bench confirmation),3 sessions each,evidence/bench/confirm/frontier.csv,exact-up-to-rounding (b16 Triton) vs stock (b8 FA4); against stock DFlash b16 every first divergence is rounding-level,none (flags),--speculative-dflash-block-size 16 --attention-backend triton,none; it is the baseline of the composition,baseline S0 | ||
| D2,c1-8 on tuned DFlash,Triton GDN verify kernel instead of FlashInfer gated_delta_rule_mtp,verify cost per token,"already the verify kernel of every bench arm (SGLang resolves it from the Triton linear-attention default on sm_90); against FlashInfer GDN verify: whole verify pass 4.55 vs 4.78 ms at B=16, 2.06x faster at B=64, 2.34x at B=256 (forced acceptance, c=1)","served cycle phases, forced acceptance (repair Stage A decomposition), single runs","1 run per width (1,024 to 64 cycles)",evidence/repair/README.md; evidence/repair/stage_a_timing.json,bench: --linear-attn-verify-backend triton gives the same tokens as the default on all 320 prompts (it is the default),none (default),default at the pin,no gain over tuned DFlash: already in it; matters for blocks of 64 and more,in every arm (default) | ||
| D3,c1-8 on tuned DFlash,Exact snapshot-free GDN verify (fold every commit),bytes per verify pass (state),"none served yet; derived (experiments/stack/expected.py): per request per cycle the stock verify writes 16 FP32 GDN states and the commit copies the accepted one, while the fold commits by replaying into the checkpoint, so 16 states of 50.3 MB are removed, 0.212 ms per request-cycle at 3.79 TB/s: 4.0% of the 5.29 ms c=1 cycle and 1.70 ms (16.7%) of the 10.19 ms c=8 cycle; moonshot measured SGLang's Triton recurrent verify slower at one request when its wrapper launches without a snapshot buffer (92 vs 76 us per layer at T=16, 0.38 ms over 24 layers), so the sign at c=1 is open",kernel-level check on an unmerged PR (pending); derived bytes,9 kernel cases; 80 served MTP sequences,PR #133 (drafter; pending until merged); evidence/moonshot/README.md section 2e,"pending (PR #133, unmerged): reported there bitwise at kernel level (verify output and committed state, B 1/8/16) and 80/80 bitwise for served MTP s3 at c=1; served DFlash undecided (pool confound), pinned-pool localization queued","drafter 0002-0003 (PR #133), base bd66ce343e",--enable-linear-replayssm-spec + SGLANG_GDN_REPLAYSSM_FOLD=1,served DFlash exactness and timing pending (drafter fold localization and fold A/B queued),yes: F | ||
| D4,c1-8 on tuned DFlash,"Backbone GEMM routing table v1 (Hopper GEMV at M=1, Triton skinny GEMM with PDL at M=2-16, merged GDN in_proj from M=64)",bytes per pass (kernel efficiency),"microbenchmarks only: at M=16, GDN out_proj and attention o_proj 0.88-0.89x of cuBLAS, GDN in_proj 0.97x, merged in_proj from M=64 5-13% faster on that projection; derived about 0.07-0.09 ms per c=1 block-16 cycle (16 verify rows and 16 draft rows), nothing at c=2 (32 rows route to cuBLAS), about 0.12-0.13 ms per verify at c=4-8 from the merged in_proj",isolated kernel microbenchmark; derived,15 replays x 10 calls per shape,evidence/backbone/README.md; evidence/backbone/tables.md,"pending: merged in_proj bitwise to cuBLAS per GEMM at every M; Triton and GEMV outputs differ from cuBLAS in a few elements (GEMV bitwise on 99.65-99.88%); served classification queued (backbone), and the stack equality hold classifies it on DFlash","backbone 0001-0008 (main), base bd66ce343e","SGLANG_BACKBONE_GEMM=1, SGLANG_BACKBONE_PDL=1, SGLANG_BACKBONE_MERGE_IN_PROJ=1, SGLANG_BACKBONE_GEMM_TABLE=<json>",served throughput and exactness pending (backbone hold 2 is plain decode only),yes: G |
There was a problem hiding this comment.
Reconcile D4's saved time with generated evidence
This inventory reports only 0.07–0.09 ms saved for the c=1 cycle, while the committed expected.json generated by expected.py records 0.140 ms and the accompanying README also states 0.14 ms. Because the row explicitly says it includes both the 16 verify rows and 16 draft rows, the lower value understates D4 by roughly half and makes the core lever inventory internally inconsistent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in aec1c02. D4 now gives expected.py's numbers: at most 0.14 ms at c = 1 (2.6% of 5.29 ms; the Triton+PDL route at 16 verify and 16 draft rows), nothing at c = 2, and 0.12 and 0.13 ms at c = 4 and 8 from the merged in_proj. It also adds backbone's served plain-decoding results (exact up to rounding; +0.4% at c = 8, where the M = 8 route kept about 10 of a predicted 90-98 us). The same commit updates D3, D5, D6, P4 and P6 from evidence that is now merged.
|
Verdict: REQUEST CHANGES (84717d2; withdraws my provisional approval. Codex's four new comments are valid, and I add one stale-wording item.)
|
…ull; at most five sessions Codex on 84717d2: the certified-head package's fingerprint is now part of the identity the equality hold's preflight records before any run, and build and every later check require it unchanged. The reused stock references must match bench's declared configuration (flags with and without Triton attention, c1 pass, concurrency 1, 256 new tokens, top-5 logprobs, 320 prompts, cold cache, S0's model and prompt set with the same prompt token counts), as must every stack equality run; the prompt file is pinned by hash from preflight to build. analyze.py accepts sessions stack-s1 to stack-s5 only (three and at most two replacements). expected.py's H note and the engine README reflect the merged #45/#52 and #133. Tests for each (98 pass).
…r hold 1 started levers.csv: D3 (fold) gets the drafter's served A/B on dflash-tuned-b16 (0.968/0.983/ 1.005/1.061 at c=1/2/4/8, one session) and its bitwise class with matched pools; D4 the derived 0.14 ms at c=1, none at c=2, 0.12-0.13 ms at c=4-8 (not 0.07-0.09 ms) and the served plain results; D5/D6 the merged certified-head numbers (head path at M=16, engine fallback rates, 0 differing rows); P4/P6 likewise. README: inventory rows, composed engine table (every series on main), and a dated amendment: the round-8 validation changes and how they apply to the equality hold that started at 84717d2, H's corrected reason for staying out of the expected range, and F's served A/B as a refuted prediction (low end at c=1, below the range at c=2-8). expected.json regenerated (H note only).
|
@codex review |
|
Verdict: APPROVE (on aec1c02. Per main's bound for this PR, it merges if Codex's round on this head has no P1; any P2 goes to the "Before the results PR" checklist.) 5d862d8 and aec1c02 resolve Codex's four comments on 84717d2 and my item.
Amendment 1 is dated after the equality hold started (21:24 UTC at 84717d2) and changes validation only, not arms, order, ranges or the decision rule.
This is the right way to handle evidence that arrived after declaration. Composed engine. The note that kernel 0007-0010 are not in the composed engine is correct: they touch only the draft-path counters and the sampled verify. Checks.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aec1c02fcc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| T95 = {1: 12.706, 2: 4.303, 3: 3.182, 4: 2.776, 5: 2.571, 6: 2.447, 7: 2.365, 8: 2.306} | ||
| METRICS = ('x_e2e', 'y') | ||
| DECLARED_C = (1, 2, 4, 8) # the plan's concurrencies | ||
| SESSION_RE = re.compile(r'^stack-s[1-5]$') # s1-s3 and at most two declared replacements |
There was a problem hiding this comment.
Reject replacement sessions unless earlier sessions are invalid
Fresh evidence after the five-session cap is that stack-s4 and stack-s5 pass this regex even when s1-s3 already provide three valid FULL/S0 comparisons at every concurrency. Because all accepted sessions are pooled, an operator can run these optional sessions after seeing an inconclusive interval and stop when it crosses one, contrary to the preregistered replacement-only rule; validate that each replacement was required by the preceding sessions before including it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed: this one can change a decision. I'll fix it in the results PR, before any s1-s3 data is analysed (it's on the "Before the results PR" checklist). The rule analyze.py will enforce, following the plan's replacement clause:
stack-s4is accepted only if, after s1-s3, some c has fewer than three valid FULL-against-S0 sessions.stack-s5is accepted only if that still holds after s4. Any other s4 or s5 makes the analysis refuse the campaign, not drop the session quietly.- At each c the decision uses the first three valid sessions in declared order. A replacement session therefore counts only at a c where the earlier sessions fell short, never at a c that already had three.
- Table-driven tests: s4 present with s1-s3 complete is refused; s4 that fills one invalid c is used only at that c; s5 without a shortfall after s4 is refused.
The sessions already queued (s1-s3) are unaffected. The hold scripts only ever create s4 or s5 by hand, after a shortfall.
| D2,c1-8 on tuned DFlash,Triton GDN verify kernel instead of FlashInfer gated_delta_rule_mtp,verify cost per token,"already the verify kernel of every bench arm (SGLang resolves it from the Triton linear-attention default on sm_90); against FlashInfer GDN verify: whole verify pass 4.55 vs 4.78 ms at B=16, 2.06x faster at B=64, 2.34x at B=256 (forced acceptance, c=1)","served cycle phases, forced acceptance (repair Stage A decomposition), single runs","1 run per width (1,024 to 64 cycles)",evidence/repair/README.md; evidence/repair/stage_a_timing.json,bench: --linear-attn-verify-backend triton gives the same tokens as the default on all 320 prompts (it is the default),none (default),default at the pin,no gain over tuned DFlash: already in it; matters for blocks of 64 and more,in every arm (default) | ||
| D3,c1-8 on tuned DFlash,Exact snapshot-free GDN verify (fold every commit),bytes per verify pass (state),"served A/B on dflash-tuned-b16 (drafter, interleaved stock/fold, two runs each): throughput 0.968x at c=1, 0.983x at c=2, 1.005x at c=4, 1.061x at c=8 (1.094x at 16, 1.120x at 32), tokens per cycle unchanged; held batch of 8: cycle 10.83 -> 9.90 ms; derived bytes (experiments/stack/expected.py): 16 FP32 states of 50.3 MB per request per cycle removed, 0.212 ms per request-cycle at 3.79 TB/s","served end to end (A/B, n = 2 runs per arm); held-batch phases; derived bytes",2 runs per arm,"evidence/drafter/README.md (fold timing, matched pools); evidence/drafter/fold_timing/summary.json; evidence/drafter/buffered_verify/","bitwise: kernel-level parity (verify output and committed state, B 1/8/16) and served DFlash b16 with matched pinned pools at c=1 and in deterministic batched waves (evidence/drafter/buffered_verify/localize/); closed-loop c>1 is not bitwise even for stock","drafter 0001-0003 (main), base bd66ce343e",--enable-linear-replayssm-spec + SGLANG_GDN_REPLAYSSM_FOLD=1,"3.2% slower at c=1 and 1.7% at c=2 on block 16; likely cause from code reading, not measured: the ring-writing verify keeps value tiles of 32 where the stock per-position verify uses 4 at small batches; selecting the narrow tiles (bitwise equal in the kernel check) has no patch yet",yes: F | ||
| D4,c1-8 on tuned DFlash,"Backbone GEMM routing table v1 (Hopper GEMV at M=1, Triton skinny GEMM with PDL at M=2-16, merged GDN in_proj from M=64)",bytes per pass (kernel efficiency),"derived from microbenchmarks (experiments/stack/expected.py, make_table.py decisions): at most 0.14 ms per c=1 block-16 cycle (2.6% of 5.29 ms; Triton+PDL route at 16 verify and 16 draft rows), nothing at c=2 (32 rows route to cuBLAS), 0.12 and 0.13 ms per verify at c=4 and 8 from the merged GDN in_proj; served plain decoding (backbone): the M=8 route delivered about 10 of a predicted 90-98 us (+0.4% at c=8)",isolated kernel microbenchmark; derived; served plain decoding,15 replays x 10 calls per shape,"evidence/backbone/README.md (microbenchmarks, Served results); evidence/backbone/tables.md; evidence/stack/expected.json","exact-up-to-rounding in served plain decoding (lever v1 at c=1 and 32: all first divergences tie/one step/near, 0 large); the merged in_proj alone bitwise; untested on DFlash before the stack equality hold","backbone 0001-0008 (main), base bd66ce343e","SGLANG_BACKBONE_GEMM=1, SGLANG_BACKBONE_PDL=1, SGLANG_BACKBONE_MERGE_IN_PROJ=1, SGLANG_BACKBONE_GEMM_TABLE=<json>",its Triton route at M=9-16 has no served test; derived gain at most 2.6% at c=1,yes: G | ||
| D5,c1-8 on tuned DFlash,Certified int8 LM head on the greedy verify,bytes per verify pass (head),"no served timing on DFlash; head-path microbenchmarks at M=16: stock chain 395.1 us, certified W8A16 pass 256.9 us, expected 335.0 us with whole-batch fallback and 271.5 us with column fallback at plain-decode fallback rates; engine check: DFlash greedy verify 3.99% of rows fell back, 90.0% of calls had a fallback (up to 128 rows); derived per c=1 DFlash cycle: a loss with whole-batch fallback, up to about 0.12 ms saved with column fallback",isolated microbenchmark; engine check-mode counters; derived,"57,424 DFlash verify rows",evidence/certified_head/README.md; evidence/certified_head/head_path_table.md; evidence/certified_head/engine_v2.json,stock-kernel contract: 0 rows differing from the stock head in check mode; column fallback rests on measured column-subset invariance of this cuBLAS build,kernel 0001-0006 (main) with stack/0001-0002 in place of 0002-0003,"SGLANG_CERTIFIED_HEAD_VERIFY=1 (+ _FALLBACK, _MODEL, _MAX_ROWS, _SRC)",served effect on DFlash unmeasured; column fallback never ran in the engine at DFlash verify shapes; whole-batch fallback a derived loss,"H, if its equality gate passes (expected effect left out of the declared range)" |
There was a problem hiding this comment.
Commit the engine evidence cited by D5 and D6
The D5 and D6 rows cite evidence/certified_head/engine_v2.json for the new fallback rates, row counts, and zero-mismatch claim, but a repository-wide file search finds no such artifact in this tree. Consequently these central inventory claims cannot be verified from the committed evidence; add the referenced result and its generating command or point the rows at an existing committed artifact.
AGENTS.md reference: AGENTS.md:L15-L18
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The file exists. evidence/certified_head/engine_v2.json came to main with #52 (960ab39), after this branch's last merge from main, so the branch tree didn't have it. Now that #138 is merged (43dd775), D5 and D6 point at the committed file on main (blob 34e17c8). It holds the per-path rows, fallback counts and 0 differing rows, and evidence/certified_head/README.md gives the command that produced it.
|
Verdict: APPROVE (aec1c02; confirmed under main's bound. Codex's round on this head has no P1.) Both new comments are P2s and go to
|
Every lever on the programme has been measured on its own, most of them in isolation; nobody has put them together. This PR is the stack workstream's first deliverable: an inventory of every lever measured so far, a composed SGLang engine that carries all of them behind their switches, and the composition plan, declared here before any of its holds runs. Results and the full gap analysis follow in a second PR once the holds have run.
What it adds
evidence/stack/levers.csvandevidence/stack/README.md: 29 levers, 20 at client concurrency 1-8 on tuned DFlash and 9 at 32-128 on tuned plain decoding. Each row gives the measured effect as measured (never multiplied with another), the kind of evidence (served end to end, served single runs, held-batch windows, isolated microbenchmark, offline oracle, derived) with its n, the exactness class and its source, the engine series and switch, and what blocks it.experiments/stack/build_engine.shapplies drafter 0001-0003, moonshot 0001-0009, backbone 0001-0008, kernel 0001-0006, hostgap 0001-0005, repair 0001 and stack/0003 to the pin, in that order, and checks the resulting tree (628f650ea0). Kernel 0002 and 0003 conflict with the drafter and moonshot hunks indflash_worker_v2.py; the rebased versions areengine/sglang/patches/stack/0001-0002(certified tokens before moonshot's relaxed-acceptance rule, which now refuses to combine with the certified head; the hot-vocabulary draft path returns before the certified draft projection); stack/0003 adds the same refusal on the EAGLE/MTP chain path. Section "stack" inengine/sglang/README.md.dflash-tuned-b16), B0 (composed tree, all switches off), F (exact GDN fold), G (backbone routing table v1), H (certified verify head, only if a citable package commit exists before session 1), and the cumulative FG and FGH. Equality first (bench's b16 Triton reference configuration, 320 prompts x 256 tokens, c = 1, bench's class rule; B0 must be bitwise equal to S0 or nothing is timed), then three single-hold sessions at c = 1, 2, 4, 8 ordered S0 FULL ... FULL S0 (A-B-B-A for the primary comparison), geometric mean of session ratios with a t interval, and a fixed decision rule. Arm definitions agreed with bench (command-line overrides; noarms.tomlchange).experiments/stack/ceiling.py->evidence/stack/ceiling.json: the HBM bandwidth floor of a block-16 cycle and the tokens per cycle 5x would need.Headline
At c <= 8 the tuned DFlash arms already contain the levers with served gains (block 16, Triton attention, the Triton GDN verify kernel, graphs, overlap, stream interval). Of the exact levers outside them, only the snapshot-free verify (F) and the backbone table (G) have evidence of a gain worth timing. F is bitwise with matched pools, and the drafter workstream's served A/B on the tuned arm gave 0.968x throughput at c = 1 and 1.061x at c = 8 (one session). That is at the low end of the declared F range at c = 1 and below it at c = 2, 4 and 8, so it is reported as a refuted prediction (README, amendment 1). G has no served DFlash measurement. The certified head's served effect on DFlash is unmeasured, and its evidence spans a loss (whole-batch fallback) to a gain (column fallback), so it is left out of the expected range. Expected composed result (derived and declared before any run,
experiments/stack/expected.py: lever savings in ms add, ratio = T / (T - sum of savings)): 0.97-1.07x the tuned per-user rate at c = 1 and 1.15-1.22x at c = 8, i.e. 4.1-4.7x short of the goal. Derived ceiling: an engine at the bandwidth floor with today's drafter decodes 1.81x faster at c = 1 (3.15x at c = 8); 5x at c = 1 needs 15.8 of 16 tokens per block-16 cycle at that floor, or about 50 of 64 at today's wide-block verify cost. The binding constraint is drafting quality.Dependencies
evidence/bench/confirm/frontier.csv(Confirmed serving frontier: nine arms, exactness classes, GSM8K quality #131), the drafter's fold evidence (Drafter: exact snapshot-free GDN verify (fold-every-commit) for DFlash and MTP, with its exactness and timing jobs #133) and the certified-head evidence (Certified int8 LM head: exact stock-head decisions, seeded sampling, kernels and evidence #45, Certified LM head in SGLang: greedy decode, verify, drafting and fixed-noise sampled verify #52), all merged. Every patch seriesbuild_engine.shapplies is onmain; kernel 0007-0010 (draft counters and sampled verify only) are not in the composed engine.Validation
tests/test_stack_analysis.py(98 tests, CPU), table-driven over each gate, provenance and analysis failure mode. Passed locally.build_engine.shrebuilt the composed tree in a scratch worktree and matched the expected tree hash.bench's own parser. Hold 1 (equality and a phase diagnostic) started at 21:24 UTC on 2026-10-01 from a hold worktree at 84717d2, which stays there until sessions s1-s3 end. Later commits on this branch change validation and evidence only; amendment 1 in the README says how each applies to that hold.equality_gate.pyapplies the declared step-1 decisions, all or nothing (sessions run only if B0 is bitwise to S0 and F, G and FG each pass; H joins FG only with identical tokens, explicit zero check-mode mismatches and a recorded package fingerprint), and writes the gate the session holds read; each equality hold runs everything afresh.equality_gate.py checkis the single precondition every timed hold calls (recomputed decision equal to gate.json, ok, table and package hashes). A campaign of sessions is pinned to one gate and the analysis refuses mixed gates.kernel/engine-combined01502cc (kernel's engine-check version, whose SGLang patches equal Certified LM head in SGLang: greedy decode, verify, drafting and fixed-noise sampled verify #52's); hold 1 runs H's check-mode equality.Codex
Review
expected.py's stated model with H left out (FULL = FG: 0.97-1.07x at c = 1, 1.01-1.08x at c = 2, 1.07-1.15x at c = 4, 1.15-1.22x at c = 8); (3) the six Codex comments are fixed in 77d83e6. All in da3b13c; no stack hold has run, so these are part of the declaration.exact-up-to-floor, main usesexact-up-to-rounding; fixed in 9754fcd (classes read from bench.arms) and fbb4286 (evidence regenerated from main's frontier, numbers unchanged).