Skip to content

State safety: declare the first-cycle test on a fresh prompt set - #114

Merged
SamMausberg merged 3 commits into
mainfrom
state/followup
Oct 1, 2026
Merged

SamMausberg merged 3 commits into
mainfrom
state/followup

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Declares the follow-up test of the exploratory first-cycle observation in #110 before any data for it exists, as the coordinator asked.

What changes

  • prompts.py --set fresh builds 960 prompts that share no prompt with the 320 used so far: GSM8K test rows 80–559, HumanEval rows 60–163, AlpacaEval rows 5, 15, …, 795 and CNN/DailyMail test rows 40–335. The set is sized for an approximate joint power of 0.87 at the exploratory effect. MT-Bench has no unused questions. Every third prompt per source runs in thinking mode, as before.
    • evidence/state_safety/prompt_manifest_fresh.json freezes the token IDs (SHA-256).
    • The main set and its digest are unchanged; I regenerated it to check.
  • experiments/state_safety/README.md, "Declared follow-up", fixes the test before any data exists:
    • Runs: pinned plain c1, MTP steps 5 and tree runs at c1 and c32, in two exclusive holds.
    • Pairs: for each pair, which run defines fragility, which run is compared and which run labels the cycles.
    • Population: one common prompt population across all four pairs.
    • (a) Primary test: prompt-level. The one-sided 95% bootstrap lower bound of the pooled primary log odds ratio, first cycle against later, must be above 0.
    • (b) Selection control: the same bound for the primary minus the control (c1-vs-c32) log odds ratio, from the same resamples.
    • Secondary: Fisher's exact test.
    • Decision: supported only if (a) and (b) both hold; otherwise the result is reported as inconclusive.
    • Power: the expected counts and an approximate joint power are stated, along with the method's optimism.
  • Evidence README: the pending list now points to the declaration.

No runs are queued yet. The runs and the analysis script follow after this merges, so the declaration is on main before any data for it exists.

Checks

Pre-commit passes, including mypy and the host-identity hook.

prompts.py --set fresh builds 384 prompts disjoint from the original 320. Their
token IDs are frozen in prompt_manifest_fresh.json; the original set is
unchanged and its digest is the same. The experiments README fixes the test of
the exploratory first-cycle observation before any data exists:
- runs: pinned plain, MTP steps 5 and the tree, each at c1 and c32;
- primary test (a): pooled one-sided Fisher exact test of first-cycle against
  later-cycle divergences at fragile positions, alpha 0.05;
- selection control (b): the same odds ratio from the c1-vs-c32 pairs,
  compared by prompt-level bootstrap;
- decision: an excess specific to speculation is supported only if (a) and (b)
  both hold.
@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:54:40.177990Z 7427a32 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: 4cbd1bfb55

ℹ️ 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/README.md Outdated
Comment on lines +169 to +172
- **Primary test (a).** Pool the counts of the two pairs MTP steps 5 c1 vs plain c1
and MTP tree c1 vs plain c1 into one table: first or later cycle against diverged
or not, at fragile positions. Test it with a one-sided Fisher exact test (first
cycle rate higher), alpha 0.05.

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 Replace the position-level Fisher test with a clustered test

The same prompt contributes many sequential positions, and pooling these two comparisons also reuses the same prompts and plain-c1 reference positions, so the table entries are neither independent nor distinct observations. A Fisher exact p-value on these pooled position counts therefore understates uncertainty; the prompt-level bootstrap specified for control (b) does not repair primary test (a). If this declared rule is used as written, pseudoreplication can produce nominal support at alpha 0.05, so (a) should also use a prompt-clustered bootstrap/permutation or a prompt-level endpoint.

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 a0417dc. (a) is now prompt-level. It is the one-sided 95% percentile lower bound of the pooled primary log odds ratio, from a prompt bootstrap: 10,000 replicates with numpy default_rng(0), one shared resample per replicate across all four pairs, +0.5 per cell. (b) uses the same resamples for L_p - L_c. The pooled Fisher test stays as a reported secondary only. The declaration also fixes four things. First, each pair's reference run (whose top-2 gap defines fragility), compared run and cycle-labelling run. Second, a common prompt population: a prompt is excluded from all four pairs if any MTP run is not one chunk per cycle. Third, the expected counts and an approximate joint power. Fourth, that a result short of support is reported as inconclusive.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Review on the exact head 4cbd1bf ("Declare the first-cycle test on a fresh prompt set before running it").

