Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/coe07-native-trm-gauge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: COE-07 native LoopScope phase-gauge validation
on:
pull_request:
paths:
- 'mechinterp/phase_gauge07/**'
- '.github/workflows/coe07-native-trm-gauge.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
exact-unit:
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --disable-pip-version-check 'numpy>=1.26,<3'
- run: python -m unittest discover -s mechinterp/phase_gauge07 -p 'test_*.py' -v
- run: python -m mechinterp.phase_gauge07.telemetry_replay --out /tmp/coe07_native_output_oracle.json
- uses: actions/upload-artifact@v4
with:
name: coe07-native-output-oracle-replay
path: /tmp/coe07_native_output_oracle.json
native-pretrained:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: exact-unit
env:
OMP_NUM_THREADS: 4
MKL_NUM_THREADS: 4
HF_HUB_DOWNLOAD_TIMEOUT: 150
HF_HUB_ETAG_TIMEOUT: 45
PYTHONUNBUFFERED: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install CPU-only native inference dependencies
run: |
python -m pip install --disable-pip-version-check 'numpy>=1.26,<3' 'huggingface_hub>=0.30,<2'
python -m pip install --disable-pip-version-check torch --index-url https://download.pytorch.org/whl/cpu
- name: Run SHA-pinned native TRM and eight-visit observer evaluation
run: python -m mechinterp.phase_gauge07.run_native --threads 4 --out /tmp/coe07_native
- name: Independent frozen-activation score replay
run: python -m mechinterp.phase_gauge07.replay --input /tmp/coe07_native/native_activations.npz --receipt /tmp/coe07_native/receipt.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: coe07-native-trm-verified-receipts
path: /tmp/coe07_native/
if-no-files-found: warn
70 changes: 70 additions & 0 deletions mechinterp/phase_gauge07/DIHEDRAL_GAUGE_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# COE-07R: Native-output reversal-gauge audit

**2026-11-15.** Post-hoc computation on the exact, previously committed LoopScope-02 output-correctness traces. This is an additional diagnostic under COE-07's sealed benchmark and checkpoint pins. It is **not** the preregistered learned-activation-probe outcome.

## Source and scope

- Repository: `MoralityLabAI/LoopedTransformers`.
- Checkpoint: `gaoxin492/TinyRecursiveModels-Sudoku-Extreme-att`, `step_21700`, SHA-256 `932b5e0df4e90021c21a064d4e716154086c46fda7afa676ea294484a30e38c3`.
- Original native data: `mechinterp/loopscope02/results/trm_results.json`, Git blob SHA `3c35daeb71da32f5c9ebbf03da539b8ee718b0ee`; original 256-board benchmark Git blob SHA `01ec63b4b2a4ae5399f783c6036a7fc018825a87`, benchmark SHA `59459ae0bb60b75db5be017e5f41adead391f2abb0b8fb043cd331c0ee043811`.
- For each target cell and each ACT step, the observed bit is `1` precisely if the model's predicted digit equals the **known correct answer**. These bits are an oracle that depends on target truth. The readout is unsuitable for deployment without access to those answers.
- Every group has 64 Sudoku boards. Pair counts include pairs with **different** correct digits and exclude same-digit pairs, leading to unequal denominators across strata. The benchmark was fixed before these post-hoc analyses.

## Exact group-action decomposition

For an ordered T-bit history `W`, let `N(W)` be its cyclic necklace, `B(W)` its dihedral bracelet (allowing rotation and reversal), and `C(W)` its popcount. On any fixed evaluator edge set, the retained-pair count obeys

```
D(W) >= D(N) >= D(B) >= D(C).
D(W)-D(C) = [D(W)-D(N)] + [D(N)-D(B)] + [D(B)-D(C)].
```

Thus the information lost when the start clock is hidden, the additional loss when forward/backward time is ambiguous, and the order-shape information retained despite those symmetries can be priced separately. The companion MathCan note proves the formula for arbitrary repeated task labels.

## Replayed pretrained observations: stalled stratum S4

There are **1,795** distinct-digit evaluator pairs in the 64-board S4 group. The original checkpoint and dataset digest were independently checked using the linked GitHub connector before reporting the following values.

