Training mixes
Each mix is a weighted, shuffled, materialized set of token shards (.bin/.idx/.desc +
manifest.json, per molvae.data.format), built from ../raw/ by mix_dataset.py.
The shards live on S3 (s3://mechanophore/molvae/tokens/<name>/) and are mirrored under each
mix's data/. The *.config.json here is the exact, re-runnable spec.
Builder
mix_dataset.py is torch-free (numpy + pyarrow + boto3 + huggingface_hub). Disk-backed & bounded-RAM:
Phase A streams each source once and fraction-samples it to disk (vectorized per parquet batch —
~7M rows/s; parquets are downloaded, not fsspec-streamed); Phase B external scatter-shuffles the
per-source temp shards into --out-shards output buckets. Per-source knobs: weight, min_len/max_len
(length filter, e.g. long-molecule streams — keep-prob is calibrated to the post-filter pool), and for
bin sources a size-stratified shard selection with per_shard_cap (or default largest-first).
Every build dedups against the held-out mechanophore test set (--dedup-holdout).
# rebuild a mix (on the CPU node; source S3 creds first)
python mix_dataset.py --config mix-v2-1B.config.json \
--dedup-holdout mechano_test.jsonl --out /tmp/mix \
--s3 s3://mechanophore/molvae/tokens/mix-v2-1B --out-shards 512 --shard-size 100000
Design principle
Sample by weights, not raw counts — the mechanophore target is a strained core at ~27 heavy atoms with esters/nitriles, which no single source spans. GDB gives strained ring grammar (but small); mcule/eMolecules give the long molecules (but drug-like); ZINC gives a medium size anchor. The mix's job is to span the composition. (Long+strained together still needs Phase-2 sources — COCONUT / SAVI — not yet added.)
mix-v2-1B — the strained-rich pretrain mix (current)
~60% GDB (strain) · ~40% size/length · ~9–13% of mols ≥55 tokens (long-decode).
| weight | source | role |
|---|---|---|
| 35% | gdb13 | strain-volume workhorse (≤13 HA rings) |
| 8% | GDB4c3D | curated strained |
| 8% | GDB-13s | ring diversity |
| 4% | gdb11 | small exhaustive |
| 5% | GDBMedChem | drug-like ring |
| 12% | ZINC (largest-first) | medium size anchor |
| 10% | mcule | long-ish (median 46) |
| 5% | mcule-long (min_len 55) |
long-decode leg (all ≥55, to 154 tok) |
| 13% | eMolecules ordersc | long + diverse (to 168 tok) |
mix-v2-40M is the same composition at 40M (pilot). mix-phase1-40M is the earlier v1
(ZINC 40% / GDB4c3D 35% / GDBMedChem 15% / ChEMBL 10%). See each *.config.json for exact specs.
Loading (training side, needs torch)
from molvae.data import MolvaeDataset, make_loader
ds = MolvaeDataset("<local>/mix-v2-1B", "train") # mmap token shards
loader = make_loader(ds, pad_id=3, token_budget=12288)