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63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
# Engineering Specification for Jacobian-Transported ISS

## 0. Purpose

This document specifies how to implement the official Internal State Stability metric, abbreviated as ISS, using Jacobian-transported hidden states.

The formal metric remains:

\[
z^\ell_{m,f,q}=J^\ell_m h^\ell_{m,f,q},
\]

where no vocabulary unembedding matrix is applied. The implementation may approximate \(J^\ell_m\), but the approximation must be independently validated and its numerical error must be reported.

Raw-ISS is retained only for debugging and ablation. It is not the official metric.

---

# 1. Official Definition

For model \(m\), fact \(f\), query \(q\), and source layer \(\ell\), extract the query-end residual state:

\[
h^\ell_{m,f,q}\in\mathbb R^{d_m}.
\]

Define the corpus-averaged input-output Jacobian:

\[
J^\ell_m
=
\mathbb E_{x\sim\mathcal C}
\left[
\frac{\partial h^L_m(x)}{\partial h^\ell_m(x)}
\right],
\]

where \(\mathcal C\) is an independent calibration corpus.

The transported representation is:

\[
\boxed{z^\ell_{m,f,q}=J^\ell_m h^\ell_{m,f,q}}
\]

Do **not** compute:

\[
W_UJ^\ell_m h^\ell_{m,f,q}.
\]

The official ISS therefore operates in the final-layer residual basis rather than vocabulary-logit space.

---

# 2. Formal Metric Versus Practical Estimator

The formal metric uses the exact population average \(J^\ell_m\). The practical implementation uses a finite-corpus, finite-rank estimator:

\[
\widehat J^{\ell,(n,k)}_m.
\]

The practical transported state is:

\[
\widehat z^\ell_{m,f,q}
=
\widehat J^{\ell,(n,k)}_m h^\ell_{m,f,q}.
\]

The paper should distinguish:

- \(\operatorname{ISS}\): the formal metric;
- \(\widehat{\operatorname{ISS}}_{n,k}\): the empirical estimator.

The approximation is acceptable only if it satisfies the validation criteria below.

---

# 3. Why Full Jacobians Are Not the General Solution

For hidden dimension \(d\):

\[
J^\ell_m\in\mathbb R^{d\times d}.
\]

Materializing this matrix is feasible only for small models. For large models with \(d=4096\), \(5120\), or more, exact recovery across many layers and calibration prompts is prohibitively expensive.

Therefore:

1. full Jacobians are used only for small-model calibration;
2. large models use a randomized factorized estimator;
3. approximation quality must be validated for every model rather than inferred from a small model.

---

# 4. Overall Engineering Pipeline

```text
Stage A: Full-matrix calibration on a small model
    |
    v
Stage B: Per-model approximation validation
    |
    v
Stage C: Freeze estimator settings
    |
    v
Stage D: Official ISS evaluation
```

The final test set must not be used to choose estimator hyperparameters.

---

# 5. Stage A: Small-Model Full-Matrix Calibration

Use Qwen2.5-0.5B as the primary exact-reference model.

## 5.1 Exact finite-corpus reference

For a fixed calibration corpus of \(n\) prompts, compute:

\[
J^{\ell,(n)}_{\mathrm{full}}
=
\frac{1}{n}
\sum_{i=1}^{n}J^\ell_{x_i}.
\]

This is an exact empirical Jacobian for that finite corpus.

Do not call it the exact population Jacobian or universal ground truth. Use one of the following terms:

- full empirical Jacobian reference;
- exact finite-corpus Jacobian.

## 5.2 Layer coverage

At minimum, compute full references for:

- one early layer;
- one middle layer;
- one late layer.

If feasible on Qwen2.5-0.5B, compute every layer.

## 5.3 Candidate ranks

Evaluate:

\[
k\in\{32,64,128,256,512,768\},
\]

subject to \(k<d\).

Use nested random probes so that larger ranks contain the directions used at smaller ranks.

## 5.4 Required validation statistics

### Matrix approximation error

\[
E_F(k)
=
\frac{\|J_{\mathrm{full}}-\widehat J_k\|_F}
{\|J_{\mathrm{full}}\|_F}.
\]

### Transported-vector relative error

For held-out activation vectors \(h_i\):

\[
E_{\mathrm{vec}}(k)
=
\frac{1}{M}
\sum_{i=1}^{M}
\frac{\|J_{\mathrm{full}}h_i-\widehat J_kh_i\|_2}
{\|J_{\mathrm{full}}h_i\|_2+\epsilon}.
\]