| ACT visits | Ordered | Necklace | Bracelet | Count | Unknown clock loss | Unknown orientation loss | Dihedral order gain |
|---:|---:|---:|---:|---:|---:|---:|---:|
| 4 | 1,278 | 1,244 | 1,244 | 1,244 | 34 | 0 | 0 |
| 8 | 1,414 | 1,389 | 1,389 | 1,369 | 25 | 0 | **20** |
| 16 | 1,447 | 1,428 | 1,428 | 1,422 | 19 | 0 | **6** |

For the **same** 64 labeled boards, assigning each observed descriptor to its most frequent target digit gives the following in-sample, truth-dependent *decoder oracle upper-bound scores*; these are intentionally not held-out learning metrics:

| ACT visits | Ordered | Necklace | Bracelet | Count |
|---:|---:|---:|---:|---:|
| 4 | 23/64 | 18/64 | 18/64 | 18/64 |
| 8 | 30/64 | 24/64 | 24/64 | 19/64 |
| 16 | 31/64 | 26/64 | 26/64 | 24/64 |

The other three groups of 64 each have zero bracelet-beyond-count gain for these windows; S1 and S2 are uniform correctness traces in the replay. S3 has 446 retained different-digit pairs under each of the four descriptors, independent of which window was chosen.

**Empirical boundary:** the eight-step, 20-pair gain survives unknown start time **and** unknown time direction in this particular oracle descriptor. The underlying probe is defined by the answer, so its performance cannot establish an unsupervised, externally observable or causally active dark-fiber mechanism. The native latent run of `mechinterp/phase_gauge07/run_native.py` is required for that question.

## Independent finite positive control

At 8 visits and Hamming weight 4 there are exactly 10 binary necklaces and 8 binary bracelets. Under time reversal, 6 of the 10 necklaces are fixed, hence Burnside's formula gives `(10+6)/2=8`. The words `0b00001011` and its reversal have equal bracelets and counts but distinct cyclic necklaces. The reference verifies reversals, rotations, nested pair losses and the weighted-label decoder on exhaustive small inputs.

## Reproduction and CI

```
python -m unittest discover -s mechinterp/phase_gauge07 -p 'test_*.py' -v
python -m mechinterp.phase_gauge07.dihedral_replay --out /tmp/coe07r_gauge.json
```

The first command works with NumPy and no model checkpoint. Its source-file-dependent test runs inside a full repository checkout. The second command also checks the **Git blob SHA** of the two original native receipts. Both are pure CPU and use only standard-library arithmetic for the new code.

**Hosted inference status:** On the COE-07 PR branch, GitHub Actions run `43699655642` failed in its preliminary `exact-unit` job before exposed step logs and skipped `native-pretrained`. Its second attempt failed identically. A successful native activation-probe result is therefore pending; no synthetic or truth-conditioned substitute is promoted into that role.

## Optional local GPU extraction

The default native runner retains the **pre-registered CPU float32** path. A device-aware patch also permits a secondary local GPU float32 run, preserving the same checkpoint SHA, source manifest, heads, and output receipts while tagging GPU evidence as exploratory:

```sh
python -m mechinterp.phase_gauge07.run_native --device cuda --threads 4 --out ./coe07_native_gpu
python -m mechinterp.phase_gauge07.replay --input ./coe07_native_gpu/native_activations.npz --receipt ./coe07_native_gpu/receipt.json
```

The GPU replicate is an additional numerical sensitivity check and is reported separately from the CPU protocol. The GPU option has been syntax-tested locally, but a CUDA checkpoint replay requires a machine with the pinned model download and GPU runtime.
36 changes: 36 additions & 0 deletions mechinterp/phase_gauge07/NATIVE_OUTPUT_TELEMETRY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# COE-07 A: Native pretrained output-oracle replay

**Evidence type:** reanalysis of existing **pretrained** LoopScope-02 output traces. The source is the earlier `gaoxin492/step_21700` (SHA-256 `932b5e0d...`) native TRM run, with all 256 puzzle target-cell correctness histories saved across 16 ACT steps. This is a **truth-conditioned correctness indicator** and has access to ground truth. It is not a model-observable latent probe, a learned readout, or a new inference run.

Source files and locked Git blob IDs:

- `mechinterp/loopscope02/results/benchmark_bundle.json` `01ec63b4b2a4ae5399f783c6036a7fc018825a87`
- `mechinterp/loopscope02/results/trm_results.json` `3c35daeb71da32f5c9ebbf03da539b8ee718b0ee`
- Both report the same internal benchmark digest `59459ae0bb60b75db5be017e5f41adead391f2abb0b8fb043cd331c0ee043811`.

