加载中…
加载中…
google/byt5-smallByte-level Sequence-to-Sequence Model for Synonymous Codon Optimization in Escherichia coli
T5ForConditionalGeneration / ByT5)google/byt5-smallfloat16Coli-ByT5-Small is a specialized byte-level sequence-to-sequence language model fine-tuned to solve the synonymous codon optimization task for the model bacterium Escherichia coli.
Given an amino acid sequence, the model generates an optimized synonymous nucleotide coding sequence (CDS). Unlike classical heuristic tools that rely on naive frequency maximization tables (which often eliminate natural translational pauses, disrupt co-translational folding, or destroy the 5' translational ramp), Coli-Byt5-Small learns contextual codon harmonization from validated endogenous sequences.
By operating directly on UTF-8 bytes rather than subword tokens:
ACDEFGHIKLMNPQRSTVWY and nucleotides ATGC) are represented at single-character granularity without out-of-vocabulary (OOV) tokens.pip install torch transformers sentencepiece
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_id = "aakashdandekar2006/Coli-Byt5-Small" # or local directory path
# Load byte-level tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Input amino acid sequence (e.g., GFP fragment / peptide sequence)
protein_seq = "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEG"
prompt = f"Optimize codon sequence for Escherichia coli: {protein_seq}"
# Tokenize byte input
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Autoregressive generation
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=len(protein_seq) * 3 + 64,
num_beams=4,
early_stopping=True
)
optimized_dna = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("Input Protein:", protein_seq)
print("Optimized DNA:", optimized_dna)
from transformers import pipeline
pipe = pipeline(
"text2text-generation",
model="aakashdandekar2006/Coli-ByT5-Small",
torch_dtype="float16",
device_map="auto"
)
result = pipe("Optimize codon sequence for Escherichia coli: MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEG")
print(result[0]["generated_text"])
adibvafa/CodonTransformer and NCBI reference genomes. Filtered through biological schema verification:ACDEFGHIKLMNPQRSTVWY) and canonical base compliance (A, C, G, T)r=16, lora_alpha=32, target_modules="all-linear") using peft and Seq2SeqTrainer, subsequently merged into standalone safetensors float16 weights.5e-4 with cosine learning rate scheduler and AdamW optimizer| Criterion | Target Standard | Description |
|---|---|---|
| Translation Fidelity | 100% Sequence Identity | Generated nucleotide sequence must translate precisely to the input protein. |
| Codon Adaptation Index (CAI) | $0.65 - 0.85$ (Balanced) | Reflects endogenous E. coli K-12 codon frequency without unphysiological 1.0 maximization. |
| GC Equilibrium | $45% - 55%$ | Maintains host physiological GC range for mRNA stability. |
| Synthesis Safety | 0 Forbidden Sites | Suppresses unwanted restriction enzyme recognition motifs (EcoRI, BamHI, HindIII, XhoI, NdeI, NcoI). |
Comparative evaluation of Coli-ByT5-Small against a traditional frequency-maximizing greedy baseline on a test sequence of 539 aa (1617 nt expected):
| Metric | Coli-ByT5-Small (LLM Model) | Traditional Greedy |
|---|---|---|
| Translation Check | PASS | PASS |
| Generated Length (nt) | 1617 | 1617 |
| Codon Adaptation (CAI) | 0.884 | 1.000 |
| GC Content (%) | 54.6% | 52.6% |
| Restriction Sites | 0 | 1 |
Sequence translated successfully with zero amino acid mismatches.
ATGGAAGATGCAAAAAATATTAAAAAAGGTCCTGCACCATTTTATCCGCTGGAAGATGGC...
ATGGAAGATGCGAAAAACATTAAAAAAGGCCCGGCGCCGTTTTATCCGCTGGAAGATGGC...
@misc{coli_byt5_small_2026,
author = {Dandekar, Aakash},
title = {Coli-ByT5-Small: Byte-Level Sequence-to-Sequence Model for Escherichia coli Codon Optimization},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/aakashdandekar2006/Coli-ByT5-Small}}
}