Skip to content

Stack: lever inventory, composed engine and the composition plan for tuned DFlash - #138

Merged
SamMausberg merged 30 commits into
mainfrom
stack/compose
Oct 1, 2026
Merged

SamMausberg merged 30 commits into
mainfrom
stack/compose

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

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.csv and evidence/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.
  • The composed engine: experiments/stack/build_engine.sh applies 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 in dflash_worker_v2.py; the rebased versions are engine/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" in engine/sglang/README.md.
  • The composition plan (README, "Composition plan"): arms S0 (stock tree, tuned 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; no arms.toml change).
  • 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

Validation

  • tests/test_stack_analysis.py (98 tests, CPU), table-driven over each gate, provenance and analysis failure mode. Passed locally.
  • build_engine.sh rebuilt the composed tree in a scratch worktree and matched the expected tree hash.
  • The hold scripts are syntax-checked and their arm arguments resolve to the expected server commands through 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.py applies 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 check is 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.
  • H can enter: the certified-head package is citable as kernel/engine-combined 01502cc (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

  • P1 on 794f983 (equality-run failures did not propagate): fixed in e221772; the hold exits non-zero on any failed run, and the gate fails without B0 or S0.
  • P2 on 794f983 (interaction kept sessions with an invalid duplicate launch): fixed in e221772; the interaction uses only sessions where every launch of B0, F, G and FG is valid.
  • Six comments on e221772 (lossy FG kept both levers; compare/gate failures and stale gate files; length mismatches in the certified-head check; implicit zero check-mode mismatches; incomplete 320-prompt comparisons; failed timed sweeps not failing the session): all fixed in 77d83e6, each reply names the change.

Review

  • REQUEST CHANGES on e221772 (reviewer): (1) numbers whose only evidence is on unmerged PRs (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 for D5 and D6, Drafter: exact snapshot-free GDN verify (fold-every-commit) for DFlash and MTP, with its exactness and timing jobs #133 for D3's exactness and P6) are now marked pending, and D3's bytes use 3.79 TB/s (0.212 ms per request-cycle: 16 states removed, the fold's own commit read and write replacing the stock commit copy); (2) the declared expected ranges now follow from 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.
  • Four comments on da3b13c (length mismatches must block a lever; bind H to the package that passed; keep all-invalid entries with n = 0; median of per-cycle idle): fixed in 47e6fbf.
  • Four comments on 47e6fbf (cached H runs reused across packages; FH/GH combinations never checked; relaxed EAGLE acceptance with certified ids; phase-diagnostic failures): fixed in 2abe821, the first two by a simpler rule (fresh equality runs, all-or-nothing gate) rather than more special cases.
  • Four comments on 2abe821 (routing table not bound to the gate; analysis assumed FG as the full arm; H without the B0 tokens-vs-logprob check; oracle failures): fixed in 0ed0b59; tests now 10.
  • Three comments on 0ed0b59 (gate reader's exit status lost in process substitution; a gate with H and no package fell back to FG; unknown divergence classes passed): fixed in 8deed83 by one gate check that every hold calls.
  • Three comments on 8deed83 (sessions not pinned to one gate; bitwise judged by the drift statistic; decisions on rounded bounds): fixed in b5c6faa.
  • Two comments on b5c6faa (analysis gate not tied to the pin; pin written before validation): fixed in 445e579 (checks run under the CPU-window shared lock).
  • One comment on 445e579 (exact class string): the branch's base used exact-up-to-floor, main uses exact-up-to-rounding; fixed in 9754fcd (classes read from bench.arms) and fbb4286 (evidence regenerated from main's frontier, numbers unchanged).
  • One comment on fbb4286 (a retried launch hid an invalid one): fixed in 1a142b2; cell_valid() states the declared rule (any invalid launch voids its session ratio), with a table-driven test per case.
  • Two comments on b25105d (session-named gate records; bitwise without complete logprob coverage): fixed in 0d4e1ef; main merged again in 37fd0c2 (index rows: kept main's triton_tma/ and this PR's stack/).
  • One comment on 37fd0c2 (a rejected gate let the equality hold exit 0 and move current): fixed in eeeacf3; build exits 1 on a rejected gate, and the holds pass hold_lint.
  • Three comments on eeeacf3 (dirty composed worktree; unchecked S0 checkout; no engine identity in the gate): fixed in 8126e93 with an audit of every session input (engine identity pinned at equality, checked by every hold and by the analysis).
  • Three comments on 8126e93 (dirty repository not caught per run; decisions from two sessions; unchecked stock references): fixed in e6e3846.
  • Three comments on e6e3846 (ambient engine variables; existing-only provenance checks; n = 1 decision): fixed in 64b5f27 after an audit of every input each step consumes; every check now compares against the declared plan.
  • Two comments on 8f42ca0 (untracked repository files; snapshot-free floor charged two states instead of three, inflating its ceilings): fixed in d8189ae and 84717d2; the regenerated numbers are listed in the thread reply.
  • Four comments on 84717d2 (package fingerprint taken only after the H runs; reused references checked only for engine and model; more than five sessions pooled; D4's 0.07-0.09 ms against expected.py's 0.14 ms): fixed in 5d862d8 (code) and aec1c02 (evidence: D3-D6, P4 and P6 from merged evidence, and the README's amendment 1, written after hold 1 started).

… 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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T21:57:27.652831Z aec1c02 Manual request
ℹ️ 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" or "@codex security review".

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/hold_equality.sh Outdated
Comment on lines +53 to +55
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)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e221772: run_eq returns the runner's exit status, failed runs are collected, and the hold exits non-zero if any equality run failed. The gate (equality_gate.py, added in 617fe96) already sets ok=false when the B0 or S0 run is missing, so no session can run without the B0-vs-S0 check.

Comment thread experiments/stack/analyze.py Outdated
Comment on lines +119 to +120
got = {a: cell.get(a) for a in ('B0', 'F', 'G', 'FG')}
if all(v and len(v) >= 1 for v in got.values()):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/equality_gate.py Outdated
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]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_equality.sh Outdated
Comment on lines +89 to +93
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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/equality_gate.py Outdated
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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 77d83e6: the certified-head pairs use identical_tokens (all 320 prompts, no divergence, no length mismatch).

Comment thread experiments/stack/equality_gate.py Outdated
Comment on lines +84 to +85
if gate['certified']['tokens_identical'] and all(m in (0, None) for m in mism):
timed.append('H')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/equality_gate.py Outdated
Comment on lines +29 to +30
def bitwise(pair: dict[str, Any]) -> bool:
return pair['diverged'] == 0 and pair['length_mismatch'] == 0 and pair['drift_max'] == 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_session.sh Outdated
Comment on lines +69 to +72
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)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Review of the exact head e221772. The plan's structure is good:

  • arms that differ only in the lever;
  • the equality gate (B0 bitwise equal to S0) before any timing;
  • A-B-B-A sessions with reversed middles, with the geometric mean of session ratios and a t interval;
  • a decision rule and a rule for invalid points fixed in advance;
  • the interaction computed in the four-way pattern instead of by multiplying ratios.