Read the first T binary correctness observations for each board; assign bit t to outer visit t+1. Within each of the original 64-item Sudoku strata, compare every unordered pair with distinct target digits. Report retained distinctions under ordered words, canonical cyclic-orbit words and popcount-only words; `final` reports only the correctness of the final visit.

## Eight-visit results on full original 64-item strata

| Stratum | Eligible cross-label pairs | Ordered | Cyclic-invariant | Popcount | Final step |
|---|---:|---:|---:|---:|---:|
| S1_naked1 | 1,811 | 0 | 0 | 0 | 0 |
| S2_prop2 | 1,788 | 0 | 0 | 0 | 0 |
| S3_prop3plus | 1,789 | 446 | 446 | 446 | 0 |
| S4_stalled | 1,795 | **1,414** | **1,389** | **1,369** | **738** |

For S4, cyclic structure contains 20 extra distinctions beyond count, while a known starting phase contains 25 more. Every S1/S2 item is correct at all eight steps, collapsing the truth-conditioned histories to the same all-ones code. These results are expected from an oracle that conditions on correctness; they cannot establish that a real quantized latent probe can recover the extra distinctions.

The **preregistered one-board-per-digit** heldout selection gives S2 `0/36` and S4 `28/36` distinctions for all three (ordered, cyclic, count) at T=8. The full S4 stratum exposes the rare phase-invariant distinctions that the small first-nine selection misses. The full-stratum result is **post-hoc diagnostic** and does not satisfy COE-07's preregistered native activation-probe success gate.

At `T=4` on all 64 S4 boards, (ordered,cyclic,count,final) = (1278,1244,1244,802)/1795. At `T=16` the values are (1447,1428,1422,685)/1795, giving 6 cyclic-above-count distinctions and 19 phase-sensitive distinctions. A longer observation horizon can reduce differences in the final correctness state as more puzzles converge, while history retains earlier distinctions.

An illustrative `T=8` pair is S4 item 05 versus item 25, binary histories `11111000` and `01001111`. Both contain five correct steps, and their necklaces differ, so the cyclic-invariant observation distinguishes them even with an unknown starting visit.

## Reproduce

```
python -m mechinterp.phase_gauge07.telemetry_replay --out /tmp/coe07_output_oracle.json
```

`telemetry_replay.py` verifies both source Git blob hashes, the original benchmark digest, the model SHA-256, and the complete 16×256 binary array before computing the result. Because it reads data already committed to this repository, the replay requires neither the checkpoint download nor a GPU. It can run with the Python standard library except that the shared `score.py` import currently needs NumPy. The full native activation extraction in `run_native.py` remains independently gated behind checkpoint download and hosted runner availability.
48 changes: 48 additions & 0 deletions mechinterp/phase_gauge07/PROTOCOL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# COE-07: Native LoopScope pretrained phase-gauge gate

**Protocol frozen before pretrained checkpoint inference.** November 15, 2026.

This is the native follow-up to `Compactification-Theory` COE-01..06 and MathCan's phase-blind observer capacity theorem. The existing COE-05/06 runs used small models trained expressly for that experiment. COE-07 uses the exact native checkpoint loader and recurrent state equations from **LoopedTransformers**, on a pretrained 7M Attention TRM.

## Immutable inputs and resource budget

