Skip to content

Confirmation harness: exactness classes, session-paired ratios, envelopes - #66

Merged
SamMausberg merged 9 commits into
mainfrom
bench/confirm
Oct 1, 2026
Merged

SamMausberg merged 9 commits into
mainfrom
bench/confirm

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Harness changes for the confirmation sweep and its evidence. This PR has no confirmation results yet: repeat 0 is running, and repeats 1-2, the supplementary hold and two quality holds are queued one at a time. The evidence will land on a new branch.

Exactness classes (coordinator fix 1). Every arm in bench/arms.toml declares exactness = stock | exact-up-to-floor | pending | lossy. resolve_arm fails in three cases:

  • the class is missing;
  • a non-stock arm has no lossy note saying why;
  • a stock arm changes anything outside an allowlist (NEUTRAL_FLAGS).

The allowlist covers capacity and memory, the prefix cache, CUDA-graph sizes, observability and frontend flags, the vision encoder's backend, and the stock speculation settings, including the draft attention backend. It also allows FlashInfer target attention, NEUTRAL_ENV, and the reference model and revision. An override outside the allowlist makes an exact arm pending. An explicit lossy note on an arm built in code makes it lossy, even when the arm inherited stock or pending (moonshot's levers). plain-tuned-triton and dflash-tuned-b16 are pending (Triton target attention, per the #60 ruling).

The Pareto builder takes each label's class from:

  1. the current arms.toml, when the run's flags still match the arm;
  2. else the run's own flags, env and model, checked before any recorded class;
  3. then the manifest's note and class.

A run whose flags are all neutral on the reference model is stock by that rule. A run with no model recorded is unclassified. A class is never inferred from a missing note. --class LABEL=CLASS overrides all three. The second envelope (envelope-exact.dat, best_exact in envelope.csv) covers only stock and exact-up-to-floor arms. The plot dashes the other classes.

Pairing by session (coordinator fix 2). bench.sweep --session records which repeat a run belongs to. paired_ratios pairs test and baseline runs within a session at each concurrency. A pair with an invalid point on either side is dropped and counted (dropped_invalid), never re-paired with another repeat's run. Two runs of one label in one session at one concurrency are an error. Repeat 0 predates sessions; confirm_evidence.sh assigns it with --session-of. The supplementary hold now starts with its own plain-tuned run, so its arms pair within the session.

Equality check. equality_tuned.sh adds plain and DFlash block 16 under Triton target attention against plain c=1. A configuration that fails to run no longer stops the others. The script deletes earlier outputs first, and exits non-zero if any pair is missing or if compare.py or bench.divergence fails.

Confirmation holds. A full repeat takes about 50 minutes, so confirm.sh <repeat> a|b runs it as two holds:

  • part a: plain-tuned with the FlashInfer speculative arms;
  • part b: plain-tuned-triton with the Triton arms.

Every matched pair stays in one hold.

Sensitivity workload, declared before any run (b028c6c). bench/README.md declares a natural-length workload: each confirmation prompt's own greedy length under plain decoding, capped at 2,048. It also fixes the arm rule (mean y over sessions, invalid points excluded, both arms if within 2%), the repeats, and how it is reported beside the primary fixed-length panel.

Implementation:

  • bench.natural_workload freezes the measured lengths into a workload file with a manifest.
  • bench.sweep sends a per-record output_length and checks osl_mismatch per prompt.
  • natural_lengths_confirm.sh measures the lengths and checks that they reach the server.
  • sensitivity.sh runs one session. Each point now also records the scheduler's generation rate at full batch as a diagnostic column (server_full_batch_tps). It is tokens over time across log windows, skipping each point's first window, which spans the idle gap before the point.

Other changes.

  • Pareto outputs: envelope.csv, envelope-all.dat, envelope-exact.dat and a PNG with both envelopes.
  • Evidence README corrections from the appendix editor: two rounded values (446, 5,386), and the depth claim, which holds within 4% at c=1 only.

Checks: pytest tests/test_bench_harness.py (33 passed), pre-commit clean.

Reproduce:

scripts/gpu_lock.sh -s bench/campaigns/equality_tuned.sh
scripts/gpu_lock.sh -x bench/campaigns/confirm.sh 1 a   # then 1 b, 2 a, 2 b
scripts/gpu_lock.sh -x bench/campaigns/confirm_supplementary.sh
bench/campaigns/confirm_evidence.sh

Each label carries its arm's exactness class (blank, pending or lossy),
read from the current arms.toml when the run's flags still match the arm
there, so a later classification reaches the plot without a rerun. Runs
that set a buffered-GDN flag through an override count as pending.
envelope.csv adds the best stock-arithmetic arm per concurrency;
envelope-all.dat and envelope-stock.dat hold the Pareto envelopes for
PGFPlots; the PNG draws both and dashes pending and lossy arms.
A full repeat of the seven tuned arms takes about 50 minutes, longer than
one exclusive hold should. Part a holds plain-tuned with the FlashInfer
speculative arms (MTP, DFlash block 8 and block 4), part b holds the Triton
plain baseline with the Triton speculative arms, so every matched pair
stays within one hold.
Plain decoding and DFlash block 16 under Triton target attention join the
pairs against plain c=1 (the reference uses FlashInfer). A configuration
that fails to run no longer stops the others; the script still fails at
the end if any pair is missing.
Every arm in arms.toml declares stock, exact-up-to-floor, pending or lossy,
and resolve_arm fails without one, or when a stock arm sets a
numerics-changing flag (buffered GDN state, non-FlashInfer target
attention, FP8, FP32 head, deterministic kernels). An override that adds
such a flag makes the arm pending. plain-tuned-triton and dflash-tuned-b16
are pending (Triton target attention). The Pareto builder takes the class
from arms.toml, the manifest or the flags, never from a missing note, and
its second envelope covers stock and exact-up-to-floor arms only.

bench.sweep --session records the repeat a run belongs to, and
paired_ratios pairs test and baseline runs within a session, dropping
(and counting) pairs with an invalid side instead of shifting to another
repeat's run. Repeat 0 predates sessions and is assigned by
confirm_evidence.sh. The supplementary hold gets its own plain-tuned
baseline.
446 and 5,386 match points.csv. Depth 3-5 are within 4% at c=1 only; at
c=8 deeper chains lead by up to 6.5% with stock verify, and under the
low-concurrency arm's buffered Triton configuration depth 4 leads depth 3
by at most 3.2%.
bench/README.md declares, before any run on it, a sensitivity workload with
each confirmation prompt's own greedy length under plain decoding (capped
at 2,048), the rule that selects its arms, its repeats and how its results
are reported beside the primary fixed-length panel.

