File size: 7,786 Bytes
4139d09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
license: other
license_name: mixed-upstream
language:
  - en
tags:
  - biology
  - proteins
  - protein-language-model
  - contrastive-learning
  - embeddings
  - sentence-transformers
  - pfam
  - alphafold
  - string-db
  - proteingym
pretty_name: ProtSent Training Data
size_categories:
  - 100M<n<1B
task_categories:
  - feature-extraction
  - sentence-similarity
configs:
  - config_name: pfam
    data_files: pfam_sorted.parquet
  - config_name: afdb
    data_files: afdb_sorted.parquet
  - config_name: stringdb
    data_files: stringdb_train.parquet
  - config_name: dms
    data_files: dms_cosent.parquet
---

# ProtSent Training Data

Training data for **ProtSent (Protein Sentence Transformers)** — a contrastive fine-tuning
framework that adapts protein language models (ESM-2, ESM-C) into general-purpose sequence
embeddings, so that nearest-neighbor distance reflects functional, evolutionary, and structural
similarity between proteins.

- **Paper:** *ProtSent: Protein Sentence Transformers* (Ofer, Perets, Linial, Rappoport), arXiv:2605.06830
- **Code:** https://github.com/oriel9p/ProtSent
- **Models:** https://huggingface.co/collections/oriel9p/protsent

Four of the paper's five training sources are included as parquet files. The synthetic **Pfam
hard-negatives** set is excluded: the paper's ablation (Tables 4, 7) shows removing it improves
aggregate performance (20/23 tasks improved, +7.9% mean delta, vs. 16/23 at +6.7% with it included).

| Source | Signal | Positive-pair criterion | Loss |
|---|---|---|---|
| **Pfam** | evolutionary / functional homology | same Pfam family | MNRL / GIST |
| **AFDB** | 3D structural similarity | same Foldseek structural cluster | MNRL / GIST |
| **STRING** | physical / functional interaction | pair-native (interacting proteins) | MNRL / GIST |
| **DMS** | continuous mutational fitness | continuous score | CoSENT |

## Files and schema

Two conventions are used. **Grouped** files store one sequence per row plus a group label; positive
pairs are formed at training time from sequences sharing a group (capped per group via
`--max_pairs_per_cluster`). **Pair-native** files store explicit pairs, one per row.

### `pfam_sorted.parquet` — Pfam families (grouped, 2.4 GB)
| column | type | notes |
|---|---|---|
| `sequence` | string | amino-acid sequence (Pfam domain) |
| `family_id` | string | Pfam family (PF accession, version stripped) |
| `clan_id` | string | Pfam clan; orphan families inherit `clan_id := family_id` |
| `group_id` | string | positive-pair label; equals `family_id` |

Sorted `clan_id → family_id`; singleton families dropped. 28.5M domains after MMseqs2
linclust@70% deduplication. Do not shuffle — training relies on the sort order for windowed slicing.

### `afdb_sorted.parquet` — AlphaFold DB Foldseek clusters (grouped, 13 GB)
| column | type | notes |
|---|---|---|
| `sequence` | string | amino-acid sequence (pLDDT > 70, non-fragment) |
| `cluster_id` | string | Foldseek structural-cluster representative |
| `afdb50_cluster_id` | string | AFDB50 (50%-identity) representative |
| `group_id` | string | positive-pair label; equals `cluster_id` |

Sorted by `cluster_id`; single-member clusters dropped. The positive label is the Foldseek
structural cluster (`cluster_id`), coarser than AFDB50 sequence identity.

### `stringdb_train.parquet` — STRING-DB v12 PPI (pair-native, 34 GB)
| column | type | notes |
|---|---|---|
| `seq1` | string | interacting protein A |
| `seq2` | string | interacting protein B |

`combined_score ≥ 400`, Bernett-decontaminated and cluster-deduplicated (see Provenance).
Endpoint length filter `[10, 2048]`.

### `dms_cosent.parquet` — ProteinGym DMS / clinical (pair-native, scored, 106 MB)
| column | type | notes |
|---|---|---|
| `sentence_0` | string | sequence A |
| `sentence_1` | string | sequence B |
| `score` | float | fitness-similarity target for CoSENT (0–1) |

2.18M pairs over 3,576 wild-type targets and 2.09M unique mutants.

## Usage