The derived ceilings check by hand:

  • the drafter has 1.270e9 params (2.54 GB), and 10.95 GB of weights per cycle;
  • the c = 1 floor is 3.144 ms with 16 snapshots and a commit copy (19 × 50.3 MB), and 2.919 ms without;
  • 5.29/2.919 gives 1.81x, 10.19/3.13 gives 3.26x, and 5 × x_decode × floor gives a τ of 15.7 at c = 1.

tests/test_stack_analysis.py passes (6 passed), and the hostname check is clean. What blocks is where some inputs come from, one derivation that doesn't reproduce, and six open Codex comments.

Blocking

  1. Inventory numbers whose only evidence is in unmerged PRs. Committed files may not cite an unmerged PR as evidence; numbers wait for the merge, or appear as pending.

    D3's byte arithmetic can stay as derived, because it follows from the GDN state size and the measured bandwidth. Use the same 3.79 TB/s as ceiling.py, though: at 3.0 TB/s, 17 × 50.3 MB is 0.285 ms; at 3.79 TB/s it is 0.226 ms.

    The Confirmed serving frontier: nine arms, exactness classes, GSM8K quality #131 rows (D1, P1, P5, and ceiling.json's frontier input) are a merge-order dependency, as the PR says. ceiling.json cannot be regenerated from this branch until Confirmed serving frontier: nine arms, exactness classes, GSM8K quality #131 merges.

  2. The declared expectation must reproduce from its stated inputs. "FULL: 0.97-1.07x at c = 1, 1.10-1.25x at c = 8" does not follow from the component ranges (F 0.95-1.05 / 1.10-1.20, G 1.015 / 1.01, H 0.97-1.03):

    • multiplied, F × G gives 0.96-1.07 and 1.11-1.21;
    • with H included at c = 1 it gives 0.94-1.10;
    • an additive model, 1/(1 − Σ cycle fractions), gives about 1.07 at c = 1 and 1.27 at c = 8 at the top ends.

    The README also says "isolated ratios are never multiplied into a composed estimate". Since this range is declared before any run and anchors the "4-5x short" reading, state the formula and the inputs that produce it, and drop H's contribution or mark it pending while its evidence is unmerged.

  3. Six Codex comments on e221772 have no reply. All are reasonable for a pre-registered gate:

    • r4157264087 (P1): reject a lossy combined arm before timing it;
    • r4157264093 (P1): propagate comparison and gate failures;
    • r4157264102 (P1): include length mismatches in the certified-head equality;
    • r4157264109 (P2): require explicit zero check-mode mismatches;
    • r4157264115 (P2): verify all 320 prompts before declaring bitwise equality;
    • r4157264125 (P2): return failure when a timed sweep fails.

    Bench's Confirmed serving frontier: nine arms, exactness classes, GSM8K quality #131 fixed the analogous length-mismatch and 320-prompt checks, and the same rules should apply here. Please fix each one or answer it with a scope.

