Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 14 min read Deep dive easyNovice

Deep Learning with Proteins

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.

Related posts

  • Accelerating Protein Language Model ProtST on Intel Gaudi 2

    Hugging Face easyNovice

    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. In bfloat16 at batch size 1, subcellular localization inference on 2,772 sequences reaches identical accuracy (0.44) with a 1.76x speedup on Gaudi 2. Fine-tuning ProtST-ESM-1b for binary membrane/soluble localization matches the paper's ~92.5% accuracy, runs 2.92x faster on a single Gaudi 2, and scales near-linearly to 4 and 8 accelerators.

  • Train 400x faster Static Embedding Models with Sentence Transformers

    Hugging Face hardMaster

    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. The recipe trains two 1024-dimensional models from randomly initialized weights using BERT tokenizers and Sentence Transformers' StaticEmbedding module: an English retrieval model trained on 13 QA datasets chosen to avoid overlap with BEIR, and a multilingual similarity model trained on parallel-sentence and positive-pair datasets. The post covers dataset selection, loss choice, training arguments, evaluators, NanoBEIR results on CPU and GPU, and Matryoshka truncation tradeoffs. The resulting models suit on-device, in-browser and edge workloads.

  • mmBERT: ModernBERT goes Multilingual

    Hugging Face hardMaster

    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. It is the first model to clearly beat XLM-R on XTREME, GLUE and MTEB v2 retrieval, and it runs 2-4x faster with an 8,192-token context. The training recipe has three phases that add languages progressively (60 → 110 → 1,833), anneal the sampling temperature (0.7 → 0.5 → 0.3) and lower the mask ratio (30% → 15% → 5%), then combines decay-phase variants with TIES merging. Low-resource languages added only in the final 100B-token decay phase are still learned effectively, and on Faroese QA the model outperforms Gemini 2.5 Pro and o3.

  • SetFit: Efficient Few-Shot Learning Without Prompts

    Hugging Face mediumAdept

    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. With 8 examples per class it matches RoBERTa Large fine-tuned on 3k examples on Customer Reviews, beats GPT-3 and PET on the RAFT benchmark with a 355M-parameter model, and rivals T-Few 3B while being 27x smaller. Training takes about 30 seconds on a V100 ($0.025) versus 11 minutes on an A100 for T-Few, and the setfit library trains a model in a few lines of Python; swapping in a multilingual checkpoint extends it to other languages.

  • ​Sequential Attention: Making AI models leaner and faster without sacrificing accuracy

    Google Research hardMaster

    Sequential Attention is a greedy subset-selection algorithm that runs inside a single training run. It uses softmax attention scores over unselected candidates (features, embedding chunks, weight blocks) to add the most informative one at each step, and recomputes scores so the ranking reflects marginal gain and avoids redundant picks. For feature selection it matches or beats baselines on proteomics, image and activity-recognition benchmarks, and on linear regression it is provably equivalent to Orthogonal Matching Pursuit. SequentialAttention++ combines differentiable pruning with combinatorial search to produce block-sparse weights that run efficiently on GPUs and TPUs, with compression gains on ImageNet. Planned uses include recommender embedding optimization and structured LLM pruning.

The quest for software engineering knowledge.

Look:
Layout: