A Generative Latent Prior (GLP) model trained on ESM2-650M Layer 17 activations from UniRef50 protein sequences. GLP learns the distribution of protein representations via flow matching, enabling on-manifold projection during protein sequence steering.
1import sys, os
2sys.path.insert(0,"generative_latent_prior")34from glp.denoiser import load_glp
56# Load from local path (after downloading)7model = load_glp("generative_latent_prior/runs/glp-esm2-650m-layer17-d6", device="cuda:0")89# Or load from HuggingFace directly10model = load_glp("Shuibai12138/glp-esm2-650m-layer17", device="cuda:0")
2. Generate Activations from Noise (Unconditional Sampling)
Sample synthetic ESM2-650M Layer 17 activations from the learned distribution:
python
1import torch
2from glp import flow_matching
34# Sample from noise5noise = torch.randn(100,1,1280).to("cuda:0")# 100 samples6gen_acts = flow_matching.sample(model, noise, num_timesteps=100)78# Denormalize back to ESM2 activation space9gen_acts = model.normalizer.denormalize(gen_acts)# (100, 1, 1280)
3. On-Manifold Projection (SDEdit for Protein Steering)
The primary use case: after applying a steering vector to ESM2 activations, project the steered activations back onto the natural protein manifold to maintain sequence naturalness.
The key insight: steering vectors can push activations off the natural protein manifold, degrading sequence quality. GLP's SDEdit projection pulls them back while preserving the steering direction.
Citation
bibtex
1@misc{steering-plms,
2 title={Steering Protein Language Models},
3 author={Zhang, Shuibai},
4 year={2025},
5 url={https://github.com/zhangshuibai/Steering-PLMs}
6}