Notes (non-blocking)

  • Plan amendments. The plan is declared before any hold runs, so these fixes are part of the declaration as long as no stack hold has started. If hold 1 has started by the time they land, record them as dated amendments.
  • The reading. "Drafting quality, not the engine, is the binding constraint" is supported by the ceilings: 15.7 of 16 tokens needed at the floor at c = 1. That holds with the label "derived" and the floor's stated idealizations.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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 tests/test_stack_analysis.py passes (7 passed):

  • equality_gate requires complete() (all 320 prompts) for every comparison. identical_tokens and bitwise exclude length mismatches.
  • The certified-head check needs a verify path with rows > 0 and mismatch_rows exactly 0.
  • A lossy FG leaves one lever.
  • The holds clear stale outputs and propagate every comparison, gate and sweep failure.

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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/equality_gate.py Outdated
own['classes'].get(k, 0) for k in LOSSY
):
return 'lossy'
return 'bitwise' if bitwise(own) else 'exact-up-to-rounding'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_session.sh Outdated
Comment on lines +41 to +43
if [ -z "${STACK_CERT_SRC:-}" ]; then
mapfile -t levers < <(printf '%s\n' "${levers[@]}" | grep -v '^H$')
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/phases.py Outdated
Comment on lines +49 to +53
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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SamMausberg