Each point now records the scheduler's generation rate across log windows
with at least 0.9 x the largest batch running, as tokens over time, next to
the window median; points.csv and frontier.csv carry it as a diagnostic.
@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-01T03:44:00.510207Z b028c6c PR opened
ℹ️ 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.

SGLang's decode-log timer is not reset when the server idles, so the first
decode line of a point covers the time since the previous point (flush,
quiet wait, client start-up). Both full-batch rates now skip it; the
token-weighted rate would otherwise charge that idle time to the point.

@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: b028c6cf19

ℹ️ 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 on lines 55 to +58
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" | tee "$OUT/compare.log"
python -m bench.divergence "$OUT/summary.json" --out "$OUT/report.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 Propagate comparison and report failures

After removing set -e, neither this pipefail pipeline nor the following bench.divergence command contributes to status. On an incremental rerun, if compare.py exits nonzero while an older complete summary.json remains—or if only report generation fails—the later pair-presence check can still pass against stale data and the script exits successfully, allowing invalid equality evidence to be treated as complete. Capture both exit statuses and set the final status nonzero.

Useful? React with 👍 / 👎.

Comment thread bench/arms.py Outdated
Comment on lines +80 to +83
if self.lossy and self.exactness in ('', 'stock'):
note = self.lossy.lower()
object.__setattr__(
self, 'exactness', 'pending' if note.startswith('pending') else '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 Classify explicit lossy overrides as lossy

When a programmatic arm applies a recognized numerical override such as quantization or kv-cache-dtype, resolve_arm first assigns exactness='pending'. The moonshot builders then replace the generated pending note with an explicit FP8 lossy description, but this condition does not recompute an already-pending class, so those deliberately lossy configurations remain labeled pending in manifests and Pareto reports. Treat a non-pending: lossy note as lossy when the inherited class is pending as well.

Useful? React with 👍 / 👎.

bench.natural_workload freezes each prompt's natural greedy length (from a
natural-stopping point that served every prompt once) into a workload
file with a manifest. bench.sweep sends a record's output_length per
request (aiperf single-turn output_length) and checks osl_mismatch per
prompt. natural_lengths_confirm.sh measures the lengths under plain-tuned
and checks that they reach the server; sensitivity.sh runs one session of
the declared arms at c=32 and 128.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Reviewed head 8f885eb (seven commits on main; harness only, with no confirmation results). Session pairing, the hold layout and the envelope classes are right. The exactness check lets several arithmetic-changing flags through as stock, and Codex found two valid issues.

