AbstractPhil commited on
Commit
26d53b2
·
verified ·
1 Parent(s): d777d10

final: 2 anchors + dispatch + card

Browse files
amoe/moe-v2/README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags: [amoe, adapter, mixture-of-experts, sentence-similarity, captionbert, aleph]
4
+ base_model: AbstractPhil/captionbert-8192-v2
5
+ library_name: amoe-lora
6
+ ---
7
+
8
+ # captionbert-8192-v2 :: AMOE 2-anchor mixture
9
+
10
+ Two [amoe-lora](https://github.com/AbstractEyes/amoe-lora) aleph anchors on the
11
+ **frozen** trunk, plus a trained dispatch over them. The trunk never moves.
12
+
13
+ | anchor | trained on | relation |
14
+ |---|---|---|
15
+ | `equiv` | all-nli triplets | semantic equivalence |
16
+ | `simplify` | simple-wiki + altlex + sentence-compression | simplification / compression |
17
+
18
+ ## Results
19
+
20
+ | config | STS-B rho | SICK-R rho |
21
+ |---|---|---|
22
+ | bare trunk | .5747 | .6526 |
23
+ | `equiv` alone | .7254 | **.7550** |
24
+ | `simplify` alone | .7400 | .7075 |
25
+ | **2-anchor dispatch** | **.7524** | .7380 |
26
+
27
+ The two are complementary along the TASK axis -- `simplify` wins STS-B solo,
28
+ `equiv` wins SICK-R -- which is the precondition a mixture needs. SICK-R is
29
+ never trained on and is the honest transfer read.
30
+
31
+ ## Why the dispatch works here
32
+
33
+ Dispatched amplitude is `(w_k/z) * sigmoid(gate_k) * consume_k(x)`, where
34
+ `w_k/z = sinh(u_k) / SUM_j cosh(u_j)` over ALL anchors (the damping law).
35
+ That gives ~1.0 only when one anchor engages and the other **abstains**
36
+ (`u ~ 0`); if both fire it collapses to ~0.5 and the mixture delivers HALF of
37
+ what either member does alone.
38
+
39
+ Measured here: mean `|w/z|` moved from **.310/.380 (blend)** before alignment to
40
+ **.645/.223 (specialize)** after 800 keys-only steps, with no starvation
41
+ strikes. That flip is why the mixture beats its best member rather than damping
42
+ itself below it.
43
+
44
+ ## Load
45
+
46
+ ```python
47
+ import amoe
48
+ h = amoe.attach(trunk, ["amoe/moe/equiv.anchor.pt", "amoe/moe/simplify.anchor.pt"],
49
+ dispatch="amoe/moe/captionbert-v2-moe.dispatch.pt",
50
+ binding=CaptionBertV2Binding(d=512)) # from modeling_captionbert.py
51
+ base = h.detach() # bit-exact or raises
52
+ ```
53
+
54
+ All anchors disabled reproduces the bare trunk **bit-exact** (asserted at build
55
+ time). Masking never renormalizes -- that is the damping law, not an oversight.
56
+
57
+ Anchor `.pt` key layout is `{block}.{param}`. (`blocks.{site}.{param}` in the
58
+ amoe README is the *safetensors* layout, a different serializer.)
59
+
60
+ ## Training
61
+
62
+ Anchors: MNRL, in-batch + hard negatives where the source has them, 1,500 steps
63
+ at batch 256, pure Adam wd=0 (`amoe.laws.make_optimizer`), fp32/TF32 off.
64
+ 1,500 not 4,000: the first solo run's STS-B **peaked at step 1,000** and then
65
+ fell .0178 while SICK-R kept climbing -- 56,825 distinct anchors behind 200,000
66
+ draws (space/draws .284). Dispatch: 800 steps, routing keys only (1,536 params),
67
+ anchors frozen, starvation safeguard armed.
68
+
69
+ See `metrics.json` for the full table and the routing telemetry.
amoe/moe-v2/captionbert-v2-moe-v2.dispatch.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08ec87e5c9d4db1b649decb720e317f0f36ceffb36a3b1366a1c13eed06c8945
3
+ size 1587469
amoe/moe-v2/config.json ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run_name": "captionbert-v2-moe-v2",
3
+ "trunk_repo": "AbstractPhil/captionbert-8192-v2",
4
+ "trunk_ckpt": "checkpoints/best_model.pt",
5
+ "tokenizer": "google-bert/bert-base-uncased",
6
+ "d_model": 512,
7
+ "n_heads": 8,
8
+ "n_layers": 12,
9
+ "d_ff": 2048,
10
+ "max_len": 8192,
11
+ "output_dim": 768,
12
+ "pooling": "mean",
13
+ "experts": [
14
+ [
15
+ "equiv",
16
+ [
17
+ [
18
+ "sentence-transformers/all-nli",
19
+ "triplet",
20
+ "anchor",
21
+ "positive",
22
+ "negative",
23
+ 200000
24
+ ]
25
+ ]
26
+ ],
27
+ [
28
+ "simplify",
29
+ [
30
+ [
31
+ "sentence-transformers/simple-wiki",
32
+ "pair",
33
+ "text",
34
+ "simplified",
35
+ null,
36
+ 0
37
+ ],
38
+ [
39
+ "sentence-transformers/altlex",
40
+ "pair",
41
+ "text",
42
+ "simplified",
43
+ null,
44
+ 0
45
+ ],
46
+ [
47
+ "sentence-transformers/sentence-compression",
48
+ "pair",
49
+ "text",
50
+ "simplified",
51
+ null,
52
+ 0
53
+ ]
54
+ ]
55
+ ]
56
+ ],
57
+ "dedup_jaccard": 0.95,
58
+ "n_slots": 16,
59
+ "K": 64,
60
+ "D": 4,
61
+ "tau": 0.1,
62
+ "hidden": 178,
63
+ "gate_init": -3.0,
64
+ "anchor_steps": 1500,
65
+ "anchor_lr": 0.001,
66
+ "batch_size": 256,
67
+ "temperature": 0.05,
68
+ "max_tokens": 64,
69
+ "align_steps": 800,
70
+ "align_lr": 0.001,
71
+ "align_emb": 64,
72
+ "check_every": 200,
73
+ "usage_ppl_floor": 1.5,
74
+ "usage_min": 0.02,
75
+ "max_strikes": 3,
76
+ "mix_rows": true,
77
+ "align_taus": [
78
+ 0.1,
79
+ 0.05,
80
+ 0.02
81
+ ],
82
+ "align_seeds": [
83
+ 0,
84
+ 1
85
+ ],
86
+ "per_block_report": true,
87
+ "seed": 0,
88
+ "log_every": 100,
89
+ "eval_every": 500,
90
+ "reuse_anchors": true,
91
+ "out_dir": "/content/amoe_moe_v2",
92
+ "hf_repo": "AbstractPhil/captionbert-8192-v2",
93
+ "hf_path": "amoe/moe-v2",
94
+ "hf_private": false,
95
+ "hf_push": true
96
+ }
amoe/moe-v2/metrics.json ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "baseline": {
3
+ "STS-B": {
4
+ "spearman": 0.574721280584061,
5
+ "self_cos": 0.13962045311927795,
6
+ "erank": 36.611595622425114
7
+ },
8
+ "SICK-R": {
9
+ "spearman": 0.652602297708298,
10
+ "self_cos": 0.32337328791618347,
11
+ "erank": 39.12520123844512
12
+ }
13
+ },
14
+ "rows": {
15
+ "OFF": {
16
+ "STS-B": {
17
+ "spearman": 0.574721280584061,
18
+ "self_cos": 0.13962045311927795,
19
+ "erank": 36.611595622425114
20
+ },
21
+ "SICK-R": {
22
+ "spearman": 0.652602297708298,
23
+ "self_cos": 0.32337328791618347,
24
+ "erank": 39.12520123844512
25
+ }
26
+ },
27
+ "equiv-only": {
28
+ "STS-B": {
29
+ "spearman": 0.7296031320607785,
30
+ "self_cos": 0.12117668986320496,
31
+ "erank": 50.97623631488965
32
+ },
33
+ "SICK-R": {
34
+ "spearman": 0.7313017301391602,
35
+ "self_cos": 0.16866683959960938,
36
+ "erank": 34.47744549861217
37
+ }
38
+ },
39
+ "simplify-only": {
40
+ "STS-B": {
41
+ "spearman": 0.6103750183460962,
42
+ "self_cos": 0.12606513500213623,
43
+ "erank": 43.105342566791094
44
+ },
45
+ "SICK-R": {
46
+ "spearman": 0.6605494548416437,
47
+ "self_cos": 0.311884343624115,
48
+ "erank": 39.36392993798925
49
+ }
50
+ },
51
+ "MOE": {
52
+ "STS-B": {
53
+ "spearman": 0.752008674994352,
54
+ "self_cos": 0.12014347314834595,
55
+ "erank": 54.27527183765544
56
+ },
57
+ "SICK-R": {
58
+ "spearman": 0.7380834347410479,
59
+ "self_cos": 0.16208913922309875,
60
+ "erank": 33.90995214648849
61
+ }
62
+ }
63
+ },
64
+ "telemetry_before": {
65
+ "equiv": 0.35067129135131836,
66
+ "simplify": 0.3346233069896698
67
+ },
68
+ "telemetry_after": {
69
+ "equiv": 0.6218417286872864,
70
+ "simplify": 0.23119299113750458
71
+ },
72
+ "alarms": [],
73
+ "sweep": [
74
+ {
75
+ "tau": 0.1,
76
+ "seed": 0,
77
+ "moe": 0.7492622354327121,
78
+ "sep": 0.492695614695549,
79
+ "tel_before": {
80
+ "equiv": 0.3686778247356415,
81
+ "simplify": 0.3205741345882416
82
+ },
83
+ "tel_after": {
84
+ "equiv": 0.6838898658752441,
85
+ "simplify": 0.19119425117969513
86
+ },
87
+ "alarms": [],
88
+ "strikes": 0
89
+ },
90
+ {
91
+ "tau": 0.1,
92
+ "seed": 1,
93
+ "moe": 0.752008674994352,
94
+ "sep": 0.3906487375497818,
95
+ "tel_before": {
96
+ "equiv": 0.35067129135131836,
97
+ "simplify": 0.3346233069896698
98
+ },
99
+ "tel_after": {
100
+ "equiv": 0.6218417286872864,
101
+ "simplify": 0.23119299113750458
102
+ },
103
+ "alarms": [],
104
+ "strikes": 0
105
+ },
106
+ {
107
+ "tau": 0.05,
108
+ "seed": 0,
109
+ "moe": 0.7469755745347753,
110
+ "sep": 0.5859148502349854,
111
+ "tel_before": {
112
+ "equiv": 0.46885594725608826,
113
+ "simplify": 0.4062764644622803
114
+ },
115
+ "tel_after": {
116
+ "equiv": 0.7744400501251221,
117
+ "simplify": 0.18852519989013672
118
+ },
119
+ "alarms": [],
120
+ "strikes": 0
121
+ },
122
+ {
123
+ "tau": 0.05,
124
+ "seed": 1,
125
+ "moe": 0.7514321248191402,
126
+ "sep": 0.5004972666501999,
127
+ "tel_before": {
128
+ "equiv": 0.4535728991031647,
129
+ "simplify": 0.4255259037017822
130
+ },
131
+ "tel_after": {
132
+ "equiv": 0.7300211787223816,
133
+ "simplify": 0.2295239120721817
134
+ },
135
+ "alarms": [],
136
+ "strikes": 0
137
+ },
138
+ {
139
+ "tau": 0.02,
140
+ "seed": 0,
141
+ "moe": 0.7413441323237747,
142
+ "sep": 0.5930631905794144,
143
+ "tel_before": {
144
+ "equiv": 0.5241063833236694,
145
+ "simplify": 0.45106133818626404
146
+ },
147
+ "tel_after": {
148
+ "equiv": 0.7937906384468079,
149
+ "simplify": 0.2007274478673935
150
+ },
151
+ "alarms": [],
152
+ "strikes": 0
153
+ },
154
+ {
155
+ "tau": 0.02,
156
+ "seed": 1,
157
+ "moe": 0.7467576450283628,
158
+ "sep": 0.5142480581998825,
159
+ "tel_before": {
160
+ "equiv": 0.5094200968742371,
161
+ "simplify": 0.4688175916671753
162
+ },
163
+ "tel_after": {
164
+ "equiv": 0.753223717212677,
165
+ "simplify": 0.2389756590127945
166
+ },
167
+ "alarms": [],
168
+ "strikes": 0
169
+ }
170
+ ],
171
+ "best": {
172
+ "tau": 0.1,
173
+ "seed": 1
174
+ },
175
+ "per_block_routing": {
176
+ "per_block": [
177
+ [
178
+ 0.5222747325897217,
179
+ 0.23786939680576324
180
+ ],
181
+ [
182
+ 0.594670832157135,
183
+ 0.2207311987876892
184
+ ],
185
+ [
186
+ 0.5590013861656189,
187
+ 0.3259524405002594
188
+ ],
189
+ [
190
+ 0.7348001599311829,
191
+ 0.1631566435098648
192
+ ],
193
+ [
194
+ 0.47123849391937256,
195
+ 0.26864129304885864
196
+ ],
197
+ [
198
+ 0.730369508266449,
199
+ 0.1671283096075058
200
+ ],
201
+ [
202
+ 0.67645663022995,
203
+ 0.20839910209178925
204
+ ],
205
+ [
206
+ 0.5062358975410461,
207
+ 0.30166953802108765
208
+ ],
209
+ [
210
+ 0.6661544442176819,
211
+ 0.2612781226634979
212
+ ],
213
+ [
214
+ 0.6028999090194702,
215
+ 0.29146650433540344
216
+ ],
217
+ [
218
+ 0.7297633290290833,
219
+ 0.14430269598960876
220
+ ],
221
+ [
222
+ 0.6682355403900146,
223
+ 0.1837206482887268
224
+ ]
225
+ ],
226
+ "spread": 0.2635616660118103
227
+ },
228
+ "anchors": [
229
+ "equiv.anchor.pt",
230
+ "simplify.anchor.pt"
231
+ ],
232
+ "config": {
233
+ "run_name": "captionbert-v2-moe-v2",
234
+ "trunk_repo": "AbstractPhil/captionbert-8192-v2",
235
+ "trunk_ckpt": "checkpoints/best_model.pt",
236
+ "tokenizer": "google-bert/bert-base-uncased",
237
+ "d_model": 512,
238
+ "n_heads": 8,
239
+ "n_layers": 12,
240
+ "d_ff": 2048,
241
+ "max_len": 8192,
242
+ "output_dim": 768,
243
+ "pooling": "mean",
244
+ "experts": [
245
+ [
246
+ "equiv",
247
+ [
248
+ [
249
+ "sentence-transformers/all-nli",
250
+ "triplet",
251
+ "anchor",
252
+ "positive",
253
+ "negative",
254
+ 200000
255
+ ]
256
+ ]
257
+ ],
258
+ [
259
+ "simplify",
260
+ [
261
+ [
262
+ "sentence-transformers/simple-wiki",
263
+ "pair",
264
+ "text",
265
+ "simplified",
266
+ null,
267
+ 0
268
+ ],
269
+ [
270
+ "sentence-transformers/altlex",
271
+ "pair",
272
+ "text",
273
+ "simplified",
274
+ null,
275
+ 0
276
+ ],
277
+ [
278
+ "sentence-transformers/sentence-compression",
279
+ "pair",
280
+ "text",
281
+ "simplified",
282
+ null,
283
+ 0
284
+ ]
285
+ ]
286
+ ]
287
+ ],
288
+ "dedup_jaccard": 0.95,
289
+ "n_slots": 16,
290
+ "K": 64,
291
+ "D": 4,
292
+ "tau": 0.1,
293
+ "hidden": 178,
294
+ "gate_init": -3.0,
295
+ "anchor_steps": 1500,
296
+ "anchor_lr": 0.001,
297
+ "batch_size": 256,
298
+ "temperature": 0.05,
299
+ "max_tokens": 64,
300
+ "align_steps": 800,
301
+ "align_lr": 0.001,
302
+ "align_emb": 64,
303
+ "check_every": 200,
304
+ "usage_ppl_floor": 1.5,
305
+ "usage_min": 0.02,
306
+ "max_strikes": 3,
307
+ "mix_rows": true,
308
+ "align_taus": [
309
+ 0.1,
310
+ 0.05,
311
+ 0.02
312
+ ],
313
+ "align_seeds": [
314
+ 0,
315
+ 1
316
+ ],
317
+ "per_block_report": true,
318
+ "seed": 0,
319
+ "log_every": 100,
320
+ "eval_every": 500,
321
+ "reuse_anchors": true,
322
+ "out_dir": "/content/amoe_moe_v2",
323
+ "hf_repo": "AbstractPhil/captionbert-8192-v2",
324
+ "hf_path": "amoe/moe-v2",
325
+ "hf_private": false,
326
+ "hf_push": true
327
+ }
328
+ }