Copy link
Copy Markdown
Owner Author

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:

  1. r4157363048 (P1, equality_gate.py). A lever comparison with a positive length_mismatch but no large or not_argmax event is still classed exact-up-to-rounding by the fallback. Bench's rule (Confirmed serving frontier: nine arms, exactness classes, GSM8K quality #131) counts a length mismatch as non-rounding. Require zero length mismatches in both the stock and the B0 comparison before an exact class.
  2. r4157363055 (P1, hold_session.sh). H's gate result is not bound to the package that produced it: a different STACK_CERT_SRC, or a changed checkout, would be timed under the old gate. Record a package revision or content hash in the gate and require the session's source to match it.
  3. r4157363065 (P2, analyze.py). An arm or concurrency whose points are all invalid drops out of the output instead of reporting n: 0. An all-invalid FULL at c = 8 would then hide the declared need for another session. Build the domains from all loaded rows before filtering.
  4. r4157363079 (P2, phases.py). median(period) − Σ median(phase) is not the median per-cycle idle, and it can go negative. Compute idle per cycle, then take the median.

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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/hold_equality.sh Outdated
Comment on lines +49 to +50
# 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; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +119 to +124
if (
gate['certified']['tokens_identical']
and all(c['ok'] for c in checks)
and 'package_sha256' in gate['certified']
):
timed.append('H')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +259 to +262
+ # 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_equality.sh Outdated
Comment on lines +114 to +116
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/hold_session.sh Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread evidence/stack/README.md Outdated
Comment on lines +275 to +276
python experiments/stack/analyze.py --points ~/vp-data/stack/pareto/points.csv --full FG \
--out evidence/stack/composition.json --csv evidence/stack/composition.csv

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/equality_gate.py Outdated
Comment on lines +109 to +110
'tokens_identical': identical_tokens(pairs.get('H tokens vs B0 tokens'))
and identical_tokens(pairs.get('FGH tokens vs FG')),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_oracle.sh Outdated
Comment on lines +28 to +32
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/hold_session.sh Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/hold_session.sh Outdated
Comment on lines +41 to +42
if [ -z "${STACK_CERT_SRC:-}" ]; then
mapfile -t levers < <(printf '%s\n' "${levers[@]}" | grep -v '^H$')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/equality_gate.py Outdated
Comment on lines +51 to +52
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  1. r4157561522 (P1, hold_session.sh:35). mapfile -t levers < <(python ...) || exit 1 tests mapfile's status, not Python's. A gate with ok: false therefore yields an empty lever list and a blank FULL arm.
    • Capture first, then check: out=$(python ...) || exit 1, then mapfile -t levers <<<"$out", and refuse an empty list.
    • mapfile -t args < <(arm_args ...) has the same pattern at hold_session.sh:73, hold_equality.sh:115 and hold_oracle.sh:25, where a failing lever_args would launch a partial arm. Please fix those the same way.
  2. r4157561538 (P1, hold_session.sh:42). When the gate admits H, a session started without STACK_CERT_SRC silently drops H and times FG as FULL, while analyze.py --gate expects FGH. Refuse to start instead, so that every session times the gated composition.
  3. r4157561551 (P2, equality_gate.py). exact() rejects only large and not_argmax, so unknown (and any class the comparator adds later) passes as exact.
    • Use an allow-list: every first divergence is tie, one_ulp or near.
    • The README's "exact means no first divergence is large or not_argmax" needs the same change.
    • Add a test with an unknown event.

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.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  • Preflight (r4160273587, r4160273595). equality_gate.py preflight runs first in every hold and refuses if:

    • the repository has tracked changes;
    • ~/sglang (S0) is not at bd66ce343e, or has tracked changes or untracked files under python/;
    • the composed worktree has either kind of change, or its tree is not STACK_TREE.

    build_engine.sh refuses a dirty worktree too.

  • Identity in the gate (r4160273602). gate.json records the repository, S0 and composed commits and trees, their dirty lists, and the venv's torch, triton, flashinfer, sgl-kernel and transformers versions.

    • build requires the identity unchanged since preflight, and every equality run's meta to name those commits with sglang_dirty false. A missing key fails closed.
    • check refuses a session whose identity differs in any field.
    • analyze.py --launches refuses any row whose bench.pareto launch record shows another engine head, a dirty engine or another repository commit. sglang_head, sglang_dirty and repo_head already exist in launches.csv on main.
    • The per-run pin copies carry the identity, since the pin hashes gate.json.
  • Checks. tests/test_stack_analysis.py passes (59 tests, 17 of them new refusal cases), pre-commit from main is clean, and the commit has no AI attribution.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/analyze.py Outdated
