A 19.3M parameter plasmid DNA generation model, post-trained with
GRPO (Group Relative Policy Optimization) using
pLannotate biological annotations as a reward signal. Fine-tuned from
McClain/PlasmidLM-kmer6.
This model was post-trained with reinforcement learning to improve the biological accuracy of generated plasmid sequences. Instead of only learning sequence statistics, the model was optimized to produce sequences where requested functional elements (antibiotic resistance genes, origins of replication, promoters, etc.) are verifiably present when analyzed by the pLannotate annotation tool.
The full configuration is included in this repository as
training_config.py. Key hyperparameters:
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "McClain/PlasmidLM-kmer6-GRPO-plannotate"
5model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to("cuda")
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7
8# Generate a plasmid with kanamycin resistance, ColE1 origin, and T7 promoter
9prompt = "<BOS> <AMR_KANAMYCIN> <ORI_COLE1> <PROM_T7> <SEP>"
10inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
11
12with torch.no_grad():
13 outputs = model.generate(
14 **inputs,
15 max_new_tokens=3000,
16 temperature=0.3,
17 do_sample=True,
18 top_k=50,
19 )
20
21sequence = tokenizer.decode(outputs[0].tolist())
22print(sequence)
23
24# Extract just the DNA sequence
25import re
26dna = re.sub(r"<[^>]+>", "", sequence.upper())
27dna = re.sub(r"[^ATGCN]", "", dna)
28print(f"Generated {len(dna)} bp plasmid sequence")
1@misc{thiel2026plasmidlm,
2 title={PlasmidLM: Language Models for Conditional Plasmid DNA Generation with Reinforcement Learning},
3 author={Thiel, McClain},
4 year={2026},
5 url={https://huggingface.co/McClain/PlasmidLM-kmer6-GRPO-plannotate}
6}