PhaGen

Overview

PhaGen is a 150M-parameter model for generating and analyzing bacteriophage DNA. It learns by reconstructing masked DNA and generates sequences by filling masked positions over multiple steps.

The same pretrained model provides sequence embeddings and masked-region scores for downstream prediction. The repository includes model code, usage examples, and training code based on VeOmni.

150M
Parameters
131,072
Token context
964
Embedding dimensions
7
Prediction benchmarks

Model framework

PhaGen uses three hierarchical stages to combine nucleotide-level information with broader sequence context. Figure 1 summarizes the training data, masked-diffusion architecture, and evaluated tasks.

Figure 1. Training data, model architecture, and generation and prediction tasks. Click the figure to enlarge.

How DNA is generated

Both examples start from the same 4-nucleotide prefix. M denotes a masked position; blank cells are not yet generated.

PhaGen Masked diffusion

Fills multiple masked positions per iteration using bidirectional context.

Illustrated iterations 0New bases 0 / 44

Evo Autoregressive

Reads the existing prefix and appends one nucleotide at a time, from left to right.

Illustrated iterations 0New bases 0 / 44

Prediction benchmarks

The pretrained model is evaluated on seven sequence-understanding tasks using sequence scores or embeddings.

TaskEvaluation
Gene essentialityZero-shot prediction for lambda and P1 genes.
T7 SNP mutabilityPredict single-nucleotide mutation patterns across 59 T7 genes.
Phage promoter recognitionClassify promoter and non-promoter DNA windows.
Virion-protein subtypesPredict seven subtypes from protein-coding DNA.
Host predictionPredict host species from tail-protein coding DNA.
infA mutation fitnessPredict fitness from E. coli infA variant sequences.
TEM-1 β-lactamase fitnessPredict fitness from TEM-1 variant coding sequences.

Quick start

Install PhaGen from the repository root. The examples support a downloaded checkpoint or a local model directory.

Python 3.10+ · PyTorch 2.5 · Transformers 4.54.1

git clone https://github.com/ai4nucleome/PhaGen.git
cd PhaGen
python -m pip install -e .

See the GitHub README for generation and embedding examples.

Resources

GitHub
Model implementation, examples, VeOmni training, and evaluation code.
Hugging Face
Pretrained weights, model configuration, and tokenizer files.
Zenodo
Evaluation data, formal results, plotting code, and figures.

Authors

  • Yusen Hou
  • Weicai Long
  • Houcheng Su
  • Junning Feng
  • Yanlin Zhang*

Data Science and Analytics Thrust, Hong Kong University of Science and Technology (Guangzhou), Guangzhou 511455, China.

* Corresponding author: yanlinzhang@hkust-gz.edu.cn

Figure 1 · Overview of PhaGen

PhaGen paper Figure 1 showing the training corpus, three-stage masked diffusion architecture, and generation and prediction tasks.

Figure 1. Training data, model architecture, and generation and prediction tasks.