bl-2633 commited on
Commit
4b39f2a
·
verified ·
1 Parent(s): 4a2cfd7

Add DecoderTCR V0.3 weights (nested layout) + MIT model card

Browse files
DecoderTCR-C-V0.3/300M.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18d47c169d0ce992152838b8229e1c682b0a681f55057b471dcdcbf07d2fcad9
3
+ size 3996365253
DecoderTCR-C-V0.3/600M.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d3c84f30e3781c023e412eb3f3c098ef9fe64fd1423fd34df4b40b9dcbac0aa
3
+ size 2300241260
DecoderTCR-C-V0.3/6B.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6bd3170b55a9a06d9c1472e248bd083e092afc7924439b444bf7379b74ab692
3
+ size 25408220584
DecoderTCR-ESM2-V0.1/3B_DecoderTCR.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc369f2387dc922660492df86e38cfcff65812201929558cfece4e6e674d3553
3
+ size 11356181292
DecoderTCR-ESM2-V0.1/650M_DecoderTCR.ckpt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf88513fabdfec601f2019cb13fb27a2980b370131a488cab3ab1e53bda483a5
3
+ size 2604318926
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chan Zuckerberg Biohub
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,178 +1,57 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
3
  ---
4
 
5
- # DecoderTCR v0.1
6
- DecoderTCR is a protein language model for T-cell receptor (TCR) & peptide-MHC complexes. The model is based on the ESM2 model family.
7
 
