Feature Extraction
Transformers
TensorBoard
Safetensors
English
captionbert_v2
sentence-similarity
consensus-distillation
geometric-deep-learning
amoe
custom_code
Instructions to use AbstractPhil/captionbert-8192-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbstractPhil/captionbert-8192-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="AbstractPhil/captionbert-8192-v2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbstractPhil/captionbert-8192-v2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
card: this folder is the 3-ANCHOR COLLECTIVE, not the 2-anchor moe run - the moe card had been copied here wholesale (wrong title, wrong anchor table, wrong results, moe-v1 amplitude telemetry). Real 8-task rows, greedy sweep incl. the random capacity control, correct in-folder load paths, masked-vs-solo labelled
Browse files- amoe/collective/README.md +132 -34
amoe/collective/README.md
CHANGED
|
@@ -5,52 +5,145 @@ base_model: AbstractPhil/captionbert-8192-v2
|
|
| 5 |
library_name: amoe-lora
|
| 6 |
---
|
| 7 |
|
| 8 |
-
# captionbert-8192-v2 :: AMOE
|
| 9 |
|
| 10 |
-
|
| 11 |
-
**frozen** trunk,
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
| `equiv` | all-nli triplets | semantic equivalence |
|
| 16 |
-
| `simplify` | simple-wiki + altlex + sentence-compression | simplification / compression |
|
| 17 |
-
|
| 18 |
-
## Results
|
| 19 |
|
| 20 |
-
|
|
| 21 |
|---|---|---|
|
| 22 |
-
|
|
| 23 |
-
| `
|
| 24 |
-
| `
|
| 25 |
-
|
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 36 |
-
(`u ~ 0`); if
|
| 37 |
-
what
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 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/
|
| 49 |
-
|
|
|
|
|
|
|
| 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 |
|
|
@@ -59,11 +152,16 @@ amoe README is the *safetensors* layout, a different serializer.)
|
|
| 59 |
|
| 60 |
## Training
|
| 61 |
|
| 62 |
-
Anchors: MNRL, in-batch + hard negatives where the source
|
| 63 |
-
at batch 256, pure Adam wd=0 (`amoe.laws.make_optimizer`), fp32/TF32 off
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
| 5 |
library_name: amoe-lora
|
| 6 |
---
|
| 7 |
|
| 8 |
+
# captionbert-8192-v2 :: AMOE 3-anchor collective
|
| 9 |
|
| 10 |
+
Three [amoe-lora](https://github.com/AbstractEyes/amoe-lora) aleph anchors on the
|
| 11 |
+
**frozen** `captionbert-8192-v2` trunk, under a trained dispatch, greedily
|
| 12 |
+
selected from a **six**-candidate pool. The trunk never moves; only the adapters
|
| 13 |
+
and the routing keys train.
|
| 14 |
|
| 15 |
+
This is the shipped collective and the source of the model's headline number:
|
| 16 |
+
**.6077 -> .7287** mean Spearman over eight sentence-similarity tasks.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
| anchor | trained on | in the ship? |
|
| 19 |
|---|---|---|
|
| 20 |
+
| `equiv` | all-nli triplets | **yes** |
|
| 21 |
+
| `simplify` | simple-wiki + altlex + sentence-compression | **yes** |
|
| 22 |
+
| `paraphrase` | paraphrase pairs | **yes** |
|
| 23 |
+
| `lexical` | lexical-overlap pairs | no -- rejected by the sweep |
|
| 24 |
+
| `topical` | topical pairs | no -- tied, not taken (see below) |
|
| 25 |
+
| `random` | random pairing | no -- **it is the capacity control** |
|
| 26 |
+
|
| 27 |
+
All six anchors ship in this folder so the selection can be reproduced or
|
| 28 |
+
contested. `equiv` and `simplify` are byte-identical to the ones in `amoe/moe/`
|
| 29 |
+
(sha256 `0029ad69…`, `8e419f69…`) -- the collective reused them rather than
|
| 30 |
+
retraining.
|
| 31 |
+
|
| 32 |
+
## Results -- 8 tasks, Spearman rho
|
| 33 |
+
|
| 34 |
+
The single-anchor columns are **masked** reads: the collective with the other
|
| 35 |
+
two arms disabled. Masking never renormalizes the amplitude budget, so a masked
|
| 36 |
+
single is *not* the same as that anchor trained and run alone -- it delivers
|
| 37 |
+
strictly less. Compare masked-to-masked; do not read these as solo scores.
|
| 38 |
+
|
| 39 |
+
| task | OFF | `equiv` masked | `simplify` masked | `paraphrase` masked | **COLLECTIVE** |
|
| 40 |
+
|---|---|---|---|---|---|
|
| 41 |
+
| STS-B | .5747 | .7208 | .6022 | .6127 | **.7684** |
|
| 42 |
+
| SICK-R | .6526 | .7269 | .6580 | .6585 | **.7391** |
|
| 43 |
+
| STS12 | .5051 | .6275 | .5359 | .5154 | **.6682** |
|
| 44 |
+
| STS13 | .5995 | .6988 | .6304 | .6338 | **.7557** |
|
| 45 |
+
| STS14 | .5452 | .6423 | .5747 | .5774 | **.6921** |
|
| 46 |
+
| STS15 | .7136 | .7783 | .7391 | .7328 | **.8055** |
|
| 47 |
+
| STS16 | .6776 | .7107 | .6945 | .7332 | **.7626** |
|
| 48 |
+
| BIOSSES | .5933 | .5845 | .6016 | .6051 | **.6382** |
|
| 49 |
+
| **mean** | **.6077** | .6862 | .6295 | .6336 | **.7287** |
|
| 50 |
+
| mean erank | 30.56 | 36.70 | 34.36 | 34.02 | **45.00** |
|
| 51 |
+
|
| 52 |
+
**The collective beats its best masked member by +.0425** (.7287 vs `equiv`'s
|
| 53 |
+
.6862) and beats it on **8 of 8** tasks.
|
| 54 |
+
|
| 55 |
+
`equiv` masked is *worse than the bare trunk* on BIOSSES (.5845 vs .5933) --
|
| 56 |
+
biomedical similarity is outside every anchor's training domain -- yet the
|
| 57 |
+
collective still lands **+.0450** there. Recovering on the one task where the
|
| 58 |
+
strongest member regresses is the honest read on this dispatch.
|
| 59 |
+
|
| 60 |
+
Effective rank rises with the score (30.6 -> 45.0). The anchors add *directions*,
|
| 61 |
+
not merely a rescaling: this trunk's unsupervised consensus target used only
|
| 62 |
+
~28.7 of 768 available directions, and supervision is what buys new ones.
|
| 63 |
+
|
| 64 |
+
## The greedy sweep -- what was tried, what was rejected
|
| 65 |
+
|
| 66 |
+
8 subsets, tau 0.1, seed 0, ranked by 8-task mean:
|
| 67 |
+
|
| 68 |
+
| subset | mean |
|
| 69 |
+
|---|---|
|
| 70 |
+
| equiv + simplify + topical | .7290 |
|
| 71 |
+
| **equiv + simplify + paraphrase** <- SHIPPED | **.7287** |
|
| 72 |
+
| equiv + simplify | .7233 |
|
| 73 |
+
| equiv + simplify + paraphrase + random | .7224 |
|
| 74 |
+
| equiv + simplify + topical | .7223 |
|
| 75 |
+
| equiv + simplify + paraphrase + lexical | .7174 |
|
| 76 |
+
| equiv + simplify + random | .7157 |
|
| 77 |
+
| equiv + simplify + lexical | .7146 |
|
| 78 |
+
|
| 79 |
+
Two things worth stating plainly rather than burying:
|
| 80 |
+
|
| 81 |
+
1. **The `+topical` variant scored .7290, marginally above the shipped .7287.**
|
| 82 |
+
That is a tie inside single-seed noise, and the smaller subset was taken. It
|
| 83 |
+
is not a measured win for the shipped configuration.
|
| 84 |
+
2. **`random` is a capacity control, and it is the informative row.** Adding a
|
| 85 |
+
randomly-paired anchor *costs* .0076 against the same-size real subset
|
| 86 |
+
(.7157 vs .7233) and .0063 against the shipped one (.7224 vs .7287). Extra
|
| 87 |
+
adapter capacity by itself does not buy score here -- the arms are earning
|
| 88 |
+
it.
|
| 89 |
|
| 90 |
## Why the dispatch works here
|
| 91 |
|
| 92 |
Dispatched amplitude is `(w_k/z) * sigmoid(gate_k) * consume_k(x)`, where
|
| 93 |
`w_k/z = sinh(u_k) / SUM_j cosh(u_j)` over ALL anchors (the damping law).
|
| 94 |
+
That approaches ~1.0 only when one anchor engages and the others **abstain**
|
| 95 |
+
(`u ~ 0`); if several fire together it collapses and the mixture delivers a
|
| 96 |
+
fraction of what any single member does alone.
|
| 97 |
+
|
| 98 |
+
Measured on this collective: mean `|w/z|` moved from
|
| 99 |
+
**.237 / .229 / .263 (blend)** before alignment to
|
| 100 |
+
**.587 / .138 / .142 (specialize)** after the keys-only alignment phase, with no
|
| 101 |
+
starvation strikes. `equiv` won the amplitude budget and the other two learned
|
| 102 |
+
to abstain. That flip is why the mixture beats its best member instead of
|
| 103 |
+
damping itself below it.
|
| 104 |
|
| 105 |
+
Per-block routing spread is **0.348** -- routing is not uniform with depth;
|
| 106 |
+
`equiv` dominates most blocks, but not all.
|
|
|
|
|
|
|
| 107 |
|
| 108 |
## Load
|
| 109 |
|
| 110 |
+
The model resolves its own arms. This is the supported path:
|
| 111 |
+
|
| 112 |
+
```python
|
| 113 |
+
from transformers import AutoModel
|
| 114 |
+
model = AutoModel.from_pretrained("AbstractPhil/captionbert-8192-v2",
|
| 115 |
+
trust_remote_code=True)
|
| 116 |
+
model.attach_amoe() # this collective, by default
|
| 117 |
+
emb = model.encode(["a cat on a windowsill"])
|
| 118 |
+
with model.amoe_off(): # the unsupervised baseline
|
| 119 |
+
base = model.encode(["a cat on a windowsill"])
|
| 120 |
+
model.detach_amoe() # bit-exact restore, asserted
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
Explicitly, via amoe-lora:
|
| 124 |
+
|
| 125 |
```python
|
| 126 |
import amoe
|
| 127 |
+
h = amoe.attach(trunk, ["amoe/collective/equiv.anchor.pt",
|
| 128 |
+
"amoe/collective/simplify.anchor.pt",
|
| 129 |
+
"amoe/collective/paraphrase.anchor.pt"],
|
| 130 |
+
dispatch="amoe/collective/captionbert-v2-collective.dispatch.pt",
|
| 131 |
binding=CaptionBertV2Binding(d=512)) # from modeling_captionbert.py
|
| 132 |
base = h.detach() # bit-exact or raises
|
| 133 |
```
|
| 134 |
|
| 135 |
+
The trunk these anchors expect is **`checkpoints/best_model.pt`**, which is what
|
| 136 |
+
the repo-root `model.safetensors` carries (verified tensor-for-tensor, max
|
| 137 |
+
absolute delta 0.0). Note that the sibling `-B` repo ships `final_model.pt` at
|
| 138 |
+
its root instead -- each repo's arms match its own root, but the two roots are
|
| 139 |
+
selected by different criteria.
|
| 140 |
+
|
| 141 |
+
**Anchors are trunk-bound.** These are `captionbert-8192-v2` anchors. Measured
|
| 142 |
+
2026-08-02, they lose 31% of their gain on the `-B` trunk (.7287 -> .6863), and
|
| 143 |
+
re-aligning the routing keys alone recovers only 29% of that. Retrained natively
|
| 144 |
+
on `-B` they reach .7294. Do not port these to another trunk -- retrain them
|
| 145 |
+
(~18 min).
|
| 146 |
+
|
| 147 |
All anchors disabled reproduces the bare trunk **bit-exact** (asserted at build
|
| 148 |
time). Masking never renormalizes -- that is the damping law, not an oversight.
|
| 149 |
|
|
|
|
| 152 |
|
| 153 |
## Training
|
| 154 |
|
| 155 |
+
Anchors: MNRL, in-batch + hard negatives where the source provides them, 1,500
|
| 156 |
+
steps at batch 256, pure Adam wd=0 (`amoe.laws.make_optimizer`), fp32 / TF32 off
|
| 157 |
+
(`amoe.laws.pin_precision`). Trunk frozen throughout.
|
| 158 |
+
|
| 159 |
+
1,500 steps and not 4,000: the first solo run's STS-B **peaked at step 1,000**
|
| 160 |
+
and then fell .0178 while SICK-R kept climbing -- 56,825 distinct anchors behind
|
| 161 |
+
200,000 draws (space/draws .284).
|
| 162 |
+
|
| 163 |
+
Dispatch: 800 steps, routing keys only, anchors frozen, starvation safeguard
|
| 164 |
+
armed. tau 0.1, seed 0.
|
| 165 |
|
| 166 |
+
SICK-R and BIOSSES are never trained on and are the honest transfer reads.
|
| 167 |
+
Full configuration in `config.json`; every number above is in `metrics.json`.
|