- Underlying source branch pinned from `MoralityLabAI/LoopedTransformers@f504111e9985bd76bf321ed3968b46ac03a9811f`; native loader file `mechinterp/loopscope02/scripts/trm_sudoku.py` Git blob `a7396bc74a635b3ccf844e72cf48f73804e6ac5b`.
- Primary checkpoint `gaoxin492/TinyRecursiveModels-Sudoku-Extreme-att`, file `step_21700`, SHA-256 `932b5e0df4e90021c21a064d4e716154086c46fda7afa676ea294484a30e38c3`. Use the existing `TS.load_trm_checkpoint`, which checks SHA before loading, with CPU float32 inference. Freeze weights.
- Benchmark source `mechinterp/loopscope02/results/benchmark_bundle.json`, internal bundle digest `59459ae0bb60b75db5be017e5f41adead391f2abb0b8fb043cd331c0ee043811`. No external dataset fetch required. Select exactly the **first row of each digit 1–9** in each of four existing strata by committed file order, for 36 distinct boards. The selection depends on metadata alone.
- Fit on `S1_naked1` and `S3_prop3plus`, test on `S2_prop2` and `S4_stalled`. All four groups have one board per digit. Within each held-out group, score the complete 9-vertex evaluator graph, 36 edges each. Exactly 72 held-out pairs per head. Context/stratum shift is an explicit limitation.
- Capture 8 outer ACT visits. Each visit is `3` H cycles with `6` L cycles and two native physical transformer layers, reusing the checkpoint's time-homogeneous weights. Capture target-cell `z_H`, `z_L`, eleven full `lm_head` logits and the `z_H` complement orthogonal to the **entire** `lm_head` row space. Report numerical projector parity and row-space rank.
- CPU-only, at most four threads, one model checkpoint and no fine-tuning. CI download consumes network bandwidth; workflow caps inference job at 30 minutes and uploads receipts and compressed activation arrays.

## Frozen fit-only probe selection

For each of four representations `visible`, `dark`, `full`, `scratch`, fit one shared binary linear threshold \(b_t(x)=1\{w\cdot z_t(x)>\theta\}\), the same \(w,\theta\) at all eight steps. Candidate directions are all 36 pairwise differences of fit-only digit centroids, 96 seeded random Gaussian directions, and the first 12 fit-only singular vectors. Norm-normalize each, evaluate the unique fit-only projected quantiles at `[.15,.25,.40,.50,.60,.75,.85]`. Random seed `20261115`. No test activations or held-out labels are available to this fitting routine.

Select four separately reported heads from this same fixed candidate pool by lexicographic fit-only objectives:

1. `ordered`: ordered edge retention, then cyclic retention, then count retention.
2. `cyclic`: cyclic-invariant edge retention, then cyclic-above-count gain, then count retention.
3. `cyclic_gain`: cyclic-above-count gain, then cyclic retention, then ordered retention.
4. `count`: count edge retention, then cyclic retention, then ordered retention.

Tie order is the deterministic enumeration order; no test-based head changes. Each selected head has *one* fitted direction and threshold, with 8 bits of **readout over time**, not 8 learned linear directions.

## Metric and decision rules

For each held-out stratum and each of the 36 pairs of distinct target digits, compute the ordered 8-bit words \(w_i\), their canonical cyclic rotations \(N(w_i)\), and popcounts \(C(w_i)\). The exact order of information loss is

\[D_{\rm ordered}\ge D_{\rm cyclic}\ge D_{\rm count},\qquad
D_{\rm ordered}-D_{\rm cyclic}=\#\{\text{phase-origin-dependent distinctions}\}.\]

A cyclic-invariant advantage means `D_cyclic − D_count ≥ 8/72` on the **`cyclic_gain` head in the `dark` representation**, with at least one such preserved distinction in each held-out stratum. This is the one pre-fixed binary success gate. Other heads and representations are diagnostics with explicit numerators, denominators and no post-hoc significance claims. A base-model performance gate reports how many of nine target cells are solved by visit at each stratum. If native inference, source hash, or the fit/test firewall fails, label the cell **invalid**, with no substituted synthetic results.

Controls include the final-step one-bit projection on the same learned direction, the full `lm_head` visible channel versus its exact orthogonal complement, and a frozen selected-head replay from a saved activation file. All source model weights and source codes are preserved; no mutation of the pretrained repository's checkpoint or original LoopScope results.

## Reproduction

```sh
python -m unittest discover -s mechinterp/phase_gauge07 -p 'test_*.py' -v
python -m mechinterp.phase_gauge07.run_native --out /tmp/coe07_native --threads 4
python -m mechinterp.phase_gauge07.replay --input /tmp/coe07_native/native_activations.npz --receipt /tmp/coe07_native/receipt.json
```

The first command requires NumPy and no internet. The native command requires CPU PyTorch, Hugging Face Hub connectivity, and the pinned external checkpoint. Final outcomes are conditional on the actual hosted native run. The literature-wide novelty of any resulting mathematical formulation remains unassessed.
1 change: 1 addition & 0 deletions mechinterp/phase_gauge07/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""COE-07: frozen native LoopScope phase-gauge probe evaluation."""
Loading
Loading