Feature Extraction
Transformers
TensorBoard
Safetensors
English
captionbert_structured_rotary
sentence-similarity
consensus-distillation
rotary-embeddings
custom_code
Instructions to use AbstractPhil/captionbert-8192-rotary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbstractPhil/captionbert-8192-rotary with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="AbstractPhil/captionbert-8192-rotary", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbstractPhil/captionbert-8192-rotary", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Document completed positional screen 817daa9e
Browse files
README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
library_name: pytorch
|
| 5 |
+
pipeline_tag: sentence-similarity
|
| 6 |
+
tags:
|
| 7 |
+
- captionbert
|
| 8 |
+
- rotary
|
| 9 |
+
- sentence-similarity
|
| 10 |
+
- consensus-distillation
|
| 11 |
+
datasets:
|
| 12 |
+
- AbstractPhil/conceptual-captions-12m-webdataset-berts
|
| 13 |
+
- AbstractPhil/captionbert-8192-v2-consensus
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# captionbert-8192-rotary
|
| 17 |
+
|
| 18 |
+
A controlled positional screen of CaptionBERT v2: the learned-position replication (A0), plain token RoPE (A1), sentence-address rotary (A2), and its anchor ablation (A3). Every arm is trained from scratch against the same precomputed five-teacher consensus. Inference uses the tokenizer and one student; teacher models are not loaded.
|
| 19 |
+
|
| 20 |
+
This is a short screen, separate from the original v2 full training run. Both seeds and all arms, including weaker results, are retained. No single winner is selected automatically.
|
| 21 |
+
|
| 22 |
+
## Loading
|
| 23 |
+
|
| 24 |
+
Install the tagged package in an isolated Python 3.11–3.13 environment:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
pip install git+https://github.com/AbstractEyes/captionbert-trainer.git@v0.2.0
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from captionbert_rotary.inference import SentenceEncoder
|
| 32 |
+
encoder = SentenceEncoder.from_pretrained("AbstractPhil/captionbert-8192-rotary",
|
| 33 |
+
run="experiments/817daa9e66a8119dc6b18a9b63fad32490d1c891e5f26750e91125d9e5e14e6c/A2-seed1",
|
| 34 |
+
revision="4e75920dfe6ddd820db321608a853c2097533f4e")
|
| 35 |
+
embeddings = encoder.encode(["A cat watches the street.", "A person walks nearby."])
|
| 36 |
+
# embeddings: (2, 768), L2-normalized
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Choose an explicit arm and seed. A2-seed1 above is a loading example, not a claim that it is best. Model code, requirements, tests and notebooks live in [captionbert-trainer](https://github.com/AbstractEyes/captionbert-trainer/tree/v0.2.0).
|
| 40 |
+
|
| 41 |
+
The [technical companion](https://github.com/AbstractEyes/captionbert-trainer/blob/v0.2.0/docs/rotary_measurements.md) describes the measurement controls, report fields and limits.
|
| 42 |
+
|
| 43 |
+
## Benchmark
|
| 44 |
+
|
| 45 |
+
Spearman correlation on the same eight test tasks as the v2 harness; mean is the unweighted task average. The benchmark uses its original 64-token ceiling.
|
| 46 |
+
|
| 47 |
+
| arm / seed | STS-B | SICK-R | STS12 | STS13 | STS14 | STS15 | STS16 | BIOSSES | mean |
|
| 48 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 49 |
+
| A0 / 1 | 0.4531 | 0.6199 | 0.4476 | 0.4354 | 0.4537 | 0.6350 | 0.4667 | 0.5083 | 0.5025 |
|
| 50 |
+
| A0 / 2 | 0.4557 | 0.6224 | 0.4292 | 0.4443 | 0.4470 | 0.6445 | 0.4750 | 0.4291 | 0.4934 |
|
| 51 |
+
| A1 / 1 | 0.5057 | 0.6330 | 0.4756 | 0.4316 | 0.4764 | 0.6601 | 0.5166 | 0.4693 | 0.5211 |
|
| 52 |
+
| A1 / 2 | 0.4965 | 0.6314 | 0.4769 | 0.4673 | 0.4736 | 0.6689 | 0.5148 | 0.3934 | 0.5153 |
|
| 53 |
+
| A2 / 1 | 0.5248 | 0.6339 | 0.4817 | 0.4665 | 0.4946 | 0.6665 | 0.5206 | 0.4607 | 0.5312 |
|
| 54 |
+
| A2 / 2 | 0.4864 | 0.6328 | 0.4706 | 0.4405 | 0.4649 | 0.6756 | 0.4949 | 0.4872 | 0.5191 |
|
| 55 |
+
| A3 / 1 | 0.5252 | 0.6383 | 0.4741 | 0.4755 | 0.4931 | 0.6685 | 0.5251 | 0.4983 | 0.5373 |
|
| 56 |
+
| A3 / 2 | 0.4845 | 0.6352 | 0.4528 | 0.4538 | 0.4751 | 0.6762 | 0.5010 | 0.4168 | 0.5119 |
|
| 57 |
+
|
| 58 |
+
The published full-run v2 mean was 0.6077 after 26.9M rows and 52,548 steps. That is historical context, not the matched control for this screen; the matched control is A0 here.
|
| 59 |
+
|
| 60 |
+
## Geometry
|
| 61 |
+
|
| 62 |
+
Effective rank is the participation ratio of centered variance. Self-cosine is the mean off-diagonal cosine, an isotropy readout. Cosine to consensus measures mimicry, separate from task capability.
|
| 63 |
+
|
| 64 |
+
The following caption-domain measurements use the fixed held-out chunk-61 sample, separately from the benchmark sentences. The >128-token slice is sampled separately from that chunk.
|
| 65 |
+
|
| 66 |
+
| arm / seed | parameters | steps | held-out cosine | effective rank | self-cosine | seconds/step |
|
| 67 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 68 |
+
| A0 / 1 | 58,308,864 | 1952 | 0.7226 | 68.19 | 0.0191 | 0.400 |
|
| 69 |
+
| A0 / 2 | 58,308,864 | 1952 | 0.7478 | 71.79 | 0.0181 | 0.400 |
|
| 70 |
+
| A1 / 1 | 54,114,560 | 1952 | 0.7459 | 71.34 | 0.0194 | 0.464 |
|
| 71 |
+
| A1 / 2 | 54,114,560 | 1952 | 0.7615 | 74.13 | 0.0171 | 0.464 |
|
| 72 |
+
| A2 / 1 | 54,114,560 | 1952 | 0.7427 | 71.87 | 0.0204 | 0.464 |
|
| 73 |
+
| A2 / 2 | 54,114,560 | 1952 | 0.7635 | 73.77 | 0.0158 | 0.465 |
|
| 74 |
+
| A3 / 1 | 54,114,560 | 1952 | 0.7429 | 69.80 | 0.0205 | 0.465 |
|
| 75 |
+
| A3 / 2 | 54,114,560 | 1952 | 0.7622 | 73.08 | 0.0169 | 0.465 |
|
| 76 |
+
|
| 77 |
+
| arm / seed | >128-token cosine | effective rank | self-cosine | measured rows |
|
| 78 |
+
|---|---:|---:|---:|---:|
|
| 79 |
+
| A0 / 1 | 0.6549 | 53.25 | 0.0312 | 5000 |
|
| 80 |
+
| A0 / 2 | 0.6831 | 50.99 | 0.0610 | 5000 |
|
| 81 |
+
| A1 / 1 | 0.6730 | 54.01 | 0.0358 | 5000 |
|
| 82 |
+
| A1 / 2 | 0.6862 | 53.85 | 0.0672 | 5000 |
|
| 83 |
+
| A2 / 1 | 0.6723 | 55.57 | 0.0345 | 5000 |
|
| 84 |
+
| A2 / 2 | 0.6879 | 53.59 | 0.0551 | 5000 |
|
| 85 |
+
| A3 / 1 | 0.6740 | 55.14 | 0.0344 | 5000 |
|
| 86 |
+
| A3 / 2 | 0.6834 | 52.04 | 0.0611 | 5000 |
|
| 87 |
+
|
| 88 |
+
## Rotary measurements
|
| 89 |
+
|
| 90 |
+
The fixed frozen-model protocol measures address kernels, simplex coherence and its explicit constant lift, periodic aliases versus the sentence clamp, identical-content oracle address lookup, controlled address changes, q/k-band removals, and per-layer/head energy and attention-mass changes.
|
| 91 |
+
|
| 92 |
+
The encoder rotates tokens to their own coordinates. It has no learned request head or AMOE member gate. Code-only oracle lookup and embedding sensitivity are not learned semantic-retrieval accuracy or task improvement. The raw anchor code is a regular simplex; the encoder does not fix the constant coordinate of the orthogonal lift.
|
| 93 |
+
|
| 94 |
+
| arm / seed | repeated baseline max error | sentence-ID collapse, mean L2 change | anchor q/k removal, mean L2 change |
|
| 95 |
+
|---|---:|---:|---:|
|
| 96 |
+
| A0 / 1 | 0.00000000 | n/a | n/a |
|
| 97 |
+
| A0 / 2 | 0.00000000 | n/a | n/a |
|
| 98 |
+
| A1 / 1 | 0.00000000 | 0.000000 | 0.000000 |
|
| 99 |
+
| A1 / 2 | 0.00000000 | 0.000000 | 0.000000 |
|
| 100 |
+
| A2 / 1 | 0.00000000 | 0.272284 | 0.116291 |
|
| 101 |
+
| A2 / 2 | 0.00000000 | 0.318407 | 0.135013 |
|
| 102 |
+
| A3 / 1 | 0.00000000 | 0.000000 | 0.000000 |
|
| 103 |
+
| A3 / 2 | 0.00000000 | 0.000000 | 0.000000 |
|
| 104 |
+
|
| 105 |
+
A0 has no rotary bands (n/a). A1/A3 have no anchor band, so anchor-removal effects are structural negative controls. Full probe inputs, checkpoint/source hashes, dtype/device, all interventions and every layer/head are in each run's `rotary_diagnostics.json` or additive `analyses/captionbert-rotary-mechanisms-v1/` report. The frozen repeat measures diagnostic-call precision, not training hardware-repeat uncertainty.
|
| 106 |
+
|
| 107 |
+
## How it was built
|
| 108 |
+
|
| 109 |
+
| part | screen recipe |
|
| 110 |
+
|---|---|
|
| 111 |
+
| arms / seeds | A0, A1, A2, A3 / 1, 2 |
|
| 112 |
+
| training chunks | [0, 1, 2, 3] |
|
| 113 |
+
| held-out chunk | 61 |
|
| 114 |
+
| epochs / contrastive batch | 2 / 2048 |
|
| 115 |
+
| optimizer | pure Adam, weight decay zero; peak LR 0.0006 |
|
| 116 |
+
| schedule | 2000-step linear warmup from 1%, then cosine |
|
| 117 |
+
| training token ceiling | 256 |
|
| 118 |
+
| objective / pooling | symmetric InfoNCE (T=0.07) + MSE; masked mean; L2-normalized 768-d output |
|
| 119 |
+
|
| 120 |
+
Captions and consensus tensors are paired by flat row index, with exact row-count checks. Sentence indices advance after `.`, `!` or `?`; the next token resets its sentence-local slot. A2 has content 8, slot 12 (wavelengths 3–256) and anchor 12 pairs per 64-d head; A3 has content 8 and slot 24. A1 uses all 32 pairs on global token index.
|
| 121 |
+
|
| 122 |
+
## Known limits
|
| 123 |
+
|
| 124 |
+
- The short screen spends most of its approximately 2,000 steps in the original 2,000-step warmup. It does not reproduce v2's full-run scale.
|
| 125 |
+
- Training is capped at 256 tokens. The model name and A0's 8,192-position table do not establish 8k-context quality.
|
| 126 |
+
- Sentence IDs clamp at 24. Unclamped rotary codes repeat every 25 addresses; neither is unlimited sentence capacity.
|
| 127 |
+
- Caption-domain consensus agreement and STS capability are separate measurements. These five teachers also constrain the target's shared geometry.
|
| 128 |
+
- Paired seeds expose seed dependence; a settled improvement additionally needs the applicable uncertainty/repeat evidence. A large band-removal response alone does not establish useful structure.
|
| 129 |
+
|
| 130 |
+
## Output convention
|
| 131 |
+
|
| 132 |
+
The package's `SentenceEncoder.encode` returns a `(batch, 768)` normalized tensor. This repository contains multiple explicit run artifacts; it is not a root-level Transformers `AutoModel` checkpoint.
|
| 133 |
+
|
| 134 |
+
## Provenance
|
| 135 |
+
|
| 136 |
+
Experiment `817daa9e66a8119dc6b18a9b63fad32490d1c891e5f26750e91125d9e5e14e6c`; result files read at Hub revision `4e75920dfe6ddd820db321608a853c2097533f4e`. Model-card organization follows the [v2 card](https://huggingface.co/AbstractPhil/captionbert-8192-v2/blob/ed468fe5aed64a3d03a56a7f7811131d20f81ddb/README.md). Original results, every arm/seed, weights and analysis JSON remain under their immutable experiment paths.
|
| 137 |
+
|
| 138 |
+
## Citation
|
| 139 |
+
|
| 140 |
+
```bibtex
|
| 141 |
+
@misc{captionbert_rotary_2026,
|
| 142 |
+
title = {CaptionBERT Sentence-Address Rotary Screen},
|
| 143 |
+
author = {AbstractPhil},
|
| 144 |
+
year = {2026},
|
| 145 |
+
url = {https://huggingface.co/AbstractPhil/captionbert-8192-rotary}
|
| 146 |
+
}
|
| 147 |
+
```
|