CoolFace
Modelpublic

vesteinn/gpt2-dna

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes281downloads
Model Card

DNA Language Model (Char-level, Human-only)

This model is a character-level GPT-style language model trained exclusively on human DNA. It uses a custom tokenizer with a vocabulary of A, C, G, T, and a special end-of-text token, trained to predict the next base in 1024-base sequences.


๐Ÿงฌ Model Summary

  • โ€”Objective: Next-token prediction over human genomic sequences
  • โ€”Tokenization: Character-level (A, C, G, T)
  • โ€”Training data: simecek/Human\_DNA\_v0
  • โ€”Sequence length: 1024 tokens
  • โ€”Final Validation Loss: 1.0299 nats/token
  • โ€”Final Validation Accuracy: 53.24%
This model outperforms classical compressors like GeCo on human DNA entropy, achieving \~1.486 bits per base.

๐Ÿ”ง Tokenizer

The tokenizer is a minimal GPT-2-style vocabulary:

json
{
  "<|endoftext|>": 0,
  "A": 1,
  "C": 2,
  "G": 3,
  "T": 4
}
  • โ€”Implemented via GPT2TokenizerFast
  • โ€”Merges file is empty (no BPE applied)

๐Ÿ“Š Dataset Preprocessing

  • โ€”Original dataset is cleaned to keep only A, C, G, T
  • โ€”Sequences are chunked into segments of length 1024
  • โ€”Very short chunks (<200bp) are discarded
  • โ€”A 10% split validation is made from the training set.

๐Ÿš€ Intended Uses

This model can be used for:

  • โ€”DNA sequence generation
  • โ€”Genomic representation learning
  • โ€”Predictive modeling for base-level structure
  • โ€”Downstream fine-tuning for biological classification tasks

Limitations

  • โ€”Trained only on human genome; not suitable for other species
  • โ€”No reverse-complement modeling
  • โ€”No masked language modeling objective

๐Ÿ‹๏ธ Training Details

Hyperparameters

  • โ€”learning\_rate: 0.0003
  • โ€”train\batch\size: 64
  • โ€”eval\batch\size: 8
  • โ€”total\train\batch\_size: 256 (across 4 GPUs)
  • โ€”total\eval\batch\_size: 32
  • โ€”optimizer: AdamW (betas=(0.9, 0.999), epsilon=1e-08)
  • โ€”lr\_scheduler: Linear with 1000 warmup steps
  • โ€”epochs: 10.0
  • โ€”mixed\_precision: Native AMP

Hardware

  • โ€”Multi-GPU training (4 devices)
  • โ€”Transformers 4.52.0.dev0
  • โ€”PyTorch 2.3.0+cu121

๐Ÿ“ˆ Training Results

StepEpochTraining LossValidation LossAccuracy
50000.691.12521.12060.4745
100001.381.08351.08140.4991
150002.071.06411.06390.5103
200002.761.05631.05470.5163
250003.451.05041.04860.5204
300004.141.04391.04390.5233
350004.841.04251.04070.5254
400005.521.03651.03800.5271
450006.221.03251.03610.5284
500006.911.03221.03410.5296
550007.601.03071.03280.5305
600008.291.02671.03160.5313
650008.981.02731.03060.5320
700009.671.02701.02990.5324

๐Ÿ”— References


๐Ÿ“„ Citation

This model is part of ongoing research. A formal citation will be added when the associated paper is published.

If you use this model in academic work, please check back for updates.