Comment on lines +183 to +185
launch['sglang_dirty'] != 'False'
or launch['sglang_head'] != engine['head']
or launch['repo_head'] != ident['repo']['head']

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread experiments/stack/analyze.py Outdated
Comment on lines +66 to +70
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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experiments/stack/equality_gate.py Outdated
Comment on lines +245 to +248
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')):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (8126e93; withdraws my provisional approval. Codex's three new comments are valid.)

  1. r4160359896 (P1, analyze.py:185): a repository edited mid-session. Preflight checks the repository at the hold's start, but a tracked edit during the roughly 45-minute session is caught nowhere. bench.server records it in the launch manifest, bench.pareto drops it from launches.csv, and analyze.py checks only repo_head. Carry the repository's dirty state into launches.csv (a repo_dirty column beside sglang_dirty) and reject any row where it is true. Better still, re-run the preflight identity check at the end of each session and fail the session on any change.
  2. r4160359904 (P2, analyze.py:70): a headline from too few sessions. The README's declared procedure (lines 225-228) says that if fewer than three sessions stay valid for FULL against S0 at any c, another session runs. interval() already emits a speedup or slowdown decision at n = 2. Withhold the FULL vs S0 decision, or label it "incomplete: n < 3", when fewer than three valid sessions remain, and test it.
  3. r4160359910 (P2, equality_gate.py:248): the reused stock references. runs_provenance checks only plain__stack_*, but ref_dflash_b16 and ref_dflash_b16_triton (symlinks into ~/vp-data/bench/equality/runs) decide every lever's "vs bench stock b16" class. Validate their c1.meta.json against the pinned S0 identity (sglang_sha = bd66ce343e, clean), or record their meta hashes in gate.json.

…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).
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  1. A dirty repository, per run. analyze.py now reads each run's own server/launch.json, written by bench.server (repo from git_state, plus sglang_source). It refuses a run unless the repository head equals the gate's, the repository's dirty_files is empty, and the engine head matches the gate's with its dirty_files empty. hold_session.sh repeats the gate check, identity included, at the end of each session, so an edit made after the last launch fails the session too.
  2. Too few sessions. interval() returns incomplete (n < 3) below MIN_SESSIONS = 3, as the declared procedure requires, and the README says so.
  3. The reused references. runs_provenance checks ref_dflash_b16 and ref_dflash_b16_triton: each must be at the pinned stock commit, clean, and run on S0's model revision, and a missing record fails. The gate records their c1.jsonl SHA-256.

Checks. tests/test_stack_analysis.py passes (65 tests), pre-commit from main is clean, and the commit has no AI attribution.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread experiments/stack/equality_gate.py Outdated
)
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')):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread experiments/stack/analyze.py Outdated
Comment on lines +69 to +73
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})'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (e6e3846; withdraws my provisional approval. Codex's three new comments are valid.)

  1. r4160428156 (P1, hold_session.sh:20): inherited switches. bench.server copies the caller's os.environ into every server, so an exported SGLANG_* switch (for example SGLANG_SIMULATE_ACC_LEN) would reach every arm unrecorded.
    • Start each hold from an allowlisted environment: unset every SGLANG_* variable the arm does not declare, before gate_plan.
    • Or refuse to start when one is set.
    • In either case, record the effective SGLANG_* set in the identity, so check and analyze.py can compare it.
  2. r4160428165 (P1, equality_gate.py:266): a missing equality record. runs_provenance globs the c1.meta.json files that exist, and fails only when none do. Require a record for every expected equality run (S0, B0, each lever, F, G, FG and an admitted H), derived from pairs.json or the declared arms, and fail on any missing one.
  3. r4160428172 (P2, analyze.py:73): n = 1. The n < MIN_SESSIONS branch sits inside if n >= 2, so a single valid session yields a ratio with no decision. Move the minimum-session check ahead of the interval, so n = 1 and n = 2 both read incomplete (n < 3), and add an n = 1 test.

…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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  1. Environment. arms.sh clears every SGLANG_*, TORCH_*, PYTORCH_*, TRITON_*, FLASHINFER_*, NCCL_* and CUDA_* variable except CUDA_HOME before any server starts. scripts/sglang_env.sh exports only CUDA_HOME, PATH, LD_LIBRARY_PATH and PYTHONPATH, so nothing the harness needs is lost.
    • The identity records what remains, and require_clean refuses anything extra.
    • Sessions write stack_env.json beside each run.
    • analyze.py refuses a server whose overrides differ from the arm's declared set, whose fold flag mismatches, or whose ambient environment differs.
  2. The declared plan. hold_equality.sh writes plan.jsonl. The gate requires exactly that set (the core five, and the H trio all or none), a matching record per declared run (flags, logprobs, prompts, pass, concurrency, model), and no undeclared run. analyze.py accepts only declared arms, the concurrencies {1, 2, 4, 8} and stack-s<k> sessions.
  3. Incomplete decisions. n = 0, 1 and 2 all return incomplete (n < 3) before any interval is computed.

