Skip to content

State safety: call H5 truncation/stop results token-identical; compare logprobs too - #76

Merged
SamMausberg merged 5 commits into
mainfrom
state/token-identical
Oct 1, 2026
Merged

SamMausberg merged 5 commits into
mainfrom
state/token-identical

Conversation

@SamMausberg

Copy link
Copy Markdown
Owner

This fixes an overstatement in #59's evidence README, found by Codex. The H5 truncation and stop-token counts (157/157, 240/240, 160/160, 240/240) were called "bitwise", but targeted.py set identical from the output token IDs only (diff() compares tokens). The README now says token-identical (output IDs; logprobs and state not compared). The same correction applies to the warm/cold continuations.

targeted.py now also records whether the top-5 logprobs of a truncated or stopped run equal the untruncated run's at the same positions:

  • per case: logprobs_identical and stop_logprobs_identical
  • in the summaries: counts of each

The runs already in the evidence predate this change, and their raw records were not kept, so their claim stays at token identity. The queued tree and plain-decode runs will record both. Separately, the tap-neutrality bullet now points to the history-dependence section instead of calling the five exceptions an unexplained open question; the KV-level link is still marked pending.

Validation: ruff and mypy are clean on targeted.py, and the hooks pass on the changed files (mypy skipped repo-wide for the known main errors).

…probs too

targeted.py set 'identical' from output IDs only, so the README's
'bitwise' overstated the H5 truncation and stop-token results. Say
token-identical (output IDs; logprobs and state not compared), and make
targeted.py also record whether the top-5 logprobs of the truncated or
stopped run equal the untruncated run's, for the runs still queued.
@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-01T04:27:15.425491Z 9ac8be9 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: 1a3a5dcfa7

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

# Ref prefix check: the truncated run must be the first m tokens; the
# top-5 logprobs at those positions are compared as well.
d['identical'] = rec['output_ids'] == full['output_ids'][:m]
d['logprobs_identical'] = rec['top_logprobs'] == full['top_logprobs'][:m]

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 Retain logprob-only failures in summarized evidence

When the truncated run has matching token IDs but different top-5 logprobs—the new failure mode this field is intended to expose—summarize_targeted.not_identical() still returns false because it checks only case['identical'], so the case details are omitted from evidence/state_safety/targeted.json; the stops path likewise ignores stop_logprobs_identical. The aggregate count reveals that mismatches occurred, but the affected prompt, position, and configuration are lost from the evidence artifact, so both retention predicates should include their new logprob flags.

Useful? React with 👍 / 👎.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST CHANGES

Reviewed head 545f4c1 (four commits on main). The token-identical wording, the scoping of the plain-only control and the new logprob comparison are right. One Codex comment and one new claim block.

Checked and correct

  • Token-identical wording. The H5 truncation and stop counts and the warm/cold continuations are now "token-identical (output IDs; logprobs and state not compared)", which matches targeted.py:116. "The emitted tokens are unaffected" replaces the state claim.
  • Logprob comparison. targeted.py now records logprobs_identical and stop_logprobs_identical (top-5 logprob lists compared exactly) for future runs.
  • Radix-off control. It is stated as plain-only, and the MTP control is added to run_targeted.sh. mtp_s3_noradix exists in server.CONFIGS.
  • Hooks. Pre-commit is clean.

Blocking

B1. Codex P2: logprob-only failures are dropped from the evidence (experiments/state_safety/summarize_targeted.py:25 and :27).

  • not_identical() keeps a truncation case only if not case['identical'], and a stop case only on token or extension mismatches.
  • A case whose tokens match but whose top-5 logprobs differ, which is exactly what the new fields exist to catch, would be counted in the aggregate but left out of non_identical_cases. The prompt, position and configuration would then be lost from targeted.json.
  • Fix: add or not case.get('logprobs_identical', True) (truncation) and or not case.get('stop_logprobs_identical', True) (stops) to the retention predicates.

B2. The new claim that mt_bench-0056 is one of the five tap-changed prompts has no committed evidence (evidence/state_safety/README.md:75).

  • The tap check in mechanism_plain_c1_vs_mtp_s3_c1.json records only a count ("tokens_and_logprobs_bitwise_equal": 162), not which five prompts differed. mechanism.py:578-592 computes same but writes only its length.
  • mt_bench-0056 appears in the history test, but nothing committed shows it among the five.
  • Fix: write the five IDs into tap_check (for example, mismatched_ids) and regenerate the mechanism summaries, or drop "and one of them, mt_bench-0056, reproduces that dependence deterministically without the tap".
  • If the link holds, it is good evidence. It should go in with its source.

…anged prompts

summarize_targeted now retains truncation and stop cases whose tokens match
but whose logprobs differ. mechanism.py's tap check lists the mismatched IDs,
and analyze_all.sh writes evidence/state_safety/tap_check.json with the five
prompts the tap changed and their first logprob difference. The evidence
README cites that file for the mt_bench-0056 claim.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Re-reviewed head 9ac8be9. Both blocking items are fixed.

B1 (Codex P2, logprob-only differences dropped from the evidence). not_identical() now keeps truncation cases with logprobs_identical False and stop cases with stop_logprobs_identical False. These are the keys that targeted.py:117 and :201 write. Codex's single comment (on 1a3a5dc) is addressed.

  • I regenerated targeted.json from ~/vp-data/state/targeted, and it is byte-identical to the committed file.
  • The truncation and stop runs predate the flags, so the .get(..., True) default is what applies to them.
  • The history__* runs do carry logprobs_identical, and their predicate already used it.

B2 (the mt_bench-0056 claim needed committed IDs).

  • tap_check.json names the five prompts the v3 tap changed. Each first differs in logprobs at output index 2, and two of them (mt_bench-0056 and -0059) keep identical tokens. The v1 tap changes only mt_bench-0056.
  • I extracted the snippet from analyze_all.sh and reran it on ~/vp-data/state. The output is byte-identical to the committed JSON.
  • The README text matches the file. The deterministic reproduction it cites for mt_bench-0056 after mt_bench-0054 is in the committed targeted.json history__* entries.

Checks:

  • pre-commit passes on the changed files.
  • The three state-safety test files pass (19 tests).
  • The PR merges cleanly with current main.
  • The commit is authored and committed by Sam, with no AI attribution.
  • Codex has reviewed only 1a3a5dc, the PR-open trigger. It has not run on 545f4c1 or 9ac8be9.

Suggestions (not blocking):

  • The README's "tapped runs match ... 162 of 167" is the v3 tap. Saying so, and adding that the v1 tap matches 166 of 167, would cover both sessions in tap_check.json.
  • mechanism.py now writes mismatched_ids, but the committed mechanism_*.json files were made before that, so their tap_check blocks lack it. They also count the same thing analyze_all.sh now computes separately. A rerun at the next mechanism refresh would make the two agree on the page as well as in count: both give 162 for v3.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 9ac8be944a

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

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