SamZou commited on
Commit
a9d1405
·
verified ·
1 Parent(s): fcd8ee2

Remove Phase 2 planning notes (kept on GitHub; HF holds artifacts only)

Browse files
phase2_scaling/phase2_final_plan.md DELETED
@@ -1,419 +0,0 @@
1
- # Phase 2 Final Plan: Scaling of Cross-Relation Truth Representations
2
-
3
- **Date:** 2026-07-11
4
- **Time budget:** approximately 1.5 days
5
- **Purpose:** implementation and paper-writing specification
6
-
7
- ## 1. Research question
8
-
9
- Phase 1 showed that breaking cross-pair truth co-occurrence removes truth decodability in the tested fully trainable synthetic model while preserving factual memorization.
10
-
11
- Phase 2 asks:
12
-
13
- > Does model scale make a linearly decodable truth representation more transferable across factual relations?
14
-
15
- The main comparison is Llama-3.1-8B versus Llama-3.1-70B. Layer-wise probing is a measurement tool; the contribution is cross-relation generalization, not the location of the single strongest layer.
16
-
17
- The final claim remains scoped to the evaluated CounterFact relations.
18
-
19
- ## 2. Fixed scope
20
-
21
- ### Models
22
-
23
- - `meta-llama/Llama-3.1-8B`
24
- - `meta-llama/Llama-3.1-70B`
25
-
26
- Use base checkpoints for both models and record exact revisions. Llama-3.1-405B is optional future work and does not block this experiment.
27
-
28
- ### Dataset
29
-
30
- - 6 semantically diverse CounterFact relations
31
- - final sample size selected from 50, 75, or 100 factual records per relation
32
- - one matched true/false pair per record
33
- - 600, 900, or 1,200 sentences in total
34
-
35
- Select relations before probing. Each relation must contain at least 50 usable records and should contain 100 if possible. Generate false examples by replacing the true attribute with a different attribute from the same relation using a deterministic permutation and fixed seed.
36
-
37
- Each processed example preserves:
38
-
39
- ```text
40
- example_id
41
- pair_id
42
- case_id
43
- relation_id
44
- subject
45
- template
46
- true_attribute
47
- used_attribute
48
- sentence
49
- label
50
- false_attribute_source_id
51
- ```
52
-
53
- Prepare nested datasets with a fixed ordering:
54
-
55
- ```text
56
- N50 = first 50 pairs per relation
57
- N75 = N50 + the next 25 pairs per relation
58
- N100 = N75 + the next 25 pairs per relation
59
- ```
60
-
61
- The final selected subset and ordering are used for both models.
62
-
63
- ### Sample-size timing gate
64
-
65
- The final sample size is selected using a disposable pilot before any full six-relation extraction.
66
-
67
- Choose one of the six relations and take its first 50 fact pairs, giving 100 pilot sentences. Run the exact four-depth activation extraction on this pilot subset for both 8B and 70B. The pilot must use the same batch size, representation position, dtype, NNsight code path, and output format intended for the final run.
68
-
69
- Record separately for each model:
70
-
71
- ```text
72
- queue_wait_seconds
73
- remote_execution_seconds
74
- result_transfer_seconds
75
- total_wall_clock_seconds
76
- sentences_processed
77
- seconds_per_sentence
78
- ```
79
-
80
- For a candidate size `N` pairs per relation, estimate full extraction time as:
81
-
82
- ```text
83
- full_sentence_count = 6 relations * N pairs * 2 labels
84
- pilot_sentence_count = 100
85
- scaling_multiplier = full_sentence_count / 100
86
- ```
87
-
88
- Therefore:
89
-
90
- | Candidate | Full sentences | Pilot-time multiplier per model |
91
- |---:|---:|---:|
92
- | 50 pairs/relation | 600 | 6x |
93
- | 75 pairs/relation | 900 | 9x |
94
- | 100 pairs/relation | 1,200 | 12x |
95
-
96
- Estimate 8B and 70B separately from their own pilot timings, then add them to estimate total active extraction time. Queue time is reported separately because it may not scale linearly.
97
-
98
- Choose `N_final` from 50, 75, or 100 using the remaining wall-clock budget. Reserve at least six hours after activation extraction for probe runs, validation, figures, and debugging. Save the decision and timing evidence in `sample_size_decision.json`.
99
-
100
- After validating tensor shapes, example ordering, saved metadata, and timing, discard the pilot activation files. Keep only the pilot logs and timing record. Once `N_final` is frozen, start a fresh activation extraction for all six relations on both models. The maximum wasted inference is one relation out of six at the 50-pair setting, and less proportionally if `N_final` is 75 or 100.
101
-
102
- ## 3. Splits
103
-
104
- The true and false sentences from the same `pair_id` remain in the same fold.
105
-
106
- ### Within-relation splits
107
-
108
- Create one fixed three-fold split independently inside each relation. Reuse it across all layers and models.
109
-
110
- ### Leave-one-relation-out splits
111
-
112
- For each target relation, train on the other five complete relations and evaluate on the target relation.
113
-
114
- ## 4. Activation extraction
115
-
116
- For each sentence, save the transformer-block output at the final subtoken of the target attribute.
117
-
118
- Extract four normalized depths:
119
-
120
- | Depth | 8B block index | 70B block index |
121
- |---:|---:|---:|
122
- | 25% | 7 | 19 |
123
- | 50% | 15 | 39 |
124
- | 75% | 23 | 59 |
125
- | 100% | 31 | 79 |
126
-
127
- Indices are zero-based. Compute them dynamically:
128
-
129
- ```python
130
- layer_index = math.ceil(depth * model.config.num_hidden_layers) - 1
131
- ```
132
-
133
- Save float16 activation matrices and convert them to float32 for probe training.
134
-
135
- Expected activation volume:
136
-
137
- | Pairs/relation | Sentences | Activation vectors | 8B + 70B storage |
138
- |---:|---:|---:|---:|
139
- | 50 | 600 | 4,800 | approximately 59 MB |
140
- | 75 | 900 | 7,200 | approximately 89 MB |
141
- | 100 | 1,200 | 9,600 | approximately 118 MB |
142
-
143
- Per-layer matrix shapes are `[12 * N_final, 4096]` for 8B and `[12 * N_final, 8192]` for 70B.
144
-
145
- Also save token position information, model ID and revision, layer index, normalized depth, activation shape, and dataset hash.
146
-
147
- ## 5. Probe configuration
148
-
149
- Use one fixed scikit-learn pipeline throughout:
150
-
151
- ```text
152
- StandardScaler
153
- L2-regularized LogisticRegression
154
- ```
155
-
156
- Fix the solver, `C`, maximum iterations, and random seed in `experiment_config.json` before Stage 2.
157
-
158
- Primary metric: ROC-AUC.
159
- Secondary metric: balanced accuracy.
160
-
161
- ## 6. Stage 1A: Within-relation probing
162
-
163
- For every model, depth, and relation, run three-fold pair-grouped cross-validation using only that relation.
164
-
165
- For each fold:
166
-
167
- 1. fit the probe on two folds;
168
- 2. evaluate it on the held-out fold;
169
- 3. record fold AUC and per-example prediction scores.
170
-
171
- The official within-relation result is:
172
-
173
- ```text
174
- mean of the three fold AUCs +/- standard deviation
175
- ```
176
-
177
- It is used for:
178
-
179
- - the within-relation baseline;
180
- - global layer selection for Stage 2;
181
- - the within-to-unseen generality gap;
182
- - the diagonal of the Stage 2 transfer matrix.
183
-
184
- Pooled OOF AUC may be stored as an additional diagnostic, but it is not the primary metric because scores from independently fitted fold models need not share an identical calibration scale.
185
-
186
- Training count:
187
-
188
- ```text
189
- 6 relations x 3 folds x 4 depths = 72 fits per model
190
- ```
191
-
192
- ## 7. Stage 1B: Leave-one-relation-out probing
193
-
194
- For every model and depth, run six experiments:
195
-
196
- ```text
197
- train on five relations -> evaluate on the sixth unseen relation
198
- ```
199
-
200
- Report one AUC for each held-out relation, followed by mean and variation across the six relations. Retain all four depths.
201
-
202
- Training count:
203
-
204
- ```text
205
- 6 held-out relations x 4 depths = 24 fits per model
206
- ```
207
-
208
- ### Generality gap
209
-
210
- For each model, depth, and target relation:
211
-
212
- ```text
213
- generality_gap = mean_within_relation_auc - leave_one_out_auc
214
- ```
215
-
216
- Interpretation:
217
-
218
- - high within and high leave-one-out AUC: relation-general decodability;
219
- - high within and low leave-one-out AUC: relation-specific decodability;
220
- - a smaller 70B gap: evidence that scaling improves transfer across the evaluated relations.
221
-
222
- ## 8. Global layer selection for Stage 2
223
-
224
- Select one layer per model from Stage 1A:
225
-
226
- ```text
227
- best_layer(model)
228
- = layer with the highest mean within-relation AUC,
229
- averaged first across folds and then across the six relations
230
- ```
231
-
232
- If two depths differ by no more than 0.005 mean AUC, select the shallower depth.
233
-
234
- Selection is global per model, not per relation. The 8B and 70B matrices may use different normalized depths and are therefore results at each model's best within-relation layer.
235
-
236
- ## 9. Stage 2: Six-by-six pairwise transfer matrix
237
-
238
- At each model's selected layer, fit one probe on all examples from each source relation:
239
-
240
- ```text
241
- 6 source relations = 6 full-source probes per model
242
- ```
243
-
244
- Apply each probe to the other five relations:
245
-
246
- ```text
247
- 6 sources x 5 targets = 30 off-diagonal evaluations per model
248
- ```
249
-
250
- Rows are source relations and columns are target relations. Transfer is directional, so `R1 -> R2` and `R2 -> R1` are separate results.
251
-
252
- For each diagonal cell, reuse the mean three-fold within-relation AUC from Stage 1A at the selected layer. The diagonal is cross-validated, whereas each off-diagonal probe is fitted on the full source relation; state this in the figure caption.
253
-
254
- Stage 2 explains whether transfer is broad, clustered among semantically related relations, or asymmetric.
255
-
256
- ## 10. Compute summary
257
-
258
- | Quantity | Total after timing decision |
259
- |---|---:|
260
- | Sentences | 600, 900, or 1,200 |
261
- | Activation vectors | 4,800, 7,200, or 9,600 |
262
- | Activation storage | approximately 59, 89, or 118 MB |
263
- | Stage 1 within-relation fits | 144 across two models |
264
- | Stage 1 leave-one-out fits | 48 across two models |
265
- | Stage 2 full-source fits | 12 across two models |
266
- | Total logistic-regression fits | 204 |
267
- | Saved probe models | all 204 fitted probes |
268
- | Stage 2 off-diagonal evaluations | 60 across two models |
269
-
270
- Remote activation extraction is the main time cost. Probe training is local and inexpensive.
271
-
272
- ## 11. Required artifacts
273
-
274
- ```text
275
- reproduction/scaling/
276
- |-- phase2_final_plan.md
277
- |-- experiment_config.json
278
- |-- sample_size_decision.json
279
- |-- data/
280
- | |-- raw/counterfact.json
281
- | |-- processed/examples.parquet
282
- | |-- processed/relations.json
283
- | |-- processed/splits.parquet
284
- | `-- processed/dataset_manifest.json
285
- |-- activations/
286
- | |-- llama_3_1_8b/
287
- | | |-- manifest.json
288
- | | |-- sample_index.parquet
289
- | | `-- layer_*.npy
290
- | `-- llama_3_1_70b/
291
- | |-- manifest.json
292
- | |-- sample_index.parquet
293
- | `-- layer_*.npy
294
- |-- results/
295
- | |-- stage1_predictions.parquet
296
- | |-- stage1_metrics.csv
297
- | |-- selected_layers.json
298
- | |-- stage2_predictions.parquet
299
- | |-- stage2_matrix_8b.csv
300
- | |-- stage2_matrix_70b.csv
301
- | `-- probe_weights/
302
- `-- figures/
303
- ```
304
-
305
- ### Data and split files
306
-
307
- `examples.parquet` contains sentence text, labels, relation and pair identity, subject, attributes, and false-attribute provenance.
308
-
309
- `splits.parquet` contains:
310
-
311
- ```text
312
- example_id, pair_id, relation_id, within_relation_fold
313
- ```
314
-
315
- ### Activations
316
-
317
- After the pilot is discarded and `N_final` is frozen, store one float16 matrix per model and layer. `sample_index.parquet` defines row-to-example correspondence. The manifest records model/data revisions, timing, shapes, and checksums.
318
-
319
- ### Predictions
320
-
321
- Store per-example scores:
322
-
323
- ```text
324
- stage, model_id, layer_index, normalized_depth, protocol,
325
- source_relations, target_relation, fold, example_id,
326
- true_label, prediction_score
327
- ```
328
-
329
- ### Metrics
330
-
331
- ```text
332
- stage, model_id, layer_index, normalized_depth, protocol,
333
- source_relations, target_relation, fold,
334
- auc, balanced_accuracy, n_train, n_test
335
- ```
336
-
337
- ### Probe weights
338
-
339
- Save all 204 fitted probes from Stage 1 and Stage 2. This includes every within-relation fold probe, every leave-one-relation-out probe, and every Stage 2 full-source probe.
340
-
341
- Store portable parameter arrays rather than relying only on pickled sklearn objects:
342
-
343
- ```text
344
- coefficient
345
- intercept
346
- scaler_mean
347
- scaler_scale
348
- classes
349
- ```
350
-
351
- Each saved probe also needs a manifest entry containing:
352
-
353
- ```text
354
- probe_id
355
- stage
356
- protocol
357
- model_id
358
- model_revision
359
- layer_index
360
- normalized_depth
361
- source_relations
362
- target_relation
363
- fold
364
- training_example_ids
365
- probe_configuration_hash
366
- sklearn_version
367
- ```
368
-
369
- The expected storage is only on the order of tens of megabytes when arrays are stored as float32. Saving every probe makes later prediction checks, coefficient analysis, and paper revisions possible without retraining.
370
-
371
- ## 12. Required figures and tables
372
-
373
- 1. **Stage 1 depth plot:** mean within-relation and leave-one-out AUC across the four depths for 8B and 70B.
374
- 2. **Generality-gap summary:** within AUC, unseen AUC, and gap by model and depth.
375
- 3. **Two transfer matrices:** one 6-by-6 heatmap per model using the same relation order and color scale.
376
- 4. **Relation-level table:** within AUC, leave-one-out AUC, and gap for every target relation.
377
-
378
- Relations are the unit of generalization. Keep relation-level results visible alongside aggregate means.
379
-
380
- ## 13. Implementation sequence
381
-
382
- 1. Select and freeze six relations.
383
- 2. Prepare and validate nested `N50`, `N75`, and `N100` subsets where data availability permits.
384
- 3. Choose one pilot relation and run its first 50 pairs through all four depths on 8B and 70B.
385
- 4. Validate the extraction and record model-specific timing components.
386
- 5. Estimate the 50-, 75-, and 100-pair full-run costs and freeze `N_final`.
387
- 6. Discard pilot activations while preserving logs and `sample_size_decision.json`.
388
- 7. Generate fixed three-fold pair assignments for the final dataset.
389
- 8. Start fresh four-depth activation extraction for all six relations on 8B and 70B.
390
- 9. Run Stage 1 on both models.
391
- 10. Select one global layer per model.
392
- 11. Run Stage 2 and generate the two matrices.
393
- 12. Produce final figures and freeze result files before interpretation.
394
-
395
- ## 14. Completion criteria
396
-
397
- The experiment is complete when:
398
-
399
- - the timing benchmark and final sample-size decision are saved;
400
- - the balanced six-relation `N_final` dataset and fixed splits are saved;
401
- - four activation depths are available for both models;
402
- - within-relation and leave-one-out results exist for every model, depth, and relation;
403
- - selected layers were produced by the fixed mean-within-AUC rule;
404
- - both 6-by-6 transfer matrices are complete;
405
- - all 204 probe models, per-example predictions, metrics, manifests, and final figures are saved.
406
-
407
- ## 15. Optional low-cost controls
408
-
409
- If time permits, add two local controls; neither requires additional activation extraction.
410
-
411
- ### Text-only baseline
412
-
413
- Train a TF-IDF logistic classifier on the raw sentences using the same within-relation and leave-one-relation-out splits. Near-chance performance would show that the activation results are not easily explained by surface lexical cues alone.
414
-
415
- ### Pair-balanced label permutation
416
-
417
- At each model's selected layer, repeat probe evaluation with randomly swapped true/false labels inside each fact pair, preserving class balance. Run approximately 10 random permutations. The resulting AUC distribution should be near 0.5 and serves as a pipeline/split sanity check.
418
-
419
- These controls are optional and must not delay the main 8B-versus-70B experiment.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
phase2_scaling/phase2_notes.txt DELETED
@@ -1,842 +0,0 @@
1
- Phase 2: Scaling Experiment Notes
2
- =================================
3
- Authoritative specification: phase2_final_plan.md
4
- This file records decisions, reasoning, and data-quality observations
5
- for paper writing. It does not duplicate the full protocol.
6
-
7
-
8
- SUPERSEDED: initial design (2026-07-11)
9
- ----------------------------------------
10
- The initial plan (also in phase2_notes.txt prior to this revision and
11
- in the Phase 2 section of updated_plan.md) described:
12
- - three models: 8B, 70B, 405B
13
- - extraction at every transformer layer
14
- - single relation P103 first, then top-25 relations
15
- - research focus on locating the highest-AUC layer
16
- - three normalised-depth AUC curves as the main figure
17
-
18
- This was superseded on 2026-07-11 by phase2_final_plan.md, which
19
- reframes the contribution around cross-relation generalisation rather
20
- than layer location. The current design is:
21
- - two models: Llama-3.1-8B and Llama-3.1-70B (405B is optional
22
- future work and does not block this experiment)
23
- - six finalised CounterFact relations
24
- - four normalised depths: 25%, 50%, 75%, 100%
25
- - Stage 1: within-relation 3-fold CV + leave-one-relation-out
26
- - Stage 2: 6x6 pairwise transfer matrices at each model's best
27
- within-relation layer
28
- - a disposable timing pilot (1 relation x 50 pairs x 2 models)
29
- to select N_final from {50, 75, 100} pairs per relation
30
-
31
- What is preserved from the initial plan:
32
- - all compute runs through NNsight + NDIF (no local Llama hosting)
33
- - the local RTX 5080 laptop handles only data prep, probe training,
34
- and figures
35
- - NDIF/NNsight citation requirement and acknowledgement
36
-
37
-
38
- Relation selection (finalised 2026-07-12)
39
- ------------------------------------------
40
- Six semantically diverse CounterFact relations:
41
-
42
- P19 (place of birth) biographical, location-type target
43
- P103 (native language) biographical, language-type target
44
- P101 (field of work) biographical, domain-type target
45
- P159 (headquarters location) organisation, location-type target
46
- P176 (manufacturer) product/organisation
47
- P138 (named after) diverse entity types
48
-
49
- Design reasoning (recorded before seeing any probe results):
50
-
51
- P19 and P103 were selected a priori, before observing any probe
52
- results, as a conceptually related biographical pair: same subject
53
- type (people), shared cultural/geographic
54
- background, but nearly no subject overlap (3 out of ~800) and zero
55
- target-vocabulary overlap (place names vs language names). We
56
- hypothesise stronger transfer between these two than between
57
- unrelated pairs.
58
-
59
- P19 and P159 share location-type targets (cities, countries) but
60
- differ in subject type (people vs organisations) and predicate.
61
- This allows comparison of whether conceptual similarity or shared
62
- target vocabulary drives transfer.
63
-
64
- P101 provides intermediate semantic distance from the biographical
65
- pair. P176 and P138 provide more distant relation structures.
66
-
67
- These expectations are NOT built into the sampling or filtering
68
- code. The preprocessing treats all six relations identically
69
- (except P103 French capping); hypotheses are tested only at the
70
- analysis stage.
71
-
72
-
73
- Data statistics
74
- ----------------
75
- Counts at each cleaning stage for the six target relations:
76
-
77
- Stage 1 — Raw records in counterfact.json:
78
-
79
- Relation Records Subjects Top attribute (%)
80
- P19 779 779 London (7.6%)
81
- P103 919 919 French (63.9%)
82
- P176 911 911 Toyota (11.0%)
83
- P101 545 545 physics (13.4%)
84
- P159 756 756 London (11.4%)
85
- P138 279 279 Victoria (3.6%)
86
-
87
- Stage 2 — After within-relation subject deduplication
88
- (keep lowest case_id per subject):
89
-
90
- P19 779 -> 779 (0 removed)
91
- P103 919 -> 918 (1 removed)
92
- P176 911 -> 900 (11 removed)
93
- P101 545 -> 519 (26 removed)
94
- P159 756 -> 754 (2 removed)
95
- P138 279 -> 272 (7 removed)
96
-
97
- Stage 3 — After cross-relation subject removal
98
- (12 subjects appear in more than one target relation):
99
-
100
- P19 779 -> 776 (3 removed: Michel Brault, Pierre Braunberger,
101
- Sergey Lavrov — shared with P103)
102
- P103 918 -> 908 (10 removed: 7 shared with P101, 3 with P19)
103
- P176 900 -> 899 (1 removed: PGM-17 Thor — shared with P138)
104
- P101 519 -> 512 (7 removed: shared with P103)
105
- P159 754 -> 753 (1 removed: Sheffield United F.C. — with P138)
106
- P138 272 -> 270 (2 removed: PGM-17 Thor, Sheffield United F.C.)
107
-
108
- Stage 4 — After duplicate-sentence removal:
109
-
110
- No duplicate sentences found in any relation after prior cleaning.
111
- All counts unchanged from Stage 3.
112
-
113
- Final cleaned pool sizes:
114
- P19=776, P103=908, P176=899, P101=512, P159=753, P138=270
115
-
116
- The tightest relation is P138 with 270 usable records, well above
117
- the N100 requirement.
118
-
119
- P103 after cleaning: 908 records, French=582 (64.1%).
120
-
121
-
122
- Negative construction via derangement
123
- --------------------------------------
124
- False sentences are constructed by permuting true attributes within
125
- each relation using a fixed-seed derangement: a permutation sigma of
126
- {1, ..., n} such that a_{sigma(i)} != a_i for every record i.
127
-
128
- Why this guarantees identical attribute marginals:
129
-
130
- A permutation is a bijection. The multiset of false attributes
131
- {a_{sigma(1)}, ..., a_{sigma(n)}} is identical to the multiset of
132
- true attributes {a_1, ..., a_n}. Every attribute value appears
133
- exactly the same number of times as true and as false. This is an
134
- exact algebraic guarantee.
135
-
136
- Consequence: a linear probe cannot succeed merely because some
137
- attribute word appears more often with one label.
138
-
139
- The no-self-match constraint ensures no record's false sentence
140
- contains the same attribute as its true sentence.
141
-
142
- Existence condition: a valid derangement exists whenever no single
143
- attribute occupies more than floor(n/2) positions.
144
-
145
- This approach is better suited to our probing control than using
146
- CounterFact's built-in target_new field, which was designed for
147
- knowledge-editing experiments and does not match attribute marginals
148
- across labels.
149
-
150
-
151
- P103 French capping
152
- ---------------------
153
- French represents 587/919 = 63.9% of P103 raw records, exceeding
154
- the derangement feasibility threshold (50%) at every sample size.
155
-
156
- Capping strategy: limit French records to 20/30/40 in the
157
- N50/N75/N100 subsets (= 40% of each subset), safely below the 50%
158
- derangement ceiling. Non-French records are sampled with the same
159
- fixed seed used for all other relations.
160
-
161
- Other relations have no attribute exceeding 14% and need no capping.
162
-
163
- Scope of this control: capping eliminates unigram attribute-frequency
164
- difference between labels. It does not rule out all forms of lexical
165
- leakage (e.g., correlated subject names or template structure). The
166
- optional TF-IDF baseline described in phase2_final_plan.md Section 15
167
- addresses surface-lexical confounds more broadly.
168
-
169
-
170
- Nested subset construction
171
- ----------------------------
172
- Three nested subsets per relation support the timing gate:
173
-
174
- N50 = 50 pairs (first selected)
175
- N75 = N50 + 25 additional pairs
176
- N100 = N75 + 25 additional pairs
177
-
178
- Nesting is strict: N50 subset N75 subset N100. The same seed
179
- controls selection at every level.
180
-
181
- Derangements are computed independently per subset level because the
182
- attribute composition changes. A given record's false attribute at
183
- N50 may differ from its false attribute at N100.
184
-
185
-
186
- Timing gate
187
- ------------
188
- Before committing to a full six-relation extraction, a disposable
189
- pilot determines N_final.
190
-
191
- Pilot procedure:
192
- 1. Choose one of the six relations and take its first 50 pairs
193
- (100 sentences).
194
- 2. Run the exact four-depth activation extraction on 8B and 70B
195
- using the same batch size, token position, dtype, and NNsight
196
- code path intended for the final run.
197
- 3. Record per model: queue wait, remote execution, result transfer,
198
- and total wall-clock time.
199
- 4. Estimate full extraction time as:
200
- N50 -> 6x pilot time per model
201
- N75 -> 9x pilot time per model
202
- N100 -> 12x pilot time per model
203
- 5. Choose N_final from {50, 75, 100} using the remaining time
204
- budget, reserving at least six hours for probing, validation,
205
- figures, and debugging.
206
- 6. Validate pilot tensor shapes and metadata, then discard pilot
207
- activation files. Keep only logs and timing record in
208
- sample_size_decision.json.
209
- 7. Start fresh extraction for all six relations on both models.
210
-
211
- Maximum wasted inference: one relation at the 50-pair level.
212
-
213
-
214
- Cleaning pipeline summary
215
- ---------------------------
216
- 1. Filter to six target relations.
217
- 2. Remove duplicate subjects within each relation (keep lowest
218
- case_id).
219
- 3. Remove subjects appearing in more than one target relation.
220
- 4. Remove duplicate sentences.
221
- 5. Apply P103 French cap.
222
- 6. Sample nested N50/N75/N100 subsets (fixed seed).
223
- 7. Construct derangement-based negatives per relation per subset.
224
- 8. Validate: class balance, no true==false, exact attribute
225
- marginals, correct subset sizes, no duplicate examples.
226
-
227
-
228
- Output files
229
- -------------
230
- data/processed/examples.parquet
231
- All examples with columns: example_id, pair_id, case_id,
232
- relation_id, subject, template, true_attribute, used_attribute,
233
- sentence, label, false_attribute_source_id, subset.
234
-
235
- data/processed/relations.json
236
- Per-relation metadata: record counts at each cleaning stage,
237
- attribute distribution, French cap details (P103), template
238
- statistics.
239
-
240
- data/processed/dataset_manifest.json
241
- Global seed, file hashes, counts, sampling decisions, validation
242
- results.
243
-
244
- Splits (3-fold pair-grouped CV assignments) are generated in a
245
- separate step after data preparation is validated.
246
-
247
-
248
- Preprocessing execution record (2026-07-12)
249
- ----------------------------------------------
250
- Script: prepare_counterfact_multirelation.py
251
- Seed: 20260712
252
- Command: python prepare_counterfact_multirelation.py
253
- Conda env: blackboxnlp
254
-
255
- Derangement algorithm: sort records by (attribute, case_id), then
256
- shift indices by max_group_size. Deterministic given the selected
257
- records — no additional random seed needed for the derangement itself.
258
- Randomness enters only through subset sampling.
259
-
260
- Per-relation RNG seeds (derived from global seed + relation index):
261
- P19: 20260712 + 0*10007 = 20260712
262
- P103: 20260712 + 1*10007 = 20270719 (sub-seeds +1/+2 for French/other)
263
- P176: 20260712 + 2*10007 = 20280726
264
- P101: 20260712 + 3*10007 = 20290733
265
- P159: 20260712 + 4*10007 = 20300740
266
- P138: 20260712 + 5*10007 = 20310747
267
-
268
- Validation: 18/18 checks passed (6 relations x 3 subset levels).
269
- All nesting checks passed (N50 ⊂ N75 ⊂ N100 by case_id).
270
- Cross-relation subject check on N100: no overlap.
271
-
272
- Output files:
273
- data/processed/examples.parquet (2700 rows)
274
- data/processed/relations.json
275
- data/processed/dataset_manifest.json
276
-
277
- Manifest hashes:
278
- raw_data: d017056125178a13728594e66a801357a8db9ed7973a7425554bb4271de9fc6f
279
- output: 5f526e216cbc5e1db494ca62340ecaad42c4515045ede33ec3658bde958a2d8d
280
-
281
- Examples per subset:
282
- N50: 600 (6 relations x 50 pairs x 2 labels)
283
- N75: 900 (6 relations x 75 pairs x 2 labels)
284
- N100: 1200 (6 relations x 100 pairs x 2 labels)
285
-
286
- P103 French counts in selected subsets:
287
- N50: 20/50 = 40% (cap: 20)
288
- N75: 30/75 = 40% (cap: 30)
289
- N100: 40/100 = 40% (cap: 40)
290
-
291
- Note: Stage 4 (sentence dedup) removed 0 records across all relations.
292
- The earlier estimate of 3 duplicate sentences in P176 was based on a
293
- raw-data scan before subject deduplication; those duplicates were
294
- already eliminated in Stage 2 (within-relation subject dedup).
295
-
296
- Data-quality observation: attribute marginals verified to match exactly
297
- between true and false examples at every relation x subset level. The
298
- derangement shift algorithm guarantees this algebraically (permutation
299
- preserves multiset), confirmed empirically.
300
-
301
-
302
- NNsight implementation note
303
- ----------------------------
304
- NNsight 0.7.0 does not trace Python for-loops inside the
305
- model.trace() context manager. Any .save() calls inside a for-loop
306
- are silently dropped — the trace completes but returns no tensor data
307
- (only ~341 bytes of metadata).
308
-
309
- Workaround: unroll layer saves as four explicit statements. Since
310
- Phase 2 always extracts exactly four depths, this is straightforward.
311
- This behaviour was discovered during the pilot and is documented
312
- here so future scripts do not repeat the debugging.
313
-
314
-
315
- Pilot timing record (2026-07-12)
316
- ----------------------------------
317
- Script: extract_activations.py --pilot
318
- Conda env: blackboxnlp-ndif
319
- Pilot relation: P19
320
- Pilot subset: N50 (50 pairs = 100 sentences)
321
-
322
- Token position strategy: last real token in tokenised sequence.
323
- Because the attribute is always the final word(s) in the sentence
324
- (by construction in make_sentence()), the last token IS the final
325
- subtoken of the target attribute.
326
-
327
- 8B (meta-llama/Llama-3.1-8B):
328
- Layers extracted: 7, 15, 23, 31 (depths 25%, 50%, 75%, 100%)
329
- Wall clock: 171.3s
330
- Per sentence: 1.71s
331
- Activation shape: (100, 4096) per layer, dtype float16
332
-
333
- 70B (meta-llama/Llama-3.1-70B):
334
- Layers extracted: 19, 39, 59, 79 (depths 25%, 50%, 75%, 100%)
335
- Wall clock: 231.9s
336
- Per sentence: 2.32s
337
- Activation shape: (100, 8192) per layer, dtype float16
338
-
339
- Estimated full extraction times:
340
- N50: 8B=17min + 70B=23min = 40min total
341
- N75: 8B=26min + 70B=35min = 60min total
342
- N100: 8B=34min + 70B=46min = 81min total
343
-
344
- Pilot activations saved to activations/pilot/ for shape validation.
345
- To be discarded after N_final is frozen.
346
- Full timing evidence saved to sample_size_decision.json.
347
-
348
-
349
- N_final decision (2026-07-12)
350
- -------------------------------
351
- N_final = 100 pairs per relation
352
- Total sentences: 1200 (6 relations x 100 pairs x 2 labels)
353
- Estimated extraction: ~81 min (8B: 34min, 70B: 46min)
354
- Rationale: well within remaining time budget; 6+ hours reserved
355
- for probing, validation, figures, and debugging.
356
-
357
- Pilot activations discarded after shape validation.
358
- Timing evidence preserved in sample_size_decision.json.
359
-
360
-
361
- Full extraction record (2026-07-12)
362
- --------------------------------------
363
- Script: extract_activations.py --subset N100
364
- Conda env: blackboxnlp-ndif
365
-
366
- 8B (meta-llama/Llama-3.1-8B):
367
- Layers: 7, 15, 23, 31 (depths 25%, 50%, 75%, 100%)
368
- Sentences: 1200
369
- Wall clock: 1957s (32.6 min)
370
- Per sentence: 1.63s
371
- Shape: (1200, 4096) per layer, dtype float16
372
-
373
- 70B (meta-llama/Llama-3.1-70B):
374
- Layers: 19, 39, 59, 79 (depths 25%, 50%, 75%, 100%)
375
- Sentences: 1200
376
- Wall clock: 2818s (47.0 min)
377
- Per sentence: 2.35s
378
- Shape: (1200, 8192) per layer, dtype float16
379
-
380
- Total extraction: 4775s (79.6 min)
381
- Estimated was 81 min — actual within 2% of estimate.
382
-
383
- Dataset hash (both models): 7ef95d79b694631d
384
- Token position: last real token (final subtoken of target attribute)
385
-
386
- Output files:
387
- activations/llama_3_1_8b/layer_{7,15,23,31}.npy
388
- activations/llama_3_1_8b/sample_index.parquet
389
- activations/llama_3_1_8b/manifest.json
390
- activations/llama_3_1_70b/layer_{19,39,59,79}.npy
391
- activations/llama_3_1_70b/sample_index.parquet
392
- activations/llama_3_1_70b/manifest.json
393
-
394
-
395
- Checklist: filled after later stages
396
- --------------------------------------
397
- [x] Split seed: 2026071203
398
- [x] Per-relation fold counts: 34/33/33 for all six relations
399
- Same-pair constraint enforced: true/false in same fold.
400
- Downstream join on example_id, not row index.
401
- [x] Observed tokenisation edge cases: none encountered.
402
- [x] Final figure paths: see "Output figures" section below.
403
-
404
-
405
- Probing execution record (2026-07-12)
406
- ---------------------------------------
407
- Script: run_probing.py
408
- Conda env: blackboxnlp
409
- Config: experiment_config.json (hash: 667540b0fa890cca)
410
-
411
- Probe: StandardScaler + LogisticRegression(solver=lbfgs, C=1.0,
412
- penalty=l2, max_iter=1000, tol=0.0001, fit_intercept=True,
413
- class_weight=None, random_state=42)
414
- Scaler fitted only on each probe's training set.
415
- ConvergenceWarning monitored: none triggered (all 204 probes converged).
416
-
417
- Stage 1A (within-relation 3-fold CV):
418
- 144 fits (6 relations × 4 depths × 3 folds × 2 models)
419
-
420
- Stage 1B (leave-one-relation-out):
421
- 48 fits (6 relations × 4 depths × 2 models)
422
-
423
- Layer selection:
424
- 8B: layer 7 (depth=0.25, mean_auc=0.9620, best=0.9660)
425
- Within 0.005 tolerance → selected shallowest qualifying layer.
426
- 70B: layer 39 (depth=0.50, mean_auc=0.9770, best=0.9770)
427
- Unique best — no tie-breaking needed.
428
-
429
- Stage 2 (6×6 transfer matrix at selected layer):
430
- 12 full-source fits (6 sources × 2 models)
431
- 60 off-diagonal evaluations
432
- Diagonal: mean 3-fold within AUC from Stage 1A
433
-
434
- Total: 204 probes fitted, 204 npz + manifest saved.
435
- Stage 2 predictions: 12,000 rows (off-diagonal only).
436
-
437
- Output files:
438
- results/stage1_metrics.csv (192 rows: 1A + 1B)
439
- results/stage2_metrics.csv (60 rows: off-diagonal)
440
- results/generality_gap.csv (48 rows)
441
- results/stage1_predictions.parquet (19,200 rows: 1A + 1B)
442
- results/stage2_predictions.parquet (12,000 rows: off-diagonal only)
443
- results/stage2_matrix_8b.csv
444
- results/stage2_matrix_70b.csv
445
- results/selected_layers.json
446
- results/probe_weights/ (204 npz + 204 manifest json)
447
-
448
- Relation order (fixed for all figures and matrices):
449
- P19, P103, P101, P159, P176, P138
450
-
451
-
452
- Output figures (2026-07-12)
453
- ----------------------------
454
- Script: generate_figures.py
455
- Conda env: blackboxnlp
456
- Colors: 8B = #2a78d6 (blue), 70B = #1baf7a (green/aqua)
457
-
458
- figures/fig1_depth_profile.{pdf,png}
459
- figures/fig2_generality_gap.{pdf,png}
460
- figures/fig3_transfer_matrices.{pdf,png}
461
- figures/fig4_relation_gap_detail.{pdf,png}
462
- figures/fig5_relation_profiles.{pdf,png}
463
- results/table1_relation_results.csv
464
-
465
-
466
- ===============================================================
467
- PAPER-WRITING REFERENCE (below this line)
468
- ===============================================================
469
-
470
- Experiment summary
471
- --------------------
472
- Research question:
473
- Does model scale make a linearly decodable truth representation
474
- more transferable across factual relations?
475
-
476
- Design:
477
- - Two models: Llama-3.1-8B (32 layers) and Llama-3.1-70B (80 layers)
478
- - Six semantically diverse CounterFact relations:
479
- P19 (place of birth), P103 (native language),
480
- P101 (field of work), P159 (headquarters location),
481
- P176 (manufacturer), P138 (named after)
482
- - 100 factual pairs per relation (N100), 1200 sentences total
483
- - Derangement-based negatives: a permutation that preserves
484
- exact attribute marginals between true and false examples
485
- - Four normalised depths per model: 25%, 50%, 75%, 100%
486
- - Probe: StandardScaler + L2-regularised logistic regression
487
- - Three evaluation stages:
488
- 1A. Within-relation 3-fold CV (pair-grouped)
489
- 1B. Leave-one-relation-out (train on 5, test on 1)
490
- 2. 6×6 pairwise transfer matrix at each model's best layer
491
- - Generality gap = within-relation mean AUC − leave-one-out AUC
492
- (positive = within > leave-one-out = relation-specific;
493
- negative = leave-one-out > within = more general)
494
- - Activations extracted via NNsight + NDIF (remote inference)
495
-
496
-
497
- Figure-by-figure interpretation
498
- ----------------------------------
499
-
500
- Fig 1: Depth profile (fig1_depth_profile.pdf)
501
- ................................................
502
- Shows mean ROC-AUC across all six relations at each normalised
503
- depth, separately for within-relation 3-fold CV and leave-one-out,
504
- for both models. Error bars = SD across 6 relations.
505
- Background colour bands mark each model's selected layer depth.
506
-
507
- Key observations:
508
- - 70B achieves uniformly higher AUC than 8B at every depth in
509
- both evaluation protocols.
510
- - Both models peak in the first half of the network (8B at 25%,
511
- 70B at 50%), consistent with truth-relevant features being
512
- encoded relatively early.
513
- - 70B's within and leave-one-out curves track each other closely
514
- (small gap), whereas 8B's curves diverge more, especially at
515
- deeper layers. This is the visual signature of better cross-
516
- relation transfer at larger scale.
517
- - The decline at depth 100% is steeper for 8B than 70B.
518
-
519
- Caption requirements:
520
- - State that error bars are SD across 6 relations, not SE.
521
- - Note background bands mark the selected layer per model.
522
- - Clarify that within = mean 3-fold CV AUC, leave-one-out =
523
- train-on-5-relations AUC.
524
-
525
- Fig 2: Generality gap summary (fig2_generality_gap.pdf)
526
- .........................................................
527
- Grouped bar chart showing mean |gap| per depth for each model.
528
-
529
- Key observations:
530
- - 70B has smaller mean absolute generality gap at every depth:
531
- depth 0.25: 70B 0.004 vs 8B 0.018
532
- depth 0.50: 70B 0.003 vs 8B 0.011
533
- depth 0.75: 70B 0.008 vs 8B 0.032
534
- depth 1.00: 70B 0.025 vs 8B 0.048
535
- - The gap advantage of 70B is most pronounced in the middle
536
- layers (50–75%) and narrows at depth 100%.
537
- - This directly addresses the RQ: scaling from 8B to 70B
538
- reduces the difference between within-relation and cross-
539
- relation probe performance.
540
-
541
- Caption requirements:
542
- - Define generality gap as within-relation mean AUC minus
543
- leave-one-out AUC.
544
- - State that bars show the mean absolute gap over 6 relations.
545
-
546
- Fig 3: Transfer matrices (fig3_transfer_matrices.pdf)
547
- ......................................................
548
- Two 6×6 heatmaps side by side (8B left, 70B right) at each
549
- model's selected layer. Rows = source relation, columns =
550
- target relation. Diagonal = within-relation mean 3-fold CV AUC
551
- (cross-validated). Off-diagonal = AUC from a probe trained on
552
- the full source relation and evaluated on the full target.
553
-
554
- Key observations:
555
- - 70B off-diagonal values are uniformly higher than 8B (mean
556
- off-diagonal: 70B ~0.972, 8B ~0.943).
557
- - P19 (place of birth) is the weakest target for both models;
558
- transferring into P19 yields the lowest values in both
559
- matrices (8B: 0.849–0.918, 70B: 0.931–0.970).
560
- - P176 and P138 are "easy" targets: nearly every source
561
- relation transfers well to them at both scales.
562
- - 70B shows a more uniform matrix with less row/column
563
- variation, suggesting that the representation is more
564
- relation-agnostic.
565
- - The P19/P103 biographical pair does NOT show obviously
566
- elevated mutual transfer relative to other pairs — this
567
- is discussed under "Cannot claim" below.
568
-
569
- Caption requirements:
570
- - State that rows are source relations, columns are targets.
571
- - State that diagonal values are mean 3-fold CV AUC (cross-
572
- validated) and off-diagonal values come from probes trained
573
- on the entire source relation.
574
- - State which layer is shown per model (8B: layer 7 / depth
575
- 25%; 70B: layer 39 / depth 50%).
576
-
577
- Fig 4: Relation-level gap detail (fig4_relation_gap_detail.pdf)
578
- ................................................................
579
- Horizontal diverging bar chart showing the signed generality
580
- gap per relation at each model's selected layer. Positive =
581
- within > leave-one-out (probe loses accuracy on unseen
582
- relations). Negative = leave-one-out > within (probe gains
583
- from multi-relation training). Labels show the numeric gap
584
- value.
585
-
586
- Key observations:
587
- - P138 (named after) has the largest positive gap in 8B
588
- (+0.048) but essentially zero in 70B (+0.001). This is
589
- the single most dramatic per-relation scaling effect.
590
- - P101 (field of work) in 8B also shows a notable positive
591
- gap (+0.031) that shrinks to 0.000 in 70B.
592
- - Negative gaps (P19, P159) indicate that multi-relation
593
- training can help: probes trained on five other relations
594
- slightly outperform within-relation probes for these
595
- targets. This is consistent across both scales.
596
- - 70B's gaps are compressed toward zero on both sides,
597
- meaning it is not just that 70B is better at within-relation
598
- probing — its representation is also more transferable.
599
-
600
- Caption requirements:
601
- - Define positive and negative gap direction.
602
- - State that values are at each model's selected layer.
603
-
604
- Fig 5: Relation depth profiles (fig5_relation_profiles.pdf)
605
- .............................................................
606
- 2×3 small-multiple grid showing per-relation within-relation
607
- AUC across the four depths for both models. Each panel is one
608
- of the six relations.
609
-
610
- Key observations:
611
- - P176 and P138 are near ceiling (>0.99) for 70B at all
612
- depths; 8B is also very high (>0.97).
613
- - P19 is the hardest relation at both scales but still well
614
- above chance (8B: 0.836–0.896, 70B: 0.935–0.950).
615
- - The depth profiles are broadly similar across relations:
616
- both models tend to peak early and decline at depth 100%.
617
- - 70B shows a flatter profile (less depth-dependence) for
618
- most relations compared to 8B.
619
-
620
- Caption requirements:
621
- - State that each panel shows within-relation mean 3-fold CV
622
- AUC across four normalised depths.
623
- - State that error bars or shaded bands (if present) are SD
624
- across the 3 folds.
625
-
626
- Table 1: Relation results (table1_relation_results.csv)
627
- ........................................................
628
- Columns: Relation, 8B within, 8B std, 8B leave-one-out,
629
- 8B gap, 70B within, 70B std, 70B leave-one-out, 70B gap.
630
- Values are at each model's selected layer.
631
- Mean row: mean gap uses the signed mean, not the mean of
632
- absolute values.
633
-
634
- Key numbers:
635
- Mean 8B within AUC: 0.962 (SD 0.013)
636
- Mean 8B leave-one-out AUC: 0.953
637
- Mean 8B gap: +0.009
638
-
639
- Mean 70B within AUC: 0.977 (SD 0.007)
640
- Mean 70B leave-one-out AUC: 0.979
641
- Mean 70B gap: −0.002
642
-
643
- Interpretation:
644
- - 70B has higher within-relation AUC (0.977 vs 0.962) and
645
- even slightly higher leave-one-out AUC than within — the
646
- mean gap is slightly negative (−0.002), meaning cross-
647
- relation training marginally helps on average.
648
- - 8B's mean gap is +0.009, meaning within-relation probes
649
- are slightly better on average — there is a small cost
650
- to generalising.
651
- - 70B has lower within-relation SD (0.007 vs 0.013),
652
- indicating more consistent performance across relations.
653
-
654
- Caption requirements:
655
- - State that values are at each model's selected layer
656
- (8B layer 7 / 25%, 70B layer 39 / 50%).
657
- - Define gap = within − leave-one-out.
658
-
659
-
660
- Core conclusions
661
- ------------------
662
- 1. Cross-relation truth signal exists at both scales: leave-one-
663
- out probes trained on five unrelated relations substantially
664
- exceed chance when tested on the sixth, for all six relations
665
- and at all four depths tested.
666
-
667
- 2. Scaling improves transferability: 70B has a smaller mean
668
- absolute generality gap at every depth. At the selected layers,
669
- 70B's signed mean gap is −0.002 (essentially zero / slightly
670
- negative) versus 8B's +0.009.
671
-
672
- 3. The 70B transfer matrix is more uniform: off-diagonal AUC
673
- values are higher and less variable than 8B. The 70B
674
- representation at its best layer is more relation-agnostic.
675
-
676
- 4. Relation identity still matters: P19 (place of birth) is
677
- consistently the hardest target. P176 (manufacturer) and P138
678
- (named after) are the easiest. This variation persists at both
679
- scales, though it is attenuated in 70B.
680
-
681
-
682
- What CANNOT be claimed from these results
683
- --------------------------------------------
684
- 1. No universal truth direction: we observe cross-relation
685
- linear decodability of truth labels, not a single truth
686
- direction. The probes at different source relations may use
687
- different linear combinations. The transfer matrix shows that
688
- these linear combinations generalise, but we have not shown
689
- (nor tested) that a single vector separates true from false
690
- across all relations simultaneously.
691
-
692
- 2. No causal claim: probing shows that truth-correlated
693
- information is linearly decodable from the residual stream.
694
- It does not demonstrate that the model uses this information
695
- for prediction. Causal interventions (e.g., activation
696
- patching, causal tracing) would be needed for that claim.
697
-
698
- 3. Lexical confounds not fully excluded: the derangement
699
- guarantees identical attribute marginals, eliminating the most
700
- obvious unigram leakage. However, more subtle lexical or
701
- distributional cues (e.g., subject–attribute co-occurrence
702
- patterns in pretraining data) are not controlled for. The
703
- optional TF-IDF baseline described in the plan was not run.
704
-
705
- 4. No P19–P103 biographical cluster: we hypothesised ex ante
706
- that the biographical pair (P19 place of birth, P103 native
707
- language) might show stronger mutual transfer. The transfer
708
- matrices do not support this: P19→P103 and P103→P19 are not
709
- notably elevated relative to other source–target pairs. This
710
- is an informative null — shared subject type does not
711
- automatically yield privileged transfer.
712
-
713
-
714
- Limitations and caveats
715
- --------------------------
716
- 1. Six relations only: the experiment covers six of the ~100
717
- relations in CounterFact. Results may not generalise to
718
- relations with very different structures (e.g., temporal,
719
- numerical, or multi-hop relations).
720
-
721
- 2. Sample size: 100 pairs per relation (200 examples per
722
- relation). This is sufficient for the linear probes used
723
- here but small by the standards of some probing studies.
724
-
725
- 3. Single dataset: all data comes from CounterFact. Template-
726
- generated sentences may contain distributional artifacts not
727
- present in naturalistic text.
728
-
729
- 4. Linear probe only: a linear probe tests linear decodability.
730
- A nonlinear probe (e.g., MLP) might find additional signal
731
- or show different scaling behaviour.
732
-
733
- 5. NDIF-served models: activations were extracted via NNsight +
734
- NDIF remote inference. We do not control exact batch
735
- composition on the server side. Determinism is ensured by
736
- per-sentence extraction and shape verification, but
737
- floating-point non-determinism at the hardware level is
738
- possible.
739
-
740
- 6. Leave-one-out sample size asymmetry: the within-relation
741
- probe trains on ~67 pairs (2 folds of 100), while the
742
- leave-one-out probe trains on 500 pairs (5 relations × 100).
743
- The leave-one-out probe sees ~7.5× more training data. The
744
- generality gap therefore confounds transferability with
745
- training-set size. This limitation should be acknowledged
746
- in the paper; it is standard for LOO designs but worth
747
- stating.
748
-
749
- 7. Controls not run: the plan described two optional controls —
750
- (a) a TF-IDF bag-of-words probe as a surface-feature
751
- baseline, and (b) a random-labels sanity check. Neither was
752
- run in this execution. The derangement design provides the
753
- primary methodological control; the TF-IDF baseline would
754
- strengthen the argument but is not essential.
755
-
756
- 8. Two model scales only: with just two points (8B and 70B),
757
- the relationship between scale and transferability is a
758
- comparison, not a trend. We cannot extrapolate to smaller
759
- or larger models.
760
-
761
-
762
- Phase 1 ↔ Phase 2 narrative connection
763
- -----------------------------------------
764
- Phase 1 (reproduction/ablation) showed that in a controlled
765
- synthetic setting, breaking cross-pair truth co-occurrence
766
- removes truth decodability from a fully trainable model while
767
- preserving factual memorization. This established that truth
768
- decodability is a function of statistical structure in the
769
- training data, not an automatic byproduct of storing factual
770
- knowledge.
771
-
772
- Phase 2 asks the natural follow-up question: given that truth
773
- decodability exists in pretrained language models, how does it
774
- behave across relations, and does model scale affect its
775
- generality?
776
-
777
- The connection:
778
- - Phase 1 shows truth decodability is contingent (can be
779
- removed). Phase 2 shows it is general (transfers across
780
- relations) and that this generality is scale-dependent.
781
- - Phase 1 uses a controlled toy model to isolate the mechanism.
782
- Phase 2 uses production-scale LLMs to test whether the
783
- phenomenon matters in practice.
784
- - Together they argue that truth representations in LLMs are
785
- (a) not an artifact of model architecture but of data
786
- structure, and (b) more transferable across factual domains
787
- at larger scale, suggesting that scaling encourages more
788
- abstract, relation-agnostic truth representations.
789
-
790
- The paper should present Phase 1 as establishing the mechanism
791
- and Phase 2 as testing its ecological validity at scale. The
792
- shared methodological thread is linear probing of truth labels
793
- with controlled negatives.
794
-
795
-
796
- Complete file inventory
797
- -------------------------
798
- Data:
799
- data/raw/counterfact.json
800
- data/processed/examples.parquet (2700 rows, all 3 subset levels)
801
- data/processed/relations.json
802
- data/processed/splits.parquet
803
- data/processed/dataset_manifest.json
804
-
805
- Activations:
806
- activations/llama_3_1_8b/layer_{7,15,23,31}.npy
807
- activations/llama_3_1_8b/sample_index.parquet
808
- activations/llama_3_1_8b/manifest.json (includes file_sha256)
809
- activations/llama_3_1_70b/layer_{19,39,59,79}.npy
810
- activations/llama_3_1_70b/sample_index.parquet
811
- activations/llama_3_1_70b/manifest.json (includes file_sha256)
812
-
813
- Results:
814
- results/stage1_metrics.csv (192 rows)
815
- results/stage2_metrics.csv (60 rows)
816
- results/generality_gap.csv (48 rows)
817
- results/stage1_predictions.parquet (19,200 rows)
818
- results/stage2_predictions.parquet (12,000 rows)
819
- results/stage2_matrix_8b.csv
820
- results/stage2_matrix_70b.csv
821
- results/selected_layers.json
822
- results/table1_relation_results.csv
823
- results/probe_weights/ (204 npz + 204 manifest json)
824
-
825
- Figures:
826
- figures/fig1_depth_profile.{pdf,png}
827
- figures/fig2_generality_gap.{pdf,png}
828
- figures/fig3_transfer_matrices.{pdf,png}
829
- figures/fig4_relation_gap_detail.{pdf,png}
830
- figures/fig5_relation_profiles.{pdf,png}
831
-
832
- Scripts:
833
- prepare_counterfact_multirelation.py
834
- extract_activations.py
835
- run_probing.py
836
- generate_figures.py
837
-
838
- Configuration:
839
- experiment_config.json
840
- sample_size_decision.json
841
- phase2_final_plan.md
842
- phase2_notes.txt (this file)