Views
No views yet
log1p(hours) scale.1import math
2import torch
3from transformers import AutoModel
4
5# Load model
6model = AutoModel.from_pretrained("dkarthikeyan1/mint-stage2-stability", trust_remote_code=True)
7model.eval()
8
9# Tokenize a peptide-MHC pair
10from transformers.dynamic_module_utils import get_class_from_dynamic_module
11MintTokenizer = get_class_from_dynamic_module(
12 "modeling_mint_stability.MintTokenizer",
13 "dkarthikeyan1/mint-stage2-stability",
14 trust_remote_code=True,
15)
16tokenizer = MintTokenizer()
17peptide = "GILGFVFTL"
18mhc_sequence = "MAVMAPRTLLLLLSGALALTQTWAG..." # full MHC-I heavy chain sequence
19
20chains, chain_ids = tokenizer.prepare_input(peptide, mhc_sequence)
21chains = chains.unsqueeze(0) # add batch dim
22chain_ids = chain_ids.unsqueeze(0)
23
24# Predict
25with torch.no_grad():
26 output = model(chains, chain_ids)
27 log_pred = output["logits"].item() # model outputs log1p(half-life in hours)
28 predicted_halflife_hours = math.expm1(log_pred)
29
30print(f"Predicted half-life: {predicted_halflife_hours:.2f} hours")1import torch
2device = "cuda" if torch.cuda.is_available() else "cpu"
3model = model.to(device)
4
5peptides = ["GILGFVFTL", "NLVPMVATV"]
6mhc_sequences = ["MAVMAPRTL...", "MAVMAPRTL..."] # full sequences
7
8chains, chain_ids = tokenizer.prepare_batch(peptides, mhc_sequences)
9with torch.no_grad():
10 output = model(chains.to(device), chain_ids.to(device))
11 predictions_hours = torch.expm1(output["logits"].squeeze(-1)) # half-life in hours, shape (batch,)<cls>, <eos>), and chain ID assignment (peptide=0, MHC=1)| Parameter | Value |
|---|---|
| Backbone | ESM2-650M (33 layers, 1280 dim, 20 heads) |
| Multimer attention | Yes (cross-chain) |
| Projection hidden dim | 512 |
| Projection dropout | 0.2 |
| Freeze percent (training) | 0.7 (layers 0-23 frozen) |
| Label transform | log1p(half_life_hours) — apply expm1() to invert |
| Output | Scalar (log1p scale, unbounded) |
| Total parameters | ~814M |
1@article{dkarthikeyan2026stability,
2 author = {Karthikeyan, Dhuvarakesh and Vincent, Benjamin and Rubinsteyn, Alexander},
3 title = {Peptide:MHC Binding Stability Prediction Using Protein Language Models},
4 elocation-id = {2026.06.28.735023},
5 year = {2026},
6 doi = {10.64898/2026.06.28.735023},
7 publisher = {Cold Spring Harbor Laboratory},
8 abstract = {Peptide:MHC class I (pMHC-I) binding stability governs the persistence of antigenic complexes at the cell surface and plays a key role in facilitating downstream immunological signals such as antigen presentation, T-cell activation, and immunodominance. However, methods for in silico stability prediction remain underexplored relative to binding affinity prediction, in part because available half-life datasets are sparse and expensive to collect. Here, we perform a systematic reassessment of pMHC-I stability prediction using controlled, similarity-aware data splits and apply a recently introduced supervised transfer-learning strategy to MINT, an interaction-aware protein language model, pretrained on binding affinity and fine-tuned for quantitative half-life prediction. We show that MINT improves stability prediction over standard ESM-2 representations and existing predictors, and that assay-conditioned recalibration corrects systematic shifts across experimental measurement modalities. Across eluted ligand, immunogenicity, and personalized neoantigen prioritization benchmarks, predicted stability provides signal beyond binding affinity, enriching for naturally presented and immunogenic peptides within affinity-filtered candidate sets. These results establish pMHC-I half-life as an orthogonal and transferable biophysical signal connecting peptide binding, surface presentation, and T-cell recognition, and provide a leakage-aware, assay-aware framework for future antigen-presentation modeling.Competing Interest StatementThe authors have declared no competing interest.},
9 URL = {https://www.biorxiv.org/content/early/2026/06/29/2026.06.28.735023},
10 eprint = {https://www.biorxiv.org/content/early/2026/06/29/2026.06.28.735023.full.pdf},
11 journal = {bioRxiv}
12}