Skip to content

A2b feasibility: G0/G1 endpoint-recovery probe for input-level re-embedding - #89

Merged
samscarrow merged 1 commit into
mainfrom
analysis/input-level-reembed-fidelity-a2b
May 30, 2026
Merged

A2b feasibility: G0/G1 endpoint-recovery probe for input-level re-embedding#89
samscarrow merged 1 commit into
mainfrom
analysis/input-level-reembed-fidelity-a2b

Conversation

@samscarrow

Copy link
Copy Markdown
Contributor

Scope — feasibility only (no experiment, no detector changes)

Narrow gate for the A2b input-level re-embed fidelity study (follow-on to #88). This PR adds only the G0/G1 endpoint-recovery probe and the design scope. It does not build ReembedDriftStream, run the subset experiment, or touch forward(), associative_core.py, the detector, or any existing analyzer.

What this proves

The faithful input-level arm needs to map each cached ImageNet-R ViT-L/14 row back to its exact source image and re-embed it, sharing endpoints with the cache-linear arm. G0/G1 de-risks that before any harness is written:

cache row i -> ImageFolder sample train_indices[i] -> exact image path -> fresh DINOv2 embedding -> cosine(cached, fresh) > 0.999

Verdict: PASS (gentoo, CUDA, train split):

Check Result
Label-match rate 100% (35/35)
cosine(cached, fresh) min/median/mean/max 1.0 / 1.0 / 1.0 / 1.0
count cos > 0.999 35/35
Rows below threshold none
Split replay length vs cache rows 23918 == 23918
Cache features raw vs unit-normalized raw (L2 norm 39.17–48.67), confirmed not unit

Sample: classes {166, 63, 77, 156} + attractor 134 + 5 out-of-class negatives, seed 0. Split/transform/model taken from extract_imagenet_r_vitl14 itself (not reimplemented from memory). Cosines are exactly 1.0 — the row↔image mapping is bit-exact (deterministic encoder, shuffle=False cache).

Consequence for the next step

Because the cache stores raw (~45-norm) features, the input-level arm must feed raw DINOv2 output to the engine (engine normalizes internally, as the text RealDriftStream does); unit-normalize only for geometry diagnostics. The next risk is no longer endpoint identity — it is whether input-level interpolation yields a meaningful drift path vs. visual artifacts / a degenerate trajectory.

Files

  • probe_g0g1_reembed.py — read-only probe over the merged feature_cache_inr_vitl14 cache
  • results/issue_input_reembed_fidelity/G0_G1_PROBE.md — verdict + run metadata
  • results/issue_input_reembed_fidelity/SCOPE.md — A2b paired-experiment design (diagnostic / not-production framing preserved)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 21:49

@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: 2b6d7a3a4d

ℹ️ 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 probe_g0g1_reembed.py
label_matches = 0
with torch.no_grad():
for i in rows:
ds_idx = split_indices[i]

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 split-length mismatches before indexing

When the replayed split is shorter than the cache (one of the G0 failure modes this probe is meant to diagnose), the script still samples cache rows and indexes split_indices[i] before it reaches the later split_len_ok verdict logic. In that environment the probe raises IndexError instead of writing the intended FAIL report, so the length check needs to abort/report before any per-row recovery is attempted.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@samscarrow
samscarrow merged commit 1ff8bda into main May 30, 2026
1 check failed
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.

2 participants