Verified

  • The fresh set is disjoint from the 320 used so far. I regenerated both sets with prompts.py (SGLang venv, one core).
    • --set fresh gives 384 prompts: GSM8K 100, HumanEval 104, AlpacaEval 80, CNN/DailyMail 100, with no MT-Bench.
    • It shares 0 IDs, 0 message contents and 0 token sequences with the main set, and contains no duplicate within itself.
  • Both manifests reproduce. The fresh manifest reproduces prompt_manifest_fresh.json exactly (input_ids_sha256 and every other field).
  • The main set is unchanged. Its input_ids_sha256 is identical to the committed prompt_manifest.json.
  • Timing. No data exists for the follow-up yet, and the declaration comes before any run.
  • Hooks and attribution. Pre-commit passes on origin/main..HEAD, the commit is by Samuel Mausberg, and there are no AI lines.

Blocking

  1. Codex P1: replace the position-level Fisher test with a clustered test (State safety: declare the first-cycle test on a fresh prompt set #114 (comment)). It has no reply yet, and it is right; I would have raised the same point.
    • Test (a) is a Fisher exact test on pooled position counts. Positions cluster by prompt, each prompt stops at its first divergence, and the two pooled pairs reuse the same prompts and the same plain-c1 reference. The table cells are therefore not independent observations, and the p-value understates the uncertainty.
    • This is the caveat State safety: pinned-pool matrix results (plain and MTP) and tree/plain exact tests #110's README states for the exploratory test, so the confirmatory test should not repeat it.
    • Make (a) prompt-level. The simplest form uses the same prompt-level bootstrap as (b): (a) holds when the one-sided 95% lower bound of the pooled first-versus-later log odds ratio is above 0. A prompt-level permutation test would also work.
    • Fisher can stay as a reported secondary figure.
  2. Underspecified parts of the analysis. Please fix these in the declaration before any run:
    • (i) The fragility reference for the control pairs. For MTP c1 against plain c1 the reference is plain c1. For MTP c1 against MTP c32 the text does not say whose top-2 gap defines a fragile position: c1, c32 or plain c1.
    • (ii) The resampling unit and the pairing. The primary and control pairs share the prompts and the MTP c1 run, so each bootstrap replicate should draw one set of prompts and use it for all four pairs. Say so, and state the interval method (percentile, or another).
    • (iii) The bootstrap's statistic. Is (b)'s statistic the pooled primary log odds ratio minus the pooled control log odds ratio, each from a 2x2 table with 0.5 added to every cell?
    • (iv) Skipped prompts. cycles.py skips prompts whose chunks are not one per cycle (skipped_prompts). Say whether those prompts are excluded from every pair, so the pairs keep the same population.
    • (v) Power. With about 40 fragile first-cycle positions per configuration (the exploratory counts), two configurations pooled, and both (a) and (b) required, the test may have little power for the observed effect (about 0.17 against 0.08). Please state the expected first-cycle fragile count and the smallest effect the rule can detect, or what happens if the count falls short. Otherwise a "not supported" result cannot be read as evidence of no effect.

On your question about (b). I think it controls the selection (frailty) effect reasonably well. The control pairs have a similar overall divergence hazard (MTP between c1 and c32 at 3.1 to 3.5 per 1,000, against 3.5 to 4.0 for MTP against plain), so the early depletion of high-hazard prompts should be comparable. It has two limits:

  • A first-cycle effect that also differs between c1 and c32 cancels in the difference.
  • A "supported" result shows only an excess specific to speculation against plain decoding. The cause could be a benign difference in numerical path: the first verify reads a KV cache and recurrent state written by prefill, while later cycles read state written by verify. It need not be a state error.

The decision text already says "an excess specific to speculation", which is the right scope, and the handoff check is the follow-up. Please keep both limits in mind when the result is written up.

Suggestions (non-blocking)

  • The fresh set has no MT-Bench prompts, so its source mix differs from the set where the exploratory signal appeared. One line saying so would help a reader compare the two results.
  • Regenerating the main manifest now changes selection (for example "test rows 0-79" becomes "rows 0-79", and MT-Bench's "first turn of questions 0-79" becomes "rows 0-79") and adds prompt_set. The token digest is unchanged. Keeping the old wording for main, or noting the change, would keep a regeneration byte-identical.

Reviewer and Codex: the pooled position-level Fisher test treated positions as
independent although they cluster by prompt. The declaration now specifies:
- (a): a prompt-level bootstrap lower bound of the pooled log odds ratio, with
  Fisher kept as a secondary test;
- each pair's reference, compared and labelling runs, and whose top-2 gap
  defines a fragile position;
- one shared prompt resample per replicate across all four pairs, with
  percentile bounds;
- the exact statistics (+0.5 per cell);
- a common prompt population;
- that a result short of support is reported as inconclusive.

The fresh set grows to 960 prompts, still disjoint from the original set, for
an approximate joint power of 0.87 at the exploratory effect (odds ratio 2.36).
The power method and its optimism are stated, as is the different source mix.
The original manifest is unchanged.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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

Re-review on the exact head a0417dc ("Make the declared first-cycle test prompt-level and size it for power").

  • Codex P1 r4155480193 is fixed and has a reply. Test (a) is now prompt-level: the one-sided 95% percentile lower bound of the pooled primary log odds ratio must be above 0. It uses the same 10,000 replicates (default_rng(0)) as (b), with one shared prompt resample per replicate across all four pairs. Fisher stays only as a reported secondary.

  • All five specifics are now declared.

    • R, C and L for every pair, where R defines fragility and L's chunk 1 is the first cycle.
    • The shared resample and the percentile method.
    • L_p and L_c from summed tables with 0.5 added per cell, and (b) bounding L_p - L_c.
    • A common population, excluding a prompt from every pair if any of the four MTP runs is not one chunk per cycle, and reporting the count.
    • Power.
  • The power figures check out. I recomputed them with the stated normal approximation, using 219 first-cycle and 12,200 later fragile positions, a later rate of 0.08 and a control odds ratio of 1:

    • (b) has about 0.87 power at odds ratio 2.36 and 0.71 at 2.0;
    • (a) is near 1 at both.

    The README states that the approximation treats positions as independent and is optimistic, and that "not supported" means inconclusive.

  • The fresh set reproduces. I regenerated it at a0417dc: 960 prompts (GSM8K 480, CNN/DailyMail 296, HumanEval 104, AlpacaEval 80; 318 in thinking mode). It shares 0 IDs and 0 token sequences with the original 320 and has no duplicates within itself. Its manifest reproduces prompt_manifest_fresh.json byte for byte.

  • The original set's committed manifest is unchanged in this PR, and its input_ids_sha256 reproduces.

  • The limits of (b) and the different source mix are stated.

  • Hooks and attribution. Pre-commit passes on origin/main..HEAD. The commits are by Samuel Mausberg, with no AI lines.

Blocking: none.

Suggestion (non-blocking, from the last round). Running prompts.py --set main now writes a manifest that differs from the committed prompt_manifest.json in selection (for example "rows 0-79" instead of "test rows 0-79") and adds prompt_set. The token digest is the same. The README's "unchanged byte for byte" is true of the committed file, but a regeneration no longer reproduces it. Keeping the old description strings for main, or noting the difference, would make it reproduce.

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

ℹ️ 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/prompts.py Outdated
Comment on lines +211 to +213
'prompt_set': args.prompt_set,
'selection': {
'gsm8k': 'test rows 0-79',
'humaneval': 'test rows 0-59',
'mt_bench': 'first turn of questions 0-79',
'alpaca_eval': 'rows 0, 10, ..., 590',
'cnn_dailymail': 'test rows 0-39',
**{name: _describe(r) for name, r in SELECTION[args.prompt_set].items()},

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 the legacy manifest when generating main prompts

Running the existing documented command without --set now regenerates the original main prompt set but unconditionally adds "prompt_set": "main" and replaces its source-specific selection descriptions with generic ones. Because the checked-in evidence/state_safety/prompt_manifest.json retains the old schema—and the new README explicitly says it is unchanged byte for byte—the command advertised for reproducing that evidence instead leaves a different manifest. Preserve the legacy serialization for main, or update the tracked manifest and the byte-for-byte claim.

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 7427a32. build_manifest() keeps main's original layout: no prompt_set key, and the original selection wording via MAIN_SELECTION_TEXT. Other sets add prompt_set before selection, which is the committed fresh manifest's order. Running prompts.py without --set now reproduces the committed main manifest and prompts.jsonl byte for byte, and --set fresh does the same for the fresh manifest and its prompts. tests/test_state_safety_prompts.py checks both layouts and, when the prompt files are present, both committed manifests byte for byte. All four tests pass here.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

This updates my provisional approval of a0417dc (#114 (comment)), which I withdraw. Codex finished its review of a0417dc at 12:50:49 and left one P2. It has no reply or fix yet.

Blocking

  1. Preserve the legacy manifest when generating the main prompts (State safety: declare the first-cycle test on a fresh prompt set #114 (comment)).
    • This is the nit I left non-blocking, but Codex is right that it contradicts a claim the PR makes.
    • The README says the original set's manifest "is unchanged byte for byte". Yet the documented command (prompts.py without --set) now writes a different prompt_manifest.json: it adds "prompt_set": "main" and changes the four description strings, for example "test rows 0-79" to "rows 0-79". I reproduced that difference on a0417dc. The token digest is the same.
    • The state agent reports that a fix is already written and makes the main manifest and prompts byte-identical. It needs one more change to keep the fresh manifest's key order.
    • Please put that fix in this PR rather than the results PR, so that main never carries a reproduction command that does not reproduce. Then regenerate both manifests and confirm both are byte-identical to the committed files.

Everything else from my a0417dc review still holds.

Codex (r4155532398) found that prompts.py without --set no longer reproduced
the committed main manifest: the selection descriptions had changed and a
prompt_set key had been added. build_manifest() now keeps the original layout
for main (no prompt_set key, the original selection wording). Other sets name
themselves before the selection, in the committed fresh manifest's order.
Regenerating gives byte-identical main and fresh manifests and prompt files.
tests/test_state_safety_prompts.py checks the layouts, and checks both
committed manifests byte for byte when the prompt files are present.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@SamMausberg

Copy link
Copy Markdown
Owner Author

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

Re-review on the exact head 7427a32 ("Keep the main prompt manifest regenerating byte for byte").

  • Codex P2 r4155532398 is fixed and has a reply. build_manifest() keeps the main set's original layout: no prompt_set key, and the original selection wording (MAIN_SELECTION_TEXT). Other sets put prompt_set before selection, which is the committed fresh manifest's key order.
  • Both sets reproduce. I ran the documented commands at 7427a32 (SGLang venv, one core).
    • prompts.py without --set writes a manifest byte-identical to the committed prompt_manifest.json, and a prompts.jsonl byte-identical to ~/vp-data/state/prompts/prompts.jsonl.
    • --set fresh writes a manifest byte-identical to the committed prompt_manifest_fresh.json.
    • The committed main manifest is untouched by this PR.
    • The README's byte-for-byte claim is therefore true, and it names the test that checks it.
  • Tests and hooks. tests/test_state_safety_prompts.py gives 4 passed (its byte-for-byte rebuild runs where the prompt data exists). Pre-commit passes on origin/main..HEAD. The commit is by Samuel Mausberg, with no AI lines.
  • Everything I checked on a0417dc still holds: the prompt-level test, the five specifics, the power figures and the disjoint 960-prompt set.

Blocking: none. Suggestions: none.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 7427a32990

ℹ️ 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 7427a32)

Codex finished its review of 7427a32 at 12:54:39 with "Didn't find any major issues". gh api --paginate shows no review threads on 7427a32. The newest Codex threads are on 4cbd1bf and a0417dc, and both have replies and fixes. My provisional approval of 7427a32 (#114 (comment)) now stands without condition. The branch head is still 7427a32.

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