{
  "licence": "https://creativecommons.org/licenses/by/4.0/",
  "credit": "Saulius Beconis, sbeconis.com",
  "page": "https://sbeconis.com/lab/protein-families/",
  "url": "https://sbeconis.com/lab/protein-families/protein-families-2026-10-26.json",
  "note": "Measurements and text are CC BY 4.0. Source data and quoted excerpts keep their own licences: see \"attribution\".",
  "lab": "LAB/025",
  "title": "Protein families: profile HMMs against a protein language model",
  "date": "2026-10-26",
  "method": {
    "data": "Pfam-A.seed release 38.2 (EBI, CC0): 1,000 index families and 200 decoy families with at least 20 seed members, sampled with a fixed seed; at most 40 members per family, half for training, half as queries",
    "difficulty": "each query's highest identity to any training member of its family, on aligned columns where both have a residue (at least 30): easy ≥ 50%, medium 30–50%, hard < 30%; queries with too little overlap left out",
    "split": "dev and test by family hash (30% dev); thresholds and the combined method's settings chosen on dev only",
    "methods": "pyhmmer 0.12.3 (HMMER 3.4): hmmbuild from training members, hmmsearch of all queries against 1,000 profiles, bit score; phmmer of each query against all training members, bit score; ESM-2 650M (facebook/esm2_t33_650M_UR50D via transformers), mean of last-layer residue embeddings, cosine to nearest training member or to family centroid; combined: HMM call above its threshold, else ESM-2 nearest neighbour above its own",
    "threshold": "per method, the lowest score that gives a family to at most 5% of dev decoys",
    "pilot": "HMM and phmmer on 400 queries, ESM-2 on 120 sequences (CPU), before the full run"
  },
  "environment": {
    "gpu": "RTX 4070 12 GB",
    "cpu": "desktop CPU, 8 threads for HMMER"
  },
  "tables": {
    "accuracy": {
      "caption": "Right family, top 1, test families. 7,895 easy, 3,886 medium and 886 hard queries, 2,760 decoys from families not in the index. Thresholds set on dev families.",
      "columns": [
        {
          "key": "easy",
          "label": "Easy (≥ 50% identity)",
          "suffix": "%"
        },
        {
          "key": "medium",
          "label": "Medium (30–50%)",
          "suffix": "%"
        },
        {
          "key": "hard",
          "label": "Hard (< 30%)",
          "suffix": "%"
        },
        {
          "key": "decoy",
          "label": "Decoys given a family",
          "suffix": "%"
        },
        {
          "key": "wrong",
          "label": "Wrong family (count)",
          "decimals": 0
        }
      ],
      "rows": [
        {
          "label": "Profile HMM (hmmsearch)",
          "highlight": true,
          "cells": {
            "easy": 100,
            "medium": 99.7,
            "hard": 95.1,
            "decoy": 6.9,
            "wrong": 8
          }
        },
        {
          "label": "Nearest sequence (phmmer)",
          "highlight": false,
          "cells": {
            "easy": 100,
            "medium": 99.5,
            "hard": 85.1,
            "decoy": 3.3,
            "wrong": 13
          }
        },
        {
          "label": "ESM-2, nearest neighbour",
          "highlight": false,
          "cells": {
            "easy": 72.3,
            "medium": 34.7,
            "hard": 17.7,
            "decoy": 5.9,
            "wrong": 311
          }
        },
        {
          "label": "ESM-2, family centroid",
          "highlight": false,
          "cells": {
            "easy": 53.5,
            "medium": 29.5,
            "hard": 15.7,
            "decoy": 5.6,
            "wrong": 402
          }
        },
        {
          "label": "HMM, then ESM-2 fallback",
          "highlight": false,
          "cells": {
            "easy": 100,
            "medium": 99.7,
            "hard": 95.3,
            "decoy": 6.9,
            "wrong": 6
          }
        }
      ],
      "note": "Each method's score threshold is the lowest that gives a family to at most 5% of dev decoys. Wrong family: a non-decoy query given another index family."
    },
    "nothreshold": {
      "caption": "The same methods with no threshold: every query gets its best-scoring family.",
      "columns": [
        {
          "key": "easy",
          "label": "Easy (≥ 50% identity)",
          "suffix": "%"
        },
        {
          "key": "medium",
          "label": "Medium (30–50%)",
          "suffix": "%"
        },
        {
          "key": "hard",
          "label": "Hard (< 30%)",
          "suffix": "%"
        },
        {
          "key": "decoy",
          "label": "Decoys given a family",
          "suffix": "%"
        }
      ],
      "rows": [
        {
          "label": "Profile HMM (hmmsearch)",
          "highlight": true,
          "cells": {
            "easy": 100,
            "medium": 99.7,
            "hard": 95.1,
            "decoy": 7.5
          }
        },
        {
          "label": "Nearest sequence (phmmer)",
          "highlight": false,
          "cells": {
            "easy": 100,
            "medium": 99.7,
            "hard": 89.3,
            "decoy": 21.2
          }
        },
        {
          "label": "ESM-2, nearest neighbour",
          "highlight": false,
          "cells": {
            "easy": 93.5,
            "medium": 86.1,
            "hard": 81,
            "decoy": 100
          }
        },
        {
          "label": "ESM-2, family centroid",
          "highlight": false,
          "cells": {
            "easy": 88.6,
            "medium": 82.4,
            "hard": 74.8,
            "decoy": 100
          }
        }
      ],
      "note": "The profile HMM reports nothing for most decoys even with no threshold; nearest-neighbour methods always return a family."
    },
    "cost": {
      "caption": "Compute on one desktop: HMMER on 8 CPU threads, ESM-2 on one RTX 4070 (12 GB).",
      "columns": [
        {
          "key": "what",
          "label": "Step"
        },
        {
          "key": "s",
          "label": "Time",
          "decimals": 0,
          "suffix": " s"
        },
        {
          "key": "per",
          "label": "Per 1,000 sequences",
          "decimals": 1,
          "suffix": " s"
        }
      ],
      "rows": [
        {
          "label": "Profile HMM",
          "cells": {
            "what": "build 1,000 profiles",
            "s": 33,
            "per": null
          }
        },
        {
          "label": "Profile HMM",
          "highlight": true,
          "cells": {
            "what": "search 21,909 queries",
            "s": 9,
            "per": 0.4
          }
        },
        {
          "label": "Nearest sequence (phmmer)",
          "cells": {
            "what": "search 21,909 queries",
            "s": 168,
            "per": 7.6
          }
        },
        {
          "label": "ESM-2 650M",
          "cells": {
            "what": "embed 40,296 sequences (GPU)",
            "s": 284,
            "per": 7
          }
        }
      ],
      "note": "ESM-2 peak GPU memory 3.9 GB. Nearest-neighbour search on the embeddings takes under a second."
    }
  },
  "charts": {
    "hard": {
      "title": "Distant relatives: the hard band",
      "meta": "886 test queries under 30% identity to any training member · higher is better",
      "max": 100,
      "decimals": 1,
      "suffix": "%",
      "groups": [
        {
          "label": "With threshold (≤ 5% dev decoys)",
          "bars": [
            {
              "label": "Profile HMM (hmmsearch)",
              "value": 95.1,
              "highlight": true
            },
            {
              "label": "Nearest sequence (phmmer)",
              "value": 85.1,
              "highlight": false
            },
            {
              "label": "ESM-2, nearest neighbour",
              "value": 17.7,
              "highlight": false
            },
            {
              "label": "ESM-2, family centroid",
              "value": 15.7,
              "highlight": false
            }
          ]
        },
        {
          "label": "No threshold",
          "bars": [
            {
              "label": "Profile HMM (hmmsearch)",
              "value": 95.1,
              "highlight": true
            },
            {
              "label": "Nearest sequence (phmmer)",
              "value": 89.3,
              "highlight": false
            },
            {
              "label": "ESM-2, nearest neighbour",
              "value": 81,
              "highlight": false
            },
            {
              "label": "ESM-2, family centroid",
              "value": 74.8,
              "highlight": false
            }
          ]
        }
      ]
    }
  },
  "stats": {
    "headline": {
      "items": [
        {
          "value": "95%",
          "label": "of distant relatives placed in the right family by profile HMMs",
          "signal": true
        },
        {
          "value": "18%",
          "label": "by ESM-2 embeddings, at the same decoy limit"
        },
        {
          "value": "6.9%",
          "label": "of test decoys given a family by the HMM (dev: 4.9%)"
        },
        {
          "value": "9 s",
          "label": "to search 21,909 sequences on a CPU"
        }
      ]
    }
  },
  "decoys": {
    "assigned": 190,
    "same_clan": 62,
    "other_rate_pct": 4.6,
    "top_pairs": [
      [
        "Npun_F0494",
        "Dimerisation",
        12
      ],
      [
        "DUF3377",
        "Orf78",
        8
      ],
      [
        "ATRIP_N",
        "TMEM120A-B",
        4
      ],
      [
        "CPL1-like",
        "cEGF",
        4
      ],
      [
        "DUF2205",
        "Spectrin",
        4
      ],
      [
        "YdjY",
        "Fer4_16",
        4
      ]
    ]
  },
  "headline": {
    "value": "95%",
    "label": "of distant protein relatives placed correctly by profile HMMs on a CPU, against 18% for language-model embeddings"
  },
  "attribution": "Sequences and families: Pfam 38.2 seed alignments (Mistry et al.; EMBL-EBI), CC0. Models and tools: ESM-2 (Meta AI, MIT), pyhmmer and HMMER (BSD-3/MIT)."
}
