compose-audit refresh 2026-08-26 21:04 UTC
Browse files- README.md +80 -32
- code/bgpt_ceiling.py +139 -0
- code/check_alignment_health.py +88 -0
- code/make_report.py +66 -10
- code/publish.py +35 -0
- code/run_abl.sh +10 -0
- code/run_blimp.sh +13 -0
- code/run_repair.sh +9 -0
- code/run_rev_after.sh +8 -0
- code/run_set1.sh +7 -0
- code/run_set4.sh +6 -0
- code/run_set4b.sh +11 -0
- code/set1_blimp.py +166 -0
- code/set1_repair.py +217 -0
- code/set4_goldfish_lib.py +22 -0
- code/set4_multiblimp.py +154 -0
- code/set4_reverse.py +136 -0
- results/alignment_health.json +20 -0
- results/blimp_160m.jsonl +1 -0
- results/blimp_31m.jsonl +0 -0
- results/repair_70m.jsonl +5 -0
- results/set1_160m.jsonl +2 -0
- results/set4_tokenizer_diag.json +46 -0
README.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Compose-audit: putting the alignment map and the merging payoff on the SAME real models
|
| 7 |
|
| 8 |
-
_Generated 2026-08-26
|
| 9 |
|
| 10 |
## Read this first: what substrate, and what metric
|
| 11 |
|
|
@@ -28,9 +34,9 @@ _Generated 2026-08-26 20:59 UTC · training-free · code: `/root/compose-audit`
|
|
| 28 |
|
| 29 |
## Headline findings
|
| 30 |
|
| 31 |
-
1. **Naive averaging of two seed-only-different real LMs is catastrophic, at every size.** Δfloor 14m: +32.4 · 31m: +20.4 · 70m: +20.2 · 160m: +8.8 · 410m: +6.5 nats/token against parent floors of 3–4.4 nats/token, i.e. above the uniform-over-vocabulary reference of 10.8 for all but the largest. n = 36 / 36 / 36 /
|
| 32 |
-
2. **Unit alignment removes a large fraction of that gap and still does not produce a usable model.**
|
| 33 |
-
3. **The rescue shrinks monotonically with scale** (14m:
|
| 34 |
4. **The likelihood rescue does not transfer to accuracy.** On pythia-14m (n=36), parents average 0.652 on BLiMP; the naive merge 0.518 and the aligned merge 0.544, against chance 0.500. A ~70% Δfloor rescue buys ~0.026 accuracy. Pairwise, the two rescues are uncorrelated.
|
| 35 |
5. **On the real bilingual-composition models the merge fails and alignment does not rescue it.** Goldfish eng×{nld,spa,ell,pol}: naive Δfloor on English text +0.91 nats/byte against a 0.81 floor; the best M1 rung +0.90. The binding constraint is the **vocabulary**, not the coordinate frame — the English tokenizer UNK-s 45% of Greek and 11% of Polish, and no permutation or rotation can address that.
|
| 36 |
6. **…and the accuracy dissociation runs the other way there.** The same likelihood-destroyed Goldfish merges retain 0.68 on MultiBLiMP-English (parent 0.96, chance 0.50). Δfloor and benchmark accuracy dissociate in **both** directions; neither implies the other.
|
|
@@ -82,17 +88,17 @@ Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **20.30**, permut
|
|
| 82 |
Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **20.17**, permutation-aligned **10.98** nats/token.
|
| 83 |
|
| 84 |
|
| 85 |
-
### pythia-160m —
|
| 86 |
|
| 87 |
| rung | n | mean nats/tok | mean Δfloor | median Δfloor | best Δfloor | beats naive | % of naive Δfloor removed |
|
| 88 |
|---|---|---|---|---|---|---|---|
|
| 89 |
-
| M0_naive_avg |
|
| 90 |
-
| M1_perm_avg |
|
| 91 |
-
| M1_orth_avg |
|
| 92 |
-
| M2_task_arith |
|
| 93 |
-
| M3_ties |
|
| 94 |
|
| 95 |
-
Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **8.
|
| 96 |
|
| 97 |
|
| 98 |
### pythia-410m — 3 seed pairs · mean parent floor **2.971** nats/token · uniform-over-vocabulary reference **10.826** nats/token
|
|
@@ -116,10 +122,11 @@ Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **6.38**, permuta
|
|
| 116 |
destroyed one. This is the pure-coordinate case: there is no data, architecture or tokenizer
|
| 117 |
difference left to blame.
|
| 118 |
2. **Unit alignment removes a large, highly consistent fraction of that gap** — the permutation rung
|
| 119 |
-
beats naive on essentially every pair — **and still does not produce a usable model.**
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
3. **Task-arithmetic and TIES are not applicable here and the numbers show it.** PolyPythia seeds are
|
| 124 |
independent re-initialisations: `EleutherAI/pythia-<size>` is *not* a shared ancestor, so the
|
| 125 |
"task vectors" those operators subtract are not task vectors. Their rows are reported only to
|
|
@@ -128,6 +135,42 @@ Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **6.38**, permuta
|
|
| 128 |
interior t that beats the better parent, aligned or not.
|
| 129 |
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
### The scale trend — alignment's coordinate rescue WEAKENS with model size
|
| 132 |
|
| 133 |
| substrate | n pairs | parent floor | naive Δfloor | rescue, permutation | rescue, Procrustes | rescue, best of the two | unaligned CKA | aligned CKA | weight coordinate share |
|
|
@@ -135,11 +178,15 @@ Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **6.38**, permuta
|
|
| 135 |
| pythia-14m | 36 | 4.38 | 32.43 | 69.9% | 50.5% | 72.0% | 0.588 | 0.374 | 0.0652 |
|
| 136 |
| pythia-31m | 36 | 3.94 | 20.35 | 47.7% | 46.4% | 57.4% | 0.632 | 0.380 | 0.0645 |
|
| 137 |
| pythia-70m | 36 | 3.63 | 20.16 | 43.9% | 50.4% | 55.1% | 0.671 | 0.428 | 0.0793 |
|
| 138 |
-
| pythia-160m |
|
| 139 |
| pythia-410m | 3 | 2.97 | 6.49 | 11.2% | 9.2% | 11.2% | 0.410 | 0.372 | 0.0333 |
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
*and* the share of it that alignment can remove shrinks faster. Two things are worth separating:
|
| 144 |
|
| 145 |
- The **naive** merge gets less catastrophic with scale, which on its own would be an encouraging
|
|
@@ -253,8 +300,9 @@ PolyPythia parents are English LMs, so BLiMP applies directly to SET 1's merges.
|
|
| 253 |
| substrate | n pairs | mean parent acc | better-parent ceiling | M0 naive | M1 permutation | M1 Procrustes | best rung, % of the parents' above-chance margin retained |
|
| 254 |
|---|---|---|---|---|---|---|---|
|
| 255 |
| pythia-14m | 36 | 0.652 | 0.664 | 0.518 | 0.533 | 0.530 | 28.5% |
|
| 256 |
-
| pythia-31m |
|
| 257 |
-
| pythia-70m |
|
|
|
|
| 258 |
|
| 259 |
**This is the result the audit asked for, and it is negative.** On pythia-14m the permutation
|
| 260 |
alignment removes ~70% of the naive merge's Δfloor in nats/token — and the merged model still scores
|
|
@@ -268,8 +316,8 @@ Pair by pair, does the size of the likelihood rescue predict the size of the acc
|
|
| 268 |
| substrate | n | Spearman(Δfloor rescue, BLiMP rescue) | mean Δfloor rescue (nats/tok) | mean BLiMP rescue (acc) |
|
| 269 |
|---|---|---|---|---|
|
| 270 |
| pythia-14m | 36 | 0.139 | 23.44 | 0.0257 |
|
| 271 |
-
| pythia-31m |
|
| 272 |
-
| pythia-70m |
|
| 273 |
|
| 274 |
## Did we try hard enough? · REPAIR on top of the alignment
|
| 275 |
|
|
@@ -282,11 +330,11 @@ The obvious objection to a negative merging result is that averaging is a weak m
|
|
| 282 |
| pythia-14m | 36 | M4_perm_repair | 7.88 | 7.41 | 0.527 | 16.7% |
|
| 283 |
| pythia-14m | 36 | M5_naive_repair | 32.50 | 31.10 | 0.512 | 7.2% |
|
| 284 |
| pythia-14m | 36 | **parents** | 0.00 | 0.00 | 0.664 | 100.0% |
|
| 285 |
-
| pythia-70m |
|
| 286 |
-
| pythia-70m |
|
| 287 |
-
| pythia-70m |
|
| 288 |
-
| pythia-70m |
|
| 289 |
-
| pythia-70m |
|
| 290 |
|
| 291 |
REPAIR does help the likelihood — it is the best training-free merge in this report, taking a further
|
| 292 |
bite out of the aligned merge's Δfloor (on pythia-14m, 9.61 → 7.88 nats/token, a further 18%). **And
|
|
@@ -640,7 +688,7 @@ SET 1's main grid uses `pythia-<size>-seed{n}`, which reseeds **both** the initi
|
|
| 640 |
|---|---|---|---|---|---|---|---|
|
| 641 |
| 160m-data | 3 | 3.27 | 3.13 | 3.00 | 3.00 | 3.9% | 0.0139 |
|
| 642 |
| 160m-weight | 3 | 3.25 | 3.10 | 2.79 | 2.79 | 10.0% | 0.0123 |
|
| 643 |
-
| 160m (init+data, main grid) |
|
| 644 |
|
| 645 |
Reading: models that differ **only in data order** start far closer together — the naive merge's
|
| 646 |
Δfloor is a small fraction of the reseeded-init case — and alignment does **nothing** for them,
|
|
@@ -658,12 +706,12 @@ init-plus-data-order number, not an init-only one.
|
|
| 658 |
| SET 1 Δfloor · pythia-14m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 659 |
| SET 1 Δfloor · pythia-31m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 660 |
| SET 1 Δfloor · pythia-70m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 661 |
-
| SET 1 Δfloor · pythia-160m |
|
| 662 |
| SET 1 Δfloor · pythia-410m | 3/15 seed pairs | partial | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 663 |
| SET 1 control · pythia-160m-data | 3/3 pairs | complete | init-seed-only vs data-order-only, same rungs |
|
| 664 |
| SET 1 control · pythia-160m-weight | 3/3 pairs | complete | init-seed-only vs data-order-only, same rungs |
|
| 665 |
-
| SET 1 accuracy · BLiMP | pythia-14m: 36/36, pythia-31m:
|
| 666 |
-
| SET 1 · REPAIR rung | pythia-14m: 36/36, pythia-70m:
|
| 667 |
| SET 4 Δfloor · English-anchored | 4/4 language pairs (nld_Latn, spa_Latn, ell_Grek, pol_Latn) | complete | M0 naive · M1a vocab-transport · M1b/c vocab+unit-aligned · M1d/e forced-residual · M1f units-only · M1g/h embedding-row Procrustes |
|
| 668 |
| SET 4 Δfloor · partner-anchored (reverse) | 4/4 language pairs | complete | same rungs, roles swapped |
|
| 669 |
| SET 4 accuracy · MultiBLiMP 1.0 | 4/4 language pairs | RAN | `jumelet/multiblimp`, English + partner, on the SAME merges; UNK rate reported per cell |
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- model-merging
|
| 5 |
+
- alignment
|
| 6 |
+
- polypythia
|
| 7 |
+
- goldfish
|
| 8 |
+
- multilingual
|
| 9 |
+
- blimp
|
| 10 |
---
|
| 11 |
|
| 12 |
# Compose-audit: putting the alignment map and the merging payoff on the SAME real models
|
| 13 |
|
| 14 |
+
_Generated 2026-08-26 21:04 UTC · training-free · code: `/root/compose-audit` · operators/aligners/metrics imported unmodified from `mergeschool.core` (`/root/mergeability`, treated as read-only)._
|
| 15 |
|
| 16 |
## Read this first: what substrate, and what metric
|
| 17 |
|
|
|
|
| 34 |
|
| 35 |
## Headline findings
|
| 36 |
|
| 37 |
+
1. **Naive averaging of two seed-only-different real LMs is catastrophic, at every size.** Δfloor 14m: +32.4 · 31m: +20.4 · 70m: +20.2 · 160m: +8.8 · 410m: +6.5 nats/token against parent floors of 3–4.4 nats/token, i.e. above the uniform-over-vocabulary reference of 10.8 for all but the largest. n = 36 / 36 / 36 / 30 / 3 pairs.
|
| 38 |
+
2. **Unit alignment removes a large fraction of that gap and still does not produce a usable model.** The exactly function-preserving permutation rung removes 14m: 70% · 31m: 48% · 70m: 44% · 160m: 23% · 410m: 11% — leaving 9.6 · 9.6 · 11.0 · 6.7 · 5.7 nats/token above the better parent, i.e. an absolute 14.0 · 13.5 · 14.6 · 10.0 · 8.7 nats/token against parent floors of 3.0–4.4 and a uniform-over-vocabulary reference of 10.8. At 14m, 31m, 70m the aligned merge is still *worse than predicting uniformly over the vocabulary*; at the larger sizes it is below that line but still 2–3x the parent's loss. (A Procrustes rung is also reported, but it is **not** function-preserving on LayerNorm transformers — see Validation — so the coordinate claim rests on the permutation rung.)
|
| 39 |
+
3. **The rescue shrinks monotonically with scale** (14m: 70% → 410m: 11% on the exact rung) while the naive gap shrinks too — so the coordinate-removable share of the obstruction is falling in exactly the direction the field is scaling. (Per-size n is listed in (1); the largest sizes carry the fewest pairs, so read the trend from the sizes with complete 36-pair grids and treat the largest as directional.)
|
| 40 |
4. **The likelihood rescue does not transfer to accuracy.** On pythia-14m (n=36), parents average 0.652 on BLiMP; the naive merge 0.518 and the aligned merge 0.544, against chance 0.500. A ~70% Δfloor rescue buys ~0.026 accuracy. Pairwise, the two rescues are uncorrelated.
|
| 41 |
5. **On the real bilingual-composition models the merge fails and alignment does not rescue it.** Goldfish eng×{nld,spa,ell,pol}: naive Δfloor on English text +0.91 nats/byte against a 0.81 floor; the best M1 rung +0.90. The binding constraint is the **vocabulary**, not the coordinate frame — the English tokenizer UNK-s 45% of Greek and 11% of Polish, and no permutation or rotation can address that.
|
| 42 |
6. **…and the accuracy dissociation runs the other way there.** The same likelihood-destroyed Goldfish merges retain 0.68 on MultiBLiMP-English (parent 0.96, chance 0.50). Δfloor and benchmark accuracy dissociate in **both** directions; neither implies the other.
|
|
|
|
| 88 |
Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **20.17**, permutation-aligned **10.98** nats/token.
|
| 89 |
|
| 90 |
|
| 91 |
+
### pythia-160m — 30 seed pairs · mean parent floor **3.254** nats/token · uniform-over-vocabulary reference **10.826** nats/token
|
| 92 |
|
| 93 |
| rung | n | mean nats/tok | mean Δfloor | median Δfloor | best Δfloor | beats naive | % of naive Δfloor removed |
|
| 94 |
|---|---|---|---|---|---|---|---|
|
| 95 |
+
| M0_naive_avg | 30 | 12.10 | 8.84 | 8.38 | 6.88 | 0/30 | 0.0% |
|
| 96 |
+
| M1_perm_avg | 30 | 9.96 | 6.70 | 6.38 | 5.50 | 27/30 | 22.8% |
|
| 97 |
+
| M1_orth_avg | 30 | 9.42 | 6.16 | 6.14 | 5.13 | 30/30 | 29.4% |
|
| 98 |
+
| M2_task_arith | 30 | 30.31 | 27.05 | 26.97 | 17.88 | 0/30 | -205.1% |
|
| 99 |
+
| M3_ties | 30 | 60.28 | 57.03 | 57.47 | 49.30 | 0/30 | -555.5% |
|
| 100 |
|
| 101 |
+
Linear-mode-connectivity barrier (`eval.merge_barrier`): naive **8.83**, permutation-aligned **6.70** nats/token.
|
| 102 |
|
| 103 |
|
| 104 |
### pythia-410m — 3 seed pairs · mean parent floor **2.971** nats/token · uniform-over-vocabulary reference **10.826** nats/token
|
|
|
|
| 122 |
destroyed one. This is the pure-coordinate case: there is no data, architecture or tokenizer
|
| 123 |
difference left to blame.
|
| 124 |
2. **Unit alignment removes a large, highly consistent fraction of that gap** — the permutation rung
|
| 125 |
+
beats naive on essentially every pair — **and still does not produce a usable model.** At 14m/31m/70m
|
| 126 |
+
the aligned merge is still *worse than predicting uniformly over the vocabulary*; at 160m/410m it
|
| 127 |
+
drops below that line but still sits at 2–3× the better parent's loss. So on real LMs at this
|
| 128 |
+
scale, alignment *predicts and reduces* the obstruction without *enabling* the merge. Reporting
|
| 129 |
+
the reduction as "merging works once you align" would be wrong.
|
| 130 |
3. **Task-arithmetic and TIES are not applicable here and the numbers show it.** PolyPythia seeds are
|
| 131 |
independent re-initialisations: `EleutherAI/pythia-<size>` is *not* a shared ancestor, so the
|
| 132 |
"task vectors" those operators subtract are not task vectors. Their rows are reported only to
|
|
|
|
| 135 |
interior t that beats the better parent, aligned or not.
|
| 136 |
|
| 137 |
|
| 138 |
+
### Validation: is the alignment actually function-preserving? (One rung is not.)
|
| 139 |
+
|
| 140 |
+
Every M1 rung is only an *alignment* if `g.θ_B` computes exactly what `θ_B` computes. This was checked
|
| 141 |
+
empirically rather than assumed: take a parent, apply the map, and re-evaluate.
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
| substrate | map | change in the parent's nats/token | verdict |
|
| 145 |
+
|---|---|---|---|
|
| 146 |
+
| set1_pythia14m | permutation_residual+mlp | +3.026e-06 | EXACT |
|
| 147 |
+
| set1_pythia14m | permutation_full(+heads) | +5.893e-06 | EXACT |
|
| 148 |
+
| set1_pythia14m | orthogonal_residual+mlp | +27.262 | **NOT function-preserving** |
|
| 149 |
+
| set4_goldfish_nld | perm_residual_only | +0.000e+00 | EXACT |
|
| 150 |
+
| set4_goldfish_nld | mlp_only | +0.000e+00 | EXACT |
|
| 151 |
+
| set4_goldfish_nld | heads_only | +0.000e+00 | EXACT |
|
| 152 |
+
| set4_goldfish_nld | perm_full | +0.000e+00 | EXACT |
|
| 153 |
+
| set4_goldfish_nld | orth_full | +0.069 | negligible |
|
| 154 |
+
|
| 155 |
+
**The permutation family is exact** — residual basis, free MLP hidden axis and attention heads, on
|
| 156 |
+
both architectures, to float32 noise. Those rungs are genuine alignments.
|
| 157 |
+
|
| 158 |
+
**The orthogonal/Procrustes residual map is not**, and on GPTNeoX it is badly not: applying it to a
|
| 159 |
+
PolyPythia parent costs that parent **+27 nats/token on its own**. The reason is structural rather
|
| 160 |
+
than a bug — LayerNorm subtracts the mean over the residual axis and applies a learned elementwise
|
| 161 |
+
gain, and neither commutes with a general rotation (an RMSNorm model would be much closer to safe).
|
| 162 |
+
On the GPT-2 Goldfish models the same map costs only +0.07 nats/token, so the defect is
|
| 163 |
+
architecture-specific in magnitude.
|
| 164 |
+
|
| 165 |
+
**Consequence for the tables.** The `M1_orth` / `M1c` / `M1e` rows are still *real measurements of a
|
| 166 |
+
merged model's loss* — a merge is a merge, and the number is what it is — but they must **not** be
|
| 167 |
+
read as "how much of the obstruction is coordinate". On SET 1 they merge parent A with a *damaged*
|
| 168 |
+
copy of parent B, and any apparent rescue is partly the arithmetic of averaging toward one parent.
|
| 169 |
+
The coordinate claim in this report rests on the **permutation** rung, which is exact. Where the two
|
| 170 |
+
disagree, believe the permutation rung. This is flagged again at every table that contains an
|
| 171 |
+
orthogonal row.
|
| 172 |
+
|
| 173 |
+
|
| 174 |
### The scale trend — alignment's coordinate rescue WEAKENS with model size
|
| 175 |
|
| 176 |
| substrate | n pairs | parent floor | naive Δfloor | rescue, permutation | rescue, Procrustes | rescue, best of the two | unaligned CKA | aligned CKA | weight coordinate share |
|
|
|
|
| 178 |
| pythia-14m | 36 | 4.38 | 32.43 | 69.9% | 50.5% | 72.0% | 0.588 | 0.374 | 0.0652 |
|
| 179 |
| pythia-31m | 36 | 3.94 | 20.35 | 47.7% | 46.4% | 57.4% | 0.632 | 0.380 | 0.0645 |
|
| 180 |
| pythia-70m | 36 | 3.63 | 20.16 | 43.9% | 50.4% | 55.1% | 0.671 | 0.428 | 0.0793 |
|
| 181 |
+
| pythia-160m | 30 | 3.25 | 8.84 | 22.8% | 29.4% | 31.2% | 0.739 | 0.746 | 0.0871 |
|
| 182 |
| pythia-410m | 3 | 2.97 | 6.49 | 11.2% | 9.2% | 11.2% | 0.410 | 0.372 | 0.0333 |
|
| 183 |
|
| 184 |
+
Read the **permutation** column: it is the one that is exactly function-preserving (see Validation
|
| 185 |
+
above). The Procrustes column is shown for completeness but on GPTNeoX that map damages the model it
|
| 186 |
+
is applied to, so its "rescue" is not a clean coordinate measurement.
|
| 187 |
+
|
| 188 |
+
The coordinator flagged this trend from the first two pairs and asked whether it survives the full
|
| 189 |
+
grid. **It does, monotonically, across every size we ran, on the exact rung alone.** The naive merge's Δfloor shrinks with scale
|
| 190 |
*and* the share of it that alignment can remove shrinks faster. Two things are worth separating:
|
| 191 |
|
| 192 |
- The **naive** merge gets less catastrophic with scale, which on its own would be an encouraging
|
|
|
|
| 300 |
| substrate | n pairs | mean parent acc | better-parent ceiling | M0 naive | M1 permutation | M1 Procrustes | best rung, % of the parents' above-chance margin retained |
|
| 301 |
|---|---|---|---|---|---|---|---|
|
| 302 |
| pythia-14m | 36 | 0.652 | 0.664 | 0.518 | 0.533 | 0.530 | 28.5% |
|
| 303 |
+
| pythia-31m | 30 | 0.690 | 0.697 | 0.523 | 0.532 | 0.534 | 24.3% |
|
| 304 |
+
| pythia-70m | 36 | 0.717 | 0.722 | 0.516 | 0.541 | 0.542 | 24.4% |
|
| 305 |
+
| pythia-160m | 1 | 0.774 | 0.780 | 0.562 | 0.545 | 0.556 | 22.1% |
|
| 306 |
|
| 307 |
**This is the result the audit asked for, and it is negative.** On pythia-14m the permutation
|
| 308 |
alignment removes ~70% of the naive merge's Δfloor in nats/token — and the merged model still scores
|
|
|
|
| 316 |
| substrate | n | Spearman(Δfloor rescue, BLiMP rescue) | mean Δfloor rescue (nats/tok) | mean BLiMP rescue (acc) |
|
| 317 |
|---|---|---|---|---|
|
| 318 |
| pythia-14m | 36 | 0.139 | 23.44 | 0.0257 |
|
| 319 |
+
| pythia-31m | 30 | -0.141 | 12.58 | 0.0213 |
|
| 320 |
+
| pythia-70m | 36 | 0.169 | 11.43 | 0.0361 |
|
| 321 |
|
| 322 |
## Did we try hard enough? · REPAIR on top of the alignment
|
| 323 |
|
|
|
|
| 330 |
| pythia-14m | 36 | M4_perm_repair | 7.88 | 7.41 | 0.527 | 16.7% |
|
| 331 |
| pythia-14m | 36 | M5_naive_repair | 32.50 | 31.10 | 0.512 | 7.2% |
|
| 332 |
| pythia-14m | 36 | **parents** | 0.00 | 0.00 | 0.664 | 100.0% |
|
| 333 |
+
| pythia-70m | 10 | M0_naive_avg | 18.33 | 17.75 | 0.523 | 10.3% |
|
| 334 |
+
| pythia-70m | 10 | M1_perm_avg | 16.91 | 16.26 | 0.541 | 17.9% |
|
| 335 |
+
| pythia-70m | 10 | M4_perm_repair | 16.88 | 17.01 | 0.535 | 15.6% |
|
| 336 |
+
| pythia-70m | 10 | M5_naive_repair | 18.29 | 18.49 | 0.516 | 7.1% |
|
| 337 |
+
| pythia-70m | 10 | **parents** | 0.00 | 0.00 | 0.727 | 100.0% |
|
| 338 |
|
| 339 |
REPAIR does help the likelihood — it is the best training-free merge in this report, taking a further
|
| 340 |
bite out of the aligned merge's Δfloor (on pythia-14m, 9.61 → 7.88 nats/token, a further 18%). **And
|
|
|
|
| 688 |
|---|---|---|---|---|---|---|---|
|
| 689 |
| 160m-data | 3 | 3.27 | 3.13 | 3.00 | 3.00 | 3.9% | 0.0139 |
|
| 690 |
| 160m-weight | 3 | 3.25 | 3.10 | 2.79 | 2.79 | 10.0% | 0.0123 |
|
| 691 |
+
| 160m (init+data, main grid) | 30 | 3.25 | 8.84 | 6.70 | 6.16 | 31.2% | 0.0871 |
|
| 692 |
|
| 693 |
Reading: models that differ **only in data order** start far closer together — the naive merge's
|
| 694 |
Δfloor is a small fraction of the reseeded-init case — and alignment does **nothing** for them,
|
|
|
|
| 706 |
| SET 1 Δfloor · pythia-14m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 707 |
| SET 1 Δfloor · pythia-31m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 708 |
| SET 1 Δfloor · pythia-70m | 36/36 seed pairs | complete | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 709 |
+
| SET 1 Δfloor · pythia-160m | 30/36 seed pairs | partial | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 710 |
| SET 1 Δfloor · pythia-410m | 3/15 seed pairs | partial | M0 naive · M1 permutation · M1 Procrustes · M2 task-arithmetic · M3 TIES; LMC barrier for M0 and M1-perm |
|
| 711 |
| SET 1 control · pythia-160m-data | 3/3 pairs | complete | init-seed-only vs data-order-only, same rungs |
|
| 712 |
| SET 1 control · pythia-160m-weight | 3/3 pairs | complete | init-seed-only vs data-order-only, same rungs |
|
| 713 |
+
| SET 1 accuracy · BLiMP | pythia-14m: 36/36, pythia-31m: 30/36, pythia-70m: 36/36, pythia-160m: 1/36 | RAN | 67 paradigms from `nyu-mll/blimp`, minimal-pair sentence-logprob scoring, on the SAME merges |
|
| 714 |
+
| SET 1 · REPAIR rung | pythia-14m: 36/36, pythia-70m: 10/36 | RAN | M4 = permutation-aligned average + pre-activation statistics repair; M5 = naive + repair; Δfloor and BLiMP on the same merges |
|
| 715 |
| SET 4 Δfloor · English-anchored | 4/4 language pairs (nld_Latn, spa_Latn, ell_Grek, pol_Latn) | complete | M0 naive · M1a vocab-transport · M1b/c vocab+unit-aligned · M1d/e forced-residual · M1f units-only · M1g/h embedding-row Procrustes |
|
| 716 |
| SET 4 Δfloor · partner-anchored (reverse) | 4/4 language pairs | complete | same rungs, roles swapped |
|
| 717 |
| SET 4 accuracy · MultiBLiMP 1.0 | 4/4 language pairs | RAN | `jumelet/multiblimp`, English + partner, on the SAME merges; UNK rate reported per cell |
|
code/bgpt_ceiling.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""What would SUCCESS look like? The jointly-trained bilingual ceiling.
|
| 2 |
+
|
| 3 |
+
SET 4 shows that merging two monolingual Goldfish models produces a model that is destroyed by
|
| 4 |
+
likelihood and badly degraded by accuracy. That is only interpretable against what a bilingual model
|
| 5 |
+
of the same budget actually achieves. B-GPT (Arnett et al.) trains English+X jointly with a single
|
| 6 |
+
shared tokenizer — the target the composition literature is trying to reach without joint training.
|
| 7 |
+
|
| 8 |
+
Reports the same two metrics on the same two corpora: nats per UTF-8 byte on FLORES-200 devtest, and
|
| 9 |
+
MultiBLiMP 1.0 accuracy."""
|
| 10 |
+
import os, sys, json, time, csv, argparse
|
| 11 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 12 |
+
from common import *
|
| 13 |
+
from mergeschool.core.models import load_hf
|
| 14 |
+
from huggingface_hub import hf_hub_download
|
| 15 |
+
|
| 16 |
+
ap = argparse.ArgumentParser()
|
| 17 |
+
ap.add_argument("--pairs", default="nld_Latn:nl:nld,spa_Latn:es:spa,ell_Grek:el:ell,pol_Latn:pl:pol")
|
| 18 |
+
ap.add_argument("--variant", default="simultaneous")
|
| 19 |
+
ap.add_argument("--n_sent", type=int, default=500)
|
| 20 |
+
ap.add_argument("--max_items", type=int, default=1200)
|
| 21 |
+
ap.add_argument("--bs", type=int, default=8)
|
| 22 |
+
A = ap.parse_args()
|
| 23 |
+
OUT = "/root/compose-audit/results/bgpt_ceiling.jsonl"
|
| 24 |
+
DEV = "cuda"
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def log(*a): print(f"[{time.strftime('%H:%M:%S')}]", *a, flush=True)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def build_blocks(tok, text, block=128, max_blocks=200):
|
| 31 |
+
ids = tok(text)["input_ids"]
|
| 32 |
+
n = max(1, min(max_blocks, len(ids) // block))
|
| 33 |
+
arr = torch.from_numpy(np.asarray(ids[: n * block], dtype=np.int64).reshape(n, block))
|
| 34 |
+
nb = sum(len(tok.decode(list(arr[i, 1:].numpy())).encode("utf-8")) for i in range(n))
|
| 35 |
+
return arr, nb
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
@torch.no_grad()
|
| 39 |
+
def nll_total(model, blocks, dev, bs=8):
|
| 40 |
+
tot, ntok = 0.0, 0
|
| 41 |
+
for i in range(0, blocks.shape[0], bs):
|
| 42 |
+
x = blocks[i:i + bs].to(dev)
|
| 43 |
+
lp = torch.log_softmax(model(x).logits.float()[:, :-1], -1)
|
| 44 |
+
tgt = x[:, 1:]
|
| 45 |
+
tot += (-lp.gather(-1, tgt.unsqueeze(-1)).squeeze(-1)).sum().item(); ntok += tgt.numel()
|
| 46 |
+
return tot, ntok
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def mb_pairs(lang, n):
|
| 50 |
+
p = hf_hub_download("jumelet/multiblimp", f"{lang}/data.tsv", repo_type="dataset")
|
| 51 |
+
rows = list(csv.DictReader(open(p, encoding="utf-8"), delimiter="\t"))[:n]
|
| 52 |
+
return [(r["sen"], r["wrong_sen"]) for r in rows if r.get("sen") and r.get("wrong_sen")]
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
@torch.no_grad()
|
| 56 |
+
def mb_acc(model, tok, pairs, dev, bs=48, maxlen=64):
|
| 57 |
+
def sc(sents):
|
| 58 |
+
e = tok(sents, return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 59 |
+
ids, am = e["input_ids"], e["attention_mask"]
|
| 60 |
+
o = []
|
| 61 |
+
for i in range(0, ids.shape[0], bs):
|
| 62 |
+
x, m = ids[i:i + bs].to(dev), am[i:i + bs].to(dev)
|
| 63 |
+
lp = torch.log_softmax(model(x, attention_mask=m).logits.float()[:, :-1], -1)
|
| 64 |
+
o.append((lp.gather(-1, x[:, 1:].unsqueeze(-1)).squeeze(-1) * m[:, 1:].float()).sum(1).cpu())
|
| 65 |
+
return torch.cat(o).numpy()
|
| 66 |
+
sg, sb = sc([g for g, _ in pairs]), sc([b for _, b in pairs])
|
| 67 |
+
unk = 0.0
|
| 68 |
+
if tok.unk_token_id is not None:
|
| 69 |
+
e = tok([g for g, _ in pairs], return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 70 |
+
unk = float(((e["input_ids"] == tok.unk_token_id) & e["attention_mask"].bool()).sum().item()
|
| 71 |
+
/ max(1, e["attention_mask"].sum().item()))
|
| 72 |
+
return float((sg > sb).mean()), unk
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
eng_text = "\n".join(flores_lines("eng_Latn")[: A.n_sent])
|
| 76 |
+
MB_ENG = mb_pairs("eng", A.max_items)
|
| 77 |
+
BLOCK = 128 # B-GPT's n_positions. Every model in this table is scored at the SAME
|
| 78 |
+
# context length so the nats/byte numbers are comparable.
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def eval_model(m, tok, x_text, mbx):
|
| 82 |
+
be, nbe = build_blocks(tok, eng_text, BLOCK); bx, nbx = build_blocks(tok, x_text, BLOCK)
|
| 83 |
+
te, _ = nll_total(m, be, DEV, bs=A.bs); tx, _ = nll_total(m, bx, DEV, bs=A.bs)
|
| 84 |
+
ae, ue = mb_acc(m, tok, MB_ENG, DEV)
|
| 85 |
+
ax, ux = mb_acc(m, tok, mbx, DEV)
|
| 86 |
+
return {"nats_per_byte_eng": te / nbe, "nats_per_byte_x": tx / nbx,
|
| 87 |
+
"multiblimp_eng": ae, "multiblimp_x": ax, "unk_rate_eng": ue, "unk_rate_x": ux}
|
| 88 |
+
|
| 89 |
+
done = set()
|
| 90 |
+
if os.path.exists(OUT):
|
| 91 |
+
for l in open(OUT):
|
| 92 |
+
try: done.add(json.loads(l)["lang"])
|
| 93 |
+
except Exception: pass
|
| 94 |
+
fh = open(OUT, "a")
|
| 95 |
+
|
| 96 |
+
for spec in A.pairs.split(","):
|
| 97 |
+
fcode, x2, mb = spec.split(":")
|
| 98 |
+
if fcode in done: continue
|
| 99 |
+
repo = f"catherinearnett/B-GPT_en_{x2}_{A.variant}"
|
| 100 |
+
try:
|
| 101 |
+
m, tok = load_hf(repo, dtype=torch.float32, device=DEV); m.eval()
|
| 102 |
+
except Exception as e:
|
| 103 |
+
log("FAILED to load", repo, type(e).__name__, str(e)[:200]); continue
|
| 104 |
+
x_text = "\n".join(flores_lines(fcode)[: A.n_sent])
|
| 105 |
+
MBX = mb_pairs(mb, A.max_items)
|
| 106 |
+
arms = {"bgpt_joint_bilingual": eval_model(m, tok, x_text, MBX)}
|
| 107 |
+
log(f" B-GPT joint: {arms['bgpt_joint_bilingual']}")
|
| 108 |
+
del m; torch.cuda.empty_cache()
|
| 109 |
+
|
| 110 |
+
# --- the same table for the Goldfish parents and their merges, at the SAME 128-token context
|
| 111 |
+
gcode = {"nld_Latn": "nld_latn", "spa_Latn": "spa_latn", "ell_Grek": "ell_grek", "pol_Latn": "pol_latn"}[fcode]
|
| 112 |
+
m_e, tok_e = load_hf("goldfish-models/eng_latn_1000mb", dtype=torch.float32, device=DEV); m_e.eval()
|
| 113 |
+
SD_E = sd_np(m_e)
|
| 114 |
+
arms["goldfish_eng_parent"] = eval_model(m_e, tok_e, x_text, MBX)
|
| 115 |
+
m_x, tok_x = load_hf(f"goldfish-models/{gcode}_1000mb", dtype=torch.float32, device=DEV); m_x.eval()
|
| 116 |
+
SD_X = sd_np(m_x)
|
| 117 |
+
arms["goldfish_partner_parent"] = eval_model(m_x, tok_x, x_text, MBX)
|
| 118 |
+
del m_x; torch.cuda.empty_cache()
|
| 119 |
+
V = int(m_e.config.vocab_size)
|
| 120 |
+
vkeys = [k for k in SD_X if k.endswith("wte.weight") or k.endswith("lm_head.weight")]
|
| 121 |
+
SD_X_V, _cov = AL.remap_vocab_rows(SD_X, tok_e, tok_x, V, keys=vkeys)
|
| 122 |
+
for k in vkeys:
|
| 123 |
+
W = np.asarray(SD_X_V[k], float)
|
| 124 |
+
if W.shape[0] == V:
|
| 125 |
+
bad = ~np.isfinite(W).all(axis=1); W[bad] = np.asarray(SD_E[k], float)[bad]
|
| 126 |
+
SD_X_V[k] = W
|
| 127 |
+
for nm, sd in (("merge_M0_naive", MG.average([SD_E, SD_X])),
|
| 128 |
+
("merge_M1a_vocab", MG.average([SD_E, SD_X_V]))):
|
| 129 |
+
sd_load(m_e, sd, DEV)
|
| 130 |
+
arms[nm] = eval_model(m_e, tok_e, x_text, MBX)
|
| 131 |
+
log(f" {nm}: {arms[nm]}")
|
| 132 |
+
del m_e; torch.cuda.empty_cache()
|
| 133 |
+
|
| 134 |
+
r = {"set": "bgpt_ceiling", "lang": fcode, "repo": repo, "variant": A.variant,
|
| 135 |
+
"context_tokens": BLOCK, "n_items_eng": len(MB_ENG), "n_items_x": len(MBX),
|
| 136 |
+
"arms": arms}
|
| 137 |
+
fh.write(json.dumps(r) + "\n"); fh.flush()
|
| 138 |
+
fh.close()
|
| 139 |
+
log("DONE bgpt")
|
code/check_alignment_health.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Sanity: is the alignment actually FUNCTION-PRESERVING?
|
| 2 |
+
|
| 3 |
+
Every M1 rung is only meaningful if g.th_B computes exactly what th_B computes. A permutation of the
|
| 4 |
+
residual basis, of the free MLP hidden axis and of the attention heads is exact in theory; a bug in
|
| 5 |
+
applying it produces a plausible-looking state dict whose merges are quietly garbage. This checks it
|
| 6 |
+
empirically on both substrates: evaluate the parent, then evaluate the aligned parent, and compare.
|
| 7 |
+
An orthogonal map is NOT expected to be exact (it does not commute with the elementwise LayerNorm
|
| 8 |
+
gain), so its drift is reported as a magnitude, not as a pass/fail."""
|
| 9 |
+
import sys, json, glob
|
| 10 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 11 |
+
from common import *
|
| 12 |
+
import gpt2_align as G2
|
| 13 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 14 |
+
from mergeschool.core.models import load_hf
|
| 15 |
+
from set4_goldfish_lib import sent_acts
|
| 16 |
+
|
| 17 |
+
DEV = "cuda"
|
| 18 |
+
out = {}
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def neox_head_match(sd_a, sd_b, d, nh, nl):
|
| 22 |
+
hd, perms = d // nh, {}
|
| 23 |
+
for L in range(nl):
|
| 24 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 25 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 26 |
+
if qk not in sd_a: continue
|
| 27 |
+
Aq = np.asarray(sd_a[qk], float).reshape(nh, 3 * hd, d)
|
| 28 |
+
Bq = np.asarray(sd_b[qk], float).reshape(nh, 3 * hd, d)
|
| 29 |
+
Ad = np.asarray(sd_a[de], float).reshape(d, nh, hd)
|
| 30 |
+
Bd = np.asarray(sd_b[de], float).reshape(d, nh, hd)
|
| 31 |
+
perms[L] = AL._assignment(np.einsum("ixy,jxy->ij", Aq, Bq) + np.einsum("xiy,xjy->ij", Ad, Bd))
|
| 32 |
+
return perms
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def neox_apply_head(sd, perms, d, nh):
|
| 36 |
+
hd, o = d // nh, dict(sd)
|
| 37 |
+
for L, h in perms.items():
|
| 38 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 39 |
+
qb = f"gpt_neox.layers.{L}.attention.query_key_value.bias"
|
| 40 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 41 |
+
o[qk] = np.asarray(sd[qk], float).reshape(nh, 3 * hd, d)[h].reshape(3 * d, d)
|
| 42 |
+
if qb in sd: o[qb] = np.asarray(sd[qb], float).reshape(nh, 3 * hd)[h].reshape(3 * d)
|
| 43 |
+
o[de] = np.asarray(sd[de], float).reshape(d, nh, hd)[:, h].reshape(d, d)
|
| 44 |
+
return o
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# ---------------- SET 1 / GPTNeoX
|
| 48 |
+
tok = AutoTokenizer.from_pretrained("EleutherAI/pythia-14m")
|
| 49 |
+
blocks = make_blocks(tok, flores_lines("eng_Latn"), block=512, max_blocks=24)
|
| 50 |
+
ma = AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-14m-seed1", dtype=torch.float32).to(DEV).eval()
|
| 51 |
+
mb = AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-14m-seed2", dtype=torch.float32).to(DEV).eval()
|
| 52 |
+
D, NH, NL = ma.config.hidden_size, ma.config.num_attention_heads, ma.config.num_hidden_layers
|
| 53 |
+
sa, sb = sd_np(ma), sd_np(mb)
|
| 54 |
+
aa, ab = capture_acts(ma, blocks, DEV), capture_acts(mb, blocks, DEV)
|
| 55 |
+
base = nll_nats(mb, blocks, DEV, bs=16)
|
| 56 |
+
res = {}
|
| 57 |
+
for method in ("permutation", "orthogonal"):
|
| 58 |
+
sd, info = AL.align_weights_full(sa, sb, D, acts_a=aa, acts_b=ab, n_heads=None,
|
| 59 |
+
method=method, strict=True, accept_each=False)
|
| 60 |
+
sd_load(mb, sd, DEV); res[f"{method}_residual+mlp"] = nll_nats(mb, blocks, DEV, bs=16) - base
|
| 61 |
+
if method == "permutation":
|
| 62 |
+
hp = neox_head_match(sa, sd, D, NH, NL)
|
| 63 |
+
sd2 = neox_apply_head(sd, hp, D, NH)
|
| 64 |
+
sd_load(mb, sd2, DEV); res["permutation_full(+heads)"] = nll_nats(mb, blocks, DEV, bs=16) - base
|
| 65 |
+
sd_load(mb, sb, DEV)
|
| 66 |
+
out["set1_pythia14m"] = {"parent_nll": base, "nll_change_after_alignment": res}
|
| 67 |
+
print("SET1", json.dumps(out["set1_pythia14m"], indent=1))
|
| 68 |
+
del ma, mb; torch.cuda.empty_cache()
|
| 69 |
+
|
| 70 |
+
# ---------------- SET 4 / GPT-2 (Conv1D)
|
| 71 |
+
m_e, tok_e = load_hf("goldfish-models/eng_latn_1000mb", dtype=torch.float32, device=DEV); m_e.eval()
|
| 72 |
+
m_x, tok_x = load_hf("goldfish-models/nld_latn_1000mb", dtype=torch.float32, device=DEV); m_x.eval()
|
| 73 |
+
D2, NH2 = m_e.config.n_embd, m_e.config.n_head
|
| 74 |
+
lines_e = flores_lines("eng_Latn")[:300]; lines_x = flores_lines("nld_Latn")[:300]
|
| 75 |
+
ae = sent_acts(m_e, tok_e, lines_e, DEV); ax = sent_acts(m_x, tok_x, lines_x, DEV)
|
| 76 |
+
sde, sdx = sd_np(m_e), sd_np(m_x)
|
| 77 |
+
bl = make_blocks(tok_x, lines_x, block=512, max_blocks=16)
|
| 78 |
+
b0 = nll_nats(m_x, bl, DEV, bs=8)
|
| 79 |
+
res2 = {}
|
| 80 |
+
for tag, sd in (("perm_residual_only", G2.apply_resid(sdx, D2, perm=AL.residual_basis_map(ae, ax, "permutation")[1])),
|
| 81 |
+
("mlp_only", G2.apply_mlp(sdx, G2.mlp_match(sde, sdx))),
|
| 82 |
+
("heads_only", G2.apply_head(sdx, G2.head_match(sde, sdx, D2, NH2), D2, NH2)),
|
| 83 |
+
("perm_full", G2.align_full(sde, sdx, D2, NH2, ae, ax, "permutation", accept_each=False)[0]),
|
| 84 |
+
("orth_full", G2.align_full(sde, sdx, D2, NH2, ae, ax, "orthogonal", accept_each=False)[0])):
|
| 85 |
+
sd_load(m_x, sd, DEV); res2[tag] = nll_nats(m_x, bl, DEV, bs=8) - b0
|
| 86 |
+
out["set4_goldfish_nld"] = {"parent_nll": b0, "nll_change_after_alignment": res2}
|
| 87 |
+
print("SET4", json.dumps(out["set4_goldfish_nld"], indent=1))
|
| 88 |
+
json.dump(out, open("/root/compose-audit/results/alignment_health.json", "w"), indent=1)
|
code/make_report.py
CHANGED
|
@@ -93,20 +93,32 @@ if set1:
|
|
| 93 |
for sz in sizes:
|
| 94 |
sub = [r for r in set1 if r["size"] == sz]
|
| 95 |
d0 = np.array([r["rungs"]["M0_naive_avg"]["delta_floor"] for r in sub])
|
|
|
|
| 96 |
db = np.array([min(r["rungs"]["M1_perm_avg"]["delta_floor"],
|
| 97 |
r["rungs"]["M1_orth_avg"]["delta_floor"]) for r in sub])
|
| 98 |
-
dd[sz] = (len(sub), d0.mean(), float(np.mean(1 -
|
|
|
|
| 99 |
hl.append(f"1. **Naive averaging of two seed-only-different real LMs is catastrophic, at every "
|
| 100 |
f"size.** Δfloor {' · '.join(f'{sz}: +{dd[sz][1]:.1f}' for sz in sizes)} nats/token "
|
| 101 |
f"against parent floors of 3–4.4 nats/token, i.e. above the uniform-over-vocabulary "
|
| 102 |
f"reference of 10.8 for all but the largest. n = "
|
| 103 |
f"{' / '.join(str(dd[sz][0]) for sz in sizes)} pairs.")
|
|
|
|
|
|
|
|
|
|
| 104 |
hl.append(f"2. **Unit alignment removes a large fraction of that gap and still does not produce a "
|
| 105 |
-
f"usable model.**
|
| 106 |
f"{' · '.join(f'{sz}: {dd[sz][2]:.0f}%' for sz in sizes)} — leaving "
|
| 107 |
-
f"{' · '.join(f'{dd[sz][3]:.1f}' for sz in sizes)} nats/token above the better parent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
hl.append(f"3. **The rescue shrinks monotonically with scale** ({sizes[0]}: {dd[sizes[0]][2]:.0f}% "
|
| 109 |
-
f"→ {sizes[-1]}: {dd[sizes[-1]][2]:.0f}%) while the naive gap shrinks too — so the "
|
| 110 |
f"coordinate-removable share of the obstruction is falling in exactly the direction the "
|
| 111 |
f"field is scaling. (Per-size n is listed in (1); the largest sizes carry the fewest "
|
| 112 |
f"pairs, so read the trend from the sizes with complete 36-pair grids and treat the "
|
|
@@ -181,10 +193,11 @@ if set1:
|
|
| 181 |
destroyed one. This is the pure-coordinate case: there is no data, architecture or tokenizer
|
| 182 |
difference left to blame.
|
| 183 |
2. **Unit alignment removes a large, highly consistent fraction of that gap** — the permutation rung
|
| 184 |
-
beats naive on essentially every pair — **and still does not produce a usable model.**
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
|
|
|
| 188 |
3. **Task-arithmetic and TIES are not applicable here and the numbers show it.** PolyPythia seeds are
|
| 189 |
independent re-initialisations: `EleutherAI/pythia-<size>` is *not* a shared ancestor, so the
|
| 190 |
"task vectors" those operators subtract are not task vectors. Their rows are reported only to
|
|
@@ -193,6 +206,45 @@ if set1:
|
|
| 193 |
interior t that beats the better parent, aligned or not.
|
| 194 |
""")
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
if len(mdtabs) >= 3:
|
| 197 |
L.append("\n### The scale trend — alignment's coordinate rescue WEAKENS with model size\n")
|
| 198 |
tr = []
|
|
@@ -214,8 +266,12 @@ if len(mdtabs) >= 3:
|
|
| 214 |
"rescue, permutation", "rescue, Procrustes", "rescue, best of the two",
|
| 215 |
"unaligned CKA", "aligned CKA", "weight coordinate share"], tr))
|
| 216 |
L.append("""
|
| 217 |
-
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
*and* the share of it that alignment can remove shrinks faster. Two things are worth separating:
|
| 220 |
|
| 221 |
- The **naive** merge gets less catastrophic with scale, which on its own would be an encouraging
|
|
|
|
| 93 |
for sz in sizes:
|
| 94 |
sub = [r for r in set1 if r["size"] == sz]
|
| 95 |
d0 = np.array([r["rungs"]["M0_naive_avg"]["delta_floor"] for r in sub])
|
| 96 |
+
dp = np.array([r["rungs"]["M1_perm_avg"]["delta_floor"] for r in sub])
|
| 97 |
db = np.array([min(r["rungs"]["M1_perm_avg"]["delta_floor"],
|
| 98 |
r["rungs"]["M1_orth_avg"]["delta_floor"]) for r in sub])
|
| 99 |
+
dd[sz] = (len(sub), d0.mean(), float(np.mean(1 - dp / d0) * 100), dp.mean(),
|
| 100 |
+
float(np.mean(1 - db / d0) * 100))
|
| 101 |
hl.append(f"1. **Naive averaging of two seed-only-different real LMs is catastrophic, at every "
|
| 102 |
f"size.** Δfloor {' · '.join(f'{sz}: +{dd[sz][1]:.1f}' for sz in sizes)} nats/token "
|
| 103 |
f"against parent floors of 3–4.4 nats/token, i.e. above the uniform-over-vocabulary "
|
| 104 |
f"reference of 10.8 for all but the largest. n = "
|
| 105 |
f"{' / '.join(str(dd[sz][0]) for sz in sizes)} pairs.")
|
| 106 |
+
_abs = {sz: dd[sz][3] + float(np.mean([r["floor"] for r in set1 if r["size"] == sz])) for sz in sizes}
|
| 107 |
+
_unif = math.log(50304)
|
| 108 |
+
_above = [sz for sz in sizes if _abs[sz] > _unif]
|
| 109 |
hl.append(f"2. **Unit alignment removes a large fraction of that gap and still does not produce a "
|
| 110 |
+
f"usable model.** The exactly function-preserving permutation rung removes "
|
| 111 |
f"{' · '.join(f'{sz}: {dd[sz][2]:.0f}%' for sz in sizes)} — leaving "
|
| 112 |
+
f"{' · '.join(f'{dd[sz][3]:.1f}' for sz in sizes)} nats/token above the better parent, "
|
| 113 |
+
f"i.e. an absolute {' · '.join(f'{_abs[sz]:.1f}' for sz in sizes)} nats/token against "
|
| 114 |
+
f"parent floors of 3.0–4.4 and a uniform-over-vocabulary reference of {_unif:.1f}. "
|
| 115 |
+
f"At {', '.join(_above)} the aligned merge is still *worse than predicting uniformly "
|
| 116 |
+
f"over the vocabulary*; at the larger sizes it is below that line but still 2–3x the "
|
| 117 |
+
f"parent's loss. (A Procrustes rung is also reported, but it is **not** "
|
| 118 |
+
f"function-preserving on LayerNorm transformers — see Validation — so the coordinate "
|
| 119 |
+
f"claim rests on the permutation rung.)")
|
| 120 |
hl.append(f"3. **The rescue shrinks monotonically with scale** ({sizes[0]}: {dd[sizes[0]][2]:.0f}% "
|
| 121 |
+
f"→ {sizes[-1]}: {dd[sizes[-1]][2]:.0f}% on the exact rung) while the naive gap shrinks too — so the "
|
| 122 |
f"coordinate-removable share of the obstruction is falling in exactly the direction the "
|
| 123 |
f"field is scaling. (Per-size n is listed in (1); the largest sizes carry the fewest "
|
| 124 |
f"pairs, so read the trend from the sizes with complete 36-pair grids and treat the "
|
|
|
|
| 193 |
destroyed one. This is the pure-coordinate case: there is no data, architecture or tokenizer
|
| 194 |
difference left to blame.
|
| 195 |
2. **Unit alignment removes a large, highly consistent fraction of that gap** — the permutation rung
|
| 196 |
+
beats naive on essentially every pair — **and still does not produce a usable model.** At 14m/31m/70m
|
| 197 |
+
the aligned merge is still *worse than predicting uniformly over the vocabulary*; at 160m/410m it
|
| 198 |
+
drops below that line but still sits at 2–3× the better parent's loss. So on real LMs at this
|
| 199 |
+
scale, alignment *predicts and reduces* the obstruction without *enabling* the merge. Reporting
|
| 200 |
+
the reduction as "merging works once you align" would be wrong.
|
| 201 |
3. **Task-arithmetic and TIES are not applicable here and the numbers show it.** PolyPythia seeds are
|
| 202 |
independent re-initialisations: `EleutherAI/pythia-<size>` is *not* a shared ancestor, so the
|
| 203 |
"task vectors" those operators subtract are not task vectors. Their rows are reported only to
|
|
|
|
| 206 |
interior t that beats the better parent, aligned or not.
|
| 207 |
""")
|
| 208 |
|
| 209 |
+
# ---------------- alignment health
|
| 210 |
+
try:
|
| 211 |
+
_ah = json.load(open(f"{R}/alignment_health.json"))
|
| 212 |
+
except Exception:
|
| 213 |
+
_ah = None
|
| 214 |
+
if _ah:
|
| 215 |
+
L.append("""
|
| 216 |
+
### Validation: is the alignment actually function-preserving? (One rung is not.)
|
| 217 |
+
|
| 218 |
+
Every M1 rung is only an *alignment* if `g.θ_B` computes exactly what `θ_B` computes. This was checked
|
| 219 |
+
empirically rather than assumed: take a parent, apply the map, and re-evaluate.
|
| 220 |
+
|
| 221 |
+
""")
|
| 222 |
+
body = []
|
| 223 |
+
for sub_, rec in _ah.items():
|
| 224 |
+
for k, v in rec["nll_change_after_alignment"].items():
|
| 225 |
+
body.append([sub_, k, f"{v:+.3e}" if abs(v) < 1e-2 else f"{v:+.3f}",
|
| 226 |
+
"EXACT" if abs(v) < 1e-3 else ("negligible" if abs(v) < 0.1 else "**NOT function-preserving**")])
|
| 227 |
+
L.append(md_table(["substrate", "map", "change in the parent's nats/token", "verdict"], body))
|
| 228 |
+
L.append("""
|
| 229 |
+
**The permutation family is exact** — residual basis, free MLP hidden axis and attention heads, on
|
| 230 |
+
both architectures, to float32 noise. Those rungs are genuine alignments.
|
| 231 |
+
|
| 232 |
+
**The orthogonal/Procrustes residual map is not**, and on GPTNeoX it is badly not: applying it to a
|
| 233 |
+
PolyPythia parent costs that parent **+27 nats/token on its own**. The reason is structural rather
|
| 234 |
+
than a bug — LayerNorm subtracts the mean over the residual axis and applies a learned elementwise
|
| 235 |
+
gain, and neither commutes with a general rotation (an RMSNorm model would be much closer to safe).
|
| 236 |
+
On the GPT-2 Goldfish models the same map costs only +0.07 nats/token, so the defect is
|
| 237 |
+
architecture-specific in magnitude.
|
| 238 |
+
|
| 239 |
+
**Consequence for the tables.** The `M1_orth` / `M1c` / `M1e` rows are still *real measurements of a
|
| 240 |
+
merged model's loss* — a merge is a merge, and the number is what it is — but they must **not** be
|
| 241 |
+
read as "how much of the obstruction is coordinate". On SET 1 they merge parent A with a *damaged*
|
| 242 |
+
copy of parent B, and any apparent rescue is partly the arithmetic of averaging toward one parent.
|
| 243 |
+
The coordinate claim in this report rests on the **permutation** rung, which is exact. Where the two
|
| 244 |
+
disagree, believe the permutation rung. This is flagged again at every table that contains an
|
| 245 |
+
orthogonal row.
|
| 246 |
+
""")
|
| 247 |
+
|
| 248 |
if len(mdtabs) >= 3:
|
| 249 |
L.append("\n### The scale trend — alignment's coordinate rescue WEAKENS with model size\n")
|
| 250 |
tr = []
|
|
|
|
| 266 |
"rescue, permutation", "rescue, Procrustes", "rescue, best of the two",
|
| 267 |
"unaligned CKA", "aligned CKA", "weight coordinate share"], tr))
|
| 268 |
L.append("""
|
| 269 |
+
Read the **permutation** column: it is the one that is exactly function-preserving (see Validation
|
| 270 |
+
above). The Procrustes column is shown for completeness but on GPTNeoX that map damages the model it
|
| 271 |
+
is applied to, so its "rescue" is not a clean coordinate measurement.
|
| 272 |
+
|
| 273 |
+
The coordinator flagged this trend from the first two pairs and asked whether it survives the full
|
| 274 |
+
grid. **It does, monotonically, across every size we ran, on the exact rung alone.** The naive merge's Δfloor shrinks with scale
|
| 275 |
*and* the share of it that alignment can remove shrinks faster. Two things are worth separating:
|
| 276 |
|
| 277 |
- The **naive** merge gets less catastrophic with scale, which on its own would be an encouraging
|
code/publish.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Publish the audit as a single commit (upload_folder), so repeated republishes do not
|
| 2 |
+
burn the Hub's per-hour commit budget the way a file-at-a-time loop does."""
|
| 3 |
+
import os, sys, shutil, glob, time
|
| 4 |
+
sys.path.insert(0, "/root/mergeability/src")
|
| 5 |
+
from huggingface_hub import HfApi, create_repo
|
| 6 |
+
REPO = "Mergeability-2/compose-audit"
|
| 7 |
+
ROOT = "/root/compose-audit"
|
| 8 |
+
STAGE = "/root/compose-audit/.stage"
|
| 9 |
+
|
| 10 |
+
api = HfApi()
|
| 11 |
+
create_repo(REPO, repo_type="dataset", exist_ok=True)
|
| 12 |
+
if os.path.isdir(STAGE):
|
| 13 |
+
shutil.rmtree(STAGE)
|
| 14 |
+
os.makedirs(f"{STAGE}/results", exist_ok=True)
|
| 15 |
+
os.makedirs(f"{STAGE}/figs", exist_ok=True)
|
| 16 |
+
os.makedirs(f"{STAGE}/code", exist_ok=True)
|
| 17 |
+
for fp in glob.glob(f"{ROOT}/results/*"):
|
| 18 |
+
if os.path.isfile(fp):
|
| 19 |
+
shutil.copy(fp, f"{STAGE}/results/{os.path.basename(fp)}")
|
| 20 |
+
for fp in glob.glob(f"{ROOT}/figs/*.png"):
|
| 21 |
+
shutil.copy(fp, f"{STAGE}/figs/{os.path.basename(fp)}")
|
| 22 |
+
for fp in glob.glob(f"{ROOT}/*.py") + glob.glob(f"{ROOT}/*.sh"):
|
| 23 |
+
shutil.copy(fp, f"{STAGE}/code/{os.path.basename(fp)}")
|
| 24 |
+
shutil.copy(f"{ROOT}/RESULTS_COMPOSE_AUDIT.md", f"{STAGE}/RESULTS_COMPOSE_AUDIT.md")
|
| 25 |
+
hdr = ("---\nlicense: apache-2.0\ntags:\n- model-merging\n- alignment\n- polypythia\n- goldfish\n"
|
| 26 |
+
"- multilingual\n- blimp\n---\n\n")
|
| 27 |
+
with open(f"{ROOT}/RESULTS_COMPOSE_AUDIT.md", encoding="utf-8") as f:
|
| 28 |
+
body = f.read()
|
| 29 |
+
with open(f"{STAGE}/README.md", "w", encoding="utf-8") as f:
|
| 30 |
+
f.write(hdr + body)
|
| 31 |
+
|
| 32 |
+
api.upload_folder(folder_path=STAGE, repo_id=REPO, repo_type="dataset",
|
| 33 |
+
commit_message=f"compose-audit refresh {time.strftime('%Y-%m-%d %H:%M UTC')}")
|
| 34 |
+
shutil.rmtree(STAGE, ignore_errors=True)
|
| 35 |
+
print("URL: https://huggingface.co/datasets/" + REPO)
|
code/run_abl.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/hf_cache_brainalign
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
P=/root/venvs/mergeability/bin/python
|
| 6 |
+
CUDA_VISIBLE_DEVICES=0 $P /root/compose-audit/set1_polypythia.py --size 160m-weight --base pythia-160m \
|
| 7 |
+
--seeds 1,2,3 --blocks 32 --barrier_n 5 --tag abl >> /root/compose-audit/logs/abl.log 2>&1
|
| 8 |
+
CUDA_VISIBLE_DEVICES=0 $P /root/compose-audit/set1_polypythia.py --size 160m-data --base pythia-160m \
|
| 9 |
+
--seeds 1,2,3 --blocks 32 --barrier_n 5 --tag abl >> /root/compose-audit/logs/abl.log 2>&1
|
| 10 |
+
echo ABL_DONE >> /root/compose-audit/logs/abl.log
|
code/run_blimp.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/hf_cache_brainalign
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
P=/root/venvs/mergeability/bin/python
|
| 6 |
+
G=${GPU:-1}
|
| 7 |
+
CUDA_VISIBLE_DEVICES=$G $P /root/compose-audit/set1_blimp.py --size 14m --n_per_paradigm 200 \
|
| 8 |
+
>> /root/compose-audit/logs/blimp_14m.log 2>&1
|
| 9 |
+
CUDA_VISIBLE_DEVICES=$G $P /root/compose-audit/set1_blimp.py --size 70m --n_per_paradigm 200 --bs 96 \
|
| 10 |
+
>> /root/compose-audit/logs/blimp_70m.log 2>&1
|
| 11 |
+
CUDA_VISIBLE_DEVICES=$G $P /root/compose-audit/set1_blimp.py --size 160m --n_per_paradigm 150 --bs 64 --blocks 32 \
|
| 12 |
+
>> /root/compose-audit/logs/blimp_160m.log 2>&1
|
| 13 |
+
echo BLIMP_ALL_DONE >> /root/compose-audit/logs/blimp_14m.log
|
code/run_repair.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/hf_cache_brainalign
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
P=/root/venvs/mergeability/bin/python
|
| 6 |
+
CUDA_VISIBLE_DEVICES=1 $P /root/compose-audit/set1_repair.py --size 14m --n_per_paradigm 200 >> /root/compose-audit/logs/repair_14m.log 2>&1
|
| 7 |
+
CUDA_VISIBLE_DEVICES=1 $P /root/compose-audit/set1_repair.py --size 70m --n_per_paradigm 200 --bs 12 >> /root/compose-audit/logs/repair_70m.log 2>&1
|
| 8 |
+
CUDA_VISIBLE_DEVICES=1 $P /root/compose-audit/set1_repair.py --size 160m --n_per_paradigm 150 --bs 8 --blocks 32 >> /root/compose-audit/logs/repair_160m.log 2>&1
|
| 9 |
+
echo REPAIR_ALL_DONE >> /root/compose-audit/logs/repair_14m.log
|
code/run_rev_after.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/goldfish-alignment/cache/hf
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8
|
| 5 |
+
until grep -q SET4B_DONE /root/compose-audit/logs/set4b.log 2>/dev/null; do sleep 20; done
|
| 6 |
+
CUDA_VISIBLE_DEVICES=0 /root/venvs/mergeability/bin/python /root/compose-audit/set4_reverse.py --n_sent 500 \
|
| 7 |
+
>> /root/compose-audit/logs/set4_rev.log 2>&1
|
| 8 |
+
echo SET4_REV_DONE >> /root/compose-audit/logs/set4_rev.log
|
code/run_set1.sh
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/hf_cache_brainalign
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
size=$1; gpu=$2; shift 2
|
| 6 |
+
CUDA_VISIBLE_DEVICES=$gpu /root/venvs/mergeability/bin/python /root/compose-audit/set1_polypythia.py --size $size "$@" \
|
| 7 |
+
>> /root/compose-audit/logs/set1_$size.log 2>&1
|
code/run_set4.sh
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/goldfish-alignment/cache/hf
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
CUDA_VISIBLE_DEVICES=3 /root/venvs/mergeability/bin/python /root/compose-audit/set4_goldfish.py "$@" \
|
| 6 |
+
>> /root/compose-audit/logs/set4.log 2>&1
|
code/run_set4b.sh
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
source /root/.ms_hf_env
|
| 3 |
+
export HF_HOME=/root/goldfish-alignment/cache/hf
|
| 4 |
+
export OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 OPENBLAS_NUM_THREADS=8 NUMEXPR_NUM_THREADS=8
|
| 5 |
+
P=/root/venvs/mergeability/bin/python
|
| 6 |
+
CUDA_VISIBLE_DEVICES=0 $P /root/compose-audit/set4_multiblimp.py --max_items 1200 >> /root/compose-audit/logs/set4_mb.log 2>&1
|
| 7 |
+
rm -f /root/compose-audit/results/set4_goldfish.jsonl
|
| 8 |
+
CUDA_VISIBLE_DEVICES=0 $P /root/compose-audit/set4_goldfish.py --n_sent 500 >> /root/compose-audit/logs/set4b.log 2>&1
|
| 9 |
+
echo SET4B_DONE >> /root/compose-audit/logs/set4b.log
|
| 10 |
+
# (reverse direction is launched by run_rev_after.sh)
|
| 11 |
+
#
|
code/set1_blimp.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""ACCURACY, not likelihood: does the Δfloor rescue transfer to BLiMP?
|
| 2 |
+
|
| 3 |
+
The audit's sharpest point is that "recovery is not success" -- a likelihood rescue has not been
|
| 4 |
+
shown to transfer to benchmark accuracy. PolyPythia parents are English LMs, so BLiMP is directly
|
| 5 |
+
applicable to SET 1's merges. Scoring: sum log p over the sentence (all tokens after the first);
|
| 6 |
+
a paradigm item is correct when the grammatical sentence scores higher. Chance = 50%."""
|
| 7 |
+
import os, sys, json, time, glob, itertools, argparse, gc
|
| 8 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 9 |
+
from common import *
|
| 10 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 11 |
+
import pyarrow.parquet as pq
|
| 12 |
+
|
| 13 |
+
ap = argparse.ArgumentParser()
|
| 14 |
+
ap.add_argument("--size", default="14m")
|
| 15 |
+
ap.add_argument("--seeds", default="1,2,3,4,5,6,7,8,9")
|
| 16 |
+
ap.add_argument("--n_per_paradigm", type=int, default=200)
|
| 17 |
+
ap.add_argument("--bs", type=int, default=128)
|
| 18 |
+
ap.add_argument("--acts_rows", type=int, default=2048)
|
| 19 |
+
ap.add_argument("--blocks", type=int, default=48)
|
| 20 |
+
A = ap.parse_args()
|
| 21 |
+
SEEDS = [int(s) for s in A.seeds.split(",")]
|
| 22 |
+
OUT = f"/root/compose-audit/results/blimp_{A.size}.jsonl"
|
| 23 |
+
DEV = "cuda"
|
| 24 |
+
BLIMP = glob.glob("/root/hf_cache_brainalign/hub/datasets--nyu-mll--blimp/snapshots/*/")[0]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def log(*a):
|
| 28 |
+
print(f"[{time.strftime('%H:%M:%S')}]", *a, flush=True)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
# reuse SET 1's aligners
|
| 32 |
+
import importlib.util
|
| 33 |
+
spec = importlib.util.spec_from_file_location("s1", "/root/compose-audit/set1_polypythia.py")
|
| 34 |
+
|
| 35 |
+
def neox_head_match(sd_a, sd_b, d, nh, nl):
|
| 36 |
+
hd, perms = d // nh, {}
|
| 37 |
+
for L in range(nl):
|
| 38 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 39 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 40 |
+
if qk not in sd_a: continue
|
| 41 |
+
Aq = np.asarray(sd_a[qk], float).reshape(nh, 3 * hd, d)
|
| 42 |
+
Bq = np.asarray(sd_b[qk], float).reshape(nh, 3 * hd, d)
|
| 43 |
+
g = np.einsum("ixy,jxy->ij", Aq, Bq)
|
| 44 |
+
Ad = np.asarray(sd_a[de], float).reshape(d, nh, hd)
|
| 45 |
+
Bd = np.asarray(sd_b[de], float).reshape(d, nh, hd)
|
| 46 |
+
perms[L] = AL._assignment(g + np.einsum("xiy,xjy->ij", Ad, Bd))
|
| 47 |
+
return perms
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def neox_apply_head(sd, perms, d, nh):
|
| 51 |
+
hd, out = d // nh, dict(sd)
|
| 52 |
+
for L, h in perms.items():
|
| 53 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 54 |
+
qb = f"gpt_neox.layers.{L}.attention.query_key_value.bias"
|
| 55 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 56 |
+
out[qk] = np.asarray(sd[qk], float).reshape(nh, 3 * hd, d)[h].reshape(3 * d, d)
|
| 57 |
+
if qb in sd: out[qb] = np.asarray(sd[qb], float).reshape(nh, 3 * hd)[h].reshape(3 * d)
|
| 58 |
+
out[de] = np.asarray(sd[de], float).reshape(d, nh, hd)[:, h].reshape(d, d)
|
| 59 |
+
return out
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def align_full(sd_a, sd_b, d, aa, ab, nh, nl, method):
|
| 63 |
+
sd, info = AL.align_weights_full(sd_a, sd_b, d, acts_a=aa, acts_b=ab, n_heads=None,
|
| 64 |
+
method=method, strict=True, accept_each=True)
|
| 65 |
+
hp = neox_head_match(sd_a, sd, d, nh, nl)
|
| 66 |
+
if hp:
|
| 67 |
+
cand = neox_apply_head(sd, hp, d, nh)
|
| 68 |
+
if AL.block_normalised_distance(sd_a, cand) <= AL.block_normalised_distance(sd_a, sd):
|
| 69 |
+
sd = cand
|
| 70 |
+
return sd
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
# ------------------------------------------------------------------ BLiMP
|
| 74 |
+
def load_blimp(tok, n_per):
|
| 75 |
+
items = []
|
| 76 |
+
for d in sorted(glob.glob(BLIMP + "*/")):
|
| 77 |
+
name = os.path.basename(d.rstrip("/"))
|
| 78 |
+
f = glob.glob(d + "*.parquet")
|
| 79 |
+
if not f: continue
|
| 80 |
+
t = pq.read_table(f[0]).to_pydict()
|
| 81 |
+
good, bad = t["sentence_good"][:n_per], t["sentence_bad"][:n_per]
|
| 82 |
+
items.append((name, good, bad))
|
| 83 |
+
return items
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def encode(tok, sents, maxlen=48):
|
| 87 |
+
enc = tok(sents, return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 88 |
+
return enc["input_ids"], enc["attention_mask"]
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
@torch.no_grad()
|
| 92 |
+
def score(model, ids, am, dev, bs=128):
|
| 93 |
+
out = []
|
| 94 |
+
for i in range(0, ids.shape[0], bs):
|
| 95 |
+
x, m = ids[i:i + bs].to(dev), am[i:i + bs].to(dev)
|
| 96 |
+
lp = torch.log_softmax(model(x, attention_mask=m).logits.float()[:, :-1], -1)
|
| 97 |
+
tgt = x[:, 1:]
|
| 98 |
+
tokl = lp.gather(-1, tgt.unsqueeze(-1)).squeeze(-1) * m[:, 1:].float()
|
| 99 |
+
out.append(tokl.sum(1).cpu())
|
| 100 |
+
return torch.cat(out).numpy()
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
tok = AutoTokenizer.from_pretrained(f"EleutherAI/pythia-{A.size}")
|
| 104 |
+
if tok.pad_token is None: tok.pad_token = tok.eos_token
|
| 105 |
+
PARA = load_blimp(tok, A.n_per_paradigm)
|
| 106 |
+
log(f"BLiMP paradigms={len(PARA)} items/paradigm={len(PARA[0][1])}")
|
| 107 |
+
ENC = [(n, encode(tok, g), encode(tok, b)) for n, g, b in PARA]
|
| 108 |
+
|
| 109 |
+
lines = flores_lines("eng_Latn")
|
| 110 |
+
blocks = make_blocks(tok, lines, block=512, max_blocks=A.blocks)
|
| 111 |
+
shell = AutoModelForCausalLM.from_pretrained(f"EleutherAI/pythia-{A.size}-seed{SEEDS[0]}",
|
| 112 |
+
dtype=torch.float32).to(DEV).eval()
|
| 113 |
+
cfg = shell.config
|
| 114 |
+
D, NH, NL = cfg.hidden_size, cfg.num_attention_heads, cfg.num_hidden_layers
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def blimp_acc(sd):
|
| 118 |
+
sd_load(shell, sd, DEV)
|
| 119 |
+
per, tot, cor = {}, 0, 0
|
| 120 |
+
for name, (gi, gm), (bi, bm) in ENC:
|
| 121 |
+
sg = score(shell, gi, gm, DEV, bs=A.bs)
|
| 122 |
+
sb = score(shell, bi, bm, DEV, bs=A.bs)
|
| 123 |
+
c = int((sg > sb).sum()); per[name] = c / len(sg); cor += c; tot += len(sg)
|
| 124 |
+
return cor / tot, per
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
SDS, ACTS, PACC = {}, {}, {}
|
| 128 |
+
for s in SEEDS:
|
| 129 |
+
m = AutoModelForCausalLM.from_pretrained(f"EleutherAI/pythia-{A.size}-seed{s}", dtype=torch.float32).to(DEV).eval()
|
| 130 |
+
SDS[s] = sd_np(m); ACTS[s] = capture_acts(m, blocks, DEV, n_rows=A.acts_rows, bs=16)
|
| 131 |
+
del m; torch.cuda.empty_cache()
|
| 132 |
+
a, _ = blimp_acc(SDS[s]); PACC[s] = a
|
| 133 |
+
log(f" seed{s} BLiMP={a:.4f}")
|
| 134 |
+
|
| 135 |
+
done = set()
|
| 136 |
+
if os.path.exists(OUT):
|
| 137 |
+
for l in open(OUT):
|
| 138 |
+
try: done.add(tuple(json.loads(l)["pair"]))
|
| 139 |
+
except Exception: pass
|
| 140 |
+
fh = open(OUT, "a")
|
| 141 |
+
for a, b in itertools.combinations(SEEDS, 2):
|
| 142 |
+
if (a, b) in done: continue
|
| 143 |
+
t0 = time.time()
|
| 144 |
+
sa, sb = SDS[a], SDS[b]
|
| 145 |
+
sbp = align_full(sa, sb, D, ACTS[a], ACTS[b], NH, NL, "permutation")
|
| 146 |
+
sbo = align_full(sa, sb, D, ACTS[a], ACTS[b], NH, NL, "orthogonal")
|
| 147 |
+
rungs = {"M0_naive_avg": MG.average([sa, sb]), "M1_perm_avg": MG.average([sa, sbp]),
|
| 148 |
+
"M1_orth_avg": MG.average([sa, sbo])}
|
| 149 |
+
res = {}
|
| 150 |
+
for k, sd in rungs.items():
|
| 151 |
+
acc, per = blimp_acc(sd)
|
| 152 |
+
res[k] = {"blimp_acc": acc, "per_paradigm": per}
|
| 153 |
+
r = {"set": "set1_blimp", "size": A.size, "pair": [a, b],
|
| 154 |
+
"metric": "BLiMP accuracy (chance=0.5) -- ACCURACY, not likelihood",
|
| 155 |
+
"n_per_paradigm": A.n_per_paradigm, "n_paradigms": len(ENC),
|
| 156 |
+
"parent_acc": {"a": PACC[a], "b": PACC[b]}, "ceiling": max(PACC[a], PACC[b]),
|
| 157 |
+
"rungs": {k: {"blimp_acc": v["blimp_acc"],
|
| 158 |
+
"delta_vs_best_parent": v["blimp_acc"] - max(PACC[a], PACC[b])} for k, v in res.items()},
|
| 159 |
+
"per_paradigm": {k: v["per_paradigm"] for k, v in res.items()},
|
| 160 |
+
"secs": time.time() - t0}
|
| 161 |
+
fh.write(json.dumps(r) + "\n"); fh.flush()
|
| 162 |
+
log(f"pair {a},{b} ceil={r['ceiling']:.4f} M0={res['M0_naive_avg']['blimp_acc']:.4f} "
|
| 163 |
+
f"M1p={res['M1_perm_avg']['blimp_acc']:.4f} M1o={res['M1_orth_avg']['blimp_acc']:.4f} ({r['secs']:.0f}s)")
|
| 164 |
+
del rungs, sbp, sbo; gc.collect()
|
| 165 |
+
fh.close()
|
| 166 |
+
log("DONE blimp", A.size)
|
code/set1_repair.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Did we try hard enough to make merging work?
|
| 2 |
+
|
| 3 |
+
The obvious objection to SET 1's negative result is that a plain average of aligned weights is a weak
|
| 4 |
+
merge: averaging two networks halves the variance of every pre-activation, and REPAIR (Jordan et al.,
|
| 5 |
+
ICLR 2023) shows that restoring those first- and second-order statistics recovers most of the
|
| 6 |
+
remaining barrier on vision nets. This adds that rung, training-free: after the permutation-aligned
|
| 7 |
+
average, walk the layers in order and affine-correct each Linear's pre-activations so their per-unit
|
| 8 |
+
mean and std match the average of the two parents' own statistics on the same corpus.
|
| 9 |
+
|
| 10 |
+
Rungs: M0 naive · M1 permutation-aligned average · M4 = M1 + REPAIR · M5 = M0 + REPAIR.
|
| 11 |
+
Metrics: Δfloor in nats/token (FLORES-200 eng devtest) AND BLiMP accuracy, on the same merges."""
|
| 12 |
+
import os, sys, json, time, glob, itertools, argparse, gc, csv
|
| 13 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 14 |
+
from common import *
|
| 15 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 16 |
+
import pyarrow.parquet as pq
|
| 17 |
+
|
| 18 |
+
ap = argparse.ArgumentParser()
|
| 19 |
+
ap.add_argument("--size", default="14m")
|
| 20 |
+
ap.add_argument("--seeds", default="1,2,3,4,5,6,7,8,9")
|
| 21 |
+
ap.add_argument("--blocks", type=int, default=48)
|
| 22 |
+
ap.add_argument("--bs", type=int, default=16)
|
| 23 |
+
ap.add_argument("--n_per_paradigm", type=int, default=200)
|
| 24 |
+
ap.add_argument("--acts_rows", type=int, default=2048)
|
| 25 |
+
A = ap.parse_args()
|
| 26 |
+
SEEDS = [int(s) for s in A.seeds.split(",")]
|
| 27 |
+
OUT = f"/root/compose-audit/results/repair_{A.size}.jsonl"
|
| 28 |
+
DEV = "cuda"
|
| 29 |
+
BLIMP = glob.glob("/root/hf_cache_brainalign/hub/datasets--nyu-mll--blimp/snapshots/*/")[0]
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def log(*a):
|
| 33 |
+
print(f"[{time.strftime('%H:%M:%S')}]", *a, flush=True)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def neox_head_match(sd_a, sd_b, d, nh, nl):
|
| 37 |
+
hd, perms = d // nh, {}
|
| 38 |
+
for L in range(nl):
|
| 39 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 40 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 41 |
+
if qk not in sd_a: continue
|
| 42 |
+
Aq = np.asarray(sd_a[qk], float).reshape(nh, 3 * hd, d)
|
| 43 |
+
Bq = np.asarray(sd_b[qk], float).reshape(nh, 3 * hd, d)
|
| 44 |
+
g = np.einsum("ixy,jxy->ij", Aq, Bq)
|
| 45 |
+
Ad = np.asarray(sd_a[de], float).reshape(d, nh, hd)
|
| 46 |
+
Bd = np.asarray(sd_b[de], float).reshape(d, nh, hd)
|
| 47 |
+
perms[L] = AL._assignment(g + np.einsum("xiy,xjy->ij", Ad, Bd))
|
| 48 |
+
return perms
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def neox_apply_head(sd, perms, d, nh):
|
| 52 |
+
hd, out = d // nh, dict(sd)
|
| 53 |
+
for L, h in perms.items():
|
| 54 |
+
qk = f"gpt_neox.layers.{L}.attention.query_key_value.weight"
|
| 55 |
+
qb = f"gpt_neox.layers.{L}.attention.query_key_value.bias"
|
| 56 |
+
de = f"gpt_neox.layers.{L}.attention.dense.weight"
|
| 57 |
+
out[qk] = np.asarray(sd[qk], float).reshape(nh, 3 * hd, d)[h].reshape(3 * d, d)
|
| 58 |
+
if qb in sd: out[qb] = np.asarray(sd[qb], float).reshape(nh, 3 * hd)[h].reshape(3 * d)
|
| 59 |
+
out[de] = np.asarray(sd[de], float).reshape(d, nh, hd)[:, h].reshape(d, d)
|
| 60 |
+
return out
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def align_perm(sd_a, sd_b, d, aa, ab, nh, nl):
|
| 64 |
+
sd, _ = AL.align_weights_full(sd_a, sd_b, d, acts_a=aa, acts_b=ab, n_heads=None,
|
| 65 |
+
method="permutation", strict=True, accept_each=True)
|
| 66 |
+
hp = neox_head_match(sd_a, sd, d, nh, nl)
|
| 67 |
+
if hp:
|
| 68 |
+
cand = neox_apply_head(sd, hp, d, nh)
|
| 69 |
+
if AL.block_normalised_distance(sd_a, cand) <= AL.block_normalised_distance(sd_a, sd):
|
| 70 |
+
sd = cand
|
| 71 |
+
return sd
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
# ------------------------------------------------------------------ REPAIR
|
| 75 |
+
TARGETS = ("mlp.dense_h_to_4h", "attention.query_key_value")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
@torch.no_grad()
|
| 79 |
+
def preact_stats(model, blocks, dev, bs, nl):
|
| 80 |
+
"""{(layer, target): (mean, std)} of each Linear's OUTPUT (= pre-activation), per unit."""
|
| 81 |
+
acc = {}
|
| 82 |
+
hs = []
|
| 83 |
+
|
| 84 |
+
def mk(key):
|
| 85 |
+
def hook(mod, inp, out):
|
| 86 |
+
o = out.detach().float().reshape(-1, out.shape[-1])
|
| 87 |
+
s = acc.setdefault(key, [0.0, None, None])
|
| 88 |
+
s[0] += o.shape[0]
|
| 89 |
+
s[1] = o.sum(0) if s[1] is None else s[1] + o.sum(0)
|
| 90 |
+
s[2] = (o * o).sum(0) if s[2] is None else s[2] + (o * o).sum(0)
|
| 91 |
+
return hook
|
| 92 |
+
|
| 93 |
+
for L in range(nl):
|
| 94 |
+
blk = model.gpt_neox.layers[L]
|
| 95 |
+
hs.append(blk.mlp.dense_h_to_4h.register_forward_hook(mk((L, "mlp.dense_h_to_4h"))))
|
| 96 |
+
hs.append(blk.attention.query_key_value.register_forward_hook(mk((L, "attention.query_key_value"))))
|
| 97 |
+
for i in range(0, blocks.shape[0], bs):
|
| 98 |
+
model(blocks[i:i + bs].to(dev))
|
| 99 |
+
for h in hs: h.remove()
|
| 100 |
+
out = {}
|
| 101 |
+
for k, (n, s1, s2) in acc.items():
|
| 102 |
+
m = s1 / n
|
| 103 |
+
v = (s2 / n - m * m).clamp_min(1e-12)
|
| 104 |
+
out[k] = (m.cpu().numpy().astype(np.float64), v.sqrt().cpu().numpy().astype(np.float64))
|
| 105 |
+
return out
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def repair(sd_merged, stats_a, stats_b, shell, blocks, dev, bs, nl):
|
| 109 |
+
"""Walk layers in order; after fixing layers < L the inputs to layer L are already corrected, so
|
| 110 |
+
layer L's own statistics are re-measured before it is corrected. Affine correction on the
|
| 111 |
+
Linear's weight/bias, so the model stays exactly a model of the same architecture."""
|
| 112 |
+
sd = {k: np.array(v, dtype=np.float64, copy=True) for k, v in sd_merged.items()}
|
| 113 |
+
for L in range(nl):
|
| 114 |
+
sd_load(shell, sd, dev)
|
| 115 |
+
cur = preact_stats(shell, blocks, dev, bs, nl)
|
| 116 |
+
for t in TARGETS:
|
| 117 |
+
mu_t = 0.5 * (stats_a[(L, t)][0] + stats_b[(L, t)][0])
|
| 118 |
+
sd_t = 0.5 * (stats_a[(L, t)][1] + stats_b[(L, t)][1])
|
| 119 |
+
mu_m, sd_m = cur[(L, t)]
|
| 120 |
+
g = sd_t / np.maximum(sd_m, 1e-8)
|
| 121 |
+
wk, bk = f"gpt_neox.layers.{L}.{t}.weight", f"gpt_neox.layers.{L}.{t}.bias"
|
| 122 |
+
sd[wk] = sd[wk] * g[:, None]
|
| 123 |
+
sd[bk] = (sd[bk] - mu_m) * g + mu_t
|
| 124 |
+
return sd
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
# ------------------------------------------------------------------ BLiMP
|
| 128 |
+
def load_blimp(n_per):
|
| 129 |
+
out = []
|
| 130 |
+
for d in sorted(glob.glob(BLIMP + "*/")):
|
| 131 |
+
f = glob.glob(d + "*.parquet")
|
| 132 |
+
if not f: continue
|
| 133 |
+
t = pq.read_table(f[0]).to_pydict()
|
| 134 |
+
out.append((os.path.basename(d.rstrip("/")), t["sentence_good"][:n_per], t["sentence_bad"][:n_per]))
|
| 135 |
+
return out
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
tok = AutoTokenizer.from_pretrained(f"EleutherAI/pythia-{A.size}")
|
| 139 |
+
if tok.pad_token is None: tok.pad_token = tok.eos_token
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
def enc(sents, maxlen=48):
|
| 143 |
+
e = tok(sents, return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 144 |
+
return e["input_ids"], e["attention_mask"]
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
ENC = [(n, enc(g), enc(b)) for n, g, b in load_blimp(A.n_per_paradigm)]
|
| 148 |
+
lines = flores_lines("eng_Latn")
|
| 149 |
+
blocks = make_blocks(tok, lines, block=512, max_blocks=A.blocks)
|
| 150 |
+
shell = AutoModelForCausalLM.from_pretrained(f"EleutherAI/pythia-{A.size}-seed{SEEDS[0]}",
|
| 151 |
+
dtype=torch.float32).to(DEV).eval()
|
| 152 |
+
cfg = shell.config
|
| 153 |
+
D, NH, NL = cfg.hidden_size, cfg.num_attention_heads, cfg.num_hidden_layers
|
| 154 |
+
log(f"size={A.size} d={D} heads={NH} layers={NL} blimp_paradigms={len(ENC)}")
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@torch.no_grad()
|
| 158 |
+
def bscore(ids, am):
|
| 159 |
+
o = []
|
| 160 |
+
for i in range(0, ids.shape[0], 128):
|
| 161 |
+
x, m = ids[i:i + 128].to(DEV), am[i:i + 128].to(DEV)
|
| 162 |
+
lp = torch.log_softmax(shell(x, attention_mask=m).logits.float()[:, :-1], -1)
|
| 163 |
+
o.append((lp.gather(-1, x[:, 1:].unsqueeze(-1)).squeeze(-1) * m[:, 1:].float()).sum(1).cpu())
|
| 164 |
+
return torch.cat(o).numpy()
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def evaluate(sd):
|
| 168 |
+
sd_load(shell, sd, DEV)
|
| 169 |
+
nll = nll_nats(shell, blocks, DEV, bs=A.bs)
|
| 170 |
+
cor = tot = 0
|
| 171 |
+
for name, (gi, gm), (bi, bm) in ENC:
|
| 172 |
+
sg, sb = bscore(gi, gm), bscore(bi, bm)
|
| 173 |
+
cor += int((sg > sb).sum()); tot += len(sg)
|
| 174 |
+
return nll, cor / tot
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
SDS, ACTS, PAR, STATS = {}, {}, {}, {}
|
| 178 |
+
for s in SEEDS:
|
| 179 |
+
m = AutoModelForCausalLM.from_pretrained(f"EleutherAI/pythia-{A.size}-seed{s}", dtype=torch.float32).to(DEV).eval()
|
| 180 |
+
SDS[s] = sd_np(m); ACTS[s] = capture_acts(m, blocks, DEV, n_rows=A.acts_rows, bs=A.bs)
|
| 181 |
+
del m; torch.cuda.empty_cache()
|
| 182 |
+
PAR[s] = evaluate(SDS[s])
|
| 183 |
+
log(f" seed{s} nll={PAR[s][0]:.4f} blimp={PAR[s][1]:.4f}")
|
| 184 |
+
|
| 185 |
+
done = set()
|
| 186 |
+
if os.path.exists(OUT):
|
| 187 |
+
for l in open(OUT):
|
| 188 |
+
try: done.add(tuple(json.loads(l)["pair"]))
|
| 189 |
+
except Exception: pass
|
| 190 |
+
fh = open(OUT, "a")
|
| 191 |
+
for a, b in itertools.combinations(SEEDS, 2):
|
| 192 |
+
if (a, b) in done: continue
|
| 193 |
+
t0 = time.time()
|
| 194 |
+
sa, sb = SDS[a], SDS[b]
|
| 195 |
+
sbp = align_perm(sa, sb, D, ACTS[a], ACTS[b], NH, NL)
|
| 196 |
+
sd_load(shell, sa, DEV); st_a = preact_stats(shell, blocks, DEV, A.bs, NL)
|
| 197 |
+
sd_load(shell, sbp, DEV); st_b = preact_stats(shell, blocks, DEV, A.bs, NL)
|
| 198 |
+
sd_load(shell, sb, DEV); st_braw = preact_stats(shell, blocks, DEV, A.bs, NL)
|
| 199 |
+
rungs = {"M0_naive_avg": MG.average([sa, sb]), "M1_perm_avg": MG.average([sa, sbp])}
|
| 200 |
+
rungs["M4_perm_repair"] = repair(rungs["M1_perm_avg"], st_a, st_b, shell, blocks, DEV, A.bs, NL)
|
| 201 |
+
rungs["M5_naive_repair"] = repair(rungs["M0_naive_avg"], st_a, st_braw, shell, blocks, DEV, A.bs, NL)
|
| 202 |
+
floor = min(PAR[a][0], PAR[b][0]); ceil = max(PAR[a][1], PAR[b][1])
|
| 203 |
+
res = {}
|
| 204 |
+
for k, sd in rungs.items():
|
| 205 |
+
nll, acc = evaluate(sd)
|
| 206 |
+
res[k] = {"nll": nll, "delta_floor": nll - floor, "blimp_acc": acc,
|
| 207 |
+
"blimp_delta_vs_ceiling": acc - ceil}
|
| 208 |
+
r = {"set": "set1_repair", "size": A.size, "pair": [a, b], "floor": floor, "blimp_ceiling": ceil,
|
| 209 |
+
"parent_nll": {"a": PAR[a][0], "b": PAR[b][0]},
|
| 210 |
+
"parent_blimp": {"a": PAR[a][1], "b": PAR[b][1]}, "rungs": res, "secs": time.time() - t0}
|
| 211 |
+
fh.write(json.dumps(r) + "\n"); fh.flush()
|
| 212 |
+
log(f"pair {a},{b} floor={floor:.2f}/ceil={ceil:.3f} | " +
|
| 213 |
+
" | ".join(f"{k}: {v['delta_floor']:+.2f}n {v['blimp_acc']:.3f}" for k, v in res.items()) +
|
| 214 |
+
f" ({r['secs']:.0f}s)")
|
| 215 |
+
del rungs, sbp; gc.collect()
|
| 216 |
+
fh.close()
|
| 217 |
+
log("DONE repair", A.size)
|
code/set4_goldfish_lib.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared with set4_goldfish.py: cross-lingual sentence-level activations."""
|
| 2 |
+
import sys
|
| 3 |
+
sys.path.insert(0,"/root/compose-audit")
|
| 4 |
+
from common import *
|
| 5 |
+
|
| 6 |
+
@torch.no_grad()
|
| 7 |
+
def sent_acts(model, tok, lines, dev, bs=16, maxlen=128):
|
| 8 |
+
"""Mean-pooled per-sentence residual activations, {layer: (n_sent, d)} -- rows are matched
|
| 9 |
+
ACROSS LANGUAGES by FLORES sentence id, which is what makes a cross-lingual basis map fittable."""
|
| 10 |
+
outs = None
|
| 11 |
+
for i in range(0, len(lines), bs):
|
| 12 |
+
enc = tok(lines[i:i + bs], return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 13 |
+
ids = enc["input_ids"].to(dev); am = enc["attention_mask"].to(dev).float()
|
| 14 |
+
hs = model(ids, attention_mask=enc["attention_mask"].to(dev), output_hidden_states=True).hidden_states
|
| 15 |
+
if outs is None:
|
| 16 |
+
outs = [[] for _ in hs]
|
| 17 |
+
w = am / am.sum(1, keepdim=True).clamp(min=1)
|
| 18 |
+
for j, h in enumerate(hs):
|
| 19 |
+
outs[j].append((h.float() * w.unsqueeze(-1)).sum(1).cpu())
|
| 20 |
+
return {j: torch.cat(o).numpy().astype(np.float64) for j, o in enumerate(outs)}
|
| 21 |
+
|
| 22 |
+
|
code/set4_multiblimp.py
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""SET 4, ACCURACY arm: MultiBLiMP 1.0 (jumelet/multiblimp) on the Goldfish merges.
|
| 2 |
+
|
| 3 |
+
The Δfloor tables for SET 4 are likelihood only. This asks the accuracy question directly, on the
|
| 4 |
+
same merges: does anything survive as *grammatical competence*? Minimal pairs are `sen` (grammatical)
|
| 5 |
+
vs `wrong_sen`; a model is correct when it assigns the higher total log-probability to `sen`.
|
| 6 |
+
Chance = 0.500.
|
| 7 |
+
|
| 8 |
+
CAVEAT built into the design: the merged models live in the ENGLISH parent's token-id space, so
|
| 9 |
+
partner-language items must be tokenized with the English tokenizer. The per-cell UNK rate is
|
| 10 |
+
reported alongside every number; where it is high (Greek) the partner-language accuracy is not
|
| 11 |
+
interpretable as grammatical competence and is marked as such."""
|
| 12 |
+
import os, sys, json, time, csv, argparse, gc
|
| 13 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 14 |
+
from common import *
|
| 15 |
+
import gpt2_align as G2
|
| 16 |
+
from mergeschool.core.models import load_hf
|
| 17 |
+
from huggingface_hub import hf_hub_download
|
| 18 |
+
|
| 19 |
+
ap = argparse.ArgumentParser()
|
| 20 |
+
ap.add_argument("--pairs", default="nld_Latn:nld_latn:nld,spa_Latn:spa_latn:spa,ell_Grek:ell_grek:ell,pol_Latn:pol_latn:pol")
|
| 21 |
+
ap.add_argument("--n_sent", type=int, default=500)
|
| 22 |
+
ap.add_argument("--max_items", type=int, default=1200)
|
| 23 |
+
ap.add_argument("--bs", type=int, default=48)
|
| 24 |
+
A = ap.parse_args()
|
| 25 |
+
OUT = "/root/compose-audit/results/set4_multiblimp.jsonl"
|
| 26 |
+
DEV = "cuda"
|
| 27 |
+
ENG_REPO = "goldfish-models/eng_latn_1000mb"
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def log(*a):
|
| 31 |
+
print(f"[{time.strftime('%H:%M:%S')}]", *a, flush=True)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def mb_pairs(lang, n):
|
| 35 |
+
p = hf_hub_download("jumelet/multiblimp", f"{lang}/data.tsv", repo_type="dataset")
|
| 36 |
+
rows = list(csv.DictReader(open(p, encoding="utf-8"), delimiter="\t"))[:n]
|
| 37 |
+
return [(r["sen"], r["wrong_sen"], r.get("phenomenon", "?")) for r in rows
|
| 38 |
+
if r.get("sen") and r.get("wrong_sen")]
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def encode(tok, sents, maxlen=64):
|
| 42 |
+
e = tok(sents, return_tensors="pt", padding=True, truncation=True, max_length=maxlen)
|
| 43 |
+
return e["input_ids"], e["attention_mask"]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@torch.no_grad()
|
| 47 |
+
def score(model, ids, am, dev, bs):
|
| 48 |
+
out = []
|
| 49 |
+
for i in range(0, ids.shape[0], bs):
|
| 50 |
+
x, m = ids[i:i + bs].to(dev), am[i:i + bs].to(dev)
|
| 51 |
+
lp = torch.log_softmax(model(x, attention_mask=m).logits.float()[:, :-1], -1)
|
| 52 |
+
out.append((lp.gather(-1, x[:, 1:].unsqueeze(-1)).squeeze(-1) * m[:, 1:].float()).sum(1).cpu())
|
| 53 |
+
return torch.cat(out).numpy()
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def unk_rate(tok, ids, am):
|
| 57 |
+
u = tok.unk_token_id
|
| 58 |
+
if u is None: return 0.0
|
| 59 |
+
return float(((ids == u) & (am.bool())).sum().item() / max(1, am.sum().item()))
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
log("loading eng parent")
|
| 63 |
+
m_e, tok_e = load_hf(ENG_REPO, dtype=torch.float32, device=DEV); m_e.eval()
|
| 64 |
+
cfg = m_e.config
|
| 65 |
+
D, NH, NL, V = cfg.n_embd, cfg.n_head, cfg.n_layer, cfg.vocab_size
|
| 66 |
+
SD_E = sd_np(m_e)
|
| 67 |
+
shell = m_e
|
| 68 |
+
|
| 69 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 70 |
+
from set4_goldfish_lib import sent_acts # noqa
|
| 71 |
+
|
| 72 |
+
eng_lines = flores_lines("eng_Latn")[: A.n_sent]
|
| 73 |
+
acts_e = sent_acts(m_e, tok_e, eng_lines, DEV)
|
| 74 |
+
MB_ENG = mb_pairs("eng", A.max_items)
|
| 75 |
+
ENC_ENG_E = (encode(tok_e, [g for g, b, p in MB_ENG]), encode(tok_e, [b for g, b, p in MB_ENG]))
|
| 76 |
+
log(f"MultiBLiMP eng items={len(MB_ENG)} UNK(eng tok)={unk_rate(tok_e, *ENC_ENG_E[0]):.2%}")
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def acc(sd, enc_g, enc_b):
|
| 80 |
+
sd_load(shell, sd, DEV)
|
| 81 |
+
sg = score(shell, *enc_g, DEV, A.bs); sb = score(shell, *enc_b, DEV, A.bs)
|
| 82 |
+
return float((sg > sb).mean())
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
ACC_E_ENG = acc(SD_E, *ENC_ENG_E)
|
| 86 |
+
log(f"eng parent, MultiBLiMP-eng = {ACC_E_ENG:.4f}")
|
| 87 |
+
|
| 88 |
+
done = set()
|
| 89 |
+
if os.path.exists(OUT):
|
| 90 |
+
for l in open(OUT):
|
| 91 |
+
try: done.add(json.loads(l)["lang"])
|
| 92 |
+
except Exception: pass
|
| 93 |
+
fh = open(OUT, "a")
|
| 94 |
+
|
| 95 |
+
for spec in A.pairs.split(","):
|
| 96 |
+
fcode, gcode, mb = spec.split(":")
|
| 97 |
+
if fcode in done: continue
|
| 98 |
+
t0 = time.time()
|
| 99 |
+
repo = f"goldfish-models/{gcode}_1000mb"
|
| 100 |
+
log(f"=== {fcode} <- {repo}")
|
| 101 |
+
m_x, tok_x = load_hf(repo, dtype=torch.float32, device=DEV); m_x.eval()
|
| 102 |
+
SD_X = sd_np(m_x)
|
| 103 |
+
x_lines = flores_lines(fcode)[: A.n_sent]
|
| 104 |
+
acts_x = sent_acts(m_x, tok_x, x_lines, DEV)
|
| 105 |
+
MB_X = mb_pairs(mb, A.max_items)
|
| 106 |
+
ENC_X_X = (encode(tok_x, [g for g, b, p in MB_X]), encode(tok_x, [b for g, b, p in MB_X]))
|
| 107 |
+
ENC_X_E = (encode(tok_e, [g for g, b, p in MB_X]), encode(tok_e, [b for g, b, p in MB_X]))
|
| 108 |
+
unk_x_e = unk_rate(tok_e, *ENC_X_E[0]); unk_x_x = unk_rate(tok_x, *ENC_X_X[0])
|
| 109 |
+
sg = score(m_x, *ENC_X_X[0], DEV, A.bs); sb = score(m_x, *ENC_X_X[1], DEV, A.bs)
|
| 110 |
+
ACC_X_X = float((sg > sb).mean())
|
| 111 |
+
del m_x; torch.cuda.empty_cache()
|
| 112 |
+
ACC_E_X = acc(SD_E, *ENC_X_E) # English parent on partner-language items
|
| 113 |
+
log(f" items={len(MB_X)} UNK(eng tok on {mb})={unk_x_e:.2%} X parent MB-{mb}={ACC_X_X:.4f} "
|
| 114 |
+
f"eng parent MB-{mb}={ACC_E_X:.4f} (chance 0.5)")
|
| 115 |
+
|
| 116 |
+
vkeys = [k for k in SD_X if k.endswith("wte.weight") or k.endswith("lm_head.weight")]
|
| 117 |
+
SD_X_V, cov = AL.remap_vocab_rows(SD_X, tok_e, tok_x, V, keys=vkeys)
|
| 118 |
+
for k in vkeys:
|
| 119 |
+
W = np.asarray(SD_X_V[k], float)
|
| 120 |
+
if W.shape[0] == V:
|
| 121 |
+
bad = ~np.isfinite(W).all(axis=1); W[bad] = np.asarray(SD_E[k], float)[bad]
|
| 122 |
+
SD_X_V[k] = W
|
| 123 |
+
BODY = [k for k in SD_E if not (k.endswith("wte.weight") or k.endswith("lm_head.weight"))]
|
| 124 |
+
R_emb, n_anch = G2.emb_procrustes(SD_E, SD_X, tok_e, tok_x)
|
| 125 |
+
sd_emb = G2.apply_resid(SD_X_V, D, R=R_emb)
|
| 126 |
+
sd_emb2, _ = G2.align_full(SD_E, sd_emb, D, NH, None, None, "permutation", body_keys=BODY)
|
| 127 |
+
sdp, ip = G2.align_full(SD_E, SD_X_V, D, NH, acts_e, acts_x, "permutation", body_keys=BODY)
|
| 128 |
+
sdo, io = G2.align_full(SD_E, SD_X_V, D, NH, acts_e, acts_x, "orthogonal", body_keys=BODY)
|
| 129 |
+
sdof, _ = G2.align_full(SD_E, SD_X_V, D, NH, acts_e, acts_x, "orthogonal", body_keys=BODY, accept_each=False)
|
| 130 |
+
|
| 131 |
+
rungs = {"M0_naive_avg": MG.average([SD_E, SD_X]),
|
| 132 |
+
"M1a_vocab_avg": MG.average([SD_E, SD_X_V]),
|
| 133 |
+
"M1b_vocab_perm_avg": MG.average([SD_E, sdp]),
|
| 134 |
+
"M1c_vocab_orth_avg": MG.average([SD_E, sdo]),
|
| 135 |
+
"M1e_vocab_orth_forced": MG.average([SD_E, sdof]),
|
| 136 |
+
"M1g_emb_procrustes": MG.average([SD_E, sd_emb]),
|
| 137 |
+
"M1h_emb_proc_units": MG.average([SD_E, sd_emb2])}
|
| 138 |
+
res = {}
|
| 139 |
+
for k, sd in rungs.items():
|
| 140 |
+
res[k] = {"mb_eng": acc(sd, *ENC_ENG_E), "mb_x": acc(sd, *ENC_X_E)}
|
| 141 |
+
res[k]["delta_eng_vs_eng_parent"] = res[k]["mb_eng"] - ACC_E_ENG
|
| 142 |
+
res[k]["delta_x_vs_x_parent"] = res[k]["mb_x"] - ACC_X_X
|
| 143 |
+
|
| 144 |
+
r = {"set": "set4_multiblimp", "lang": fcode, "mb_lang": mb, "repo_b": repo,
|
| 145 |
+
"metric": "MultiBLiMP 1.0 accuracy (chance=0.5) -- ACCURACY, not likelihood",
|
| 146 |
+
"n_items_eng": len(MB_ENG), "n_items_x": len(MB_X),
|
| 147 |
+
"unk_rate_eng_tok_on_x_items": unk_x_e, "unk_rate_own_tok_on_x_items": unk_x_x,
|
| 148 |
+
"parents": {"eng_on_mb_eng": ACC_E_ENG, "x_on_mb_x": ACC_X_X, "eng_on_mb_x": ACC_E_X},
|
| 149 |
+
"rungs": res, "align_info": {"perm": ip, "orth": io}, "secs": time.time() - t0}
|
| 150 |
+
fh.write(json.dumps(r) + "\n"); fh.flush()
|
| 151 |
+
log(" " + " ".join(f"{k}: eng={v['mb_eng']:.3f} x={v['mb_x']:.3f}" for k, v in res.items()))
|
| 152 |
+
del rungs, sdp, sdo, sdof, sd_emb, sd_emb2, SD_X, SD_X_V; gc.collect()
|
| 153 |
+
fh.close()
|
| 154 |
+
log("DONE set4_multiblimp")
|
code/set4_reverse.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""SET 4, REVERSE direction: the partner language is the anchor, English is transported into it.
|
| 2 |
+
|
| 3 |
+
Same four Goldfish pairs, same rungs, same metric — but the merged model now lives in the PARTNER
|
| 4 |
+
language's tokenizer and residual basis. If the composition failure were an artifact of anchoring on
|
| 5 |
+
English (English rows filling every unshared id, English tokenizer scoring the partner text), it
|
| 6 |
+
would not survive the swap."""
|
| 7 |
+
import os, sys, json, time, argparse, gc
|
| 8 |
+
sys.path.insert(0, "/root/compose-audit")
|
| 9 |
+
from common import *
|
| 10 |
+
import gpt2_align as G2
|
| 11 |
+
from set4_goldfish_lib import sent_acts
|
| 12 |
+
from mergeschool.core.models import load_hf
|
| 13 |
+
|
| 14 |
+
ap = argparse.ArgumentParser()
|
| 15 |
+
ap.add_argument("--pairs", default="nld_Latn:nld_latn,spa_Latn:spa_latn,ell_Grek:ell_grek,pol_Latn:pol_latn")
|
| 16 |
+
ap.add_argument("--n_sent", type=int, default=500)
|
| 17 |
+
ap.add_argument("--bs", type=int, default=8)
|
| 18 |
+
ap.add_argument("--barrier_n", type=int, default=7)
|
| 19 |
+
A = ap.parse_args()
|
| 20 |
+
OUT = "/root/compose-audit/results/set4_reverse.jsonl"
|
| 21 |
+
DEV = "cuda"
|
| 22 |
+
ENG_REPO = "goldfish-models/eng_latn_1000mb"
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def log(*a):
|
| 26 |
+
print(f"[{time.strftime('%H:%M:%S')}]", *a, flush=True)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def build_blocks(tok, text, block=512, max_blocks=64):
|
| 30 |
+
ids = tok(text)["input_ids"]
|
| 31 |
+
n = max(1, min(max_blocks, len(ids) // block))
|
| 32 |
+
arr = torch.from_numpy(np.asarray(ids[: n * block], dtype=np.int64).reshape(n, block))
|
| 33 |
+
nb = sum(len(tok.decode(list(arr[i, 1:].numpy())).encode("utf-8")) for i in range(n))
|
| 34 |
+
return arr, nb
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
@torch.no_grad()
|
| 38 |
+
def nll_total(model, blocks, dev, bs=8):
|
| 39 |
+
tot, ntok = 0.0, 0
|
| 40 |
+
for i in range(0, blocks.shape[0], bs):
|
| 41 |
+
x = blocks[i:i + bs].to(dev)
|
| 42 |
+
lp = torch.log_softmax(model(x).logits.float()[:, :-1], -1)
|
| 43 |
+
tgt = x[:, 1:]
|
| 44 |
+
tot += (-lp.gather(-1, tgt.unsqueeze(-1)).squeeze(-1)).sum().item(); ntok += tgt.numel()
|
| 45 |
+
return tot, ntok
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
eng_lines = flores_lines("eng_Latn")[: A.n_sent]
|
| 49 |
+
eng_text = "\n".join(eng_lines)
|
| 50 |
+
m_e, tok_e = load_hf(ENG_REPO, dtype=torch.float32, device=DEV); m_e.eval()
|
| 51 |
+
SD_E = sd_np(m_e)
|
| 52 |
+
cfg = m_e.config
|
| 53 |
+
D, NH, NL, V = cfg.n_embd, cfg.n_head, cfg.n_layer, cfg.vocab_size
|
| 54 |
+
acts_e = sent_acts(m_e, tok_e, eng_lines, DEV)
|
| 55 |
+
bl_e_e, by_e_e = build_blocks(tok_e, eng_text)
|
| 56 |
+
te0, _ = nll_total(m_e, bl_e_e, DEV, bs=A.bs)
|
| 57 |
+
ENG_ON_ENG = te0 / by_e_e
|
| 58 |
+
del m_e; torch.cuda.empty_cache()
|
| 59 |
+
log(f"eng parent on eng (own tok) = {ENG_ON_ENG:.4f} nats/byte")
|
| 60 |
+
|
| 61 |
+
done = set()
|
| 62 |
+
if os.path.exists(OUT):
|
| 63 |
+
for l in open(OUT):
|
| 64 |
+
try: done.add(json.loads(l)["lang"])
|
| 65 |
+
except Exception: pass
|
| 66 |
+
fh = open(OUT, "a")
|
| 67 |
+
|
| 68 |
+
for spec in A.pairs.split(","):
|
| 69 |
+
fcode, gcode = spec.split(":")
|
| 70 |
+
if fcode in done: continue
|
| 71 |
+
t0 = time.time()
|
| 72 |
+
repo = f"goldfish-models/{gcode}_1000mb"
|
| 73 |
+
log(f"=== ANCHOR={fcode} transporting {ENG_REPO} into it")
|
| 74 |
+
m_x, tok_x = load_hf(repo, dtype=torch.float32, device=DEV); m_x.eval()
|
| 75 |
+
SD_X = sd_np(m_x) # ANCHOR (role "A")
|
| 76 |
+
shell = m_x
|
| 77 |
+
x_lines = flores_lines(fcode)[: A.n_sent]
|
| 78 |
+
x_text = "\n".join(x_lines)
|
| 79 |
+
acts_x = sent_acts(m_x, tok_x, x_lines, DEV)
|
| 80 |
+
bl_x_x, by_x_x = build_blocks(tok_x, x_text) # X text, X tok (anchor space)
|
| 81 |
+
bl_e_x, by_e_x = build_blocks(tok_x, eng_text) # eng text, X tok (anchor space)
|
| 82 |
+
tx, _ = nll_total(m_x, bl_x_x, DEV, bs=A.bs); X_ON_X = tx / by_x_x
|
| 83 |
+
|
| 84 |
+
def ev(sd, blocks):
|
| 85 |
+
sd_load(shell, sd, DEV)
|
| 86 |
+
t, n = nll_total(shell, blocks, DEV, bs=A.bs)
|
| 87 |
+
return t, n
|
| 88 |
+
|
| 89 |
+
tex, _ = ev(SD_X, bl_e_x); X_ON_ENG = tex / by_e_x
|
| 90 |
+
log(f" parents: X/X={X_ON_X:.4f} X-on-eng={X_ON_ENG:.4f} eng/eng(own tok)={ENG_ON_ENG:.4f}")
|
| 91 |
+
|
| 92 |
+
# transport ENGLISH into the anchor's id space
|
| 93 |
+
vkeys = [k for k in SD_E if k.endswith("wte.weight") or k.endswith("lm_head.weight")]
|
| 94 |
+
SD_E_V, cov = AL.remap_vocab_rows(SD_E, tok_x, tok_e, V, keys=vkeys)
|
| 95 |
+
for k in vkeys:
|
| 96 |
+
W = np.asarray(SD_E_V[k], float)
|
| 97 |
+
if W.shape[0] == V:
|
| 98 |
+
bad = ~np.isfinite(W).all(axis=1); W[bad] = np.asarray(SD_X[k], float)[bad]
|
| 99 |
+
SD_E_V[k] = W
|
| 100 |
+
anchors = AL.vocab_anchors(tok_x, tok_e)
|
| 101 |
+
BODY = [k for k in SD_X if not (k.endswith("wte.weight") or k.endswith("lm_head.weight"))]
|
| 102 |
+
R_emb, n_anch = G2.emb_procrustes(SD_X, SD_E, tok_x, tok_e)
|
| 103 |
+
sd_emb = G2.apply_resid(SD_E_V, D, R=R_emb)
|
| 104 |
+
sdp, ip = G2.align_full(SD_X, SD_E_V, D, NH, acts_x, acts_e, "permutation", body_keys=BODY)
|
| 105 |
+
sdo, io = G2.align_full(SD_X, SD_E_V, D, NH, acts_x, acts_e, "orthogonal", body_keys=BODY)
|
| 106 |
+
sdof, _ = G2.align_full(SD_X, SD_E_V, D, NH, acts_x, acts_e, "orthogonal", body_keys=BODY, accept_each=False)
|
| 107 |
+
|
| 108 |
+
rungs = {"M0_naive_avg": MG.average([SD_X, SD_E]),
|
| 109 |
+
"M1a_vocab_avg": MG.average([SD_X, SD_E_V]),
|
| 110 |
+
"M1b_vocab_perm_avg": MG.average([SD_X, sdp]),
|
| 111 |
+
"M1c_vocab_orth_avg": MG.average([SD_X, sdo]),
|
| 112 |
+
"M1e_vocab_orth_forced": MG.average([SD_X, sdof]),
|
| 113 |
+
"M1g_emb_procrustes": MG.average([SD_X, sd_emb])}
|
| 114 |
+
res = {}
|
| 115 |
+
for k, sd in rungs.items():
|
| 116 |
+
t_x, n_x = ev(sd, bl_x_x); t_e, n_e = ev(sd, bl_e_x)
|
| 117 |
+
res[k] = {"x": {"nats_per_byte": t_x / by_x_x, "nats_per_token": t_x / n_x},
|
| 118 |
+
"eng": {"nats_per_byte": t_e / by_e_x, "nats_per_token": t_e / n_e},
|
| 119 |
+
"delta_floor_x": t_x / by_x_x - X_ON_X,
|
| 120 |
+
"delta_floor_eng": t_e / by_e_x - min(X_ON_ENG, ENG_ON_ENG)}
|
| 121 |
+
res[k]["delta_floor_mean"] = 0.5 * (res[k]["delta_floor_x"] + res[k]["delta_floor_eng"])
|
| 122 |
+
for k in res:
|
| 123 |
+
res[k]["delta_vs_naive_mean"] = res[k]["delta_floor_mean"] - res["M0_naive_avg"]["delta_floor_mean"]
|
| 124 |
+
|
| 125 |
+
r = {"set": "set4_reverse", "lang": fcode, "anchor": fcode, "repo_a": repo, "repo_b": ENG_REPO,
|
| 126 |
+
"corpus": "flores200_devtest", "n_sent": A.n_sent,
|
| 127 |
+
"metric": "nats_per_utf8_byte (likelihood, NOT benchmark accuracy)",
|
| 128 |
+
"parents": {"x_on_x": X_ON_X, "x_on_eng": X_ON_ENG, "eng_on_eng_own_tok": ENG_ON_ENG},
|
| 129 |
+
"floor_x": X_ON_X, "floor_eng": min(X_ON_ENG, ENG_ON_ENG),
|
| 130 |
+
"vocab_anchors": len(anchors), "align_info": {"perm": ip, "orth": io},
|
| 131 |
+
"rungs": res, "secs": time.time() - t0}
|
| 132 |
+
fh.write(json.dumps(r) + "\n"); fh.flush()
|
| 133 |
+
log(" " + " ".join(f"{k}: dfl_mean={v['delta_floor_mean']:+.4f}" for k, v in res.items()))
|
| 134 |
+
del rungs, sdp, sdo, sdof, sd_emb, SD_E_V, m_x; gc.collect(); torch.cuda.empty_cache()
|
| 135 |
+
fh.close()
|
| 136 |
+
log("DONE set4_reverse")
|
results/alignment_health.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"set1_pythia14m": {
|
| 3 |
+
"parent_nll": 4.414665286866031,
|
| 4 |
+
"nll_change_after_alignment": {
|
| 5 |
+
"permutation_residual+mlp": 3.025878587692432e-06,
|
| 6 |
+
"permutation_full(+heads)": 5.892500407611578e-06,
|
| 7 |
+
"orthogonal_residual+mlp": 27.2622880929448
|
| 8 |
+
}
|
| 9 |
+
},
|
| 10 |
+
"set4_goldfish_nld": {
|
| 11 |
+
"parent_nll": 4.093903364267368,
|
| 12 |
+
"nll_change_after_alignment": {
|
| 13 |
+
"perm_residual_only": 0.0,
|
| 14 |
+
"mlp_only": 0.0,
|
| 15 |
+
"heads_only": 0.0,
|
| 16 |
+
"perm_full": 0.0,
|
| 17 |
+
"orth_full": 0.06913312400623717
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
results/blimp_160m.jsonl
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"set": "set1_blimp", "size": "160m", "pair": [1, 2], "metric": "BLiMP accuracy (chance=0.5) -- ACCURACY, not likelihood", "n_per_paradigm": 150, "n_paradigms": 67, "parent_acc": {"a": 0.780497512437811, "b": 0.7677611940298508}, "ceiling": 0.780497512437811, "rungs": {"M0_naive_avg": {"blimp_acc": 0.5619900497512438, "delta_vs_best_parent": -0.21850746268656718}, "M1_perm_avg": {"blimp_acc": 0.5450746268656717, "delta_vs_best_parent": -0.2354228855721393}, "M1_orth_avg": {"blimp_acc": 0.5556218905472636, "delta_vs_best_parent": -0.22487562189054733}}, "per_paradigm": {"M0_naive_avg": {"adjunct_island": 0.4533333333333333, "anaphor_gender_agreement": 0.38, "anaphor_number_agreement": 0.6066666666666667, "animate_subject_passive": 0.6266666666666667, "animate_subject_trans": 0.52, "causative": 0.4666666666666667, "complex_NP_island": 0.49333333333333335, "coordinate_structure_constraint_complex_left_branch": 0.5933333333333334, "coordinate_structure_constraint_object_extraction": 0.38666666666666666, "determiner_noun_agreement_1": 0.56, "determiner_noun_agreement_2": 0.54, "determiner_noun_agreement_irregular_1": 0.4866666666666667, "determiner_noun_agreement_irregular_2": 0.5533333333333333, "determiner_noun_agreement_with_adj_2": 0.5133333333333333, "determiner_noun_agreement_with_adj_irregular_1": 0.54, "determiner_noun_agreement_with_adj_irregular_2": 0.58, "determiner_noun_agreement_with_adjective_1": 0.46, "distractor_agreement_relational_noun": 0.48, "distractor_agreement_relative_clause": 0.4666666666666667, "drop_argument": 0.74, "ellipsis_n_bar_1": 0.66, "ellipsis_n_bar_2": 0.26, "existential_there_object_raising": 0.7666666666666667, "existential_there_quantifiers_1": 0.72, "existential_there_quantifiers_2": 0.19333333333333333, "existential_there_subject_raising": 0.62, "expletive_it_object_raising": 0.6533333333333333, "inchoative": 0.4, "intransitive": 0.4533333333333333, "irregular_past_participle_adjectives": 1.0, "irregular_past_participle_verbs": 0.5866666666666667, "irregular_plural_subject_verb_agreement_1": 0.44666666666666666, "irregular_plural_subject_verb_agreement_2": 0.5266666666666666, "left_branch_island_echo_question": 0.28, "left_branch_island_simple_question": 0.6266666666666667, "matrix_question_npi_licensor_present": 0.22, "npi_present_1": 0.38666666666666666, "npi_present_2": 0.8066666666666666, "only_npi_licensor_present": 0.6, "only_npi_scope": 0.7666666666666667, "passive_1": 0.6666666666666666, "passive_2": 0.66, "principle_A_c_command": 0.6866666666666666, "principle_A_case_1": 0.96, "principle_A_case_2": 0.44, "principle_A_domain_1": 0.5266666666666666, "principle_A_domain_2": 0.5333333333333333, "principle_A_domain_3": 0.4533333333333333, "principle_A_reconstruction": 0.37333333333333335, "regular_plural_subject_verb_agreement_1": 0.56, "regular_plural_subject_verb_agreement_2": 0.5666666666666667, "sentential_negation_npi_licensor_present": 1.0, "sentential_negation_npi_scope": 0.52, "sentential_subject_island": 0.48, "superlative_quantifiers_1": 0.10666666666666667, "superlative_quantifiers_2": 0.34, "tough_vs_raising_1": 0.22, "tough_vs_raising_2": 0.8266666666666667, "transitive": 0.49333333333333335, "wh_island": 0.9333333333333333, "wh_questions_object_gap": 0.9333333333333333, "wh_questions_subject_gap": 0.9733333333333334, "wh_questions_subject_gap_long_distance": 0.9533333333333334, "wh_vs_that_no_gap": 0.9866666666666667, "wh_vs_that_no_gap_long_distance": 0.96, "wh_vs_that_with_gap": 0.04, "wh_vs_that_with_gap_long_distance": 0.04}, "M1_perm_avg": {"adjunct_island": 0.46, "anaphor_gender_agreement": 0.28, "anaphor_number_agreement": 0.47333333333333333, "animate_subject_passive": 0.64, "animate_subject_trans": 0.5, "causative": 0.26, "complex_NP_island": 0.6133333333333333, "coordinate_structure_constraint_complex_left_branch": 0.35333333333333333, "coordinate_structure_constraint_object_extraction": 0.5866666666666667, "determiner_noun_agreement_1": 0.56, "determiner_noun_agreement_2": 0.5, "determiner_noun_agreement_irregular_1": 0.4666666666666667, "determiner_noun_agreement_irregular_2": 0.5333333333333333, "determiner_noun_agreement_with_adj_2": 0.48, "determiner_noun_agreement_with_adj_irregular_1": 0.49333333333333335, "determiner_noun_agreement_with_adj_irregular_2": 0.5533333333333333, "determiner_noun_agreement_with_adjective_1": 0.5066666666666667, "distractor_agreement_relational_noun": 0.4666666666666667, "distractor_agreement_relative_clause": 0.5, "drop_argument": 0.6533333333333333, "ellipsis_n_bar_1": 0.4666666666666667, "ellipsis_n_bar_2": 0.16666666666666666, "existential_there_object_raising": 0.72, "existential_there_quantifiers_1": 0.6066666666666667, "existential_there_quantifiers_2": 0.37333333333333335, "existential_there_subject_raising": 0.6733333333333333, "expletive_it_object_raising": 0.66, "inchoative": 0.32666666666666666, "intransitive": 0.43333333333333335, "irregular_past_participle_adjectives": 0.04, "irregular_past_participle_verbs": 0.76, "irregular_plural_subject_verb_agreement_1": 0.5933333333333334, "irregular_plural_subject_verb_agreement_2": 0.4533333333333333, "left_branch_island_echo_question": 0.6466666666666666, "left_branch_island_simple_question": 0.36666666666666664, "matrix_question_npi_licensor_present": 0.16, "npi_present_1": 0.9666666666666667, "npi_present_2": 0.92, "only_npi_licensor_present": 0.9666666666666667, "only_npi_scope": 0.88, "passive_1": 0.56, "passive_2": 0.5733333333333334, "principle_A_c_command": 0.7866666666666666, "principle_A_case_1": 0.8666666666666667, "principle_A_case_2": 0.30666666666666664, "principle_A_domain_1": 0.6333333333333333, "principle_A_domain_2": 0.5066666666666667, "principle_A_domain_3": 0.46, "principle_A_reconstruction": 0.22666666666666666, "regular_plural_subject_verb_agreement_1": 0.38, "regular_plural_subject_verb_agreement_2": 0.52, "sentential_negation_npi_licensor_present": 0.92, "sentential_negation_npi_scope": 0.44, "sentential_subject_island": 0.5266666666666666, "superlative_quantifiers_1": 0.38, "superlative_quantifiers_2": 0.7466666666666667, "tough_vs_raising_1": 0.26666666666666666, "tough_vs_raising_2": 0.8, "transitive": 0.5, "wh_island": 0.06666666666666667, "wh_questions_object_gap": 1.0, "wh_questions_subject_gap": 1.0, "wh_questions_subject_gap_long_distance": 1.0, "wh_vs_that_no_gap": 1.0, "wh_vs_that_no_gap_long_distance": 0.9933333333333333, "wh_vs_that_with_gap": 0.0, "wh_vs_that_with_gap_long_distance": 0.0}, "M1_orth_avg": {"adjunct_island": 0.42, "anaphor_gender_agreement": 0.32666666666666666, "anaphor_number_agreement": 0.6, "animate_subject_passive": 0.54, "animate_subject_trans": 0.4266666666666667, "causative": 0.36666666666666664, "complex_NP_island": 0.58, "coordinate_structure_constraint_complex_left_branch": 0.18666666666666668, "coordinate_structure_constraint_object_extraction": 0.3933333333333333, "determiner_noun_agreement_1": 0.5533333333333333, "determiner_noun_agreement_2": 0.5333333333333333, "determiner_noun_agreement_irregular_1": 0.5266666666666666, "determiner_noun_agreement_irregular_2": 0.5866666666666667, "determiner_noun_agreement_with_adj_2": 0.48, "determiner_noun_agreement_with_adj_irregular_1": 0.54, "determiner_noun_agreement_with_adj_irregular_2": 0.5333333333333333, "determiner_noun_agreement_with_adjective_1": 0.52, "distractor_agreement_relational_noun": 0.46, "distractor_agreement_relative_clause": 0.41333333333333333, "drop_argument": 0.7466666666666667, "ellipsis_n_bar_1": 0.5, "ellipsis_n_bar_2": 0.35333333333333333, "existential_there_object_raising": 0.8266666666666667, "existential_there_quantifiers_1": 0.8666666666666667, "existential_there_quantifiers_2": 0.22, "existential_there_subject_raising": 0.6533333333333333, "expletive_it_object_raising": 0.6533333333333333, "inchoative": 0.41333333333333333, "intransitive": 0.58, "irregular_past_participle_adjectives": 0.6066666666666667, "irregular_past_participle_verbs": 0.54, "irregular_plural_subject_verb_agreement_1": 0.6266666666666667, "irregular_plural_subject_verb_agreement_2": 0.6533333333333333, "left_branch_island_echo_question": 0.6733333333333333, "left_branch_island_simple_question": 0.2866666666666667, "matrix_question_npi_licensor_present": 0.4666666666666667, "npi_present_1": 0.34, "npi_present_2": 0.47333333333333333, "only_npi_licensor_present": 0.9466666666666667, "only_npi_scope": 0.30666666666666664, "passive_1": 0.6133333333333333, "passive_2": 0.6533333333333333, "principle_A_c_command": 0.6933333333333334, "principle_A_case_1": 0.9866666666666667, "principle_A_case_2": 0.36, "principle_A_domain_1": 0.8466666666666667, "principle_A_domain_2": 0.5466666666666666, "principle_A_domain_3": 0.4066666666666667, "principle_A_reconstruction": 0.26, "regular_plural_subject_verb_agreement_1": 0.5666666666666667, "regular_plural_subject_verb_agreement_2": 0.5933333333333334, "sentential_negation_npi_licensor_present": 0.9933333333333333, "sentential_negation_npi_scope": 0.5133333333333333, "sentential_subject_island": 0.58, "superlative_quantifiers_1": 0.5533333333333333, "superlative_quantifiers_2": 0.9666666666666667, "tough_vs_raising_1": 0.32666666666666666, "tough_vs_raising_2": 0.68, "transitive": 0.4866666666666667, "wh_island": 0.26666666666666666, "wh_questions_object_gap": 0.74, "wh_questions_subject_gap": 0.9666666666666667, "wh_questions_subject_gap_long_distance": 0.9, "wh_vs_that_no_gap": 0.94, "wh_vs_that_no_gap_long_distance": 0.9666666666666667, "wh_vs_that_with_gap": 0.06, "wh_vs_that_with_gap_long_distance": 0.04}}, "secs": 136.26438093185425}
|
results/blimp_31m.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
results/repair_70m.jsonl
CHANGED
|
@@ -3,3 +3,8 @@
|
|
| 3 |
{"set": "set1_repair", "size": "70m", "pair": [1, 4], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.6809065309289384}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7046268656716418}, "rungs": {"M0_naive_avg": {"nll": 31.469823390614806, "delta_floor": 27.890990335025275, "blimp_acc": 0.5120149253731343, "blimp_delta_vs_ceiling": -0.21850746268656718}, "M1_perm_avg": {"nll": 34.52885987442922, "delta_floor": 30.950026818839692, "blimp_acc": 0.5324626865671642, "blimp_delta_vs_ceiling": -0.19805970149253727}, "M4_perm_repair": {"nll": 33.901358906148076, "delta_floor": 30.322525850558545, "blimp_acc": 0.5334328358208955, "blimp_delta_vs_ceiling": -0.19708955223880598}, "M5_naive_repair": {"nll": 27.07668085962981, "delta_floor": 23.49784780404028, "blimp_acc": 0.49417910447761193, "blimp_delta_vs_ceiling": -0.23634328358208956}}, "secs": 46.491278886795044}
|
| 4 |
{"set": "set1_repair", "size": "70m", "pair": [1, 5], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.653146961508276}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.712910447761194}, "rungs": {"M0_naive_avg": {"nll": 22.256370270711024, "delta_floor": 18.677537215121493, "blimp_acc": 0.5526865671641791, "blimp_delta_vs_ceiling": -0.1778358208955224}, "M1_perm_avg": {"nll": 19.006473469096544, "delta_floor": 15.427640413507014, "blimp_acc": 0.561865671641791, "blimp_delta_vs_ceiling": -0.16865671641791047}, "M4_perm_repair": {"nll": 19.184357226944716, "delta_floor": 15.605524171355185, "blimp_acc": 0.5460447761194029, "blimp_delta_vs_ceiling": -0.18447761194029855}, "M5_naive_repair": {"nll": 24.3843732163242, "delta_floor": 20.80554016073467, "blimp_acc": 0.539179104477612, "blimp_delta_vs_ceiling": -0.19134328358208952}}, "secs": 43.83965444564819}
|
| 5 |
{"set": "set1_repair", "size": "70m", "pair": [1, 6], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.652026510518591}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7257462686567164}, "rungs": {"M0_naive_avg": {"nll": 17.456871356205152, "delta_floor": 13.878038300615621, "blimp_acc": 0.48649253731343284, "blimp_delta_vs_ceiling": -0.24402985074626865}, "M1_perm_avg": {"nll": 12.588115814069635, "delta_floor": 9.009282758480104, "blimp_acc": 0.5443283582089552, "blimp_delta_vs_ceiling": -0.1861940298507463}, "M4_perm_repair": {"nll": 11.522275562622308, "delta_floor": 7.943442507032778, "blimp_acc": 0.5246268656716417, "blimp_delta_vs_ceiling": -0.20589552238805975}, "M5_naive_repair": {"nll": 16.34223865327381, "delta_floor": 12.76340559768428, "blimp_acc": 0.49977611940298505, "blimp_delta_vs_ceiling": -0.23074626865671644}}, "secs": 45.298933267593384}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
{"set": "set1_repair", "size": "70m", "pair": [1, 4], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.6809065309289384}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7046268656716418}, "rungs": {"M0_naive_avg": {"nll": 31.469823390614806, "delta_floor": 27.890990335025275, "blimp_acc": 0.5120149253731343, "blimp_delta_vs_ceiling": -0.21850746268656718}, "M1_perm_avg": {"nll": 34.52885987442922, "delta_floor": 30.950026818839692, "blimp_acc": 0.5324626865671642, "blimp_delta_vs_ceiling": -0.19805970149253727}, "M4_perm_repair": {"nll": 33.901358906148076, "delta_floor": 30.322525850558545, "blimp_acc": 0.5334328358208955, "blimp_delta_vs_ceiling": -0.19708955223880598}, "M5_naive_repair": {"nll": 27.07668085962981, "delta_floor": 23.49784780404028, "blimp_acc": 0.49417910447761193, "blimp_delta_vs_ceiling": -0.23634328358208956}}, "secs": 46.491278886795044}
|
| 4 |
{"set": "set1_repair", "size": "70m", "pair": [1, 5], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.653146961508276}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.712910447761194}, "rungs": {"M0_naive_avg": {"nll": 22.256370270711024, "delta_floor": 18.677537215121493, "blimp_acc": 0.5526865671641791, "blimp_delta_vs_ceiling": -0.1778358208955224}, "M1_perm_avg": {"nll": 19.006473469096544, "delta_floor": 15.427640413507014, "blimp_acc": 0.561865671641791, "blimp_delta_vs_ceiling": -0.16865671641791047}, "M4_perm_repair": {"nll": 19.184357226944716, "delta_floor": 15.605524171355185, "blimp_acc": 0.5460447761194029, "blimp_delta_vs_ceiling": -0.18447761194029855}, "M5_naive_repair": {"nll": 24.3843732163242, "delta_floor": 20.80554016073467, "blimp_acc": 0.539179104477612, "blimp_delta_vs_ceiling": -0.19134328358208952}}, "secs": 43.83965444564819}
|
| 5 |
{"set": "set1_repair", "size": "70m", "pair": [1, 6], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.652026510518591}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7257462686567164}, "rungs": {"M0_naive_avg": {"nll": 17.456871356205152, "delta_floor": 13.878038300615621, "blimp_acc": 0.48649253731343284, "blimp_delta_vs_ceiling": -0.24402985074626865}, "M1_perm_avg": {"nll": 12.588115814069635, "delta_floor": 9.009282758480104, "blimp_acc": 0.5443283582089552, "blimp_delta_vs_ceiling": -0.1861940298507463}, "M4_perm_repair": {"nll": 11.522275562622308, "delta_floor": 7.943442507032778, "blimp_acc": 0.5246268656716417, "blimp_delta_vs_ceiling": -0.20589552238805975}, "M5_naive_repair": {"nll": 16.34223865327381, "delta_floor": 12.76340559768428, "blimp_acc": 0.49977611940298505, "blimp_delta_vs_ceiling": -0.23074626865671644}}, "secs": 45.298933267593384}
|
| 6 |
+
{"set": "set1_repair", "size": "70m", "pair": [1, 7], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.6513079439823874}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7194776119402985}, "rungs": {"M0_naive_avg": {"nll": 20.72262344310584, "delta_floor": 17.143790387516308, "blimp_acc": 0.5322388059701493, "blimp_delta_vs_ceiling": -0.1982835820895522}, "M1_perm_avg": {"nll": 22.063156774910308, "delta_floor": 18.484323719320777, "blimp_acc": 0.5494776119402985, "blimp_delta_vs_ceiling": -0.18104477611940295}, "M4_perm_repair": {"nll": 22.484095982142858, "delta_floor": 18.905262926553327, "blimp_acc": 0.5373880597014925, "blimp_delta_vs_ceiling": -0.19313432835820898}, "M5_naive_repair": {"nll": 22.253626595115787, "delta_floor": 18.674793539526256, "blimp_acc": 0.5185820895522388, "blimp_delta_vs_ceiling": -0.21194029850746265}}, "secs": 51.879844665527344}
|
| 7 |
+
{"set": "set1_repair", "size": "70m", "pair": [1, 8], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.6366048814110403}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7105970149253731}, "rungs": {"M0_naive_avg": {"nll": 17.48817327391145, "delta_floor": 13.909340218321919, "blimp_acc": 0.5073880597014926, "blimp_delta_vs_ceiling": -0.2231343283582089}, "M1_perm_avg": {"nll": 20.054851852984346, "delta_floor": 16.476018797394815, "blimp_acc": 0.5556716417910448, "blimp_delta_vs_ceiling": -0.1748507462686567}, "M4_perm_repair": {"nll": 20.535853476129322, "delta_floor": 16.95702042053979, "blimp_acc": 0.5664179104477612, "blimp_delta_vs_ceiling": -0.16410447761194025}, "M5_naive_repair": {"nll": 18.670102790688194, "delta_floor": 15.091269735098663, "blimp_acc": 0.5109701492537313, "blimp_delta_vs_ceiling": -0.2195522388059702}}, "secs": 62.3910436630249}
|
| 8 |
+
{"set": "set1_repair", "size": "70m", "pair": [1, 9], "floor": 3.5788330555895302, "blimp_ceiling": 0.7305223880597015, "parent_nll": {"a": 3.5788330555895302, "b": 3.631728518810135}, "parent_blimp": {"a": 0.7305223880597015, "b": 0.7205970149253731}, "rungs": {"M0_naive_avg": {"nll": 20.806881421232877, "delta_floor": 17.228048365643346, "blimp_acc": 0.5282089552238806, "blimp_delta_vs_ceiling": -0.20231343283582093}, "M1_perm_avg": {"nll": 23.1886485598092, "delta_floor": 19.609815504219668, "blimp_acc": 0.5526119402985075, "blimp_delta_vs_ceiling": -0.17791044776119402}, "M4_perm_repair": {"nll": 22.703683035714285, "delta_floor": 19.124849980124754, "blimp_acc": 0.556865671641791, "blimp_delta_vs_ceiling": -0.17365671641791047}, "M5_naive_repair": {"nll": 20.535575732326322, "delta_floor": 16.95674267673679, "blimp_acc": 0.5292537313432836, "blimp_delta_vs_ceiling": -0.20126865671641792}}, "secs": 55.22801184654236}
|
| 9 |
+
{"set": "set1_repair", "size": "70m", "pair": [2, 3], "floor": 3.631012022611913, "blimp_ceiling": 0.7144029850746269, "parent_nll": {"a": 3.654927770685543, "b": 3.631012022611913}, "parent_blimp": {"a": 0.7114925373134329, "b": 0.7144029850746269}, "rungs": {"M0_naive_avg": {"nll": 21.89409233834801, "delta_floor": 18.263080315736097, "blimp_acc": 0.5023134328358209, "blimp_delta_vs_ceiling": -0.212089552238806}, "M1_perm_avg": {"nll": 12.230675465284573, "delta_floor": 8.59966344267266, "blimp_acc": 0.5131343283582089, "blimp_delta_vs_ceiling": -0.20126865671641792}, "M4_perm_repair": {"nll": 12.242747128281964, "delta_floor": 8.611735105670052, "blimp_acc": 0.5155223880597015, "blimp_delta_vs_ceiling": -0.19888059701492533}, "M5_naive_repair": {"nll": 21.926796671151337, "delta_floor": 18.295784648539424, "blimp_acc": 0.522686567164179, "blimp_delta_vs_ceiling": -0.1917164179104478}}, "secs": 38.11003923416138}
|
| 10 |
+
{"set": "set1_repair", "size": "70m", "pair": [2, 4], "floor": 3.654927770685543, "blimp_ceiling": 0.7114925373134329, "parent_nll": {"a": 3.654927770685543, "b": 3.6809065309289384}, "parent_blimp": {"a": 0.7114925373134329, "b": 0.7046268656716418}, "rungs": {"M0_naive_avg": {"nll": 22.71234087063764, "delta_floor": 19.057413099952097, "blimp_acc": 0.5008955223880597, "blimp_delta_vs_ceiling": -0.2105970149253732}, "M1_perm_avg": {"nll": 14.072119108773647, "delta_floor": 10.417191338088104, "blimp_acc": 0.5295522388059701, "blimp_delta_vs_ceiling": -0.18194029850746274}, "M4_perm_repair": {"nll": 14.23412018917156, "delta_floor": 10.579192418486016, "blimp_acc": 0.5261940298507463, "blimp_delta_vs_ceiling": -0.1852985074626866}, "M5_naive_repair": {"nll": 24.689999057199934, "delta_floor": 21.03507128651439, "blimp_acc": 0.5065671641791045, "blimp_delta_vs_ceiling": -0.20492537313432835}}, "secs": 62.753533124923706}
|
results/set1_160m.jsonl
CHANGED
|
@@ -26,3 +26,5 @@
|
|
| 26 |
{"set": "set1_polypythia", "size": "160m", "pair": [4, 9], "parent_nll": {"a": 3.2741363585111913, "b": 3.262358126108427}, "floor": 3.262358126108427, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.03161099443751422, "weight_cosine_bn": 0.198844620318614, "d_raw": 1.3926834761794986, "qmd_perm": 1.3306865199238942, "coord_share_perm": 0.044516185706229935, "norm_ratio_perm": 1.0000000000000009, "qmd_orth": 1.2979315969696825, "coord_share_orth": 0.0680354731211041, "d_raw_bn_perm": 1.193857643425369, "qmd_bn_perm": 1.132963438133865, "coordinate_gap_bn_perm": 0.06089420529150402, "coord_fraction_bn_perm": 0.05100625323869334, "d_raw_bn_orth": 1.193857643425369, "qmd_bn_orth": 1.0599208049643605, "coordinate_gap_bn_orth": 0.13393683846100846, "coord_fraction_bn_orth": 0.11218828241256822, "bnd_raw": 1.193857643425369, "bnd_perm": 1.132963438133865, "bnd_orth": 1.0599208049643605, "coord_share_bnd_perm": 0.05100625323869334, "coord_share_bnd_orth": 0.11218828241256822, "cka_mean": 0.7211211159755844, "cka_last": 0.8792108760076334, "qmd_act_perm": 0.27289764096798597, "aligned_cka_perm": 0.727102359032014, "qmd_act_procrustes": 0.2728976409679881, "aligned_cka_procrustes": 0.7271023590320119, "qmd_act_ot": 0.27214817102079025, "aligned_cka_ot": 0.7278518289792097, "task_vector_cosine": 0.5774673146699185}, "rungs": {"M0_naive_avg": {"nll": 16.348348061399218, "delta_floor": 13.08598993529079, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 10.698082134448386, "delta_floor": 7.4357240083399585, "delta_vs_naive": -5.650265926950832}, "M1_orth_avg": {"nll": 9.423008748929794, "delta_floor": 6.160650622821366, "delta_vs_naive": -6.925339312469424}, "M2_task_arith": {"nll": 42.591483457681015, "delta_floor": 39.32912533157259, "delta_vs_naive": 26.243135396281797}, "M3_ties": {"nll": 62.245552914016635, "delta_floor": 58.98319478790821, "delta_vs_naive": 45.89720485261742}}, "barrier_naive": {"barrier": 13.08010081908941, "losses": [3.2741363585111913, 9.463472549229452, 16.348348061399218, 9.968132242997799, 3.262358126108427]}, "barrier_perm": {"barrier": 7.429834772696001, "losses": [3.2741363585111913, 7.971878678831335, 10.698082134448386, 7.5754769580938115, 3.262358364993579]}, "secs": 103.6531343460083}
|
| 27 |
{"set": "set1_polypythia", "size": "160m", "pair": [5, 6], "parent_nll": {"a": 3.255690960968077, "b": 3.275654115322285}, "floor": 3.255690960968077, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.029452020971517494, "weight_cosine_bn": 0.20353675966522838, "d_raw": 1.393565225037434, "qmd_perm": 1.3389471776539443, "coord_share_perm": 0.039193032663413715, "norm_ratio_perm": 0.9999999999999996, "qmd_orth": 1.3183360477744988, "coord_share_orth": 0.05398324808292658, "d_raw_bn_perm": 1.191233032171224, "qmd_bn_perm": 1.1051826225905557, "coordinate_gap_bn_perm": 0.08605040958066823, "coord_fraction_bn_perm": 0.07223641995876054, "d_raw_bn_orth": 1.191233032171224, "qmd_bn_orth": 1.0548282186261682, "coordinate_gap_bn_orth": 0.13640481354505574, "coord_fraction_bn_orth": 0.11450724573716267, "bnd_raw": 1.191233032171224, "bnd_perm": 1.1051826225905557, "bnd_orth": 1.0548282186261682, "coord_share_bnd_perm": 0.07223641995876054, "coord_share_bnd_orth": 0.11450724573716267, "cka_mean": 0.649440526694889, "cka_last": 0.8637804403134508, "qmd_act_perm": 0.33485238992431854, "aligned_cka_perm": 0.6651476100756815, "qmd_act_procrustes": 0.33485238992431976, "aligned_cka_procrustes": 0.6651476100756802, "qmd_act_ot": 0.33289167401260766, "aligned_cka_ot": 0.6671083259873923, "task_vector_cosine": 0.5972592227439053}, "rungs": {"M0_naive_avg": {"nll": 11.751382189487524, "delta_floor": 8.495691228519448, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 9.339639742080479, "delta_floor": 6.083948781112402, "delta_vs_naive": -2.411742447407045}, "M1_orth_avg": {"nll": 8.96071199241683, "delta_floor": 5.705021031448752, "delta_vs_naive": -2.7906701970706944}, "M2_task_arith": {"nll": 28.49879792991683, "delta_floor": 25.24310696894875, "delta_vs_naive": 16.747415740429304}, "M3_ties": {"nll": 57.710245688600786, "delta_floor": 54.45455472763271, "delta_vs_naive": 45.958863499113264}}, "barrier_naive": {"barrier": 8.485709651342344, "losses": [3.255690960968077, 8.387657568646038, 11.751382189487524, 8.489705483274218, 3.275654115322285]}, "barrier_perm": {"barrier": 6.0739676219843135, "losses": [3.255690960968077, 7.5054752476761255, 9.339639742080479, 7.668855969453278, 3.275653279224254]}, "secs": 157.79209566116333}
|
| 28 |
{"set": "set1_polypythia", "size": "160m", "pair": [5, 7], "parent_nll": {"a": 3.255690960968077, "b": 3.2518446711411446}, "floor": 3.2518446711411446, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.01915622824598225, "weight_cosine_bn": 0.2034414457667437, "d_raw": 1.4054618945489141, "qmd_perm": 1.3374365428824475, "coord_share_perm": 0.04840070864269109, "norm_ratio_perm": 1.0000000000000004, "qmd_orth": 1.3364405485695097, "coord_share_orth": 0.04910936841980835, "d_raw_bn_perm": 1.1878870672165711, "qmd_bn_perm": 1.0993100663726114, "coordinate_gap_bn_perm": 0.0885770008439597, "coord_fraction_bn_perm": 0.07456685343962136, "d_raw_bn_orth": 1.1878870672165711, "qmd_bn_orth": 1.057410730308829, "coordinate_gap_bn_orth": 0.13047633690774219, "coord_fraction_bn_orth": 0.10983900785574781, "bnd_raw": 1.1878870672165711, "bnd_perm": 1.0993100663726114, "bnd_orth": 1.057410730308829, "coord_share_bnd_perm": 0.07456685343962136, "coord_share_bnd_orth": 0.10983900785574781, "cka_mean": 0.42912236754975763, "cka_last": 0.8934120530157756, "qmd_act_perm": 0.7496748755874749, "aligned_cka_perm": 0.25032512441252514, "qmd_act_procrustes": 0.7496748755874751, "aligned_cka_procrustes": 0.2503251244125248, "qmd_act_ot": 0.668917372802649, "aligned_cka_ot": 0.33108262719735104, "task_vector_cosine": 0.6099042051034456}, "rungs": {"M0_naive_avg": {"nll": 10.320688982999021, "delta_floor": 7.068844311857877, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 9.72730638836228, "delta_floor": 6.475461717221135, "delta_vs_naive": -0.5933825946367417}, "M1_orth_avg": {"nll": 9.17136091915362, "delta_floor": 5.919516248012476, "delta_vs_naive": -1.1493280638454006}, "M2_task_arith": {"nll": 22.496724406800393, "delta_floor": 19.244879735659246, "delta_vs_naive": 12.176035423801371}, "M3_ties": {"nll": 61.21087825648239, "delta_floor": 57.959033585341245, "delta_vs_naive": 50.890189273483365}}, "barrier_naive": {"barrier": 7.066921166944411, "losses": [3.255690960968077, 8.213293863136007, 10.320688982999021, 8.742778979635519, 3.2518446711411446]}, "barrier_perm": {"barrier": 6.473538154258653, "losses": [3.255690960968077, 8.223385327482877, 9.72730638836228, 7.600769162411326, 3.2518455072391754]}, "secs": 112.05698370933533}
|
|
|
|
|
|
|
|
|
| 26 |
{"set": "set1_polypythia", "size": "160m", "pair": [4, 9], "parent_nll": {"a": 3.2741363585111913, "b": 3.262358126108427}, "floor": 3.262358126108427, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.03161099443751422, "weight_cosine_bn": 0.198844620318614, "d_raw": 1.3926834761794986, "qmd_perm": 1.3306865199238942, "coord_share_perm": 0.044516185706229935, "norm_ratio_perm": 1.0000000000000009, "qmd_orth": 1.2979315969696825, "coord_share_orth": 0.0680354731211041, "d_raw_bn_perm": 1.193857643425369, "qmd_bn_perm": 1.132963438133865, "coordinate_gap_bn_perm": 0.06089420529150402, "coord_fraction_bn_perm": 0.05100625323869334, "d_raw_bn_orth": 1.193857643425369, "qmd_bn_orth": 1.0599208049643605, "coordinate_gap_bn_orth": 0.13393683846100846, "coord_fraction_bn_orth": 0.11218828241256822, "bnd_raw": 1.193857643425369, "bnd_perm": 1.132963438133865, "bnd_orth": 1.0599208049643605, "coord_share_bnd_perm": 0.05100625323869334, "coord_share_bnd_orth": 0.11218828241256822, "cka_mean": 0.7211211159755844, "cka_last": 0.8792108760076334, "qmd_act_perm": 0.27289764096798597, "aligned_cka_perm": 0.727102359032014, "qmd_act_procrustes": 0.2728976409679881, "aligned_cka_procrustes": 0.7271023590320119, "qmd_act_ot": 0.27214817102079025, "aligned_cka_ot": 0.7278518289792097, "task_vector_cosine": 0.5774673146699185}, "rungs": {"M0_naive_avg": {"nll": 16.348348061399218, "delta_floor": 13.08598993529079, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 10.698082134448386, "delta_floor": 7.4357240083399585, "delta_vs_naive": -5.650265926950832}, "M1_orth_avg": {"nll": 9.423008748929794, "delta_floor": 6.160650622821366, "delta_vs_naive": -6.925339312469424}, "M2_task_arith": {"nll": 42.591483457681015, "delta_floor": 39.32912533157259, "delta_vs_naive": 26.243135396281797}, "M3_ties": {"nll": 62.245552914016635, "delta_floor": 58.98319478790821, "delta_vs_naive": 45.89720485261742}}, "barrier_naive": {"barrier": 13.08010081908941, "losses": [3.2741363585111913, 9.463472549229452, 16.348348061399218, 9.968132242997799, 3.262358126108427]}, "barrier_perm": {"barrier": 7.429834772696001, "losses": [3.2741363585111913, 7.971878678831335, 10.698082134448386, 7.5754769580938115, 3.262358364993579]}, "secs": 103.6531343460083}
|
| 27 |
{"set": "set1_polypythia", "size": "160m", "pair": [5, 6], "parent_nll": {"a": 3.255690960968077, "b": 3.275654115322285}, "floor": 3.255690960968077, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.029452020971517494, "weight_cosine_bn": 0.20353675966522838, "d_raw": 1.393565225037434, "qmd_perm": 1.3389471776539443, "coord_share_perm": 0.039193032663413715, "norm_ratio_perm": 0.9999999999999996, "qmd_orth": 1.3183360477744988, "coord_share_orth": 0.05398324808292658, "d_raw_bn_perm": 1.191233032171224, "qmd_bn_perm": 1.1051826225905557, "coordinate_gap_bn_perm": 0.08605040958066823, "coord_fraction_bn_perm": 0.07223641995876054, "d_raw_bn_orth": 1.191233032171224, "qmd_bn_orth": 1.0548282186261682, "coordinate_gap_bn_orth": 0.13640481354505574, "coord_fraction_bn_orth": 0.11450724573716267, "bnd_raw": 1.191233032171224, "bnd_perm": 1.1051826225905557, "bnd_orth": 1.0548282186261682, "coord_share_bnd_perm": 0.07223641995876054, "coord_share_bnd_orth": 0.11450724573716267, "cka_mean": 0.649440526694889, "cka_last": 0.8637804403134508, "qmd_act_perm": 0.33485238992431854, "aligned_cka_perm": 0.6651476100756815, "qmd_act_procrustes": 0.33485238992431976, "aligned_cka_procrustes": 0.6651476100756802, "qmd_act_ot": 0.33289167401260766, "aligned_cka_ot": 0.6671083259873923, "task_vector_cosine": 0.5972592227439053}, "rungs": {"M0_naive_avg": {"nll": 11.751382189487524, "delta_floor": 8.495691228519448, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 9.339639742080479, "delta_floor": 6.083948781112402, "delta_vs_naive": -2.411742447407045}, "M1_orth_avg": {"nll": 8.96071199241683, "delta_floor": 5.705021031448752, "delta_vs_naive": -2.7906701970706944}, "M2_task_arith": {"nll": 28.49879792991683, "delta_floor": 25.24310696894875, "delta_vs_naive": 16.747415740429304}, "M3_ties": {"nll": 57.710245688600786, "delta_floor": 54.45455472763271, "delta_vs_naive": 45.958863499113264}}, "barrier_naive": {"barrier": 8.485709651342344, "losses": [3.255690960968077, 8.387657568646038, 11.751382189487524, 8.489705483274218, 3.275654115322285]}, "barrier_perm": {"barrier": 6.0739676219843135, "losses": [3.255690960968077, 7.5054752476761255, 9.339639742080479, 7.668855969453278, 3.275653279224254]}, "secs": 157.79209566116333}
|
| 28 |
{"set": "set1_polypythia", "size": "160m", "pair": [5, 7], "parent_nll": {"a": 3.255690960968077, "b": 3.2518446711411446}, "floor": 3.2518446711411446, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.01915622824598225, "weight_cosine_bn": 0.2034414457667437, "d_raw": 1.4054618945489141, "qmd_perm": 1.3374365428824475, "coord_share_perm": 0.04840070864269109, "norm_ratio_perm": 1.0000000000000004, "qmd_orth": 1.3364405485695097, "coord_share_orth": 0.04910936841980835, "d_raw_bn_perm": 1.1878870672165711, "qmd_bn_perm": 1.0993100663726114, "coordinate_gap_bn_perm": 0.0885770008439597, "coord_fraction_bn_perm": 0.07456685343962136, "d_raw_bn_orth": 1.1878870672165711, "qmd_bn_orth": 1.057410730308829, "coordinate_gap_bn_orth": 0.13047633690774219, "coord_fraction_bn_orth": 0.10983900785574781, "bnd_raw": 1.1878870672165711, "bnd_perm": 1.0993100663726114, "bnd_orth": 1.057410730308829, "coord_share_bnd_perm": 0.07456685343962136, "coord_share_bnd_orth": 0.10983900785574781, "cka_mean": 0.42912236754975763, "cka_last": 0.8934120530157756, "qmd_act_perm": 0.7496748755874749, "aligned_cka_perm": 0.25032512441252514, "qmd_act_procrustes": 0.7496748755874751, "aligned_cka_procrustes": 0.2503251244125248, "qmd_act_ot": 0.668917372802649, "aligned_cka_ot": 0.33108262719735104, "task_vector_cosine": 0.6099042051034456}, "rungs": {"M0_naive_avg": {"nll": 10.320688982999021, "delta_floor": 7.068844311857877, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 9.72730638836228, "delta_floor": 6.475461717221135, "delta_vs_naive": -0.5933825946367417}, "M1_orth_avg": {"nll": 9.17136091915362, "delta_floor": 5.919516248012476, "delta_vs_naive": -1.1493280638454006}, "M2_task_arith": {"nll": 22.496724406800393, "delta_floor": 19.244879735659246, "delta_vs_naive": 12.176035423801371}, "M3_ties": {"nll": 61.21087825648239, "delta_floor": 57.959033585341245, "delta_vs_naive": 50.890189273483365}}, "barrier_naive": {"barrier": 7.066921166944411, "losses": [3.255690960968077, 8.213293863136007, 10.320688982999021, 8.742778979635519, 3.2518446711411446]}, "barrier_perm": {"barrier": 6.473538154258653, "losses": [3.255690960968077, 8.223385327482877, 9.72730638836228, 7.600769162411326, 3.2518455072391754]}, "secs": 112.05698370933533}
|
| 29 |
+
{"set": "set1_polypythia", "size": "160m", "pair": [5, 8], "parent_nll": {"a": 3.255690960968077, "b": 3.2340771102158756}, "floor": 3.2340771102158756, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.021209732059568748, "weight_cosine_bn": 0.20021527035166653, "d_raw": 1.399296639755202, "qmd_perm": 1.3204037532476478, "coord_share_perm": 0.0563803873075519, "norm_ratio_perm": 0.999999999999999, "qmd_orth": 1.3049933683615855, "coord_share_orth": 0.06739333799166004, "d_raw_bn_perm": 1.1854023591369292, "qmd_bn_perm": 1.086907705870477, "coordinate_gap_bn_perm": 0.09849465326645213, "coord_fraction_bn_perm": 0.08308963830489115, "d_raw_bn_orth": 1.1854023591369292, "qmd_bn_orth": 1.0524820315302943, "coordinate_gap_bn_orth": 0.13292032760663486, "coord_fraction_bn_orth": 0.11213097947891029, "bnd_raw": 1.1854023591369292, "bnd_perm": 1.086907705870477, "bnd_orth": 1.0524820315302943, "coord_share_bnd_perm": 0.08308963830489115, "coord_share_bnd_orth": 0.11213097947891029, "cka_mean": 0.6863836885751571, "cka_last": 0.8952499492708976, "qmd_act_perm": 0.32540832925888985, "aligned_cka_perm": 0.6745916707411101, "qmd_act_procrustes": 0.3254083292588872, "aligned_cka_procrustes": 0.6745916707411128, "qmd_act_ot": 0.32527434289189827, "aligned_cka_ot": 0.6747256571081017, "task_vector_cosine": 0.5870299075043434}, "rungs": {"M0_naive_avg": {"nll": 11.34057473856409, "delta_floor": 8.106497628348215, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 9.431755289872799, "delta_floor": 6.197678179656923, "delta_vs_naive": -1.9088194486912915}, "M1_orth_avg": {"nll": 9.744953790056263, "delta_floor": 6.510876679840387, "delta_vs_naive": -1.5956209485078272}, "M2_task_arith": {"nll": 24.767799810420744, "delta_floor": 21.53372270020487, "delta_vs_naive": 13.427225071856654}, "M3_ties": {"nll": 62.77044474681996, "delta_floor": 59.53636763660408, "delta_vs_naive": 51.429870008255875}}, "barrier_naive": {"barrier": 8.095690702972114, "losses": [3.255690960968077, 8.579819173495597, 11.34057473856409, 8.70538533130504, 3.2340771102158756]}, "barrier_perm": {"barrier": 6.186870537625367, "losses": [3.255690960968077, 7.922326970706947, 9.431755289872799, 7.9574896706060425, 3.2340785435267856]}, "secs": 119.55984807014465}
|
| 30 |
+
{"set": "set1_polypythia", "size": "160m", "pair": [5, 9], "parent_nll": {"a": 3.255690960968077, "b": 3.262358126108427}, "floor": 3.255690960968077, "corpus": "flores200_devtest_eng_Latn", "metric": "nats_per_token", "align_info": {"perm": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}, "orth": {"residual": true, "hidden": 12, "heads": 12, "rejected": []}}, "predictors": {"weight_cosine": 0.03175794804743437, "weight_cosine_bn": 0.20099153645269635, "d_raw": 1.391689139546756, "qmd_perm": 1.3257191886094788, "coord_share_perm": 0.04740279209102856, "norm_ratio_perm": 1.0000000000000007, "qmd_orth": 1.3119229902655778, "coord_share_orth": 0.05731606794542959, "d_raw_bn_perm": 1.2012469216172317, "qmd_bn_perm": 1.1051201293880468, "coordinate_gap_bn_perm": 0.09612679222918485, "coord_fraction_bn_perm": 0.08002250869435729, "d_raw_bn_orth": 1.2012469216172317, "qmd_bn_orth": 1.0719854456121225, "coordinate_gap_bn_orth": 0.12926147600510918, "coord_fraction_bn_orth": 0.10760608304501228, "bnd_raw": 1.2012469216172317, "bnd_perm": 1.1051201293880468, "bnd_orth": 1.0719854456121225, "coord_share_bnd_perm": 0.08002250869435729, "coord_share_bnd_orth": 0.10760608304501228, "cka_mean": 0.4491167062038712, "cka_last": 0.8540013414352915, "qmd_act_perm": 0.7117680963700491, "aligned_cka_perm": 0.2882319036299509, "qmd_act_procrustes": 0.7117680963700488, "aligned_cka_procrustes": 0.2882319036299512, "qmd_act_ot": 0.6231035100779849, "aligned_cka_ot": 0.3768964899220151, "task_vector_cosine": 0.5866746181886868}, "rungs": {"M0_naive_avg": {"nll": 12.76205318921233, "delta_floor": 9.506362228244253, "delta_vs_naive": 0.0}, "M1_perm_avg": {"nll": 10.125313895089286, "delta_floor": 6.869622934121209, "delta_vs_naive": -2.6367392941230428}, "M1_orth_avg": {"nll": 10.130426515105185, "delta_floor": 6.874735554137108, "delta_vs_naive": -2.631626674107144}, "M2_task_arith": {"nll": 35.43659796966732, "delta_floor": 32.18090700869924, "delta_vs_naive": 22.674544780454987}, "M3_ties": {"nll": 60.47141022504892, "delta_floor": 57.215719264080846, "delta_vs_naive": 47.70935703583659}}, "barrier_naive": {"barrier": 9.503028645674078, "losses": [3.255690960968077, 9.004827391144815, 12.76205318921233, 9.568154411539872, 3.262358126108427]}, "barrier_perm": {"barrier": 6.866289530714898, "losses": [3.255690960968077, 8.016000288573263, 10.125313895089286, 8.429588601547211, 3.2623577677806996]}, "secs": 119.26395511627197}
|
results/set4_tokenizer_diag.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eng_Latn": {
|
| 3 |
+
"eng_tok_tokens": 13449,
|
| 4 |
+
"eng_tok_bytes_per_token": 4.917614692542196,
|
| 5 |
+
"eng_tok_unk_rate": 0.0006691947356680794,
|
| 6 |
+
"own_tok_tokens": 13449,
|
| 7 |
+
"own_tok_bytes_per_token": 4.917614692542196,
|
| 8 |
+
"own_tok_unk_rate": 0.0006691947356680794
|
| 9 |
+
},
|
| 10 |
+
"nld_Latn": {
|
| 11 |
+
"eng_tok_tokens": 27457,
|
| 12 |
+
"eng_tok_bytes_per_token": 2.7147903995338165,
|
| 13 |
+
"eng_tok_unk_rate": 0.0033142732272280293,
|
| 14 |
+
"own_tok_tokens": 14656,
|
| 15 |
+
"own_tok_bytes_per_token": 5.085971615720524,
|
| 16 |
+
"own_tok_unk_rate": 0.0008187772925764192,
|
| 17 |
+
"partner_tok_unk_rate_on_ENGLISH_text": 0.0009789273017672213
|
| 18 |
+
},
|
| 19 |
+
"spa_Latn": {
|
| 20 |
+
"eng_tok_tokens": 28343,
|
| 21 |
+
"eng_tok_bytes_per_token": 2.8297992449634832,
|
| 22 |
+
"eng_tok_unk_rate": 0.05271142786578697,
|
| 23 |
+
"own_tok_tokens": 16023,
|
| 24 |
+
"own_tok_bytes_per_token": 5.00561692566935,
|
| 25 |
+
"own_tok_unk_rate": 0.0006241028521500343,
|
| 26 |
+
"partner_tok_unk_rate_on_ENGLISH_text": 0.00037121247273908404
|
| 27 |
+
},
|
| 28 |
+
"ell_Grek": {
|
| 29 |
+
"eng_tok_tokens": 24991,
|
| 30 |
+
"eng_tok_bytes_per_token": 5.725861310071625,
|
| 31 |
+
"eng_tok_unk_rate": 0.4648873594494018,
|
| 32 |
+
"own_tok_tokens": 16049,
|
| 33 |
+
"own_tok_bytes_per_token": 8.916131846220948,
|
| 34 |
+
"own_tok_unk_rate": 0.0002492367125677612,
|
| 35 |
+
"partner_tok_unk_rate_on_ENGLISH_text": 0.0005506374687619128
|
| 36 |
+
},
|
| 37 |
+
"pol_Latn": {
|
| 38 |
+
"eng_tok_tokens": 33295,
|
| 39 |
+
"eng_tok_bytes_per_token": 2.235650998648446,
|
| 40 |
+
"eng_tok_unk_rate": 0.11371076738248986,
|
| 41 |
+
"own_tok_tokens": 14458,
|
| 42 |
+
"own_tok_bytes_per_token": 5.148429934984092,
|
| 43 |
+
"own_tok_unk_rate": 0.0003458292986581823,
|
| 44 |
+
"partner_tok_unk_rate_on_ENGLISH_text": 0.0005674378000872981
|
| 45 |
+
}
|
| 46 |
+
}
|