Skip to content

State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests - #110

Merged
SamMausberg merged 7 commits into
mainfrom
state/pinned-results
Oct 1, 2026
Merged

SamMausberg merged 7 commits into
mainfrom
state/pinned-results

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Results from the pinned-pool matrix (#102) and the tree and plain exact tests. More results will follow as the queued runs land.

What's in it

  • Pinned matrix: plain baseline and MTP. MTP steps 1, 3 and 5 and the top-k 2 tree, at concurrency 1 and 32, 320 prompts × 256 tokens. Every server allocated exactly cap 8, 49,152 KV tokens and 40 GDN slots, recorded in run_meta_pinned.json (resolved_pools). Every pair has identical pools (pools.json). Files: noise_floor_pinned.json/.csv, divergences_pinned.csv, cycles_*_pinned.json.
    • MTP vs plain: 3.5–4.0 divergences per 1,000 tokens in every configuration and at both concurrencies. MTP vs itself across concurrency: 3.1–3.5.
    • Every divergence is an exact tie, within one BF16 step, or near (11 events, 5 prompts, both margins ≤ 2 BF16 steps). There are 0 large and 0 non-argmax commits.
    • Divergences per fragile position by the previous cycle's commit length, including full acceptance: no length stands out. For example, MTP steps 3 gives 0.089 / 0.098 / 0.088 / 0.079 for lengths 1–4. The first verify cycle after prefill is counted separately and kept out of the test.
    • No divergence at any commit length is at a non-fragile position. That would be the strong sign of a state error, and it is reported separately.
    • The rates (fragile divergences per fragile position) are compatible with one common rate (chi-square p = 0.75, 0.72, 0.54, 0.38).
    • Exploratory only: the first verify cycle after prefill has a higher rate for steps 5 and the tree (7/40, 6/33; Fisher p = 0.033, 0.049 against later cycles). The test was chosen after seeing the data, is uncorrected, and compares groups that differ in more than state. It is a lead for a declared follow-up on fresh prompts, not a finding. That is a failure to reject, and the test treats positions as independent although they cluster by prompt. There is no prompt-clustered analysis or excess-rate bound yet.
    • Fresh-server repeat at c32: 4/320 (identical pools, cap 8), against 24/320 unpinned (different pools, cap 16). Pools and cap changed together, so these runs don't apportion the drop between them.
    • Same-server warm repeats now differ (17/320 at c1, 4/320 at c32, all ties or one ulp). The pinned KV pool (49,152 tokens) is smaller than one pass (126,408 tokens), so the radix tree evicts. The README treats this, untested, as the history dependence, and says a same-server warm repeat is not an equality reference with the radix cache on.
    • A deliberate cross-regime pair (cross_regime.json, via --allow-mixed-pins): pinned vs unpinned plain c1 is 320/320 token-identical, and one prompt's logprobs differ (mt_bench-0064, from output index 2).
  • Exact tests, tree and plain decoding (targeted.json), with top-5 logprobs compared too.
    • Truncation: 159/159 (tree) and 39/39 (plain), identical in tokens and logprobs.
    • Stop token at every cycle index: 160/160 and 40/40.
    • Warm vs cold continuation: 142/160 (tree) and 33/40 (plain), the rest at ties or one ulp. Plain has no speculation, so the warm/cold flips come from the warm path's prefill and radix history.

Missing pairs

noise_floor_pinned.json lists 26 missing_pairs. They are the queued pinned runs: radix off, overlap off, deterministic, FP32 head, logprobs off, retraction, second MTP session, and the ReplaySSM and FlashInfer GDN paths. This regeneration used STATE_ALLOW_MISSING=1. Without it, analyze_all.sh fails by design until those runs land.

Code changes (squashed into 39072c5)

  • server_id no longer includes the host name. public_server_info() replaces the host part of ids recorded by earlier runs, in compare.py (run meta) and summarize_targeted.py. No machine address reaches committed evidence, and same_server stays exact.
  • compare.py records first_logprob_diff (the first output index whose top-k logprobs differ). It adds --all-logprob-differences, which the deliberate cross-regime pair uses so that divergences_cross_regime.csv lists mt_bench-0064 (first difference at output index 2, drift 0.24 nats). It also puts prompt_tokens, cached_tokens and requests_with_cached_tokens sums in the run meta.
  • cycles.py reports the divergence rate per fragile position by commit length, with a chi-square homogeneity test: p = 0.75, 0.72, 0.54 and 0.38 for MTP steps 1, 3 and 5 and the tree. The test is reported as not applicable when an outcome is empty.

Checks

  • analyze_all.sh regenerates every file.
  • 20 state tests pass.
  • Pre-commit passes, including mypy.

@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-01T12:28:04.161923Z fb1b4b9 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.

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

ℹ️ 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 +39 to +41
nice -n 19 python compare.py --runs "$HOME/vp-data/state" --pairs pairs_cross_regime.json \
--allow-mixed-pins --out-json "$evidence/cross_regime.json" \
--out-csv "$evidence/divergences_cross_regime.csv" > /dev/null

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 Record low-drift rows for the cross-regime comparison

For this token-identical comparison, compare.py only writes event rows when max_drift > LARGE_DRIFT_NATS (0.5), while the reported maximum is about 0.238. Consequently, divergences_cross_regime.csv contains only its header and cross_regime.json retains only aggregate statistics, so the README's key claim that specifically mt_bench-0064 begins differing at output index 2 cannot be regenerated or audited from the committed evidence. This invocation should preserve all nonzero-drift prompts, or use a cross-regime-specific output threshold/detail report.

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 14e38db, regenerated from the existing runs with no new GPU work. compare.py records first_logprob_diff, the first output index whose top-k logprobs differ. A new --all-logprob-differences flag also writes every prompt whose logprobs differ without a token change (the default threshold is still drift above 0.5 nats). analyze_all.sh passes that flag for the cross-regime pair, so divergences_cross_regime.csv now has the row the README cites: mt_bench-0064, first_logprob_diff 2, max_drift 0.238 nats, tokens identical. divergences.csv and divergences_pinned.csv gain only the new column; I checked row by row that every other value is unchanged. There is a unit test for first_logprob_diff.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 14e38dbc7c

ℹ️ 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".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Review on the exact head 14e38db.

What I verified

  • Regeneration. STATE_ALLOW_MISSING=1 experiments/state_safety/analyze_all.sh (one core, 39 s) reproduces every committed file in evidence/state_safety byte-identical, at both c287be0 and 14e38db.
  • The 14e38db change only adds a column. divergences.csv (222 rows) and divergences_pinned.csv (2,488 rows) are identical row by row to c287be0 apart from the new first_logprob_diff column. divergences_cross_regime.csv now holds the mt_bench-0064 row: tokens identical, first_logprob_diff 2, drift 0.238 nats.
  • Pools.
    • All 14 pinned runs in run_meta_pinned.json report resolved_pools = 49,152 KV tokens, cap 8 and 40 GDN slots.
    • All 14 have mem fraction 0.25, a clean SGLang tree, repo 5c3f1d2 (on main), and 320 prompts × 256 tokens.
    • All 20 pinned pairs in pools.json have pools_identical: true: 7 same-server pairs and 13 fresh-server pairs.
  • Divergence classes.
    • Over the 20 pairs there are 2,364 tie, 109 one_ulp and 11 near, with 0 large and 0 not_argmax.
    • self_consistency shows not_argmax 0 in every run.
    • The 11 near events cover 5 prompts. Every one has both margins at most 2× its ulp column, so within two BF16 steps.
    • Logprob drift without a token change is at most 0.617 nats.
  • Rates per 1,000 tokens.
    • MTP vs plain: 3.51 to 3.68 at c1 and 3.53 to 3.96 at c32, which is the stated 3.5 to 4.0.
    • MTP c1 vs c32: 3.07 to 3.47, which is the stated 3.1 to 3.5.
  • Rates by commit length. I summed the cycles_*_pinned.json buckets by previous commit length, and every cell of the README table matches.
  • Repeats.
    • Fresh-server repeat at c32: 4/320 pinned against 24/320 unpinned (noise_floor.json).
    • Same-server warm repeats: 17/320 at c1 and 4/320 at c32, all ties or one ulp. Unpinned, it was 0/320.
  • The 126,408-token figure. From the raw runs it is 56,366 prompt tokens plus 70,042 output tokens. cached_tokens is 0 for every request in all 14 pinned runs, which supports "no prefill in any pass reused a cached prefix".
  • Cross-regime pair: 320/320 identical, with pools_identical: false, as intended.
  • targeted.json:
    • truncation: tree 159/159, plain 39/39, logprobs included;
    • stops: 160/160 and 40/40, logprobs included, with 120 of the tree stops inside the draft block;
    • warm vs cold: 142/160 (17 ties and 1 one-ulp) and 33/40 (7 ties).
  • Tests and hooks: tests/test_state_safety_compare.py passes (8 tests).
  • Codex:
    • The P2 on c287be0 (low-drift cross-regime rows) is fixed and has a reply.
    • Codex finished its review of 14e38db at 12:01:45 with no new threads (--paginate).
  • Attribution: both commits are authored and committed by Samuel Mausberg, with no AI lines.

Blocking

  1. The committed evidence publishes the machine's public IP address. The repository is public.
    • server_info.server_id is built from socket.gethostname() in experiments/state_safety/server.py:401. On this box the hostname is the public IP in dashed form: <hostname>:<port>:<pid>:<ns>.
    • It appears 18 times: 14 in run_meta_pinned.json and 4 in targeted.json. None of main's evidence contains it yet; this PR would be the first.
    • Please:
      • (a) stop recording the hostname in server.py. Pid plus time_ns already make the id unique on one host, or a hash of the hostname would do.
      • (b) scrub the host part where the evidence is written (compare.py --out-meta and summarize_targeted.py), because the raw runs already contain it and a regeneration would otherwise put it back. Replacing it with a constant keeps the same_server comparisons exact.
      • (c) rewrite the branch (amend and force-push), or squash on merge, so the address does not enter main's history.
    • The address has been on the public PR branch since c287be0. Whether that matters is for Sam to decide, and I have flagged it to the coordinator.

Suggestions (non-blocking)

  • "Do not depend on the previous cycle's commit length" is stated without a test. The rates range from 0.061 to 0.100, with 13 to 136 divergences per cell. A chi-square test of homogeneity across commit lengths does not reject: p = 0.74 (steps 1), 0.72 (steps 3), 0.71 (steps 5) and 0.27 (tree). Saying "show no dependence (chi-square homogeneity, p >= 0.27)" would put a test behind the words.
  • Two claims rest only on the raw runs. The 126,408 tokens and the zero cached-prefix tokens are not in the committed evidence. Adding prompt_tokens and cached_tokens sums per run to run_meta_pinned.json would let a reader check them from the repository.

The plain baseline and the MTP matrix (steps 1, 3 and 5 and the top-k 2 tree, at
concurrency 1 and 32) ran with identical pinned pools. Every divergence between
speculative and plain decoding, or between speculative configurations, is an
exact tie, one ulp, or near (both margins at most two BF16 steps). None is
large, and no run committed a token that was not its own top-1. Divergences per
fragile position do not depend on the previous cycle's commit length (chi-square
homogeneity p = 0.74, 0.72, 0.71, 0.27). The tree and plain truncation and stop
tests are identical in tokens and logprobs.