### Transported-vector cosine agreement

\[
C_{\mathrm{vec}}(k)
=
\frac{1}{M}
\sum_{i=1}^{M}
\cos(J_{\mathrm{full}}h_i,\widehat J_kh_i).
\]

### ISS absolute error

\[
E_{\mathrm{ISS}}(k)
=
\left|
\operatorname{ISS}_{\mathrm{full}}
-
\widehat{\operatorname{ISS}}_k
\right|.
\]

### Per-fact ISS rank agreement

\[
\rho_{\mathrm{fact}}(k)
=
\operatorname{Spearman}
\left(
\{\operatorname{ISS}^{\mathrm{full}}_f\},
\{\widehat{\operatorname{ISS}}^{(k)}_f\}
\right).
\]

A low Frobenius error is not sufficient. The transported vectors and the final ISS must also be stable.

---

# 6. Randomized Factorized Jacobian Estimator

The estimator must define a linear operator that can be applied to arbitrary hidden states. Computing only \(J\Omega\) is not enough.

Use randomized range finding with a two-sided operator estimate.

## 6.1 Random probe matrix

For target rank \(k\), draw:

\[
\Omega\in\mathbb R^{d\times(k+p)},
\]

where:

- \(p\) is an oversampling dimension;
- recommended \(p\in\{32,64\}\);
- \(\Omega\) uses Gaussian or Rademacher entries;
- all random seeds are fixed and recorded.

## 6.2 Estimate the Jacobian output range

Compute:

\[
Y
=
J^\ell\Omega
=
\mathbb E_x[J^\ell_x\Omega].
\]

Use batched Jacobian-vector products.

Then compute:

\[
Q=\operatorname{qr}(Y),
\]

with:

\[
Q\in\mathbb R^{d\times(k+p)}.
\]

## 6.3 Estimate the reduced operator

Compute:

\[
B=Q^\top J^\ell.
\]

Equivalently:

\[
B^\top=J^{\ell\top}Q.
\]

Use batched vector-Jacobian products.

The final estimator is:

\[
\boxed{\widehat J^\ell=QB}
\]

and:

\[
\widehat J^\ell h=Q(Bh).
\]

## 6.4 Storage

Store only:

\[
Q\in\mathbb R^{d\times r},
\qquad
B\in\mathbb R^{r\times d},
\]

where \(r=k+p\).

Do not reconstruct and store the complete \(d\times d\) matrix.

Since \(Q\) has orthonormal columns:

\[
\cos(Qy_1,Qy_2)=\cos(y_1,y_2).
\]

Therefore downstream cosine computations may use:

\[
y^\ell=Bh
\]

directly. Residualization and whitening must then be performed consistently in that reduced coordinate space.

---

# 7. Per-Model Validation Is Mandatory

A rank that works for Qwen2.5-0.5B must not be assumed to work for larger models.

Different models can have different:

- hidden dimensions;
- Jacobian singular-value decay;
- effective rank;
- depth;
- normalization;
- architecture;
- post-training behavior.

The small-model experiment validates the estimator implementation. It does not determine one universal rank.

## 7.1 Direct action validation

For every evaluated model, select representative:

- early layers;
- middle layers;
- late layers.

For held-out activation vectors \(h_i\), directly compute:

\[
u_i=J^\ell h_i
=
\frac1n\sum_{x\in\mathcal C}J^\ell_xh_i.
\]

This does not require materializing the full Jacobian.

Compare with:

\[
\widehat u_i=\widehat J^\ell_kh_i.
\]

## 7.2 Validation activation set

Use a calibration activation set independent of the final ISS test set.

Recommended:

- 64–128 activation vectors per representative layer;
- multiple prompt types if benchmark-like prompts are used;
- or a separate set of held-out natural questions.

## 7.3 Rank candidates

Use a nested grid such as:

\[
k\in\{64,128,256,512,1024\},
\]

bounded by model dimension and compute resources.

Choose the smallest \(k_{m,\ell}\) that satisfies the fixed validation criteria.

Recommended initial criteria:

\[
\operatorname{median}_i\cos(u_i,\widehat u_i)\ge0.99,
\]

\[
\operatorname{median}_i
\frac{\|u_i-\widehat u_i\|_2}
{\|u_i\|_2+\epsilon}
\le0.05,
\]

and:

\[
\left|
\widehat{\operatorname{ISS}}_{2k}
-
\widehat{\operatorname{ISS}}_k
\right|
\le0.01.
\]

