Fill-Mask
Safetensors
multimolecule
amplify
Biology
Protein

AMPLIFY

Pre-trained model on protein sequences using a masked language modeling (MLM) objective.

Disclaimer

This is an UNOFFICIAL implementation of the Protein Language Models: Is Scaling Necessary? by Quentin Fournier, Robert M. Vernon, Almer van der Sloot, Benjamin Schulz, Sarath Chandar, and Christopher James Langmead.

The OFFICIAL repository of AMPLIFY is at chandar-lab/AMPLIFY.

The MultiMolecule team has confirmed that the provided model and checkpoints match the original implementation's logits and attention maps within 1e-4 absolute tolerance on representative protein sequences.

The team releasing AMPLIFY did not write this model card for this model so this model card has been written by the MultiMolecule team.

Model Details

AMPLIFY is a modern encoder-only protein language model with RMSNorm, SwiGLU, and rotary position embeddings. It is pre-trained on UR100P, a corpus derived from UniRef100 and supplemented with paired sequences from the Observed Antibody Space and domains from SCOP, using a masked language modeling objective. Please refer to the Training Details section for more information on the training process.

Variants

Model Specification

Variants Num Layers Hidden Size Num Heads Intermediate Size Num Parameters (M) FLOPs (G) MACs (G) Max Num Tokens
AMPLIFY-120M 24 640 10 2560 118.67 137.34 68.58 2048
AMPLIFY-350M 32 960 15 3840 354.91 394.98 197.30

Links

Usage

The model file depends on the multimolecule library. You can install it using pip:

pip install multimolecule

Direct Use

Masked Language Modeling

You can use this model directly with a pipeline for masked language modeling:

import multimolecule  # you must import multimolecule to register models
from transformers import pipeline

predictor = pipeline("fill-mask", model="multimolecule/amplify-350m")
output = predictor("MVLSPADKTNVKAAW<mask>KVGAHAGEYGAEALER")

Downstream Use

Extract Features

Here is how to use this model to get the features of a given sequence in PyTorch:

from multimolecule import ProteinTokenizer, AmplifyModel


tokenizer = ProteinTokenizer.from_pretrained("multimolecule/amplify-350m")
model = AmplifyModel.from_pretrained("multimolecule/amplify-350m")

text = "MVLSPADKTNVKAAWGKVGAHAGEYGAEALER"
input = tokenizer(text, return_tensors="pt")

output = model(**input)

Sequence Classification / Regression

This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for sequence classification or regression.

Here is how to use this model as backbone to fine-tune for a sequence-level task in PyTorch:

import torch
from multimolecule import ProteinTokenizer, AmplifyForSequencePrediction


tokenizer = ProteinTokenizer.from_pretrained("multimolecule/amplify-350m")
model = AmplifyForSequencePrediction.from_pretrained("multimolecule/amplify-350m")

text = "MVLSPADKTNVKAAWGKVGAHAGEYGAEALER"
input = tokenizer(text, return_tensors="pt")
label = torch.tensor([1])

output = model(**input, labels=label)

Token Classification / Regression

This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for token classification or regression.

Here is how to use this model as backbone to fine-tune for a residue-level task in PyTorch:

import torch
from multimolecule import ProteinTokenizer, AmplifyForTokenPrediction


tokenizer = ProteinTokenizer.from_pretrained("multimolecule/amplify-350m")
model = AmplifyForTokenPrediction.from_pretrained("multimolecule/amplify-350m")

text = "MVLSPADKTNVKAAWGKVGAHAGEYGAEALER"
input = tokenizer(text, return_tensors="pt")
label = torch.randint(2, (len(text), ))

output = model(**input, labels=label)

Contact Classification / Regression

This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for contact classification or regression.

Here is how to use this model as backbone to fine-tune for a contact-level task in PyTorch:

import torch
from multimolecule import ProteinTokenizer, AmplifyForContactPrediction


tokenizer = ProteinTokenizer.from_pretrained("multimolecule/amplify-350m")
model = AmplifyForContactPrediction.from_pretrained("multimolecule/amplify-350m")

text = "MVLSPADKTNVKAAWGKVGAHAGEYGAEALER"
input = tokenizer(text, return_tensors="pt")
label = torch.randint(2, (len(text), len(text)))

output = model(**input, labels=label)

Training Details

AMPLIFY was trained with Masked Language Modeling (MLM) as the pre-training objective: 15% of the residues in the input are randomly selected as prediction targets, and the model is asked to recover the original amino acids from the surrounding context. The model is bidirectional (encoder-only) so the prediction at each masked position attends to the entire sequence.

Training Data

AMPLIFY was pre-trained on the UR100P dataset, which is a curated union of:

  • UniRef100: All UniProt sequences clustered at 100% sequence identity.
  • Observed Antibody Space (OAS): Paired antibody repertoire sequences, represented with heavy and light chains separated by the | chain separator.
  • SCOP: Structurally classified protein domains.

Training Procedure

Preprocessing

AMPLIFY uses masked language modeling (MLM) as the pre-training objective. The masking procedure is similar to the one used in BERT:

  • 15% of the residues are masked.
  • In 80% of the cases, the masked residues are replaced by <mask>.
  • In 10% of the cases, the masked residues are replaced by a random residue (different) from the one they replace.
  • In the 10% remaining cases, the masked residues are left as is.

Pre-training

Training is performed in two stages, both on the UR100P dataset:

  • Stage 1: trained for 1,000,000 steps at a maximum length of 512 residues with a peak learning rate of 1e-3, cosine-decayed to 1e-4.
  • Stage 2: trained for an additional 25,000 (120M) or 50,000 (350M) steps at a maximum length of 2,048 residues with a constant learning rate of 1e-4.

Both stages use AdamW with betas (0.9, 0.95), weight decay 0.01, gradient clipping 1.0, mixed-precision bf16 with tf32, a total batch size of 4,096 sequences, and DeepSpeed ZeRO stage 3.

Citation

BibTeX:

@article{Fournier2024.09.23.614603,
  title     = {Protein Language Models: Is Scaling Necessary?},
  author    = {Fournier, Quentin and Vernon, Robert M. and van der Sloot, Almer and Schulz, Benjamin and Chandar, Sarath and Langmead, Christopher James},
  year      = {2024},
  journal   = {bioRxiv},
  publisher = {Cold Spring Harbor Laboratory},
  doi       = {10.1101/2024.09.23.614603},
  url       = {https://www.biorxiv.org/content/early/2024/09/23/2024.09.23.614603},
}

The artifacts distributed in this repository are part of the MultiMolecule project. If you use MultiMolecule in your research, you must cite the MultiMolecule project as follows:

@software{chen_2024_12638419,
  author    = {Chen, Zhiyuan and Zhu, Sophia Y.},
  title     = {MultiMolecule},
  doi       = {10.5281/zenodo.12638419},
  publisher = {Zenodo},
  url       = {https://doi.org/10.5281/zenodo.12638419},
  year      = 2024,
  month     = may,
  day       = 4
}

Contact

Please use GitHub issues of MultiMolecule for any questions or comments on the model card.

Please contact the authors of the AMPLIFY paper for questions or comments on the paper/model.

License

This model is licensed under the GNU Affero General Public License.

For additional terms and clarifications, please refer to our License FAQ.

SPDX-License-Identifier: AGPL-3.0-or-later
Downloads last month
16
Safetensors
Model size
0.4B params
Tensor type
F32
·
Inference Examples
Examples
Mask token: <mask>
A
0.944
T
0.018
V
0.017
S
0.012
G
0.006
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support