### Load with `datasets`
```python
from datasets import load_dataset

pfam     = load_dataset("GrimSqueaker/protsent-data", "pfam",     split="train")
afdb     = load_dataset("GrimSqueaker/protsent-data", "afdb",     split="train")
stringdb = load_dataset("GrimSqueaker/protsent-data", "stringdb", split="train")
dms      = load_dataset("GrimSqueaker/protsent-data", "dms",      split="train")
```

### Download raw parquets (for the ProtSent training code)
```python
from huggingface_hub import snapshot_download
snapshot_download("GrimSqueaker/protsent-data", repo_type="dataset", local_dir="data")
```
Files land flat in `data/`. Then train:
```bash
accelerate launch --num_processes 8 --mixed_precision bf16 \
  protein_pipeline.py train \
  --model Synthyra/ESMplusplus_large \
  --files data/pfam_sorted.parquet data/afdb_sorted.parquet data/stringdb_train.parquet \
  --dms_file data/dms_cosent.parquet \
  --loss_mode multi --multi_primary_loss gist \
  --max_seq_length 1024 --max_pairs_per_cluster 100
```
The training code detects file type by schema: `seq1`/`seq2` → PPI pairs; `sentence_0`/`sentence_1`/`score`
→ DMS/CoSENT; otherwise grouped (`sequence` + `group_id`), with positive pairs formed per group.

## Provenance and filtering

- **Pfam**`Pfam-A.fasta.gz` + `Pfam-A.clans.tsv.gz` (EBI current release). MMseqs2 `easy-linclust`
  at 70% identity (`--cov-mode 1 -c 0.8`), family→clan join, singleton families dropped, sorted by
  `(clan_id, family_id)`.
- **AFDB** — sequences from `willdaspit/afdb_clustered_seqs` (pLDDT > 70, non-fragment) inner-joined to
  the Steinegger-Lab AFDB Foldseek v6 S-cluster mapping (`cluFlag ∈ {1,2}`) on the AFDB50
  representative; positive label = Foldseek cluster.
- **STRING** — STRING v12.0 physical links (`combined_score ≥ 400`). Bernett decontamination: any
  STRING protein clustering (MMseqs2 linclust, 50% id / 80% cov) with a `Synthyra/bernett_gold_ppi`
  test sequence is removed. Survivors two-stage clustered (65%/85% then 50%/75%); pairs canonicalized
  and deduplicated per cluster-pair; endpoint length filter `[10, 2048]`.
- **DMS**`OATML-Markslab/ProteinGym_v1` (DMS + clinical, substitutions + indels). Per-assay
  z-scored, clipped to [−3, 3], rescaled to [0, 1]; clinical Pathogenic→0 / Benign→1. GB1 and GFP
  assays dropped (benchmark overlap); supervised test folds removed.

Thresholds, identity cutoffs, and seeds are fixed in `data_prep.py`.

## Leakage controls

- DMS and STRING are decontaminated against their downstream benchmarks (ProteinGym excluded from
  evaluation; Bernett test set removed from STRING).
- Pfam training uses family-membership labels, disjoint from the fold-level remote-homology eval split.
- AFDB uses Foldseek-cluster co-membership rather than SCOPe labels. AFDB sequences are not filtered
  against SCOPe test domains, so partial sequence overlap with SCOPe-40 retrieval is possible — noted
  in the paper as a limitation.

## Reproduce

```bash
# requires MMseqs2 on PATH for pfam + stringdb
python data_prep.py --dataset pfam
python data_prep.py --dataset afdb --limit_gb 0
python data_prep.py --dataset stringdb --max_seq_len 2048 --min_seq_len 10
python data_prep.py --dataset dms
```

## Citation

```bibtex
@article{ofer2026protsent,
  title         = {ProtSent: Protein Sentence Transformers},
  author        = {Ofer, Dan and Perets, Oriel and Linial, Michal and Rappoport, Nadav},
  journal       = {arXiv preprint arXiv:2605.06830},
  year          = {2026},
  eprint        = {2605.06830},
  archivePrefix = {arXiv},
  primaryClass  = {cs.LG},
  url           = {https://arxiv.org/abs/2605.06830}
}
```

## License

Pfam (EBI), AlphaFold DB (CC-BY-4.0), STRING (CC-BY-4.0), and ProteinGym each carry their own
license.