8
- For Model Code and additional information on installation/usage please see [the associated GitHub repository](https://github.com/czbiohub-chi/DecoderTCR)
 
 
9
 
10
- ## Model Architecture
 
 
11
 
12
- DecoderTCR is built on a Transformer-based protein language model (ESM2 family).
13
 
14
- ### Core Architecture
 
 
 
 
 
 
15
 
16
- The model follows the **ESM2** architecture, a deep Transformer encoder designed for protein sequences.
 
17
 
18
- #### Embedding Layer
19
- - Token embedding dimension: *d* (e.g., 1280)
20
- - Learned positional embeddings
21
- - Vocabulary includes:
22
- - 20 standard amino acids
23
- - Special tokens (mask, padding, BOS/EOS, unknown)
24
 
25
- #### Transformer Stack
26
- - Number of layers: *L* (e.g., 33)
27
- - Hidden dimension: *d*
28
- - Number of attention heads: *h* (e.g., 20)
29
- - Multi-head self-attention:
30
- - Full-sequence, bidirectional attention
31
- - Feed-forward network:
32
- - Intermediate dimension ≈ 4× *d*
33
- - Activation function: GELU
34
- - Layer normalization: Pre-LayerNorm
35
- - Residual connections around attention and feed-forward blocks
36
 
37
- ### Continual Training Setup
 
 
 
 
38
 
39
- The model is initialized from a pretrained **ESM2 checkpoint** and further trained via continual pretraining with MLM objectives.
 
 
 
40
 
 
41
 
42
- ### Model Scale (Example Configurations)
43
-
44
- | Model Variant | Parameters | Layers | Hidden Dim | Attention Heads |
45
- | --- | --- | --- | --- | --- |
46
- | ESM2-650M | ~650M | 33 | 1280 | 20 |
47
- | ESM2-3B | ~3B | 36 | 2560 | 40 |
48
-
49
- ### Model Card Authors
50
-
51
- Ben Lai
52
-
53
- ### Primary Contact Email
54
-
55
- Ben Lai ben.lai@czbiohub.org
56
- To submit feature requests or report issues with the model, please open an issue on [the GitHub repository](https://github.com/czbiohub-chi/DecoderTCR).
57
-
58
- ### System Requirements
59
-
60
- - Compute Requirements: GPU
61
-
62
- ## Intended Use
63
-
64
- ### Primary Use Cases
65
-
66
- The DecoderTCR models are designed for the following primary use cases:
67
-
68
- 1. **TCR-pMHC Binding Prediction**: Predict the interaction between T-cell receptors (TCRs) and peptide-MHC complexes
69
- 2. **Interaction Scoring**: Calculate interface energy scores for TCR-pMHC interactions
70
- 3. **Sequence Analysis**: Analyze TCR sequences and their interactions with specific peptides
71
- 4. **Immunology Research**: Support research in adaptive immunity, T-cell recognition, and antigen presentation
72
-
73
- The models are particularly useful for:
74
- - Identifying potential TCR-peptide binding pairs
75
- - Screening TCR sequences for specific antigen recognition
76
- - Understanding the molecular basis of T-cell recognition
77
- - Supporting vaccine design and immunotherapy development
78
-
79
- ### Out-of-Scope or Unauthorized Use Cases
80
-
81
- Do not use the model for the following purposes:
82
- - Use that violates applicable laws, regulations (including trade compliance laws), or third party rights such as privacy or intellectual property rights
83
- - Any use that is prohibited by the [MIT license](https://github.com/czbiohub-chi/DecoderTCR/blob/main/LICENSE) and [Acceptable Use Policy](https://virtualcellmodels.cziscience.com/acceptable-use-policy).
84
- - Clinical diagnosis or treatment decisions without proper validation
85
- - Direct use in patient care without appropriate clinical validation and regulatory approval
86
- - Use for purposes that could cause harm to individuals or groups
87
-
88
- The models are research tools and should not be used as the sole basis for clinical or diagnostic decisions.
89
-
90
- ## Training Data
91
-
92
- The models are trained with multi-component large-scale protein sequence databases. The training data consists of:
93
-
94
- - **TCR sequences**: Observerd T-cell Space(OTS) for paired $\alpha/\beta$ TCR sequences.
95
- - **Peptide-MHC sequences**: MHC Motif Atlas for peptide-MHC ligandomes and high confidence synthetic interactions via MixMHCpred predictions.
96
- - **Paired TCR-pMHC Interactions**: VDJdb for paired TCR-pMHC interaction data.
97
-
98
-
99
- ## Continual Pre-training Strategy
100
-
101
- This model is trained using a **continual pre-training curriculum** that adapts a pretrained ESM2 backbone to new protein domains while preserving previously learned representations.
102
-
103
- ### Overview
104
-
105
- Continual pre-training proceeds in **multiple stages**, each leveraging different data regimes and masking strategies:
106
-
107
- - Stage 1 emphasize **abundant marginal sequence data**, encouraging robust component-level representations.
108
- - Stage 2 incorporate **scarcer, structured, or interaction-rich data**, refining conditional dependencies without overwriting earlier knowledge.
109
-
110
- The architecture, tokenizer, and objective remain unchanged throughout training; only the data distribution and masking strategy evolve.
111
-
112
- ### Stage 1: Component-Level Adaptation
113
-
114
- In the first stage, the model is further pretrained on large collections of unpaired or weakly structured protein sequences relevant to the target domain.
115
-
116
- - **Objective:** Masked Language Modeling (MLM)
117
- - **Masking:** Component- or region-aware masking schedules that upweight functionally relevant positions
118
- - **Purpose:**
119
- - Adapt the pretrained ESM2 representations to the target protein subspace
120
- - Learn domain-specific sequence statistics while retaining general protein knowledge
121
-
122
- This stage acts as a regularizer, anchoring learning in large-scale marginal data before introducing more complex dependencies.
123
-
124
- ### Stage 2: Conditional / Interaction-Aware Refinement
125
-
126
- In subsequent stages, the model is continually trained on **structured or paired sequences** that encode higher-order dependencies (e.g., interactions between protein regions or components).
127
-
128
- - **Objective:** Masked Language Modeling (MLM)
129
- - **Masking:** Joint masking across interacting regions to encourage cross-context conditioning
130
- - **Purpose:**
131
- - Refine conditional relationships learned from limited paired data
132
- - Align representations across components without degrading Stage 1 task performance
133
-
134
- ## Biases, Risks, and Limitations
135
-
136
- ### Potential Biases
137
-
138
- - The model may reflect biases present in the training data, including:
139
- - Overrepresentation of certain HLA alleles or peptide types
140
- - Limited diversity in TCR sequences from specific populations
141
- - Bias toward well-studied antigen systems
142
- - Certain TCR clonotypes or peptide types may be underrepresented in training data
143
-
144
- ### Risks
145
-
146
- Areas of risk may include but are not limited to:
147
- - **Inaccurate predictions**: The model may produce incorrect binding predictions, especially for novel sequences or rare HLA-peptide combinations
148
- - **Overconfidence**: The model may assign high confidence to predictions that are actually uncertain
149
- - **Biological misinterpretation**: Users may misinterpret model outputs as definitive biological facts rather than predictions
150
- - **Clinical misuse**: Use in clinical settings without proper validation could lead to incorrect treatment decisions
151
-
152
- ### Limitations
153
-
154
- - **Sequence length**: The model has limitations on maximum sequence length (typically ~1024 tokens)
155
- - **Novel sequences**: Performance may degrade on sequences very different from training data
156
- - **HLA diversity**: Limited training data for rare HLA alleles may affect prediction accuracy
157
- - **Context dependency**: The model may not capture all biological context (e.g., post-translational modifications, cellular environment)
158
- - **Computational requirements**: GPU is recommended for optimal performance
159
-
160
- ### Caveats and Recommendations
161
-
162
- - **Review and validate outputs**: Always review and validate model predictions, especially for critical applications
163
- - **Experimental validation**: Model predictions should be validated experimentally before use in research or clinical contexts
164
- - **Uncertainty awareness**: Be aware that predictions are probabilistic and may have uncertainty
165
- - **Domain expertise**: Use the model in conjunction with domain expertise in immunology and T-cell biology
166
- - **Version tracking**: Keep track of which model version and checkpoint you are using
167
-
168
- We are committed to advancing the responsible development and use of artificial intelligence. Please follow our [Acceptable Use Policy](/acceptable-use-policy) when engaging with our services.
169
-
170
- Should you have any security or privacy issues or questions related to the services, please reach out to our team at security@chanzuckerberg.com or privacy@chanzuckerberg.com respectively.
171
-
172
- ## Acknowledgements
173
-
174
- This model builds upon:
175
- - **ESM2** by Meta AI (Facebook Research) for the base protein language model
176
- - The broader computational biology and immunology research communities
177
-
178
- Special thanks to the developers and contributors of the ESM models and the open-source tools that made this work possible.
 
1
  ---
2
  license: mit
3
+ library_name: pytorch
4
+ pipeline_tag: other
5
+ tags:
6
+ - protein
7
+ - tcr
8
+ - tcr-pmhc
9
+ - immunology
10
+ - esm-c
11
+ - esm2
12
+ - masked-language-model
13
  ---
14
 
15
+ # DecoderTCR V0.3
 
16
 
17
+ TCR–pMHC binding scoring by masked-language-model pseudo-log-likelihood (PLL), on ESM-2 and
18
+ ESM-C backbones. Given a TCR (V/J genes + CDR3) paired with an HLA allele and a peptide, the
19
+ models score how well the TCR is predicted to bind the peptide–MHC.
20
 
21
+ This repository hosts **model weights only**. The code, loader, and prediction CLIs live in the
22
+ DecoderTCR package; weights are fetched into the expected paths by its `download_weights.py`
23
+ script — you do not load these checkpoints with `transformers`.
24
 
25
+ ## Models
26
 
27
+ | File | Registry name | Backbone | Params | Version | Notes |
28
+ |------|---------------|----------|--------|---------|-------|
29
+ | `DecoderTCR-C-V0.3/600M.ckpt` | `DecoderTCR-C_600M` | ESM-C | 600M | V0.3 | **default**, runs on ≤24 GB GPUs |
30
+ | `DecoderTCR-C-V0.3/300M.ckpt` | `DecoderTCR-C_300M` | ESM-C | 300M | V0.3 | lightest ESM-C |
31
+ | `DecoderTCR-C-V0.3/6B.ckpt` | `DecoderTCR-C_6B` | ESM-C | 6B | V0.3 | larger variant (80 GB GPU) |
32
+ | `DecoderTCR-ESM2-V0.1/650M_DecoderTCR.ckpt` | `DecoderTCR_650M` | ESM-2 | 650M | V0.1 | paper reproduction |
33
+ | `DecoderTCR-ESM2-V0.1/3B_DecoderTCR.ckpt` | `DecoderTCR_3B` | ESM-2 | 3B | V0.1 | paper reproduction |
34
 
35
+ The V0.3 ESM-C line (`DecoderTCR-C`) is the current default; the V0.1 ESM-2 line is kept for
36
+ paper reproduction and backward compatibility.
37
 
38
+ ## Usage
 
 
 
 
 
39
 
40
+ Get the DecoderTCR code, then fetch weights (they download into these same nested paths):
 
 
 
 
 
 
 
 
 
 
41
 
42
+ ```bash
43
+ uv sync
44
+ uv run python scripts/download_weights.py # all models
45
+ uv run python scripts/download_weights.py -m DecoderTCR-C_600M # just the default
46
+ ```
47
 
48
+ ```python
49
+ from DecoderTCR.utils.model_zoo import load
50
+ model, n_layers = load() # default = DecoderTCR-C_600M
51
+ ```
52
 
53
+ ## License
54
 
55
+ MIT (see [`LICENSE`](LICENSE)). The bundled backbones are also MIT: ESM-2 (Meta) and the
56
+ Chan Zuckerberg Biohub ESM-C release (https://github.com/Biohub/esm). The released checkpoints
57
+ contain the full fine-tuned weights and are distributed under the MIT license.