Code changes:
- server_id no longer contains the host name. public_server_info replaces the
  host of ids recorded earlier, so committed evidence carries no machine address.
- compare.py records first_logprob_diff, adds --all-logprob-differences (used
  for the deliberate cross-regime pair), and puts prompt and cached token sums in
  the run meta.
- cycles.py reports rates by commit length with the homogeneity test.

Pairs still queued are listed as missing; this regeneration used
STATE_ALLOW_MISSING=1.
@SamMausberg
SamMausberg force-pushed the state/pinned-results branch from 14e38db to 39072c5 Compare October 1, 2026 12:06
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional: Codex's review of 39072c5 was still running when I posted this. I will re-check its threads on this head before merge.)

Re-review on the exact head 39072c5. It is one commit on 5896eb2 that replaces c287be0 and 14e38db.

The blocking item, the machine's hostname in committed evidence, is fixed.

  • Search method. I searched for the hostname and its dotted form, both computed at runtime with hostname, in four places:

    • the branch tip;
    • every commit between origin/main and 39072c5 (git log -p);
    • the PR title, body, comments, review comments and reviews;
    • origin/main.

    There were 0 matches in each.

  • At the source, server.py now builds server_id as port:pid:start_ns, with no host.

  • Where evidence is written, public_server_info() drops cmd and replaces the host part of older four-part ids with the constant host.

    • compare.py (run metadata) and summarize_targeted.py both use it, so regenerating from the raw runs cannot reintroduce the hostname.
    • Every server_id in run_meta_pinned.json now starts with host.
    • Equal ids stay equal and different servers stay distinct, so the same_server result is unchanged.
    • The new test uses an address from the documentation range.
  • What remains: the earlier commits may still be reachable by SHA on GitHub. That is with the coordinator and Sam.

