File size: 5,294 Bytes
2f92e95 ff416bc 2f92e95 ff416bc 2f92e95 ff416bc 2f92e95 ff416bc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | # Teacher embeddings
The cached teacher embeddings that stage 2 of OpenEmbed-0.8B, -2B, -4B and -9B distilled from. All four models read
the same store: 75 datasets, 11,868,778 training rows. This folder holds the vectors of all 75 (11,868,774 rows,
48.7 GB); only 4 rows have none (below).
| Teacher | Datasets | Rows with vectors | Licence |
|---|---|---|---|
| [Qwen/Qwen3-VL-Embedding-8B](https://huggingface.co/Qwen/Qwen3-VL-Embedding-8B), revision `2c4565515e0f265c6511776e7193b22c0968ddc7` | 51 | 8,726,225 | Apache-2.0 |
| [tencent/WeMM-Embedding-9B](https://huggingface.co/tencent/WeMM-Embedding-9B) | 24 | 3,142,549 | Apache-2.0 |
Each folder's `teacher.json` names its teacher. Qwen3-VL-Embedding-8B embedded a row's query with the dataset's query
instruction in the system message and the positive with the model's default instruction ("Represent the user's
input."). It ran in our Flax port with float32 activations, checked against the Hugging Face model on canary inputs.
WeMM-Embedding-9B embedded query and positive as the student renders them, with the dataset's instructions, in our
Flax port with bfloat16 language-model activations and a float32 vision tower.
## Layout
```
teacher/
MANIFEST.json per dataset: teacher, rows, rows encoded, parts, bytes
<category>/<name>/ the same folder name as the dataset's records in this repository
part-00000.npz, ... record_key int64 [n]; q, p float16 [n, 1024]
teacher.json teacher, row counts, repeated keys, the size and sha256 of every file
labels.npz, labels.json the 10 classification datasets only (below)
```
`q` is the teacher's embedding of a row's query and `p` that of its positive: the first 1,024 of the teacher's 4,096
dimensions, re-normalised to unit length. These are the files training read, byte for byte; only the part numbers
are new.
The 10 classification datasets also have `labels.npz`: one vector per class name, `labels` (float16 [V, 1024], the
same prefix, re-normalised) and `labels_full` (float16 [V, 4096]), plus `vocab_sha256`. Row i belongs to
`labels.json["labels"][i]`. Training used these vectors for the class-name candidates of the label pool.
## Joining the records
`record_key` joins a vector to the `record_key` column of the dataset's `records.parquet`. It is a 64-bit content key
over the record's dataset id, modality, query image and text, and target image and text. The snippet needs numpy and
pyarrow (`pip install numpy pyarrow`) and runs from the folder that holds `teacher/<category>/<name>/` and
`<category>/<name>/` (see Getting the files in the repository README):
```python
import glob
import numpy as np
import pyarrow.parquet as pq
def teacher_vectors(folder):
parts = [np.load(f) for f in sorted(glob.glob(f"teacher/{folder}/part-*.npz"))]
keys = np.concatenate([z["record_key"] for z in parts])
q = np.concatenate([z["q"] for z in parts])
p = np.concatenate([z["p"] for z in parts])
order = np.argsort(keys, kind="stable") # a repeated key keeps its first row in file order
return keys[order], q[order], p[order]
keys, q, p = teacher_vectors("vqa/llavanext-vqa")
rk = pq.read_table("vqa/llavanext-vqa/records.parquet", columns=["record_key"]).column(0).to_numpy()
i = np.minimum(np.searchsorted(keys, rk), len(keys) - 1)
found = keys[i] == rk # q[i], p[i] are the record's vectors where found
```
The training loader does the same (`wemm.teacher_store`). Loaded this way a dataset takes about 4 KB per row; the
largest, the two VisualNews sets, about 5 GB each.
**Coverage.** We joined every dataset with its released records. All 11,864,921 records of the 75 datasets have a
vector except 4 in `text/msmarco-passage`, whose positive passage was longer than the teacher pass accepted; training
gave these 4 no distillation term. Every vector belongs to a released record.
**Repeated keys.** In 21 datasets some keys occur more than once (6,192 extra rows in all; `repeated_record_keys` in
`teacher.json`). In 20 of them the records repeat too: rows with the same query and target share the content key. In
`vqa/llavanext-vqa`, 3,857 records were embedded twice. The copies of a key agree: bit for bit for
Qwen3-VL-Embedding-8B, and to a cosine of at least 0.9995 for WeMM-Embedding-9B, whose bfloat16 activations vary
slightly with the batch. Training read the first copy in file order, as the snippet above does.
## How stage 2 used them
The distillation term of the paper (Sec. 4): for each row, the teacher's softmax over the cosine similarities of `q`
to the batch's candidates (`p` of the rows, class-name vectors in the label pool), at temperature 0.02, is matched to
the student's with the KL divergence taken in both directions, each split into a positive-versus-rest part and a part
over the negatives alone (decoupled distillation). The term enters the loss with weight 0.5. Explicit negatives have no teacher vectors and stay out of
it, as do rows without a vector. Training launcher settings: `TEACHER_DIM=1024 KD_WEIGHT=0.5 KD_TAU=0.02 KD_MODE=sym
KD_DKD=1`.
## Terms
Both teachers are Apache-2.0. The vectors are computed from each dataset's records, so that dataset's terms (its
folder's README) apply to them too.
|