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
Update README.md
Browse files
README.md
CHANGED
|
@@ -25,31 +25,62 @@ emb = model.encode(["a cat on a windowsill", "a feline by the window"]) # (2,
|
|
| 25 |
(emb[0] @ emb[1]).item()
|
| 26 |
```
|
| 27 |
|
| 28 |
-
##
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
| 35 |
-
|--
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
|
| 39 |
-
|
|
| 40 |
-
|
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
`all-MiniLM-L6-v2`
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
## With AMOE arms (`amoe/`)
|
| 55 |
|
|
@@ -129,6 +160,28 @@ rather than return a silently-wrong model.
|
|
| 129 |
|
| 130 |
`pip install git+https://github.com/AbstractEyes/amoe-lora` for the arm methods.
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
### Arm library
|
| 133 |
|
| 134 |
`amoe/arms/` holds one canonical copy of every anchor with `ARMS.json`
|
|
@@ -167,6 +220,10 @@ See [amoe-lora](https://github.com/AbstractEyes/amoe-lora).
|
|
| 167 |
- **10 of 66 source chunks lacked ModernBERT**, so 54 chunks (~27M rows) were
|
| 168 |
used. No 4-expert fallback: that would change the target definition mid-dataset.
|
| 169 |
- Trained on image captions. Expect caption-like text to be its strongest domain.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
- **The trunk is single-seed.** The AMOE results are 2-seed with a measured
|
| 171 |
spread of .003-.005, against margins of +.012 to +.019.
|
| 172 |
- `amoe/sts-combo` stopped at step 500 of a planned 4000; its card and config
|
|
|
|
| 25 |
(emb[0] @ emb[1]).item()
|
| 26 |
```
|
| 27 |
|
| 28 |
+
## Benchmark
|
| 29 |
+
|
| 30 |
+
| model | params | STS-B | SICK-R | STS12 | STS13 | STS14 | STS15 | STS16 | BIOSSES | mean |
|
| 31 |
+
|---|---|---|---|---|---|---|---|---|---|---|
|
| 32 |
+
| bert-base | 109.5M | 0.4729 | 0.5865 | 0.3087 | 0.5988 | 0.4773 | 0.6029 | 0.6373 | 0.5469 | 0.5289 |
|
| 33 |
+
| ModernBERT-base | 149.0M | 0.4215 | 0.5479 | 0.3527 | 0.4247 | 0.3795 | 0.5349 | 0.4174 | 0.5630 | 0.4552 |
|
| 34 |
+
| roberta-base | 124.6M | 0.5436 | 0.6296 | 0.3211 | 0.5631 | 0.4522 | 0.6134 | 0.6198 | 0.5777 | 0.5401 |
|
| 35 |
+
| albert-base-v2 | 11.7M | 0.4784 | 0.5364 | 0.3101 | 0.4831 | 0.3809 | 0.5542 | 0.5491 | 0.4863 | 0.4723 |
|
| 36 |
+
| distilbert | 66.4M | 0.5717 | 0.6424 | 0.4344 | 0.6490 | 0.5410 | 0.6663 | 0.6854 | 0.5162 | 0.5883 |
|
| 37 |
+
| **captionbert-8192-v2** | 58.3M | **0.5747** | **0.6526** | **0.5051** | **0.5995** | **0.5452** | **0.7136** | **0.6776** | **0.5933** | **0.6077** |
|
| 38 |
+
| **captionbert-8192-v2 + arms** | 63.2M | **0.7684** | **0.7391** | **0.6682** | **0.7557** | **0.6921** | **0.8055** | **0.7626** | **0.6382** | **0.7287** |
|
| 39 |
+
| captionbert-8192-b | 58.3M | 0.5752 | 0.6548 | 0.5012 | 0.6037 | 0.5470 | 0.7146 | 0.6782 | 0.5500 | 0.6031 |
|
| 40 |
+
| all-MiniLM-L6-v2 | 22.7M | 0.8203 | 0.7758 | 0.7237 | 0.8058 | 0.7559 | 0.8539 | 0.7899 | 0.8144 | 0.7925 |
|
| 41 |
+
|
| 42 |
+
All ten models measured in **one harness**, same eight tasks, **mean-pooled and
|
| 43 |
+
L2-normalized**, no task tuning. Spearman correlation; `mean` is the unweighted
|
| 44 |
+
average over the eight.
|
| 45 |
+
|
| 46 |
+
`all-MiniLM-L6-v2` was contrastively trained on 1B+ curated sentence pairs. It is
|
| 47 |
+
listed for scale, not as a peer -- nothing here saw a similarity label.
|
| 48 |
+
|
| 49 |
+
**The trunk beats every teacher it was distilled from**, and the best of them
|
| 50 |
+
(distilbert, .5883) by +.0194 -- at **13% of their combined 461M parameters**,
|
| 51 |
+
having never seen a similarity label. The margin comes mostly from STS12, where
|
| 52 |
+
every teacher collapses to .31-.43 and the trunk holds .50.
|
| 53 |
+
|
| 54 |
+
**With arms it clears the best teacher by +.14** and closes to within **.063** of
|
| 55 |
+
a model trained on a billion curated pairs.
|
| 56 |
+
|
| 57 |
+
Mean-pooled BERT-family encoders are known-weak sentence encoders -- that is the
|
| 58 |
+
reason Sentence-BERT exists -- so beating them is an efficiency result rather
|
| 59 |
+
than a state-of-the-art one. The MiniLM row is in the table to keep that honest.
|
| 60 |
+
|
| 61 |
+
### Geometry
|
| 62 |
+
|
| 63 |
+
| model | self_cos | erank |
|
| 64 |
+
|---|---|---|
|
| 65 |
+
| bert-base | +0.6071 | 32.8 |
|
| 66 |
+
| ModernBERT-base | +0.9001 | 26.1 |
|
| 67 |
+
| roberta-base | +0.9594 | 19.8 |
|
| 68 |
+
| albert-base-v2 | +0.7473 | 20.9 |
|
| 69 |
+
| distilbert | +0.6920 | 31.1 |
|
| 70 |
+
| **captionbert-8192-v2** | +0.1396 | 36.6 |
|
| 71 |
+
| **captionbert-8192-v2 + arms** | +0.0964 | 57.6 |
|
| 72 |
+
| captionbert-8192-b | +0.1411 | 36.1 |
|
| 73 |
+
| all-MiniLM-L6-v2 | +0.0251 | 86.7 |
|
| 74 |
+
|
| 75 |
+
`self_cos` is the isotropy gauge: the mean cosine between unrelated sentences.
|
| 76 |
+
Mean-pooled BERT-family embeddings sit in a narrow cone (+.61 to +.96), where
|
| 77 |
+
cosine cannot discriminate. `erank` is the participation ratio -- how many of the
|
| 78 |
+
768 directions carry variance.
|
| 79 |
+
|
| 80 |
+
Both track capability almost perfectly across all ten models, and **isotropy is
|
| 81 |
+
the mechanism**: no isotropy objective appears anywhere in the training stack.
|
| 82 |
+
The arms then lift erank 36.6 -> 57.6, the first evidence in this line that
|
| 83 |
+
adaptation *adds* usable directions rather than only rotating them.
|
| 84 |
|
| 85 |
## With AMOE arms (`amoe/`)
|
| 86 |
|
|
|
|
| 160 |
|
| 161 |
`pip install git+https://github.com/AbstractEyes/amoe-lora` for the arm methods.
|
| 162 |
|
| 163 |
+
### Arms do not transfer between trunks
|
| 164 |
+
|
| 165 |
+
These anchors were trained against **this** trunk's residual stream. Measured
|
| 166 |
+
against the sibling [`captionbert-8192-b`](https://huggingface.co/AbstractPhil/captionbert-8192-v2-B)
|
| 167 |
+
(same architecture, complete 66-chunk corpus):
|
| 168 |
+
|
| 169 |
+
| configuration | 8-task mean |
|
| 170 |
+
|---|---|
|
| 171 |
+
| v2 arms on v2 | .7287 |
|
| 172 |
+
| v2 arms on **-b** | .6863 |
|
| 173 |
+
| + re-aligned routing keys | .6987 |
|
| 174 |
+
| -b's own anchors on -b | .7295 |
|
| 175 |
+
|
| 176 |
+
Transferring costs **31% of the gain**; re-training only the 1,536 routing keys
|
| 177 |
+
recovers 29% of that, so **71% of the loss is in the anchors themselves**.
|
| 178 |
+
|
| 179 |
+
The two trunks are indistinguishable on all eight tasks (+.0009 mean excluding
|
| 180 |
+
the 100-row BIOSSES) and on geometry, yet 1.6M adapter parameters tell them
|
| 181 |
+
apart -- adapters read the residual stream, the task gauges read the pooled
|
| 182 |
+
output, and the stream carries trunk identity the output does not. Budget one
|
| 183 |
+
anchor set per trunk (~18 min).
|
| 184 |
+
|
| 185 |
### Arm library
|
| 186 |
|
| 187 |
`amoe/arms/` holds one canonical copy of every anchor with `ARMS.json`
|
|
|
|
| 220 |
- **10 of 66 source chunks lacked ModernBERT**, so 54 chunks (~27M rows) were
|
| 221 |
used. No 4-expert fallback: that would change the target definition mid-dataset.
|
| 222 |
- Trained on image captions. Expect caption-like text to be its strongest domain.
|
| 223 |
+
- **A sibling trained on the complete 66-chunk corpus** ([`-b`](https://huggingface.co/AbstractPhil/captionbert-8192-v2-B))
|
| 224 |
+
scores within .0046 of this one bare and .0008 with arms. 19% more data bought
|
| 225 |
+
nothing: the ceiling is teacher agreement (28.7 of 768 shared directions), not
|
| 226 |
+
corpus size.
|
| 227 |
- **The trunk is single-seed.** The AMOE results are 2-seed with a measured
|
| 228 |
spread of .003-.005, against margins of +.012 to +.019.
|
| 229 |
- `amoe/sts-combo` stopped at step 500 of a planned 4000; its card and config
|