AbstractPhil commited on
Commit
9154293
·
verified ·
1 Parent(s): b5b6e0f

final: 2 anchors + dispatch + card

Browse files
amoe/moe/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/captionbert-v2-moe.dispatch.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11979c0f396ac1f5df995c6de4a1df3eafad6382dc62879ac1ce1b21b741f1a7
3
+ size 1587315
amoe/moe/config.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run_name": "captionbert-v2-moe",
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
+ "align_tau": 0.1,
73
+ "check_every": 200,
74
+ "usage_ppl_floor": 1.5,
75
+ "usage_min": 0.02,
76
+ "max_strikes": 3,
77
+ "seed": 0,
78
+ "log_every": 100,
79
+ "eval_every": 500,
80
+ "out_dir": "/content/amoe_moe",
81
+ "hf_repo": "AbstractPhil/captionbert-8192-v2",
82
+ "hf_path": "amoe/moe",
83
+ "hf_private": false,
84
+ "hf_push": true
85
+ }
amoe/moe/metrics.json ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.731078083351727,
30
+ "self_cos": 0.1255255937576294,
31
+ "erank": 50.663957003073875
32
+ },
33
+ "SICK-R": {
34
+ "spearman": 0.7325251878585886,
35
+ "self_cos": 0.17530100047588348,
36
+ "erank": 34.694745020767634
37
+ }
38
+ },
39
+ "simplify-only": {
40
+ "STS-B": {
41
+ "spearman": 0.6031180553522926,
42
+ "self_cos": 0.12380383908748627,
43
+ "erank": 43.472962330224135
44
+ },
45
+ "SICK-R": {
46
+ "spearman": 0.6609382896862828,
47
+ "self_cos": 0.3064461648464203,
48
+ "erank": 39.3687757862779
49
+ }
50
+ },
51
+ "MOE": {
52
+ "STS-B": {
53
+ "spearman": 0.7524264373550089,
54
+ "self_cos": 0.12201106548309326,
55
+ "erank": 54.394680890714454
56
+ },
57
+ "SICK-R": {
58
+ "spearman": 0.7380408425545968,
59
+ "self_cos": 0.16639426350593567,
60
+ "erank": 34.39546446727023
61
+ }
62
+ }
63
+ },
64
+ "telemetry_before": {
65
+ "equiv": 0.3097170293331146,
66
+ "simplify": 0.3800048828125
67
+ },
68
+ "telemetry_after": {
69
+ "equiv": 0.6454874873161316,
70
+ "simplify": 0.2226928472518921
71
+ },
72
+ "alarms": [],
73
+ "anchors": [
74
+ "equiv.anchor.pt",
75
+ "simplify.anchor.pt"
76
+ ],
77
+ "config": {
78
+ "run_name": "captionbert-v2-moe",
79
+ "trunk_repo": "AbstractPhil/captionbert-8192-v2",
80
+ "trunk_ckpt": "checkpoints/best_model.pt",
81
+ "tokenizer": "google-bert/bert-base-uncased",
82
+ "d_model": 512,
83
+ "n_heads": 8,
84
+ "n_layers": 12,
85
+ "d_ff": 2048,
86
+ "max_len": 8192,
87
+ "output_dim": 768,
88
+ "pooling": "mean",
89
+ "experts": [
90
+ [
91
+ "equiv",
92
+ [
93
+ [
94
+ "sentence-transformers/all-nli",
95
+ "triplet",
96
+ "anchor",
97
+ "positive",
98
+ "negative",
99
+ 200000
100
+ ]
101
+ ]
102
+ ],
103
+ [
104
+ "simplify",
105
+ [
106
+ [
107
+ "sentence-transformers/simple-wiki",
108
+ "pair",
109
+ "text",
110
+ "simplified",
111
+ null,
112
+ 0
113
+ ],
114
+ [
115
+ "sentence-transformers/altlex",
116
+ "pair",
117
+ "text",
118
+ "simplified",
119
+ null,
120
+ 0
121
+ ],
122
+ [
123
+ "sentence-transformers/sentence-compression",
124
+ "pair",
125
+ "text",
126
+ "simplified",
127
+ null,
128
+ 0
129
+ ]
130
+ ]
131
+ ]
132
+ ],
133
+ "dedup_jaccard": 0.95,
134
+ "n_slots": 16,
135
+ "K": 64,
136
+ "D": 4,
137
+ "tau": 0.1,
138
+ "hidden": 178,
139
+ "gate_init": -3.0,
140
+ "anchor_steps": 1500,
141
+ "anchor_lr": 0.001,
142
+ "batch_size": 256,
143
+ "temperature": 0.05,
144
+ "max_tokens": 64,
145
+ "align_steps": 800,
146
+ "align_lr": 0.001,
147
+ "align_emb": 64,
148
+ "align_tau": 0.1,
149
+ "check_every": 200,
150
+ "usage_ppl_floor": 1.5,
151
+ "usage_min": 0.02,
152
+ "max_strikes": 3,
153
+ "seed": 0,
154
+ "log_every": 100,
155
+ "eval_every": 500,
156
+ "out_dir": "/content/amoe_moe",
157
+ "hf_repo": "AbstractPhil/captionbert-8192-v2",
158
+ "hf_path": "amoe/moe",
159
+ "hf_private": false,
160
+ "hf_push": true
161
+ }
162
+ }