The exact numeric thresholds may be adjusted after Stage A, but they must be frozen before final evaluation.

## 7.4 Model-specific rank is allowed

Different models and layers may use different ranks:

\[
k_{m,\ell}.
\]

This is methodologically acceptable because all models use the same approximation-quality standard.

Always report:

- \(k_{m,\ell}\);
- \(k_{m,\ell}/d_m\);
- validation cosine;
- validation relative error;
- rank-stability error.

---

# 8. Calibration Corpus Size

Rank error and corpus-sampling error are separate.

The empirical Jacobian is:

\[
J^{\ell,(n)}
=
\frac1n\sum_{i=1}^{n}J^\ell_{x_i}.
\]

A large \(k\) does not compensate for insufficient corpus size \(n\).

## 8.1 Corpus requirements

The Jacobian corpus must:

- be independent of the factual benchmark;
- contain general pretraining-style or natural text;
- use the same construction rule for all models;
- use a fixed sequence-length and position convention;
- record all sample IDs and random seeds.

## 8.2 Corpus-size convergence

On representative models, compare:

\[
n\in\{32,64,128,256,512\}.
\]

Measure:

\[
\cos(\widehat J^{(n)}h,\widehat J^{(2n)}h),
\]

and:

\[
\left|
\widehat{\operatorname{ISS}}_n
-
\widehat{\operatorname{ISS}}_{2n}
\right|.
\]

Select \(n\) using a fixed convergence rule. Do not select \(n\) based on preferred final benchmark conclusions.

---

# 9. Random-Seed Stability

For representative model-layer-rank settings, use at least three sketch seeds.

Report mean and standard deviation for:

- transported-vector cosine;
- transported-vector relative error;
- ISS;
- KTS if KTS uses the same transported states.

A rank is not considered stable if results vary materially across seeds.

Preferred final reporting:

- average the result across three validated seeds; or
- use one preregistered seed after proving seed variance is negligible.

Never choose the seed that gives the preferred scientific result.

---

# 10. Official ISS Computation

After freezing the estimator, compute:

\[
\widehat z^\ell_{m,f,q}
=
\widehat J^\ell_m h^\ell_{m,f,q}.
\]

Then run the standard ISS pipeline.

## 10.1 Relation and condition residualization

\[
\bar z^\ell_{m,f,q}
=
z^\ell_{m,f,q}
-
\mu^\ell_{m,r_f}
-
\mu^\ell_{m,t(q)}
+
\mu^\ell_m.
\]

## 10.2 Regularized whitening

\[
\tilde z^\ell_{m,f,q}
=
(\Sigma^\ell_m+\lambda I)^{-1/2}
\bar z^\ell_{m,f,q}.
\]

If the reduced coordinate \(y=Bh\) is used directly, estimate \(\Sigma\) in that coordinate system.

Do not fit a separate whitening transform for each condition family.

## 10.3 Family centroid

\[
v^\ell_{m,f,t}
=
\operatorname{Normalize}
\left(
\frac1{|Q_{f,t}|}
\sum_{q\in Q_{f,t}}
\tilde z^\ell_{m,f,q}
\right).
\]

## 10.4 Same-fact cross-condition similarity