expected.json now records its input hashes, which match evidence/stack/ceiling.json (04171c70...) and evidence/backbone/gemm_microbench.json (f001afa8...). Its ratios are unchanged.

Checks. tests/test_stack_analysis.py passes (87 tests), pre-commit from main is clean, and the commits have no AI attribution.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/equality_gate.py Outdated
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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread experiments/stack/ceiling.py Outdated
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (8f42ca0; withdraws my provisional approval. Codex's two new comments are valid, and the second changes committed numbers.)

  1. r4160536949 (P2, ceiling.py:68): the snapshot-free floor misses one state read. floor_ms charges the stock path 1 + BLOCK + 2 = 19 GDN states per request (read, 16 snapshots, commit copy), but the snapshot-free path only 2, leaving out the verify pass's initial read. expected.py's F model removes exactly BLOCK states (f_bytes_removed_per_request = BLOCK * GDN_STATE), which implies 19 - 16 = 3. Use (1 + 2) for the snapshot-free case, regenerate ceiling.json and anything derived from it (expected.json hashes it as an input), and update every README number that quotes those ceilings or the selector and full-block bounds. The change lowers each snapshot-free ceiling by c * GDN_STATE / BW of floor.
  2. r4160536946 (P1, equality_gate.py:242): untracked repository files. tree_state(repo, None) and the launch manifest ignore untracked files, so an untracked importable file (an untracked .py beside a module the harness imports, or a sitecustomize.py on the path) could change every arm while the repository reads clean. Refuse untracked files in the repository, at least *.py, *.sh, *.toml, *.json under bench/, experiments/, scripts/, src/ and the root, in preflight and in the end-of-session check. Alternatively, run the holds from a fresh clean checkout of the gate's commit. The second is also the simplest way to pin the harness.

… 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.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  1. The snapshot-free floor. floor_ms now charges 1 + 2 states for a snapshot-free verify, against 1 + 16 + 2 for stock, which is consistent with expected.py removing exactly BLOCK states. A test checks both slopes.
    • I reran both README commands with the repository venv. ceiling.json and expected.json reproduce exactly, apart from repo_commit: they were generated at d8189ae, where the code is identical.
    • The README table matches ceiling.json at every c:
      • snapshot-free floors 2.93 / 2.98 / 3.06 / 3.23 ms;
      • ceilings 1.81 / 2.00 / 2.42 / 3.15x;
      • tau for 5x 15.8 / 14.2 / 11.7 / 9.2;
      • selector bounds 2.95 / 3.27 / 3.95 / 5.15x;
      • full blocks 5.07 / 5.62 / 6.81 / 8.74x.
    • The short answer now reads 3.15x and 15.8. The expected ratios are unchanged. Neither the old nor the new values appear in the paper on main.
  2. Untracked files. The repository's identity now covers every untracked file not ignored by .gitignore. Preflight, build and the session start and end checks refuse any, and a test covers an untracked sitecustomize.py (refused) and an ignored file (allowed).

Checks. tests/test_stack_analysis.py passes (87 tests), pre-commit from main is clean, and the commits have no AI attribution.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread experiments/stack/equality_gate.py Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +298 to +304
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}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +203 to +206
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}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread evidence/stack/levers.csv Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (84717d2; withdraws my provisional approval. Codex's four new comments are valid, and I add one stale-wording item.)

  1. r4160599845 (P1, equality_gate.py:491): the certified-head fingerprint is taken too late. The package fingerprint is taken in build, after the H and FGH equality servers have run. Take it in preflight, before any certified run, store it in identity.json, and require the same value in build, check and the end-of-session check.
  2. r4160599852 (P2, equality_gate.py:304): the reused references' configuration. ref_dflash_b16 and ref_dflash_b16_triton are checked for engine, cleanliness and model only. Also check their run metadata against the declared reference configuration: DFlash block and flags, attention backends, prompt set (hash), max new tokens, concurrency, top-logprobs and radix setting. The same plan-record check the stack's own runs get would do.
  3. r4160599854 (P2, analyze.py:206): the number of sessions. The declared procedure is s1-s3 plus at most two more sessions. Refuse a campaign with more than five distinct sessions, or any session name outside stack-s1..stack-s5, and test it.
  4. r4160599858 (P2, levers.csv D4): two different savings. D4 says "derived about 0.07-0.09 ms per c=1 block-16 cycle", while expected.json gives G a saving of up to 0.140 ms at c = 1 and README line 266 says 0.14 ms. Make the inventory row agree with the generated value, or say what each number counts.
  5. Mine: stale "unmerged" wording. Certified int8 LM head: exact stock-head decisions, seeded sampling, kernels and evidence #45 and Certified LM head in SGLang: greedy decode, verify, drafting and fixed-noise sampled verify #52 are now merged. levers.csv D5 ("pending (inputs only on unmerged PRs Certified int8 LM head: exact stock-head decisions, seeded sampling, kernels and evidence #45 and Certified LM head in SGLang: greedy decode, verify, drafting and fixed-noise sampled verify #52)") and expected.json's "h": "left out: inputs only on unmerged PRs #45 and #52 (pending)" now describe that evidence wrongly. Cite evidence/certified_head/ (micro_head.json, engine_v2.json) and keep H pending only for what is still unmeasured: the composed run and serving. Regenerate expected.json if its text changes.

…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).
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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.

  1. The package fingerprint (P1). It is now part of the preflight identity, taken before any H run, and build refuses a change.

  2. The references. They are checked against bench's full declared configuration (flags with and without Triton, pass, concurrency 1, 256 tokens, top-5, 320 prompts, cold cache, and S0's prompts and prompt token counts), and the prompt file is pinned by hash.

  3. Sessions. Only stack-s1 to stack-s5 are accepted.

  4. D4. levers.csv now matches expected.json's G savings: up to 0.14 ms at c = 1, none at 2, 0.12 and 0.13 ms at 4 and 8. The served plain-decoding +0.4% at c = 8 is added.

  5. The stale wording. expected.json's H note no longer says "unmerged". It now says H's served effect on DFlash is unmeasured and that evidence/certified_head spans a loss to a gain. The D3, D5 and D6 rows use merged evidence:

    • the drafter's 0.968, 0.983, 1.005 and 1.061;
    • the head path at M = 16, 395.1 us stock against 256.9 us certified;
    • DFlash verify falling back on 3.99% of rows and 90.0% of calls;
    • the draft projection falling back on 3.96% of rows and 87.6% of calls.

    All of these match their sources.

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.

  • Post-hoc checks for hold 1. For the scripts that hold ran, it names the checks that apply after the fact: package checkout and mtime, and fingerprint equality.
  • H's reason. It restates H's reason for staying out of the range.
  • F refuted. It reports F's prediction as refuted by the drafter's A/B: 0.968 at the low end of 0.969-1.042, and below 1.007-1.077, 1.067-1.130 and 1.148-1.200, which are expected.json's ranges. It locates the miss: the verify phase loses 1.10 ms, not 8 x 0.212 = 1.70 ms, and the commit adds 0.22 ms. It keeps the declared ranges.

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.

  • tests/test_stack_analysis.py passes (98 tests).
  • Pre-commit from main is clean.
  • expected.py reproduces expected.json apart from repo_commit.
  • The commits have no AI attribution.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-s4 is accepted only if, after s1-s3, some c has fewer than three valid FULL-against-S0 sessions. stack-s5 is 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.

Comment thread evidence/stack/levers.csv
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)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SamMausberg
SamMausberg merged commit 43dd775 into main Oct 1, 2026
@SamMausberg

Copy link
Copy Markdown
Owner Author

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 ~/vp-coord/notes/stack.md, under "Before the results PR":

  • r4160910683 (replacement sessions). stack-s4 and stack-s5 should count only when s1-s3 leave fewer than three valid FULL vs S0 sessions at some c. This can change a decision, so per main's rule it must be enforced in analyze.py, with a test, before hold 1's and s1-s3's data are analysed. The checklist marks it "must fix before analysis".
  • r4160910698 (engine_v2.json). The file is on main (from Certified LM head in SGLang: greedy decode, verify, drafting and fixed-noise sampled verify #52) but not in this branch's tree, because the branch predates that merge. The merge resolves the citation, and the checklist has an item to confirm it on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant