Skip to content

State safety: list every history pair, tap-session signature, scope the history claim - #86

Merged
SamMausberg merged 2 commits into
mainfrom
state/history-evidence
Oct 1, 2026
Merged

SamMausberg merged 2 commits into
mainfrom
state/history-evidence

Conversation

@SamMausberg

Copy link
Copy Markdown
Owner

Follow-up to #76, requested in the review of #83.

What changes

  • summarize_targeted.py keeps every pair the history test served, under history__*.pairs: the id, its predecessor, the shared prefix length, token identity and the first logprob difference. It also records how many prefills reused a cached prefix, read from the server log (none did, in all three history runs). targeted.json is regenerated.
  • tap_check.json: for each of the three tap-changed prompts whose tokens changed, it adds the first changed token and the top-2 logprob gap there in both runs. Each gap is 0 (an exact tie) or 0.125.
  • New tap_signature.py, run by analyze_all.sh and output to evidence/state_safety/tap_signature.json, compares the v1 and v3 tapped sessions of plain c1 and of MTP steps 3. Each pair has the same flags, the same 167 prompts in the same order, and 0 of 169 prefills with cached tokens in either session. For four prompts (alpaca_eval-0450, alpaca_eval-0500, mt_bench-0053, mt_bench-0059), the first differing module output is layer 3's attention. In plain decoding this is at output index 2; with MTP it is at a verify step, output index 3 or 5. Its qkv_proj output and every earlier comparable module output are identical. Until now this signature came from an analysis that was not committed.
  • evidence/state_safety/README.md corrections:
    • Neutrality: the 162/167 figure is for tap v3; v1 matched 166/167.
    • History test: it covered all five tap-changed prompts, and only mt_bench-0056 changed. The claim that output depends on which request computed the shared prefix is now limited to the two prompts that reproduce it.
    • For the other four, the README now says that "likely" holds only for the mechanism (attention over a different copy of cached KV, from the signature at the same batch shape). What triggers it in those sessions is unknown. The README says so and labels the ordering idea as reasoning.
    • "under overlap scheduling on timing" is dropped as a claim, and "the attention read different KV" is reworded as an inference.
    • Code reading is now marked separately from measurement.

Checks

  • analyze_all.sh regenerates the evidence in about 15 s. Apart from the files above, nothing else changes.
  • pre-commit passes. mypy is clean on tap_signature.py and summarize_targeted.py. The 10 state-safety tests pass.

summarize_targeted.py now keeps every pair the history test served (id,
predecessor, shared prefix, token identity, first logprob difference) and the
prefill cache-hit count from the server log. tap_check.json adds the first
changed token and the top-2 gap there in both runs. The new tap_signature.py,
run by analyze_all.sh, records where the v1 and v3 tapped sessions (same
prompts, same order, no prefill cache hits) first differ.

The evidence README now states that four of the five tap-changed prompts do not
change in the history test, scopes the history claim to the two prompts that
do, separates code reading from measurement, and drops the unsupported claim
that the dependence also follows timing.
@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:47:54.165204Z ad8c49c 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.

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

ℹ️ 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/analyze_all.sh Outdated
Comment on lines +140 to +143
if [ -d "$tap/plain_c1" ] && [ -d "$tap/v3_plain_c1" ]; then
nice -n 19 python tap_signature.py \
--pair "$tap/plain_c1" "$tap/v3_plain_c1" \
--pair "$tap/mtp_s3_c1" "$tap/v3_mtp_s3_c1" \

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 Guard both tap pairs before running the signature

When the optional tap data contains the plain v1/v3 pair but either MTP directory is absent, this condition still invokes tap_signature.py with both MTP paths; the script then fails while reading the missing client.jsonl, and set -e aborts all evidence regeneration. This partial-data scenario is otherwise supported by the surrounding per-session existence checks, so check each pair independently or require all four directories before invoking the command.

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 985aedb. Each v1/v3 pair (plain_c1, mtp_s3_c1) is added only when both of its client.jsonl files exist, and tap_signature.py runs only if at least one pair is present. The evidence regenerates unchanged.

Each v1/v3 pair is now checked on its own, so missing MTP tap data no longer
aborts the whole evidence regeneration.
@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Reviewed head 985aedb (ad8c49c plus the Codex fix). It closes the gap I raised on #83: the history test's four null results are now committed evidence.

All three evidence files reproduce byte-identical from ~/vp-data/state:

  • tap_signature.py, run on both pairs, takes 7 s on one core;
  • summarize_targeted.py regenerates targeted.json;
  • the analyze_all.sh tap-check snippet regenerates tap_check.json.

Each README claim matches the files:

  • The tap sessions. v3 matches 162/167 and v1 matches 166/167; v1's one exception is mt_bench-0056.
    • For the three token-changing prompts, the top-2 gap at the first changed token is 0 or 0.125 in both runs (0.125/0.125, 0/0.125, 0.125/0).
  • The v1/v3 comparison. The two sessions differ for exactly the four other prompts, in both plain and MTP-3, which makes the 8 comparisons.
    • In every one, the first differing module is model.layers.3.attn. That is at output index 2 in DECODE for plain, and at a TARGET_VERIFY step at index 3 (one prompt) or 5 (three) for MTP.
    • qkv_proj is among the 411 compared modules and agrees.
    • Both pairs have the same 167 prompts in the same order (same_order true), with 0 of 169 prefills using cached tokens.
  • Output caps. "v3 capped them" holds: the median output is 136 tokens in v3 and 256 in v1.
  • mt_bench-0056. Its only tapped comparison, mechanism_plain_c1_vs_c32.json, gives model.layers.3.attn at output index 2 with batch 1 against 16. The README correctly notes that the batch shapes differ.
  • The history test. history__*.pairs lists all 12 pairs, which include all five tap-changed prompts.
    • Only mt_bench-0056 and humaneval-0008 change; the other four keep identical log-probabilities under plain and MTP-3.
    • 0 of 38 prefills per run used cached tokens.
  • Reasoning is kept apart from measurement.
    • "Likely" for the four is scoped to the mechanism and backed by the same-batch-shape signature.
    • What decides which KV copy a step reads is stated as unknown.
    • The ordering idea is labelled reasoning and untested.
    • The unsupported timing claim is gone.

Codex. Its one P2 (on ad8c49c) said a missing MTP tap directory would abort regeneration under set -e. 985aedb fixes it by adding each v1/v3 pair only when both of its client.jsonl files exist. The thread has a reply. Codex has not run on 985aedb.

Checks.

  • pre-commit passes on the changed files, and the state tests pass (19).
  • Both commits are Sam's, with no AI attribution.

Once this merges, Appendix D (#83's follow-up) can state the four null results by citing targeted.json (history__*.pairs) and tap_signature.json.

@SamMausberg
SamMausberg merged commit c26681f into main Oct 1, 2026
SamMausberg added a commit that referenced this pull request Oct 1, 2026
Appendix D: state the full prefix-cache history evidence (#86)
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