---
title: "Deep Learning with Proteins"
description: "Protein sequences can be modelled with the same transfer-learning recipe as large language models like BERT: pre-train a transformer on abundant protein sequence data, then fine-tune it on tasks with sparse labels."
url: "https://swe.quest/articles/deep-learning-with-proteins-756c2b371bafc569"
canonical: "https://huggingface.co/blog/deep-learning-with-proteins"
source: "Hugging Face"
published: "2022-12-02"
difficulty: "easy"
kind: "Deep dive"
reading_minutes: 14
tags: ["machine-learning","model-training","llms","scientific-computing"]
---

# Deep Learning with Proteins

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-12-02, 14 min read, Deep dive. Original: [https://huggingface.co/blog/deep-learning-with-proteins](https://huggingface.co/blog/deep-learning-with-proteins)

## Summary

Protein sequences can be modelled with the same transfer-learning recipe as large language models like BERT: pre-train a transformer on abundant protein sequence data, then fine-tune it on tasks with sparse labels. Proteins resemble text in useful ways. They are long strings over a small alphabet of about 20 amino acids, only a tiny subset of possible strings are meaningful, and long-range interactions matter, which suits global self-attention. Each amino acid maps to one token, so no word splitting is needed. Typical downstream tasks are protein folding (via ESMFold, which avoids AlphaFold2's external database search), sequence classification such as subcellular localization, and token classification such as post-translational modification sites, with example notebooks for fine-tuning.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Scientific computing](https://swe.quest/tags/scientific-computing.md) (Domains)

## Keywords

ESMFold, AlphaFold2, BERT, ULMFiT, Hugging Face Transformers, protein language models

## Related posts

- [Accelerating Protein Language Model ProtST on Intel Gaudi 2](https://swe.quest/articles/accelerating-protein-language-model-protst-on-intel-gaudi-2-8726b8333bad484f.md): Hugging Face · 2024-07-03 · Easy · 3 min read · Hardware, Inference & serving, Model training, Scientific computing, Performance engineering
  ProtST, a multi-modal protein language model from MILA and Intel Labs, runs faster on Intel Gaudi 2 than on an NVIDIA A100 80GB using the Optimum for Intel Gaudi library with minimal code changes.
- [Train 400x faster Static Embedding Models with Sentence Transformers](https://swe.quest/articles/train-400x-faster-static-embedding-models-with-sentence-transformers-9f174d4b1294477b.md): Hugging Face · 2025-01-15 · Hard · 39 min read · Model training, Machine learning, Search, Python, Performance engineering
  Static embedding models, which replace the attention-based encoder with a token embedding lookup plus mean pooling (an EmbeddingBag), can be trained with modern contrastive losses and Matryoshka Representation Learning to run 100x to 400x faster on CPU than models like all-mpnet-base-v2 and multilingual-e5-small, while keeping at least 85% of their benchmark quality.
- [mmBERT: ModernBERT goes Multilingual](https://swe.quest/articles/mmbert-modernbert-goes-multilingual-ef8a6ca2e930c6ea.md): Hugging Face · 2025-09-09 · Hard · 15 min read · Model training, LLMs, Search
  mmBERT is a massively multilingual encoder built on the ModernBERT architecture with the Gemma 2 tokenizer, trained on over 3T tokens covering 1,833 languages.
- [SetFit: Efficient Few-Shot Learning Without Prompts](https://swe.quest/articles/setfit-efficient-few-shot-learning-without-prompts-aff1dcaa7c0b808d.md): Hugging Face · 2022-09-26 · Medium · 6 min read · Model training, Machine learning, Python
  SetFit is a prompt-free few-shot text classification framework that first fine-tunes a Sentence Transformer contrastively on in-class/out-of-class sentence pairs built from a handful of labeled examples, then trains a classifier head on the resulting embeddings.
- [​Sequential Attention: Making AI models leaner and faster without sacrificing accuracy](https://swe.quest/articles/sequential-attention-making-ai-models-leaner-and-faster-without-sacrificing-65f934b916a51bd2.md): Google Research · 2026-02-04 · Hard · 7 min read · Machine learning, Algorithms, Inference & serving, Recommendations & ranking
  Sequential Attention is a greedy subset-selection algorithm that runs inside a single training run.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
