Update README.md
Browse files
README.md
CHANGED
|
@@ -15,57 +15,13 @@ tags:
|
|
| 15 |
ModernGENA is a DNA foundation model based on a modernized BERT-style encoder architecture adapted for genomic sequence modeling.
|
| 16 |
**ModernGENA base** is the 135M-parameter version introduced in the paper *Back to BERT in 2026: ModernGENA as a Strong, Efficient Baseline for DNA Foundation Models*.
|
| 17 |
|
| 18 |
-
Pretrained models:
|
| 19 |
-
- [AIRI-Institute/moderngena-base](https://huggingface.co/AIRI-Institute/moderngena-base)
|
| 20 |
-
- [AIRI-Institute/moderngena-large](https://huggingface.co/AIRI-Institute/moderngena-large)
|
| 21 |
|
| 22 |
-
|
| 23 |
- [GENA_LM repository](https://github.com/AIRI-Institute/GENA_LM/tree/main/examples/modernGENA)
|
| 24 |
|
| 25 |
-
## Key features
|
| 26 |
-
|
| 27 |
-
Compared to earlier DNA BERT-style models, ModernGENA incorporates several modern Transformer improvements:
|
| 28 |
-
|
| 29 |
-
- **RoPE positional embeddings** instead of absolute positional embeddings;
|
| 30 |
-
- **Hybrid attention pattern** with alternating local sliding-window and global attention;
|
| 31 |
-
- **Pre-norm Transformer blocks** for improved optimization stability;
|
| 32 |
-
- **GeGLU feed-forward layers** for more expressive nonlinear transformations;
|
| 33 |
-
- **Reduced bias parameterization** in most linear and normalization layers;
|
| 34 |
-
- **Efficient long-context implementation** with unpadding, FlashAttention-compatible kernels, and `torch.compile`.
|
| 35 |
-
|
| 36 |
-
These changes make ModernGENA a practical and reproducible baseline for studying DNA language modeling under modern training and inference setups.
|
| 37 |
-
|
| 38 |
-
## Model description
|
| 39 |
-
|
| 40 |
-
**ModernGENA base** is an encoder-only Transformer trained with masked language modeling (MLM) on genomic sequences.
|
| 41 |
-
|
| 42 |
-
### Architecture
|
| 43 |
-
|
| 44 |
-
- **Parameters:** 135M
|
| 45 |
-
- **Number of layers:** 22
|
| 46 |
-
- **Hidden size:** 768
|
| 47 |
-
- **Intermediate size:** 1152
|
| 48 |
-
- **Attention heads:** 12
|
| 49 |
-
- **Vocabulary size:** 32k BPE
|
| 50 |
-
- **Maximum sequence length during training:** up to 1024 tokens with dynamic packing
|
| 51 |
-
- **Sliding window size:** 128
|
| 52 |
-
- **Global attention every:** 3 layers
|
| 53 |
-
|
| 54 |
### Tokenization
|
| 55 |
|
| 56 |
-
ModernGENA uses a **32k BPE vocabulary** built over DNA alphabet symbols `A/T/G/C/N`, with special tokens
|
| 57 |
-
|
| 58 |
-
- `[CLS]`
|
| 59 |
-
- `[SEP]`
|
| 60 |
-
- `[PAD]`
|
| 61 |
-
- `[UNK]`
|
| 62 |
-
- `[MASK]`
|
| 63 |
-
|
| 64 |
-
As a preprocessing step, long runs of `N` are collapsed into a single token.
|
| 65 |
-
|
| 66 |
-
## Training data
|
| 67 |
-
|
| 68 |
-
The model was pretrained on a large multispecies vertebrate genomic corpus derived from **NCBI RefSeq** annotations available as of **December 2024**.
|
| 69 |
|
| 70 |
### Pretraining corpus
|
| 71 |
|
|
@@ -80,57 +36,6 @@ To reduce overrepresentation of simple repeats and enrich biologically informati
|
|
| 80 |
- overlapping intervals merged with BEDTools
|
| 81 |
- both strands included for each resulting region
|
| 82 |
|
| 83 |
-
## Training setup
|
| 84 |
-
|
| 85 |
-
ModernGENA base was trained with masked language modeling on:
|
| 86 |
-
|
| 87 |
-
- **8 × NVIDIA A100 80GB GPUs**
|
| 88 |
-
- **Global batch size:** 4096 sequences
|
| 89 |
-
- **Sequence lengths sampled dynamically from 10 to 1024 tokens**
|
| 90 |
-
- **Average sequence length:** ~700 tokens
|
| 91 |
-
- **Optimizer:** AdamW
|
| 92 |
-
- **Learning rate:** `4e-4`
|
| 93 |
-
- **Betas:** `(0.9, 0.98)`
|
| 94 |
-
- **Epsilon:** `1e-6`
|
| 95 |
-
- **Weight decay:** `1e-5`
|
| 96 |
-
- **Warmup:** first `3e9` tokens, then constant LR
|
| 97 |
-
|
| 98 |
-
### Training scale
|
| 99 |
-
|
| 100 |
-
- **158 epochs**
|
| 101 |
-
- **1,510B processed tokens**
|
| 102 |
-
- **Observed pretraining throughput:** **1.33M tokens/s**
|
| 103 |
-
|
| 104 |
-
## Evaluation
|
| 105 |
-
|
| 106 |
-
ModernGENA was evaluated on the **Nucleotide Transformer benchmark** consisting of 18 genomic downstream tasks.
|
| 107 |
-
|
| 108 |
-
Key results reported in the paper:
|
| 109 |
-
|
| 110 |
-
- **ModernGENA base** ranks **first within the primary baseline set** among encoder-only Transformer models of comparable size;
|
| 111 |
-
- it shows a strong **efficiency–quality trade-off**;
|
| 112 |
-
- it achieves **higher inference throughput** than the main comparable baselines under FlashAttention-based inference settings.
|
| 113 |
-
|
| 114 |
-
The primary comparison group includes:
|
| 115 |
-
|
| 116 |
-
- DNABERT-2
|
| 117 |
-
- GENA-LM
|
| 118 |
-
- Nucleotide Transformer v2
|
| 119 |
-
|
| 120 |
-
## Intended use
|
| 121 |
-
|
| 122 |
-
ModernGENA base is intended for:
|
| 123 |
-
|
| 124 |
-
- masked language modeling on DNA sequences;
|
| 125 |
-
- extracting contextual embeddings for genomic regions;
|
| 126 |
-
- fine-tuning on downstream genomics classification tasks such as:
|
| 127 |
-
- promoter prediction,
|
| 128 |
-
- enhancer prediction,
|
| 129 |
-
- histone mark prediction,
|
| 130 |
-
- splice-site related tasks.
|
| 131 |
-
|
| 132 |
-
## Example usage
|
| 133 |
-
|
| 134 |
### Load pretrained model
|
| 135 |
|
| 136 |
```python
|
|
|
|
| 15 |
ModernGENA is a DNA foundation model based on a modernized BERT-style encoder architecture adapted for genomic sequence modeling.
|
| 16 |
**ModernGENA base** is the 135M-parameter version introduced in the paper *Back to BERT in 2026: ModernGENA as a Strong, Efficient Baseline for DNA Foundation Models*.
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
Fine-tuning code:
|
| 20 |
- [GENA_LM repository](https://github.com/AIRI-Institute/GENA_LM/tree/main/examples/modernGENA)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
### Tokenization
|
| 23 |
|
| 24 |
+
ModernGENA uses a **32k BPE vocabulary** built over DNA alphabet symbols `A/T/G/C/N`, with special tokens (`[CLS]`, `[SEP]`, `[PAD]`, `[UNK]`, `[MASK]`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
### Pretraining corpus
|
| 27 |
|
|
|
|
| 36 |
- overlapping intervals merged with BEDTools
|
| 37 |
- both strands included for each resulting region
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
### Load pretrained model
|
| 40 |
|
| 41 |
```python
|