Both of my suggestions are in.

  • Chi-square test. cycles.py writes by_commit_length.homogeneity_chi2, which gives p = 0.7392, 0.7185, 0.7055 and 0.2692 for steps 1, 3, 5 and the tree. These match my own calculation, and the README cites them.
  • Token counts. run_meta*.json now carry prompt_tokens, cached_tokens and requests_with_cached_tokens.
    • plain/c1 has 56,366 prompt plus 70,042 output tokens, which is 126,408.
    • cached_tokens and requests_with_cached_tokens are 0 for every pinned run.

Checks

  • Regeneration: STATE_ALLOW_MISSING=1 analyze_all.sh (one core) reproduces every committed file byte-identical.
  • Earlier checks still hold. Everything I checked on 14e38db holds on this head: pools, classes, rates, buckets, repeats, targeted counts and the cross-regime row.
  • Tests and hooks: tests/test_state_safety_compare.py and tests/test_state_safety_server.py give 17 passed. Pre-commit passes on the whole range from origin/main.
  • Attribution and merge state: the commit is by Samuel Mausberg, with no AI lines, and the branch is MERGEABLE.

Blocking: none.

Note (outside this PR): bench/server.py:509 on main records socket.gethostname() in each run's launch.json under ~/vp-data. Nothing committed contains it yet, but copying a launch.json into evidence would leak the hostname. The state agent has raised this with bench. The pre-commit guard in #111 should also catch it.