Checked and correct

  • The exact envelope (integrator check 2). envelope-exact.dat and best_exact use only EXACT_CLASSES = {stock, exact-up-to-floor}. A label with no recorded class reads as unclassified, which ranks worst in label_exactness and is never exact. --class LABEL=CLASS is validated.
  • Pairing by session (check 3). paired_ratios indexes runs by (label, concurrency, session). It pairs only within a shared session, drops a pair when either side is invalid and counts it in dropped_invalid, counts unmatched sessions, and raises on two runs of one label in one session. Nothing is re-paired across repeats. Repeat 0 is assigned confirm-r0 through --session-of, and the supplementary hold has its own session (confirm-supp) and its own plain-tuned run.
  • Two holds per repeat (check 6). Part a runs plain-tuned with mtp-tuned, dflash-tuned and dflash-tuned-b4. Part b runs plain-tuned-triton with mtp-tuned-triton and dflash-tuned-b16. Every --pair in confirm_evidence.sh matches an arm with a plain baseline from the same hold. The exception is plain-tuned-triton:plain-tuned, which crosses holds within one session; that is intended and fine.
  • Arm classes. plain-tuned-triton and dflash-tuned-b16 are pending (Triton target attention), the replay arms are pending, and draft-only FA4 stays stock.
  • server_full_batch_tps (check 5).
    • It is token-weighted: running x accept per window, divided by the rate.
    • The first log window of each point is left out (lines[1:]).
    • The README calls it a diagnostic, not a headline metric.
  • Tests and hooks. pytest tests/test_bench_harness.py gives 32 passed, and pre-commit is clean.

Blocking

B1. NUMERICS_FLAGS misses flags that change the target's arithmetic, so overrides that set them stay stock (bench/arms.py, integrator check 1).

  • I resolved plain-tuned with each of these overrides, and every one came back stock:
    • mamba-ssm-dtype=float16, a lossy lever already in this project;
    • enable-torch-compile;
    • decode-attention-backend=triton;
    • linear-attn-prefill-backend=flashinfer;
    • enable-tf32-matmul;
    • bf16-gemm-backend=cutedsl.
  • Others in the same position at the pin include prefill-attention-backend, linear-attn-backend, linear-attn-verify-backend, dtype, speculative-attention-mode and rl-on-policy-target.
  • A list of flags known to change arithmetic will always be incomplete.
  • Fix: invert it. Keep an allowlist of flags known not to change the target's arithmetic: capacity, memory and cache sizes, ports, metrics, stream interval, the radix cache, the speculative algorithm, its steps and draft model, the draft attention backend, CUDA-graph sizes and the seed. Any flag outside it, or any attention or GEMM backend that differs from the reference, makes the arm pending.
  • Add a test per flag class (dtype, attention backends, GDN backends, compile/TF32/GEMM backend).

