← Workbench

AnalyseVia your AI assistantProtein

Language-model embeddings of protein sequences

Free · seconds

Embed up to 50 protein sequences, pasted or by UniProt accession, with the ESM2 language model, and report the cosine similarity between every pair. Each embedding is the mean over the residues of the last-layer hidden state, 1,280 numbers; the full vector or a per-residue summary is returned only on request, for at most three sequences.

Try asking

Using rnafold, embed human haemoglobin alpha (P69905), haemoglobin beta (P68871) and myoglobin (P02144) together with a shuffled copy of the alpha sequence, show me the cosine matrix, and tell me what that number can and cannot say about how related the proteins are.

Tools your assistant calls

embed_sequenceslookup_alphafold_dbprotein_properties

Every tool, with its inputs and outputs →

How it works

The method behind this item.

ESM2 (650M) sequence embeddingsTool · version esm2_t33_650M_UR50D, Hugging Face revision 08e4846

ESM2 is a protein language model trained on UniRef50 sequences. For each sequence you give we run the model once and take the hidden state of its last layer (after the final layer norm) at every residue position; the embedding is the mean of those 1,280-number vectors over the residues. The start and end tokens and any padding used to batch sequences of different lengths are not in the mean. We run it in float32, on the GPU when it is free and otherwise on the CPU. For two or more sequences we also report the cosine similarity between every pair of mean embeddings, computed in float64, in the order you gave them. Nothing is ranked, clustered or labelled, and a full vector or a per-residue summary is returned only on request and for at most three sequences.

Paper

Lin Z, et al. Evolutionary-scale prediction of atomic-level protein structure with a language model. Science 379, 2023.

Code
ESM on GitHub
Licence
MIT (code and the released weights); the UniRef50 training data are CC-BY-4.0 · Copyright (c) Meta Platforms, Inc. and affiliates
Length cap here
5 to 1,022 residues per sequence; up to 50 sequences and 20,000 residues per request

Run on its own, in a batch with padding, on the CPU and on the GPU, the same sequence gave the same vector to within 1e-6 per component, and an independent recomputation (a separately loaded model class, one sequence at a time) agreed to 5e-7; including the start and end tokens in the mean would have changed components by up to 0.056. Cosines between mean embeddings are all high: pairs of unrelated proteins sit at 0.69 to 0.87, shuffles of one sequence at 0.60 to 0.99 of the original, and a shuffled green fluorescent protein stayed at 0.96 to 0.99 of the original, as close as two orthologs. Two globins from different families (0.93 to 0.95) were above every shuffle of a globin (at most 0.90) but a globin and an unrelated protein reached 0.91. A cosine is a property of the model vectors, not a percent identity, a homology call, a shared fold or a shared function.

Limits

  • A cosine between two embeddings is a property of the language model’s vectors. It is not a percent identity, a homology call, an evolutionary distance, a shared fold or a shared function.
  • Cosines between mean ESM2 embeddings are all high: unrelated proteins sit around 0.7 to 0.9 and a shuffled copy of a sequence can stay close to the original, so a value means something only against a control built for your question.
  • The mean over positions discards order, and a long sequence’s vector averages over its domains. The model sees each sequence alone, with no structure, partner, ligand or modification.
  • Results are listed in the order you gave them. Nothing is ranked, clustered or labelled.
  • Sequences of 5 to 1,022 residues of the 20 standard amino acids only (X and other letters are refused, longer input is refused, never truncated); up to 50 sequences and 20,000 residues per request.