analyze_all.sh exits non-zero if any evidence file contains the machine's host
name, in its dashed or dotted form, computed at run time.

@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: 39072c5491

ℹ️ 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 evidence/state_safety/README.md Outdated
Comment on lines +296 to +298
- **By rejection position.** Divergences per fragile position (one where the plain
reference's top-2 gap is at most 0.25 nats) do not depend on the previous cycle's
commit length, including full acceptance (`cycles_*_pinned.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 Avoid claiming independence from nonsignificant tests

For the four reported experiments, these p-values only fail to reject a common rate; they do not establish that divergence rates “do not depend” on commit length. Moreover, chi2_contingency treats the bucketed positions as independent observations even though many positions come from the same prompt and collection stops at that prompt's first divergence. The current p-values therefore cannot support the stated independence conclusion without a prompt-clustered analysis and an uncertainty/power bound; otherwise describe the rates as merely compatible with homogeneity.

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, fixed in f5061a4. The README no longer says the rates "do not depend" on commit length. It now says that no length stands out and that the rates are compatible with one common rate (chi-square p = 0.74, 0.72, 0.71, 0.27). It adds that this is a failure to reject, not a proof of equal rates, and that the test treats positions as independent although they cluster by prompt and a prompt's positions stop at its first divergence. It also says that no prompt-clustered analysis or per-length excess-rate bound has been done. The PR description is reworded the same way.

Comment thread experiments/state_safety/cycles.py Outdated
Comment on lines +124 to +128
if len(used) >= 2:
from scipy.stats import chi2_contingency

chi2, p, dof, _ = chi2_contingency(used)
test.update(chi2=round(float(chi2), 3), dof=int(dof), p=round(float(p), 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 Handle exact runs before invoking the chi-square test

When a valid comparison has zero divergences at every commit length, used still contains two or more rows, but its entire divergence column is zero. SciPy's chi2_contingency then raises because the expected-frequency table contains zeros, so cycles.py and consequently analyze_all.sh fail on the exact-output result that this state-safety analysis is intended to handle. Skip the test or emit an explicit non-applicable result when either outcome column has no observations.

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 5a56c0f. by_commit_length() now records homogeneity_chi2 as not applicable when either outcome column (divergent or non-divergent fragile positions) is empty across all commit lengths, instead of calling chi2_contingency with zero expected counts. A run with exact output therefore regenerates without error. A unit test covers the all-zero case.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

With no divergence at any commit length (or every fragile position
diverging), the contingency table has a zero column and SciPy's test cannot
run. cycles.py now records the test as not applicable instead of failing, so
analyze_all.sh handles an exact-output result.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Re-review on the exact head 5a56c0f. It adds 6097d16 and 5a56c0f on top of 39072c5, which I approved provisionally.

What I verified

  • 6097d16: analyze_all.sh now exits 1 if any evidence file contains the hostname, in its dashed or dotted form, both computed at runtime. Neither commit contains the hostname. I checked with the same runtime search over the tip, git log -p origin/main..HEAD and the PR text.
  • 5a56c0f: by_commit_length() records the homogeneity test as not applicable when an outcome column is empty, and the new unit test covers it. This answers Codex's P2 r4155182559, which has a reply.
  • Regeneration: STATE_ALLOW_MISSING=1 analyze_all.sh (one core) passes the new guard and leaves every committed file byte-identical.
  • Tests and hooks: the two state-safety test files give 18 passed. Pre-commit passes on origin/main..HEAD.
  • Attribution: both commits are by Samuel Mausberg, with no AI lines. The branch is MERGEABLE.

Blocking

  1. Codex P2 on 39072c5: avoid claiming independence from nonsignificant tests (State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests #110 (comment)). It has no reply or fix yet, and it is right.
    • The README says the rates "do not depend on the previous cycle's commit length" and backs this with the chi-square p-values. A non-significant test only fails to reject one common rate; it does not show independence.
    • The test also treats every fragile position as independent. Positions cluster within prompts, and collection stops at each prompt's first divergence, so the p-values are not calibrated.
    • That wording came from my own suggestion on 14e38db, which was too loose.
    • Please say the rates are compatible with one common rate. Give the p-values with the caveat that the test treats positions as independent, although they cluster by prompt. Change "None does" to something like "No length stands out".
    • If you want a stronger statement, a prompt-level permutation or bootstrap test, or an upper bound on the excess rate at any one length, would support it. That is optional.

Suggestion (non-blocking). On another machine, a short or generic hostname (for example gpu) could make the guard fire on ordinary evidence text. That fails closed, which is right, but a message naming the matching file would make it easier to diagnose.

@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: 5a56c0f71c

ℹ️ 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/state_safety/cycles.py Outdated
Comment on lines +108 to +110
if '/' not in key:
continue # the prefill token has no previous cycle
length = key.split('/')[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 Exclude the first verify cycle from length-one results

compare.py defines chunks[0] as the prefill-sampled token, but analyse() subsequently sets prev to that chunk's length (always 1), causing every prompt's first actual verify cycle to be recorded under the 1/* keys. Grouping those keys here therefore mixes cycles with no previous verify cycle into commit length 1, biasing both its reported rate and the chi-square result used for the rollback conclusion; the first verify cycle needs a distinct prefill bucket that this aggregation excludes.

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 de6f569. After chunk 0 (the prefill token), prev is now 'prefill' rather than '1', so each prompt's first verify cycle goes into 'prefill/' buckets instead of '1/*'. by_commit_length() skips non-numeric lengths and reports that cycle separately as first_cycle_after_prefill, outside the homogeneity test. I regenerated the files. The README table and p-values now come from them: p = 0.75, 0.72, 0.54, 0.38 for steps 1, 3, 5 and the tree, with the first cycle after prefill at 2/22, 3/32, 7/40 and 6/33. A two-chunk unit test checks the bucketing.

…endent

A non-significant chi-square fails to reject a common rate. It does not show
that the rates are equal, and the test treats positions as independent although
they cluster by prompt and stop at a prompt's first divergence. The README now
says the rates are compatible with one common rate, says that no length stands
out, and names these limits. The host-name guard now lists the files it matched.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Re-review on the exact head f5061a4 ("State the commit-length result as compatible with one rate, not independent").

What I verified

  • Codex P2 r4155182543 (independence wording) is fixed and has a reply.
    • The README now says the rates are compatible with one common rate, gives the p-values, and calls this a failure to reject.
    • It states that the test treats positions as independent although they cluster by prompt and stop at the first divergence, and that no clustered analysis has been done.
    • Neither the README nor the PR body says "do not depend", "flat" or "None does" any more.
  • The guard now names the matching files and never prints the matched text.
  • The hostname is absent. I searched the tip, git log -p origin/main..HEAD and the PR text, computing both forms at runtime, and found 0 matches.
  • Regeneration: STATE_ALLOW_MISSING=1 analyze_all.sh (one core) passes the guard and leaves every committed file byte-identical.
  • Pre-commit passes on origin/main..HEAD.

Blocking

  1. Codex P2 on 5a56c0f: exclude the first verify cycle from the length-one results (State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests #110 (comment)). It has no reply or fix yet. It is not a repeat of the independence comment, and it is right.
    • In cycles.py analyse(), chunk 0 (the prefill-sampled token) goes to prefill_token, but prev is then set to str(commit_len) of that chunk, which is '1'.
    • So every prompt's first verify cycle, which follows prefill rather than a verify cycle that committed one token, is bucketed under 1/*.
    • That mixes 320 post-prefill cycles into the commit-length-1 rate for every configuration. It moves the first column of the README table and feeds into the chi-square test.
    • Please keep prev = 'prefill' after chunk 0, so the first verify cycle gets its own prefill/* buckets. Then:
      • make by_commit_length() skip any key whose length part is not a number (today it only skips keys without /, and int('prefill') would fail in the sort);
      • regenerate, and update the README table and p-values from the new files;
      • add a unit test with a two-chunk prompt.

Suggestions: none.

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

ℹ️ 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/state_safety/cycles.py Outdated
Comment on lines +112 to +113
r[0] += v['divergences']
r[1] += v['fragile']

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 Restrict the fragile-rate numerator to fragile divergences

When a rollback error causes a token divergence at a position whose reference top-2 gap exceeds FRAGILE_GAP—precisely a strong signal this analysis is meant to detect—divergences increases while fragile does not. Aggregating all divergences here therefore makes divergences_per_fragile invalid and constructs (d, f - d) with unrelated counts for the chi-square test; this inflates the reported rate and can produce a negative contingency cell when d > f, causing SciPy to fail. Track divergences at fragile positions separately for this table and report non-fragile divergences independently.

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 51f4ac2. analyse() now counts divergences at fragile and non-fragile positions separately. divergences_per_fragile and the chi-square table (d, f - d) use only the fragile divergences, so d <= f always holds. Divergences at non-fragile positions are reported per commit length, for the first cycle after prefill, and in total (nonfragile_divergences). In every pinned MTP configuration that count is 0, so the rates and p-values (0.75, 0.72, 0.54, 0.38) are unchanged. The README table gains a non-fragile column, and a unit test covers a divergence at a non-fragile position.

cycles.py set the previous commit length to 1 after the prefill token, so every
prompt's first verify cycle was counted under commit length 1. That cycle now
has its own bucket ('prefill/<offset>'), reported as first_cycle_after_prefill
and left out of the homogeneity test. The README table and p-values are
regenerated from the corrected files (p = 0.75, 0.72, 0.54, 0.38). A two-chunk
unit test covers the bucketing.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

The rate and the homogeneity test used every divergence as the numerator,
including any at non-fragile positions, which mixed unrelated counts and could
make a contingency cell negative. They now use divergences at fragile positions
only. Divergences at non-fragile positions, the strong sign of a state error,
are reported per commit length and in total. There are none in any
configuration, so the rates and p-values are unchanged. The README table gains
the column, and a unit test covers a non-fragile divergence.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Re-review on the exact head de6f569 ("Count the first verify cycle after prefill apart from commit length one").

What I verified

  • Codex P2 r4155232868 (first verify cycle under length 1) is fixed and has a reply.
    • prev is 'prefill' after chunk 0. by_commit_length() skips non-numeric lengths and reports the first cycle separately.
    • The new two-chunk test checks the bucket keys.
  • Regeneration: STATE_ALLOW_MISSING=1 analyze_all.sh (one core) passes the hostname guard and leaves every committed file byte-identical.
  • The README matches the regenerated files. I checked:
    • the length table: steps 5 at length 1 is 0.064 and the tree at length 1 is 0.085;
    • the all-lengths rates: 168/1951, 168/1950, 157/2046 and 164/2025;
    • the first-cycle counts: 2/22, 3/32, 7/40 and 6/33;
    • the p-values: 0.75, 0.72, 0.54 and 0.38.
  • Tests and hooks: 19 state-safety tests pass, and pre-commit passes on origin/main..HEAD.
  • The hostname is absent from the tip, the history and the PR text. I searched at runtime.
  • Attribution: the commit is by Samuel Mausberg, with no AI lines.

Blocking

  1. Codex P2 on f5061a4: restrict the numerator to fragile divergences (State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests #110 (comment)). It has no reply or fix yet, and it is right.
    • divergences counts every divergence in a bucket, but fragile counts only positions whose reference top-2 gap is at most 0.25 nats. So divergences_per_fragile and the (d, f - d) cells of the chi-square mix two different counts.
    • A divergence at a non-fragile position is exactly what a rollback error would produce. It would inflate the rate, and with d > f it would make a negative cell that SciPy rejects.
    • With today's data every divergence is a tie, one ulp or near (margin at most 0.25), so this is probably moot for the numbers. The analysis still has to be right for the runs still queued.
    • Please count fragile divergences separately and use them for the rate and the test. Report non-fragile divergences per length on their own (today, presumably 0), and add a unit test with a non-fragile divergence.
  2. The independence caveat now sits under the wrong bullet.
    • "That is a failure to reject, not a proof of equal rates. The test also treats positions as independent ... No prompt-clustered analysis ... has been done." now closes the new bullet about the first cycle after prefill. The commit-length bullet that it qualifies ends at the p-values.
    • This is the caveat the last round required. The appendix will take its wording from this README, so please move those sentences back under the commit-length bullet.

Suggestion (non-blocking). The first-cycle comparison is called "untested". A Fisher exact test of the first cycle against all later lengths gives p = 0.71, 0.75, 0.033 and 0.049 for steps 1, 3, 5 and the tree. These are uncorrected for four comparisons and confounded by the selection you describe: later cycles only count prompts that have not yet diverged. Reporting that, rather than "untested", would be more exact. Because the prefill-to-decode handoff is where a state error could also show, a short pending item (for example the same split at c32, or against a plain-decoding first step) would also help.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES (one item left, the caveat's placement)

Re-review on the exact head 51f4ac2 ("Rate only fragile divergences per fragile position; count the rest apart").

  • Codex P2 r4155267697 (fragile-only numerator) is fixed and has a reply.
    • The rate and the chi-square cells now use fragile_divergences, so d <= f always holds.
    • Non-fragile divergences are counted per length, for the first cycle after prefill, and in total.
    • The regenerated files report 0 non-fragile divergences in all four MTP configurations, so the rates and p-values (0.7464, 0.7213, 0.5406, 0.3775) are unchanged, as the README says.
  • Regeneration and checks. STATE_ALLOW_MISSING=1 analyze_all.sh (one core) leaves every committed file byte-identical. The two state test files give 20 passed, and pre-commit passes on origin/main..HEAD. The hostname is absent from the tip, the history and the PR text (runtime search).

Blocking

  1. The caveat still sits under the wrong bullet. This is item 2 of my de6f569 review (State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests #110 (comment)).
    • "That is a failure to reject, not a proof of equal rates. The test also treats positions as independent ... No prompt-clustered analysis or bound on a per-length excess rate has been done." still ends the "first verify cycle after the prefill" bullet.
    • Those sentences qualify the chi-square result, which ends the previous bullet. Please move them there, after "(by_commit_length.homogeneity_chi2 in each file)."

Suggestion (non-blocking, unchanged). For the first cycle after prefill, report the Fisher exact results (p = 0.033 for steps 5 and 0.049 for the tree; uncorrected and selection-confounded) instead of "untested".

… test exploratory

The caveat (failure to reject; positions assumed independent; no clustered
analysis) had slipped into the first-cycle bullet; it is back after the
commit-length p-values. The first verify cycle after prefill has its own bullet,
with a Fisher exact test against later cycles (p = 0.71, 0.75, 0.033, 0.049). The
README labels it exploratory: chosen after seeing the data, uncorrected, and
comparing groups that differ in more than state. It is a lead for a declared
follow-up on fresh prompts, which is listed as pending. The p-values are written
by cycles.py as fisher_vs_later_p_exploratory.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (provisional: Codex's review of fb1b4b9 was still running when I posted this. I will re-check its threads on this head before merge.)

Re-review on the exact head fb1b4b9 ("Restore the caveat to the commit-length result; label the first-cycle test exploratory").

  • My last blocking item is fixed. The failure-to-reject and clustering caveat now ends the commit-length bullet, right after the p-values it qualifies.
  • The first-cycle bullet is accurate.
    • The first cycle after prefill has its own bullet, with the Fisher exact p-values written by cycles.py as fisher_vs_later_p_exploratory: 0.7141, 0.7525, 0.0333 and 0.0494. These match my own run.
    • It is labelled exploratory: chosen after seeing the data, uncorrected, and comparing groups that differ in more than state.
    • The pre-declared first-cycle test on fresh prompts and the prefill-to-decode handoff check are listed as pending.
  • Regeneration. STATE_ALLOW_MISSING=1 analyze_all.sh (one core) leaves every committed file byte-identical. Against 51f4ac2, the cycles files only gain the new field.
  • Tests and hooks. The two state test files give 20 passed, both with SciPy (the SGLang venv) and without it (the repo venv). Pre-commit passes on origin/main..HEAD.
  • Hostname. It is absent from the tip, the history and the PR text (runtime search).
  • Attribution and merge state. The commit is by Samuel Mausberg, with no AI lines, and the branch is MERGEABLE.
  • Earlier Codex threads. All Codex threads before this head have replies and fixes: r4155044785, r4155182543, r4155182559, r4155232868 and r4155267697.

Blocking: none.

Suggestion (non-blocking). fisher_exact is imported under a guard that writes None without SciPy, while chi2_contingency a few lines above is imported unguarded. An evidence regeneration in an environment without SciPy would then either fail on the chi-square or quietly write None for the Fisher p-value. Making both imports unguarded, and having the tests that need SciPy call pytest.importorskip('scipy'), would keep the evidence path failing closed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: fb1b4b921d

ℹ️ 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".

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE (confirmed on fb1b4b9)

Codex finished its review of fb1b4b9 at 12:28:03 with "Didn't find any major issues". gh api --paginate shows no review threads on fb1b4b9. The newest Codex threads are on 5a56c0f and f5061a4, and both have replies and fixes. My provisional approval of fb1b4b9 (#110 (comment)) now stands without condition. The branch head is still fb1b4b9.

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