B2. exactness(manifest) trusts a recorded stock even when the run's args change arithmetic (bench/pareto.py, exactness()).

  • When the arm no longer matches arms.toml, a manifest with exactness: stock and no note returns stock before numerics_changes(args) is consulted.
  • An arm built in code from a stock base, with a flag added but no note, would therefore land on the exact envelope.
  • Fix: check numerics_changes(args) (or B1's allowlist) first, and never return stock for a run whose args fail it.

B3. Codex P1: equality failures no longer fail the script (bench/campaigns/equality_tuned.sh:58).

  • With set -e removed, a failing compare.py or bench.divergence does not set status. On a rerun, a stale but complete summary.json then passes the pair check.
  • Fix: capture both exit codes (|| status=1, using PIPESTATUS for the tee pipeline), and delete summary.json and report.json before comparing.

B4. Codex P2: an explicit lossy note on an already-pending arm stays pending (bench/arms.py:83, __post_init__).

  • Moonshot's FP8 builders get pending from resolve_arm and then write an explicit lossy note, but __post_init__ only reclassifies '' or stock.
  • Fix: a note that does not start with pending should make the class lossy when the inherited class is pending too.

B5. The declaration time does not match its commit (bench/README.md, "Declared on 2026-10-01 at 03:50 UTC"; integrator check 4).

  • The declaration's commit b028c6c is dated 03:40:18 UTC.
  • I checked the data side: the only natural-length data under ~/vp-data/bench/natural is the tune-split length run from 2026-09-30 19:11, which is not a timed arm. No sensitivity run exists yet, so the declaration does precede every sensitivity run.
  • Fix: state the commit and its time instead of a clock time that does not match it.
  • Also make the arm rule fully mechanical: "highest confirmation y" should say mean over repeats, invalid points excluded, and give a tie rule.

Suggestion (not blocking)

  • The full-batch rate in the README. State the first-window exclusion, and say that the rate is never used to form a speedup. The code already does the first.

B1: a stock arm may set only flags in NEUTRAL_FLAGS (capacity, memory,
prefix cache, CUDA-graph sizes, observability, frontend, the vision
encoder's backend, stock speculation settings) and FlashInfer target
attention. Any other flag, any environment variable outside NEUTRAL_ENV,
or another model makes it pending; tests cover each flag class the review
named. B2: the Pareto builder checks the run's flags before a recorded
stock class, and derives stock only for runs whose flags are all neutral
on the reference model. B3: equality_tuned.sh deletes earlier outputs and
fails when compare.py or bench.divergence fails. B4: an explicit lossy
note on an arm that inherited the pending class makes it lossy. B5: the
sensitivity declaration cites its commit, and its arm rule uses the mean
y over sessions with invalid points excluded, running both arms when the
second is within 2%.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Re-reviewed head 6b25b9f (8ab13d9 and 6b25b9f on 8f885eb). All five blocking items are fixed.

  • B1 (fixed). Exactness is now decided by an allowlist.
    • Stock arms may set only NEUTRAL_FLAGS (capacity and memory, the radix cache, CUDA-graph sizes, observability and seed, frontend workers, the vision attention backend, stock speculation settings with the draft attention backend) plus FlashInfer target attention. NEUTRAL_ENV allows only the FlashInfer workspace size, and the model and revision must be the reference.
    • Anything else makes the arm pending: I re-ran my six overrides (mamba-ssm-dtype, torch compile, decode attention backend, GDN prefill backend, TF32, bf16-gemm-backend), plus chunked-prefill-size and an arbitrary environment variable, and every one now resolves pending. Neutral overrides keep stock.
    • A stock arm in arms.toml that sets anything else is an error.
    • An exact-up-to-floor arm with an added flag drops to pending, because a classification covers the arm's own flags only.
    • The tests cover each class.
  • B2 (fixed). pareto.exactness() checks the run's flags, environment and model before trusting any recorded class.
  • B3 (fixed). equality_tuned.sh deletes the old summary, report, CSV and table first. It takes compare.py's status from PIPESTATUS and also checks bench.divergence's exit code; either failing makes the script exit 1.
  • B4 (fixed). An explicit note that does not start with pending maps '', stock or pending to lossy.
  • B5 (fixed). The declaration cites commit b028c6c (03:40 UTC). The rule is now: the mean y over the three sessions, invalid points excluded, and both arms run when the second is within 2%. No sensitivity run exists, so the order holds.
  • Checks. 33 tests pass and pre-commit is clean. Codex's two comments on b028c6c are the B3 and B4 fixes above.

Before the first sensitivity run (not blocking this merge).

  • Record the refinement. The arm-selection rule was refined after b028c6c, in 6b25b9f at 03:47 UTC, at my request and still before any sensitivity run. Add one line to the declaration saying so, so that the pre-registration history is complete.
  • Derive the arm list mechanically. sensitivity.sh takes the arms on its command line. Derive them from the confirmation evidence with a small script that applies the rule to frontier.csv / pairs.csv and prints the arm list, so that choosing the arms needs no judgement.

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