Skip to main content

PLM Reverse Distillation

Reverse Distillation Abstract

Protein language models (PLMs) scale poorly: for many tasks, mid-sized models often outperform the largest in the same family. Reverse Distillation addresses this by decomposing large PLM representations into orthogonal subspaces guided by smaller models of the same family. The resulting embeddings have a Matryoshka-style nested structure — the first k dimensions of a larger model's embedding exactly match the smaller model's representation — ensuring larger reverse-distilled models consistently outperform smaller ones.

On ProteinGym benchmarks, reverse-distilled ESM-2 variants outperform their respective baselines at the same embedding dimensionality, with the reverse-distilled 15B model achieving the strongest performance.

Installation

Requires Python ≥ 3.12 and uv.

git clone https://github.com/rohitsinghlab/plm_reverse_distillation.git
cd plm_reverse_distillation
uv lock && uv sync
uv pip install -e '.[dev]'
source .venv/bin/activate

Quick Start

See inference_tutorial.ipynb for a step-by-step walkthrough of loading pretrained models and extracting embeddings.

Pretrained scalers for all ESM-2 model pairs (8M → 35M → 150M → 650M → 3B → 15B) are available on HuggingFace and loaded automatically via the model registry:

singhlab/plm_reverse_distillation

Available Models

All models use PCR regression and PCA for dimensionality reduction. Each model applies the full chain of scalers from ESM-2 8M up to the target size.

Model name Chain Output dim
esm2.rd/35M 8M → 35M 480
esm2.rd/150M 8M → 35M → 150M 640
esm2.rd/650M 8M → 35M → 150M → 650M 1280
esm2.rd/3B 8M → 35M → 150M → 650M → 3B 2560
esm2.rd/15B 8M → 35M → 150M → 650M → 3B → 15B 5120

Scripts

Embedding extraction

Extract embeddings from a FASTA file using a pretrained RD model:

python scripts/extract.py \
    --fasta_file proteins.fasta \
    --output_dir embeddings/ \
    --repr_type mean \
    --batch_size 32

Key arguments: --repr_type (per_tok / mean / bos), --repr_layers, --batch_size, --truncation_seq_length.

Training scalers

Train new scalers on your own data:

python scripts/train.py \
    --dataset_path proteins.fasta \
    --scalar_path scalers/ \
    --regressor_type pcr \
    --scaler_type rd \
    --n_pretrained_seqs 5000

Key arguments: --regressor_type (linear / ridge / pcr), --scaler_type (rd / naive), --pca_type (incremental / fbpca), --n_pretrained_seqs.

Citation

If you use reverse distillation, please cite:

@inproceedings{catrina2026reverse,
  title   = {Reverse Distillation: Consistently Scaling Protein Language Model Representations},
  author  = {Catrina, Darius and Bepler, Christian and Sledzieski, Samuel and Singh, Rohit},
  booktitle = {International Conference on Learning Representations},
  year    = {2026}
}

License

This project is licensed under the MIT License — see LICENSE for details.

Metadata

Release files for reverse_distillation 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reverse_distillation 0.1.0
File Size Uploaded
reverse_distillation-0.1.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reverse_distillation 0.1.0
File Interpreter ABI Platform
reverse_distillation-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / reverse_distillation-0.1.0.tar.gz

Download URL reverse_distillation-0.1.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c278b787425a18b62735d37235ef4745ce0da2fe9961bb5f9af17fe12cca4ba7
BLAKE2b-256 checksum
How to use checksums
1bbd5e78f14cdd39572b7baf08e174169d126bc61f969db8a0dea2034d61f7ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release files / reverse_distillation-0.1.0-py3-none-any.whl

Download URL reverse_distillation-0.1.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a5efda80b77147e513279e99bced5fa672c4b8537510cadd178fc17c161d0be
BLAKE2b-256 checksum
How to use checksums
c61e80d17f9c71851fd4fcb0e7dba8b5bbdfb3310ffded1d1a023f6915340bd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page