zmactep commited on
Commit
f5551d6
·
verified ·
1 Parent(s): a181320

Release MHC-PLM model weights and metadata

Browse files
CITATION.cff ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "If you use MHC-PLM, please cite this repository and the upstream ESM-C and NetMHCIIpan 4.3 work."
3
+ title: "MHC-PLM: core-aware protein language modeling for MHC class II prediction"
4
+ type: software
5
+ authors:
6
+ - family-names: "Yakovlev"
7
+ given-names: "Pavel"
8
+ version: 0.1.0
9
+ date-released: 2026-08-28
10
+ repository-code: "https://huggingface.co/zmactep/MHC-PLM"
11
+ license: MIT
LICENSE_WEIGHTS.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MHC-PLM weight notice
2
+
3
+ The MHC-PLM adapter and interaction-head weights are released for scientific research,
4
+ reproducibility, and evaluation. They are provided without warranty and are not a
5
+ medical device. Do not use them for clinical diagnosis, treatment selection, or vaccine
6
+ design decisions without independent experimental and regulatory validation.
7
+
8
+ These files are derivative research artifacts. They require the separately downloaded
9
+ `biohub/ESMC-300M` and `biohub/ESMC-600M` base models and were trained using the public
10
+ NetMHCIIpan 4.3 training pack. This notice does not grant rights in either upstream
11
+ asset. Users are responsible for complying with the current Biohub ESM-C license and
12
+ acceptable-use policy, the DTU Health Tech terms applying to NetMHCIIpan data/software,
13
+ and all applicable laws and third-party rights.
14
+
15
+ The original training data and complete ESM-C base weights are not redistributed in the
16
+ MHC-PLM repository. The source code written for MHC-PLM is separately available under
17
+ the MIT license in `LICENSE`.
README.md ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: mhc-plm-research-weight-notice
4
+ license_link: https://huggingface.co/zmactep/MHC-PLM/blob/main/LICENSE_WEIGHTS.md
5
+ library_name: pytorch
6
+ base_model:
7
+ - biohub/ESMC-300M
8
+ - biohub/ESMC-600M
9
+ tags:
10
+ - biology
11
+ - protein-language-model
12
+ - immunology
13
+ - mhc
14
+ - mhc-class-ii
15
+ - peptide-binding
16
+ - antigen-presentation
17
+ - esmc
18
+ - lora
19
+ - multiple-instance-learning
20
+ model-index:
21
+ - name: MHC-PLM core-selected ensemble
22
+ results:
23
+ - task:
24
+ type: mhc-ii-binding-affinity
25
+ name: MHC-II binding affinity
26
+ dataset:
27
+ type: netmhciipan-4.3-full-fold1-audit
28
+ name: NetMHCIIpan 4.3 fold 1 audit excluding fixed selection rows
29
+ metrics:
30
+ - type: auroc-500nm
31
+ name: BA AUROC at 500 nM
32
+ value: 0.8881501373829886
33
+ - type: average-precision-500nm
34
+ name: BA average precision at 500 nM
35
+ value: 0.8529772425709462
36
+ - type: pearson-r
37
+ name: BA Pearson r
38
+ value: 0.7654025002504102
39
+ - type: spearman-r
40
+ name: BA Spearman r
41
+ value: 0.7655603005570821
42
+ - type: mse
43
+ name: BA mean squared error
44
+ value: 0.028142128247225746
45
+ - task:
46
+ type: mhc-ii-eluted-ligand
47
+ name: MHC-II eluted-ligand presentation
48
+ dataset:
49
+ type: netmhciipan-4.3-full-fold1-audit
50
+ name: NetMHCIIpan 4.3 fold 1 audit excluding fixed selection rows
51
+ metrics:
52
+ - type: auroc
53
+ name: EL AUROC
54
+ value: 0.9644079925097755
55
+ - type: average-precision
56
+ name: EL average precision
57
+ value: 0.8110726901017381
58
+ ---
59
+
60
+ # MHC-PLM
61
+
62
+ MHC-PLM is a research model for joint MHC class II binding-affinity (BA) and
63
+ eluted-ligand presentation (EL) prediction. The primary release is a four-member ensemble
64
+ selected on a peptide-9-mer-disjoint subset and frozen before evaluation on the remaining
65
+ full fold.
66
+
67
+ The architecture combines pinned ESM-C encoders with peptide-to-MHC cross-attention,
68
+ explicit forward/reverse 9-mer binding-register enumeration, multi-allelic
69
+ multiple-instance pooling, and an EL-only processing-context branch. The released files
70
+ are compact LoRA plus interaction-head state dictionaries; the Biohub ESM-C base models
71
+ are downloaded separately at exact revisions.
72
+
73
+ This model is **not a medical device**, has not been validated for clinical decision
74
+ making, and should not be described as state of the art. It requires direct same-row
75
+ baseline comparisons, all-fold validation, external temporal tests, and uncertainty
76
+ estimation before such claims.
77
+
78
+ ## Primary result
79
+
80
+ | Evaluation | Composite | BA AUROC | BA AP | BA Pearson | EL AUROC | EL AP |
81
+ |---|---:|---:|---:|---:|---:|---:|
82
+ | Core-disjoint selection | 0.866341 | 0.879578 | 0.843251 | 0.749431 | 0.963304 | 0.873052 |
83
+ | Frozen full-fold audit | **0.857258** | **0.888150** | **0.852977** | **0.765403** | **0.964408** | **0.811073** |
84
+
85
+ The full-fold audit contains 21,794 BA and 1,516,156 EL rows after excluding the fixed
86
+ model-selection subset; EL positive prevalence is 0.08165. The best individual model is
87
+ `stage4` with full-fold composite 0.852588. The preselected ensemble improves it by
88
+ 0.004671. An exploratory full-fold search happened to choose the same four members, but
89
+ it did not define the primary model.
90
+
91
+ ## Files and ensemble composition
92
+
93
+ `ensemble.json` is the authoritative machine-readable release manifest. Inference uses
94
+ the arithmetic mean of post-sigmoid scores from:
95
+
96
+ | Member | Backbone | Role | SHA-256 |
97
+ |---|---|---|---|
98
+ | `stage3` | ESMC-300M | Main trajectory stage 3 | `2ef7668d…a640892` |
99
+ | `600m` | ESMC-600M | Independently trained diversity member | `7e6dda37…8dedda` |
100
+ | `stage4` | ESMC-300M | Best individual, low-LR continuation | `8a2efbde…9493493` |
101
+ | `replica_s3333` | ESMC-300M | Independent seed trajectory | `aedbaf24…478237` |
102
+
103
+ The exact base revisions are:
104
+
105
+ - `biohub/ESMC-300M@a59b831785f907e96e6a246b1d142bfb76df31ee`
106
+ - `biohub/ESMC-600M@a7e82012c83126b9eedb055fea9fa84b6c02f094`
107
+
108
+ The CLI checks the complete SHA-256 of every adapter file before loading it. Members are
109
+ loaded sequentially to limit peak memory.
110
+
111
+ ## Installation
112
+
113
+ The model repository contains weights and release metadata only. Install the inference
114
+ code from the paired [GitHub source repository](https://github.com/zmactep/MHC-PLM):
115
+
116
+ ```bash
117
+ git clone https://github.com/zmactep/MHC-PLM.git
118
+ cd MHC-PLM
119
+ uv python install 3.10
120
+ uv sync --locked --extra gpu
121
+ ```
122
+
123
+ ## Quick start
124
+
125
+ The GitHub source repository contains `examples/input.tsv`:
126
+
127
+ ```text
128
+ id task peptide alleles mhc_sequences context
129
+ ha_ba ba PKYVKQNTLKLAT DRB1_0101 QEFFIASGAAVDAIMWLFLECYDLQRATYHVGFT
130
+ ha_el el PKYVKQNTLKLAT DRB1_0101 QEFFIASGAAVDAIMWLFLECYDLQRATYHVGFT XXXPKYLATXXX
131
+ ```
132
+
133
+ Run the full ensemble. The CLI downloads `ensemble.json` and the required weights from
134
+ this Hugging Face repository automatically:
135
+
136
+ ```bash
137
+ uv run --locked --extra gpu mhc2-plm-predict \
138
+ --input examples/input.tsv \
139
+ --output predictions.tsv
140
+ ```
141
+
142
+ Run the best individual model only:
143
+
144
+ ```bash
145
+ uv run --locked --extra gpu mhc2-plm-predict \
146
+ --members stage4 \
147
+ --input examples/input.tsv \
148
+ --output predictions-stage4.tsv
149
+ ```
150
+
151
+ For an offline deployment, download this model repository separately and pass its local
152
+ path with `--model-dir /path/to/MHC-PLM-model`.
153
+
154
+ ### Input contract
155
+
156
+ - `task` is `ba` or `el`.
157
+ - `peptide` must contain at least nine residues.
158
+ - `alleles` and `mhc_sequences` are corresponding semicolon-separated lists. The model
159
+ was trained on MHC-II pseudosequences, not raw allele strings or full chains.
160
+ - EL `context` contains three upstream residues, the first three peptide residues, the
161
+ last three peptide residues, and three downstream residues. Missing context is replaced
162
+ by twelve `X` residues and should be treated as lower-information input.
163
+ - Up to 14 candidate alleles are pooled as latent alternatives.
164
+
165
+ The output provides the ensemble score and all selected member scores. BA score is the
166
+ normalized affinity target, where higher is stronger; the CLI also reports the inverse
167
+ approximation `IC50 nM = 50000^(1-score)`. EL score is suitable for ranking but is not a
168
+ calibrated probability. This release does not provide NetMHCIIpan-style percentile ranks.
169
+
170
+ ## Model architecture
171
+
172
+ Each member uses:
173
+
174
+ 1. an ESMC-300M or ESMC-600M encoder with rank-16 LoRA on all linear layers;
175
+ 2. a 256-dimensional interaction projection;
176
+ 3. two 8-head peptide-to-MHC cross-attention blocks;
177
+ 4. all overlapping 9-mer peptide cores in forward and reverse orientations;
178
+ 5. separate BA and EL register heads;
179
+ 6. EL-only flanking-context adaptation;
180
+ 7. temperature-0.15 masked log-mean-exp pooling over candidate allele, register, and
181
+ orientation.
182
+
183
+ BA uses Huber loss on normalized affinity. EL uses weighted binary cross-entropy with
184
+ positive weight 10.04. Optimization uses AdamW with separate backbone/head learning
185
+ rates, warmup, cosine decay, gradient clipping, and weak register-entropy regularization.
186
+
187
+ ## Training and evaluation data
188
+
189
+ The training source was the public NetMHCIIpan 4.3 training pack from DTU Health Tech:
190
+ 129,110 BA and 7,594,916 EL records across five supplied folds. The source archive SHA-256
191
+ was `bde8e21addba99ed8a2202f5c6aff40d653cddc425aa728fb5b9378c3aaa2261`.
192
+
193
+ A fixed balanced 16,384-row subset of fold 1 was used during iterative model selection.
194
+ An overlap audit found no exact peptide overlap between fold 1 and folds 2–5, but 62.9%
195
+ of unique fold-1 peptides contain a 9-mer observed in training. Final ensemble membership
196
+ was therefore selected on a stricter subset excluding all such peptides and all fixed
197
+ selection rows. The remaining fold was used once as a frozen natural-prevalence audit.
198
+
199
+ The original data archive is not included in this repository. See the official
200
+ [NetMHCIIpan 4.3 service](https://services.healthtech.dtu.dk/services/NetMHCIIpan-4.3/)
201
+ for data access, descriptions, and citation requirements.
202
+
203
+ ## What the scaling study found
204
+
205
+ - Successive low-learning-rate continuations improved ESMC-300M from fixed composite
206
+ 0.8321 to 0.8908.
207
+ - ESMC-600M scored 0.8668 fixed and 0.8264 core-disjoint, below the optimized 300M model.
208
+ - An independent 300M trajectory was also weaker individually but added ensemble diversity.
209
+ - The full ESMC-6B quality run was cancelled after 600M failed to justify the projected
210
+ cost. 6B throughput and memory benchmarks were retained in the source repository.
211
+
212
+ These results indicate that optimization, inductive bias, split design, and model
213
+ diversity mattered more here than simple backbone scaling.
214
+
215
+ ## Limitations and responsible use
216
+
217
+ - Only one supplied fold was used for architecture/ensemble selection.
218
+ - The official fold has substantial shared-binding-core overlap with training.
219
+ - No direct identical-row comparison with NetMHCIIpan 4.3, MixMHC2pred, or
220
+ pMHChat has yet been completed.
221
+ - Performance has not been established for unseen allele families, temporally new data,
222
+ rare organisms, altered peptides, or noncanonical amino acids.
223
+ - Scores are not calibrated and must not be interpreted as clinical probabilities.
224
+ - Do not use this model as the sole basis for diagnosis, treatment, vaccine design, or
225
+ safety-critical experimental prioritization.
226
+
227
+ Recommended next evaluations are all-five-fold replication, per-allele macro metrics,
228
+ paired bootstrap confidence intervals, leave-one-allele-family-out tests, sequence-clustered
229
+ and temporal splits, calibration, ablations, and direct baseline reruns on identical rows.
230
+
231
+ ## Reproducibility and provenance
232
+
233
+ This Hugging Face repository includes only:
234
+
235
+ - this Model Card (`README.md`);
236
+ - the machine-readable ensemble and base-revision manifest (`ensemble.json`);
237
+ - four adapter/interaction-head checkpoints under `weights/`;
238
+ - the weight notice (`LICENSE_WEIGHTS.md`) and citation metadata (`CITATION.cff`).
239
+
240
+ Training, inference, evaluation, tests, locked dependencies, configurations, and
241
+ machine-readable experiment results are maintained in the paired
242
+ [GitHub source repository](https://github.com/zmactep/MHC-PLM).
243
+
244
+ Before release, 21 unit tests passed, Ruff and shell/JSON validation passed, every release
245
+ weight matched its recorded SHA-256, and an actual pinned ESMC-300M adapter inference was
246
+ smoke-tested offline. The original experiment bundle separately passed a deep scan over
247
+ 7,724,026 rows and 21 cached model files.
248
+
249
+ ## License and citations
250
+
251
+ MHC-PLM source code is MIT-licensed. Adapter/head weights are published under the
252
+ research notice in [`LICENSE_WEIGHTS.md`](LICENSE_WEIGHTS.md). Users must separately obey
253
+ the current Biohub ESM-C license and acceptable-use policy and any DTU terms applying to
254
+ the NetMHCIIpan training data. Complete ESM-C base weights and the DTU archive are not
255
+ redistributed here.
256
+
257
+ Please cite:
258
+
259
+ - Nilsson et al. *Accurate prediction of HLA class II antigen presentation across all
260
+ loci using tailored data acquisition and refined machine learning*. Science Advances
261
+ (2023), DOI: 10.1126/sciadv.adj6367.
262
+ - The current Biohub ESM-C model and paper listed in the
263
+ [Biohub ESM repository](https://github.com/Biohub/esm).
264
+ - MHC-PLM using the included `CITATION.cff`.
ensemble.json ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "name": "MHC-PLM core-selected ensemble",
4
+ "repo_id": "zmactep/MHC-PLM",
5
+ "architecture": "ESM-C plus peptide-to-MHC cross-attention and explicit 9-mer MIL",
6
+ "selection_scope": "core-disjoint-fold1",
7
+ "default_members": [
8
+ "stage3",
9
+ "600m",
10
+ "stage4",
11
+ "replica_s3333"
12
+ ],
13
+ "best_single_member": "stage4",
14
+ "aggregation": "arithmetic mean of post-sigmoid member scores",
15
+ "inference_seed": 2026,
16
+ "input_limits": {
17
+ "max_peptide_length": 64,
18
+ "max_context_length": 16,
19
+ "max_mhc_length": 64,
20
+ "max_alleles": 14
21
+ },
22
+ "score_semantics": {
23
+ "ba": "normalized affinity in [0,1], higher is stronger; approximate IC50 nM = 50000^(1-score)",
24
+ "el": "presentation score in [0,1]; not a calibrated clinical probability"
25
+ },
26
+ "model_defaults": {
27
+ "backbone": "hf",
28
+ "backbone_dtype": "bf16",
29
+ "attention_implementation": "sdpa",
30
+ "interaction_dim": 256,
31
+ "interaction_heads": 8,
32
+ "interaction_layers": 2,
33
+ "core_length": 9,
34
+ "allow_reverse": true,
35
+ "dropout": 0.1,
36
+ "lora": true,
37
+ "lora_rank": 16,
38
+ "lora_alpha": 32,
39
+ "lora_dropout": 0.05,
40
+ "gradient_checkpointing": false,
41
+ "backbone_chunk_size": 256,
42
+ "pooling_temperature": 0.15
43
+ },
44
+ "members": [
45
+ {
46
+ "name": "stage3",
47
+ "description": "ESMC-300M main trajectory, stage 3",
48
+ "weight_path": "weights/stage3.safetensors",
49
+ "weight_sha256": "2ef7668d28ac2c451e210624b2f7dd46418790e9feb8c6d830c8ab1f5a640892",
50
+ "weight_size_bytes": 12349296,
51
+ "weight_partial": true,
52
+ "model": {
53
+ "model_name": "biohub/ESMC-300M",
54
+ "model_revision": "a59b831785f907e96e6a246b1d142bfb76df31ee"
55
+ }
56
+ },
57
+ {
58
+ "name": "600m",
59
+ "description": "independent ESMC-600M trajectory",
60
+ "weight_path": "weights/600m.safetensors",
61
+ "weight_sha256": "7e6dda37c80ae11dbe44954f442f0490e16bdb3c1f23aabec2867fed198dedda",
62
+ "weight_size_bytes": 13360248,
63
+ "weight_partial": true,
64
+ "model": {
65
+ "model_name": "biohub/ESMC-600M",
66
+ "model_revision": "a7e82012c83126b9eedb055fea9fa84b6c02f094"
67
+ }
68
+ },
69
+ {
70
+ "name": "stage4",
71
+ "description": "ESMC-300M low-learning-rate stage 4; best individual member",
72
+ "weight_path": "weights/stage4.safetensors",
73
+ "weight_sha256": "8a2efbdebfe10d2a723be25e2e342a5209b546f2ea3fed1dcd73bb599b499493",
74
+ "weight_size_bytes": 12349296,
75
+ "weight_partial": true,
76
+ "model": {
77
+ "model_name": "biohub/ESMC-300M",
78
+ "model_revision": "a59b831785f907e96e6a246b1d142bfb76df31ee"
79
+ }
80
+ },
81
+ {
82
+ "name": "replica_s3333",
83
+ "description": "independent ESMC-300M seed trajectory",
84
+ "weight_path": "weights/replica_s3333.safetensors",
85
+ "weight_sha256": "aedbaf249908fad38fd61643639042ce5a2030da70ac1c3d5cc586cdbe478237",
86
+ "weight_size_bytes": 12349296,
87
+ "weight_partial": true,
88
+ "model": {
89
+ "model_name": "biohub/ESMC-300M",
90
+ "model_revision": "a59b831785f907e96e6a246b1d142bfb76df31ee"
91
+ }
92
+ }
93
+ ],
94
+ "metrics": {
95
+ "core_disjoint": {
96
+ "composite": 0.866341447431238,
97
+ "ba_examples": 12911,
98
+ "ba_auroc_500nm": 0.8795781333432586,
99
+ "ba_average_precision_500nm": 0.8432509682864474,
100
+ "ba_pearson_r": 0.7494314418958933,
101
+ "ba_spearman_r": 0.7513894503510444,
102
+ "ba_mse": 0.027961074615603626,
103
+ "el_examples": 572664,
104
+ "el_positive_fraction": 0.14436039279193315,
105
+ "el_auroc": 0.9633044656226264,
106
+ "el_average_precision": 0.8730517488631739
107
+ },
108
+ "full_fold": {
109
+ "composite": 0.8572583300612281,
110
+ "ba_examples": 21794,
111
+ "ba_auroc_500nm": 0.8881501373829886,
112
+ "ba_average_precision_500nm": 0.8529772425709462,
113
+ "ba_pearson_r": 0.7654025002504102,
114
+ "ba_spearman_r": 0.7655603005570821,
115
+ "ba_mse": 0.028142128247225746,
116
+ "el_examples": 1516156,
117
+ "el_positive_fraction": 0.08164859025060746,
118
+ "el_auroc": 0.9644079925097755,
119
+ "el_average_precision": 0.8110726901017381
120
+ }
121
+ }
122
+ }
weights/600m.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e6dda37c80ae11dbe44954f442f0490e16bdb3c1f23aabec2867fed198dedda
3
+ size 13360248
weights/replica_s3333.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aedbaf249908fad38fd61643639042ce5a2030da70ac1c3d5cc586cdbe478237
3
+ size 12349296
weights/stage3.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ef7668d28ac2c451e210624b2f7dd46418790e9feb8c6d830c8ab1f5a640892
3
+ size 12349296
weights/stage4.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a2efbdebfe10d2a723be25e2e342a5209b546f2ea3fed1dcd73bb599b499493
3
+ size 12349296