\[
S^+_{m,f,\ell}
=
\frac1{|\mathcal P_f|}
\sum_{(t,t')\in\mathcal P_f}
\cos(v^\ell_{m,f,t},v^\ell_{m,f,t'}).
\]

## 10.5 Relation-matched background

\[
S^-_{m,f,\ell}
=
\mathbb E_{\substack{g\neq f,\ r_g=r_f\\t\neq t'}}
\cos(v^\ell_{m,f,t},v^\ell_{m,g,t'}).
\]

## 10.6 Official ISS estimator

\[
\boxed{
\widehat{\operatorname{ISS}}_{m,f,\ell}
=
\frac{S^+_{m,f,\ell}-S^-_{m,f,\ell}}
{1-S^-_{m,f,\ell}+\epsilon}
}
\]

Average over the preregistered layer window:

\[
\widehat{\operatorname{ISS}}_{m,f}
=
\frac1{|\mathcal W_m|}
\sum_{\ell\in\mathcal W_m}
\widehat{\operatorname{ISS}}_{m,f,\ell}.
\]

Then average over the fixed fact set:

\[
\widehat{\operatorname{ISS}}_m
=
\frac1{|\mathcal D|}
\sum_{f\in\mathcal D}
\widehat{\operatorname{ISS}}_{m,f}.
\]

---

# 11. Raw-ISS

Raw-ISS uses:

\[
z^\ell_{m,f,q}=h^\ell_{m,f,q}.
\]

It should be computed because it is inexpensive and useful for:

- debugging hidden-state extraction;
- validating family aggregation;
- validating negative sampling;
- checking whitening and residualization;
- ablation;
- testing whether Jacobian transport changes the conclusion.

However:

\[
\boxed{\text{Raw-ISS is not the official ISS result.}}
\]

Recommended table terminology:

| Metric | Representation | Role |
|---|---|---|
| Raw-ISS | \(h^\ell\) | Identity-transport ablation |
| ISS | \(\widehat J^\ell h^\ell\) | Official metric |
| Token readout | \(W_U\widehat J^\ell h^\ell\) | Not used |

---

# 12. Failure Policy

Do not silently report an unvalidated approximation.

A model-layer estimator fails validation if:

- rank convergence is not achieved;
- action-vector cosine remains below threshold;
- relative action error remains above threshold;
- ISS changes materially across ranks;
- ISS changes materially across random seeds.

## 12.1 Allowed responses

In order:

1. increase \(k\);
2. increase oversampling \(p\);
3. increase corpus size \(n\);
4. add power iterations;
5. restrict official ISS to validated layers;
6. mark the model-layer estimator as unresolved.

Raw-ISS may still be reported as an ablation, but it must not be relabeled as official ISS.

## 12.2 Optional fallback estimator

If low-rank reconstruction consistently fails, consider a geometry-preserving output sketch:

\[
RJ^\ell h,
\]

where:

\[
R\in\mathbb R^{k\times d}.
\]

This avoids assuming that \(J^\ell\) itself is low rank. However, it is a different estimator and must be separately validated against the full small-model reference.

Do not switch to this estimator silently.

---

# 13. Data Separation

Use three disjoint resources.

## 13.1 Jacobian corpus

Used to estimate \(J^\ell_m\). It must contain independent general text.

## 13.2 Estimator calibration set

Used to select:

- corpus size \(n\);
- rank \(k\);
- sketch seed;
- oversampling;
- power iterations;
- approximation thresholds.

It must not overlap with the final benchmark evaluation facts.

## 13.3 Final ISS benchmark

Used only after all estimator settings are frozen.

Do not tune \(n\), \(k\), seeds, layer windows, or whitening choices on the final benchmark.

---

# 14. Required Output Files

```text
jacobian_iss/
β”œβ”€β”€ configs/
β”‚   β”œβ”€β”€ corpus_config.yaml
β”‚   β”œβ”€β”€ estimator_config.yaml
β”‚   β”œβ”€β”€ validation_thresholds.yaml
β”‚   └── layer_windows.yaml
β”œβ”€β”€ full_reference/
β”‚   └── qwen2.5_0.5b/
β”œβ”€β”€ low_rank_factors/
β”‚   └── {model}/{layer}/
β”‚       β”œβ”€β”€ Q.pt
β”‚       β”œβ”€β”€ B.pt
β”‚       └── metadata.json
β”œβ”€β”€ validation/
β”‚   β”œβ”€β”€ small_model_full_comparison.json
β”‚   β”œβ”€β”€ per_model_action_validation.jsonl
β”‚   β”œβ”€β”€ rank_convergence.jsonl
β”‚   β”œβ”€β”€ corpus_convergence.jsonl
β”‚   └── seed_stability.jsonl
β”œβ”€β”€ transported_states/
β”œβ”€β”€ iss_per_fact_layer.jsonl
β”œβ”€β”€ iss_per_fact.jsonl
β”œβ”€β”€ iss_model_summary.json
└── raw_iss_ablation.json
```

---

# 15. Required Metadata

For every estimator, store:

```json
{
  "model": "model_name",
  "model_revision": "revision",
  "tokenizer_revision": "revision",
  "layer": 16,
  "hidden_dimension": 4096,
  "rank": 512,
  "oversampling": 64,
  "power_iterations": 0,
  "calibration_corpus_size": 256,
  "calibration_sequence_length": 128,
  "random_seed": 42,
  "validation_cosine_median": 0.993,
  "validation_relative_error_median": 0.041,
  "iss_rank_difference": 0.006,
  "validated": true
}
```

---

# 16. Minimum Required Experiments

## Experiment A: Full-reference calibration

Model:

```text
Qwen2.5-0.5B
```

Compare:

```text
full empirical Jacobian
vs.
rank 32/64/128/256/512/768 approximations
```

Report:

- Frobenius error;
- transported-vector error;
- transported-vector cosine;
- ISS absolute error;
- per-fact ISS Spearman correlation.

## Experiment B: Medium-scale transfer check

Use at least one medium-sized model.

At representative layers:

- compute high-accuracy direct \(Jh\) actions;
- validate rank behavior;
- confirm that the small-model rank does not automatically transfer.

## Experiment C: Per-model validation

For every evaluated model:

- representative early, middle, and late layers;
- 64–128 held-out activation vectors;
- nested candidate ranks;
- fixed validation thresholds;
- at least three random seeds on representative settings.

## Experiment D: Official evaluation

Only after freezing all estimator choices:

- compute transported states;
- compute official ISS;
- compute Raw-ISS;
- compare trends;
- report approximation uncertainty.

---

# 17. Recommended Decision Rule

Do not use:

```text
k = 512 for every model
```

Use:

```text
Choose the smallest k for each model-layer that satisfies
one fixed approximation-quality standard.
```

Recommended initial rule:

```text
median action cosine >= 0.99
median relative action error <= 0.05
|ISS(2k) - ISS(k)| <= 0.01
seed standard deviation of ISS <= 0.005
```

The exact thresholds may be refined after the small-model calibration, but they must be frozen before final evaluation.

---

# 18. Uncertainty Reporting

Separate the following sources of uncertainty:

1. finite Jacobian-corpus error;
2. low-rank approximation error;
3. random-sketch error;
4. benchmark sampling uncertainty;
5. relation-level heterogeneity.

At minimum, report:

- rank sensitivity;
- corpus-size sensitivity;
- random-seed sensitivity;
- per-model action validation;
- relation-clustered bootstrap confidence intervals for final ISS.

Do not present one confidence interval that silently mixes all uncertainty sources.

---

# 19. Paper-Ready Method Description

> We define Internal State Stability on Jacobian-transported residual states \(z^\ell=J^\ell h^\ell\), where \(J^\ell\) is the corpus-averaged input-output Jacobian from layer \(\ell\) to the final residual stream. We do not apply the vocabulary unembedding matrix, thereby retaining a continuous hidden representation compatible with multi-token and multilingual answers. Since explicitly materializing \(J^\ell\in\mathbb R^{d\times d}\) is prohibitive for large models, we estimate it using randomized range finding, yielding a factorized operator \(\widehat J^\ell=Q^\ell B^\ell\). We validate this approximation against full empirical Jacobians on Qwen2.5-0.5B and against directly computed Jacobian-vector products on held-out activations for every evaluated model. The sketch rank is selected independently for each model and layer using a fixed preregistered approximation-error tolerance rather than a universal rank or final benchmark performance.

Continuation:

> We separately evaluate calibration-corpus convergence, rank convergence, and random-seed stability. Raw hidden-state ISS is reported only as an identity-transport ablation.

---

# 20. Final Engineering Decisions

```text
Official ISS:
    Jacobian-transported hidden-state ISS

Transport:
    z = J h

Unembedding:
    Do not multiply by W_U

Small-model full Jacobian:
    Finite-corpus exact reference only

Large-model implementation:
    Randomized factorized operator estimate

Rank selection:
    Per model and per layer

Rank criterion:
    Shared fixed approximation-quality threshold

Validation:
    Full matrix comparison on Qwen2.5-0.5B
    Direct J h comparison on every evaluated model

Raw-ISS:
    Debugging and ablation only

Final test set:
    Never used to tune n, k, seeds, layers, or estimator settings

Failure:
    Do not report unvalidated Jacobian ISS
```

---

# 21. Immediate Implementation Order for Claude

1. Finish Raw-ISS to validate data loading and metric aggregation.
2. Implement exact finite-corpus Jacobian recovery on Qwen2.5-0.5B.
3. Implement the randomized factorized estimator \(\widehat J=QB\).
4. Compare candidate ranks against the full small-model reference.
5. Measure matrix, vector-action, ISS-value, and fact-ranking errors.
6. Freeze approximation-quality thresholds.
7. Implement direct \(Jh\) validation for large models.
8. Select \(k_{m,\ell}\) using the fixed thresholds.
9. Run corpus-size and seed-stability checks.
10. Freeze all estimator configurations.
11. Compute official ISS on the final benchmark.
12. Report Raw-ISS only as an ablation.
13. Save all factors, configurations, validation logs, and checksums.

The objective is not to recover every Jacobian entry exactly. The objective is to guarantee that the transported representations and the resulting ISS remain within a preregistered numerical tolerance.