SAVRN
Search Contact SAVRN

Open-weight model · Fill mask

minerva-mlm

by Garyk Brixi gbrixi/minerva-mlm

minerva-mlm is an open-weight model for fill mask from Garyk Brixi, released under Apache License 2.0. It has 671M parameters. At 16-bit it needs about 1.6 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index. It draws 4k downloads a month.

Minerva-MLM is a genome language model for coevolutionary mining. The checkpoint includes the masked language model head and three interaction heads for base-pairing, repeat, and structure signals.

Parameters671M
Context—
Weights2.7 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads4k

Runs On

What it takes to serve minerva-mlm (671M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 1.3 GB 1.6 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.7 GB 0.8 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.3 GB 0.4 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Oct 7, 2026.

minerva-mlm on every accelerator the SAVRN Index prices, at every precision

Model Card

By Garyk Brixi, published under apache-2.0, revision ccff620c393f.

Minerva-MLM is a genome language model for coevolutionary mining. The checkpoint includes the masked language model head and three interaction heads for base-pairing, repeat, and structure signals. Full documentation, finetuning scripts, notebooks, and setup are on the github. Try it in the browser here. Inference from this repo needs only Transformers and PyTorch: flash-attn is picked up automatically when present, otherwise Minerva falls back to PyTorch SDPA. The optional minerva-dna package adds plotting helpers, GenBank utilities and finetuning wrappers, and lets you load the model without trustremotecode: With minerva-dna installed, import the class directly and drop trustremotecode…

Read Garyk Brixi's full model card

Minerva-MLM is a genome language model for coevolutionary mining. The checkpoint includes the masked language model head and three interaction heads for base-pairing, repeat, and structure signals.

Full documentation, finetuning scripts, notebooks, and setup are on the github. Try it in the browser here.

Checkpoints

Model Context length Hugging Face repo
Minerva-MLM 4,096 tokens gbrixi/minerva-mlm
Minerva-MLM-8k 8,192 tokens gbrixi/minerva-mlm-8k

Install

Inference from this repo needs only Transformers and PyTorch:

pip install "transformers>=4.41" torch safetensors
pip install flash-attn      # optional, recommended for production and packed sequences

flash-attn is picked up automatically when present, otherwise Minerva falls back to PyTorch SDPA. The optional minerva-dna package adds plotting helpers, GenBank utilities and finetuning wrappers, and lets you load the model without trust_remote_code:

pip install minerva-dna

Quick Start

import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer

repo = "gbrixi/minerva-mlm"  # or "gbrixi/minerva-mlm-8k" for 8k context
device = "cuda" if torch.cuda.is_available() else "cpu"

model = AutoModelForMaskedLM.from_pretrained(
    repo,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
).to(device).eval()
tokenizer = AutoTokenizer.from_pretrained(repo)

sequence = "cgcggggtggagcagcctggtagctcgtcgggctcataacccgaagatcgtcggttcaaatccggcccccgcaacca"
tokens = tokenizer(f"<+>{sequence.lower()}", return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model(**tokens, output_interactions=True)

base_pairing = outputs.interactions["base_pairing"]  # [batch, L, L]
protein = outputs.interactions["protein"]            # [batch, L, L]
repeat = outputs.interactions["repeat"]              # [batch, L, L]
logits = outputs.logits                              # [batch, L, vocab]

With minerva-dna installed, import the class directly and drop trust_remote_code:

from minerva import MinervaForMaskedLM

model = MinervaForMaskedLM.from_pretrained(
    repo, torch_dtype=torch.bfloat16,
).to(device).eval()

Strand Orientation

Minerva was trained with positive-strand DNA. To intepret unknown loci, run inference on both strands and compare results (or combine maps downstream):

def reverse_complement(seq: str) -> str:
    return seq.lower().translate(str.maketrans("acgtn", "tgcan"))[::-1]

strands = {
    "forward": f"<+>{sequence.lower()}",
    "reverse_complement": f"<+>{reverse_complement(sequence)}",
}

results = {}
for name, seq in strands.items():
    tokens = tokenizer(seq, return_tensors="pt").to(model.device)
    with torch.no_grad():
        outputs = model(**tokens, output_interactions=True)
    results[name] = outputs.interactions

For mixed DNA/protein token strings, minerva.sequence_utils.extract_fwd_rc_attention aligns and combines forward and reverse-complement attention maps automatically (requires pip install minerva-dna).

Interaction Outputs

Set output_interactions=True to return all three standard Minerva interaction maps:

  • base_pairing: RNA base-pairing contacts
  • protein: protein contact prediction
  • repeat: repeat element signal

By default, Minerva uses the last-2-layer interaction heads:

outputs = model(**tokens, output_interactions=True)

To plot the interaction-head outputs (requires pip install minerva-dna):

from minerva.visualization import plot_contacts

token_list = tokenizer.convert_ids_to_tokens(tokens["input_ids"][0].tolist())
plot_contacts(outputs, tokens=token_list, track=True)

Six-layer heads are available with interaction_layers=6.

Jacobian Fingerprinting

get_fingerprints returns named interaction-pattern channels for a sequence, computing the categorical Jacobian internally.

fp = model.get_fingerprints(sequence, tokenizer, position_range=(0, 96))
fp.channel_names          # ["basepairing", "repeat", "protein", "other"]
basepairing = fp["basepairing"]   # [L, L]

Raw Jacobians, plotting helpers and the rest of the API are documented in the repository.

Finetuning

Finetuning scripts, LoRA support, and GenBank ingestion live in the GitHub repository. See scripts/finetune.py and the README there for full examples with accelerate and PEFT.

Limitations

  • Model performance is best on the positive DNA strand (<+> prefix). When orientation is unknown, run inference on both strands.
  • trust_remote_code=True is needed only without minerva-dna installed (see Install).

Citation

If you use Minerva, please cite Li & Brixi et al., bioRxiv 2026:

@article{li2026minerva,
  title     = {Coevolutionary mining of prokaryotic non-coding elements with a genome language model},
  author    = {Li, David B. and Brixi, Garyk and Kim, Alexandra S. and Fiamenghi, Mateus B. and Driscoll, Claudia L. and Evans, Simone A. and Gao, Alex and Ivanova, Natalia N. and Kyrpides, Nikos C. and Deisseroth, Karl and Wilkinson, Max E. and Fischbach, Michael A. and Hie, Brian L.},
  journal   = {bioRxiv},
  year      = {2026},
  doi       = {10.64898/2026.09.22.753630},
  url       = {https://www.biorxiv.org/content/10.64898/2026.09.22.753630},
  publisher = {Cold Spring Harbor Laboratory}
}

License

Apache 2.0. Minerva-MLM is initialized from gLM2 650M (Tatta Bio, Apache 2.0) and adopts its mixed-modality tokenization.

Configuration

Architecture
MinervaForMaskedLM
Vocabulary size
37
Model type
minerva

Identity and Version

Repository
gbrixi/minerva-mlm
Publisher
Garyk Brixi
Task
Fill mask
Modality
Text
Library
transformers
Parameters
671M parameters
Languages
Not stated by the source
Revision
ccff620c393f10177c24fe171850a69403d4e5a7
First published
2026-05-26
Last updated
2026-10-05

Files and Weights

18 files, 2.7 GB in total. The weights are 1 file totalling 2.7 GB in safetensors.

Weights1 file · 2.7 GB
Configuration7 files · 205.4 KB
Tokenizer2 files · 4.1 KB
Documentation2 files · 17.8 KB
Other5 files · 1.0 MB
Repository1 file · 1.8 KB
Every file
FileTypeSizeSHA-256
model.safetensorsWeights2.7 GB fc18e12ba6d4
config.jsonConfiguration1.9 KB —
constants.pyConfiguration14.4 KB —
data.pyConfiguration19.5 KB —
jacobian.pyConfiguration32.8 KB —
modeling_minerva.pyConfiguration88.3 KB —
special_tokens_map.jsonConfiguration833 B —
visualization.pyConfiguration47.7 KB —
LICENSEDocumentation11.3 KB —
README.mdDocumentation6.4 KB —
assets/minerva_banner_dark.webpOther174.1 KB f3ba92c1f5d1
assets/minerva_banner_light.webpOther150.8 KB 31eff6c9334f
assets/minerva_owl_small.pngOther10.9 KB —
examples/TwoAYGGAY_Pseudomonas_fluorescens_SBW25.gbOther601.6 KB —
examples/UG27_systems.gbOther104.9 KB —
.gitattributesRepository1.8 KB —
tokenizer.jsonTokenizer2.4 KB —
tokenizer_config.jsonTokenizer1.7 KB —

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
2.7 GB
Download from Garyk Brixi

Released by Garyk Brixi through its official repository on Hugging Face. Read the license.

Memory Requirements

PrecisionWeights in memory
As published2.7 GB
16-bit1.3 GB
8-bit0.7 GB
4-bit0.3 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Built on This Model

Questions About minerva-mlm

How much GPU memory does minerva-mlm need?

About 1.6 GB at 16-bit and 0.4 GB at 4-bit: the weights (671M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run minerva-mlm on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use minerva-mlm commercially?

Yes. minerva-mlm is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

Similar Models

Model · Fill mask

minerva-mlm-8k

Garyk Brixi

Minerva-MLM is a genome language model for coevolutionary mining. The checkpoint includes the masked language model head and three interaction heads for base-pairing, repeat, and structure signals. Full documentation, finetuning scripts, notebooks, and setup are on the github. Try it in the browser here. Inference from this repo needs only Transformers and PyTorch: flash-attn is picked up automatically when present, otherwise Minerva falls back to PyTorch SDPA. The optional minerva-dna package adds plotting helpers, GenBank utilities and finetuning wrappers, and lets you load the model without trustremotecode: With minerva-dna installed, import the class directly and drop trustremotecode…

Open weights apache-2.0 671M parameters transformers

Model · Fill mask

esm2_t33_650M_UR50D

AI at Meta

ESM-2 is a state-of-the-art protein model trained on a masked language modelling objective. It is suitable for fine-tuning on a wide range of tasks that take protein sequences as input. For detailed information on the model architecture and training data, please refer to the accompanying paper. You may also be interested in some demo notebooks (PyTorch, TensorFlow) which demonstrate how to fine-tune ESM-2 models on your tasks of interest. Several ESM-2 checkpoints are available in the Hub with varying sizes. Larger sizes generally have somewhat better accuracy, but require much more memory and time to train

Open weights mit 652M parameters 1,026 tokens transformers

XLM-RoBERTa model pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages. It was introduced in the paper Unsupervised Cross-lingual Representation Learning at Scale by Conneau et al. and first released in this repository. Disclaimer: The team releasing XLM-RoBERTa did not write a model card for this model so this model card has been written by the Hugging Face team. XLM-RoBERTa is a multilingual version of RoBERTa. It is pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages. RoBERTa is a transformers model pretrained on a large corpus in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in…

Open weights mit 561M parameters 514 tokens transformers

Model · Fill mask

ModernBERT-large

Answer.AI

ModernBERT is a modernized bidirectional encoder-only Transformer model (BERT-style) pre-trained on 2 trillion tokens of English and code data with a native context length of up to 8,192 tokens. ModernBERT leverages recent architectural improvements such as: - Rotary Positional Embeddings (RoPE) for long-context support. - Local-Global Alternating Attention for efficiency on long inputs. - Unpadding and Flash Attention for efficient inference. ModernBERT’s native long context length makes it ideal for tasks that require processing long documents, such as retrieval, classification, and semantic search within large corpora. The model was trained on a large corpus of text and code, making it…

Open weights apache-2.0 396M parameters 8,192 tokens transformers

This model is a fine-tuned version of ModernBERT optimized for logical reasoning, deductive analysis, and structure-based token prediction. It relies on the ModernBertForMaskedLM architecture, making it highly effective at filling in missing contextual logic tokens (fill-mask). - As an encoder-based Masked Language Model, it is not designed for long-form generative text (like ChatGPT). It excels at predicting masked tokens inside structured prompts.

Open weights apache-2.0 396M parameters 8,192 tokens

Pretrained model on English language using a masked language modeling (MLM) objective. It was introduced in this paper and first released in this repository. This model is case-sensitive: it makes a difference between english and English. Disclaimer: The team releasing RoBERTa did not write a model card for this model so this model card has been written by the Hugging Face team. RoBERTa is a transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels…

Open weights mit 355M parameters 514 tokens transformers