alt.freeweights.vision / ModernBERT-base
From: answerdotai <huggingface.co/answerdotai>Newsgroups: alt.freeweights.visionSubject:

ModernBERT-base

Date: 2026-11-15Commit: 8949b90Signed: 2DC28CC7B26A283B ✓

Fill mask model with 150M parameters. Onnx and safetensors weights, 3.13 GB in all. Published by answerdotai under Apache-2.0.

150M params3.13GBModernBERT-baseonnx safetensorspermissive
FactsParams150MSize3.13 GBFormatsonnx, safetensorsTaskfill maskLicenseApache-2.0From sourcepermissive
$ fw get answerdotai/ModernBERT-base
# manifest sha256 86b4a2a44759… · 3.13 GB · 16 files
$ fw verify ./ModernBERT-base answerdotai/ModernBERT-base
From sourceHosted (signed)answerdotai/ModernBERT-baseLast check: 2026-11-15 02:25 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Overview

Size
3.13 GB
Weights
599 MB (safetensors)
Parameters
150M
Formats
onnx, safetensors
Task
fill mask
License
Apache-2.0 (permissive)
Files
16, each with a sha256
Publisher
answerdotai
Added
2026-11-15
Section
alt.freeweights.vision
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 02:25 UTCpassed

Model card

From the publisher at commit 8949b90. Shown as plain text with links; images open at the publisher.

ModernBERT#

Table of Contents#

  1. Model Summary
  2. Usage
  3. Evaluation
  4. Limitations
  5. Training
  6. License
  7. Citation

Model Summary#

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 suitable for a wide range of downstream tasks, including code retrieval and hybrid (text + code) semantic search.

It is available in the following sizes:

For more information about ModernBERT, we recommend our release blog post for a high-level overview, and our arXiv pre-print for in-depth information.

ModernBERT is a collaboration between Answer.AI, LightOn, and friends.

Usage#

You can use these models directly with the transformers library starting from v4.48.0:

pip install -U transformers>=4.48.0

Since ModernBERT is a Masked Language Model (MLM), you can use the fill-mask pipeline or load it via AutoModelForMaskedLM. To use ModernBERT for downstream tasks like classification, retrieval, or QA, fine-tune it following standard BERT fine-tuning recipes.

⚠️ If your GPU supports it, we recommend using ModernBERT with Flash Attention 2 to reach the highest efficiency. To do so, install Flash Attention as follows, then use the model as normal:

pip install flash-attn

Using AutoModelForMaskedLM:

from transformers import AutoTokenizer, AutoModelForMaskedLM

model_id = "answerdotai/ModernBERT-base"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(model_id)

text = "The capital of France is [MASK]."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)

# To get predictions for the mask:
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
predicted_token_id = outputs.logits[0, masked_index].argmax(axis=-1)
predicted_token = tokenizer.decode(predicted_token_id)
print("Predicted token:", predicted_token)
# Predicted token:  Paris

Using a pipeline:

import torch
from transformers import pipeline
from pprint import pprint

pipe = pipeline(
    "fill-mask",
    model="answerdotai/ModernBERT-base",
    torch_dtype=torch.bfloat16,
)

input_text = "He walked to the [MASK]."
results = pipe(input_text)
pprint(results)

Note: ModernBERT does not use token type IDs, unlike some earlier BERT models. Most downstream usage is identical to standard BERT models on the Hugging Face Hub, except you can omit the token_type_ids parameter.

Evaluation#

We evaluate ModernBERT across a range of tasks, including natural language understanding (GLUE), general retrieval (BEIR), long-context retrieval (MLDR), and code retrieval (CodeSearchNet and StackQA).

Key highlights:

  • On GLUE, ModernBERT-base surpasses other similarly-sized encoder models, and ModernBERT-large is second only to Deberta-v3-large.
  • For general retrieval tasks, ModernBERT performs well on BEIR in both single-vector (DPR-style) and multi-vector (ColBERT-style) settings.
  • Thanks to the inclusion of code data in its training mixture, ModernBERT as a backbone also achieves new state-of-the-art code retrieval results on CodeSearchNet and StackQA.
Base Models#
ModelIR (DPR)IR (DPR)IR (DPR)IR (ColBERT)IR (ColBERT)NLUCodeCode
BEIRMLDR_OODMLDR_IDBEIRMLDR_OODGLUECSNSQA
BERT38.923.932.249.028.184.741.259.5
RoBERTa37.722.932.848.728.286.444.359.6
DeBERTaV320.25.413.447.121.988.117.518.6
NomicBERT41.026.730.349.961.384.041.661.4
GTE-en-MLM41.434.344.448.269.385.644.971.4
ModernBERT41.627.444.051.380.288.456.473.6

Large Models#
ModelIR (DPR)IR (DPR)IR (DPR)IR (ColBERT)IR (ColBERT)NLUCodeCode
BEIRMLDR_OODMLDR_IDBEIRMLDR_OODGLUECSNSQA
BERT38.923.331.749.528.585.241.660.8
RoBERTa41.422.636.149.828.888.947.368.1
DeBERTaV325.67.119.246.723.091.421.219.7
GTE-en-MLM42.536.448.950.771.387.640.566.9
ModernBERT44.034.348.652.480.490.459.583.9

Table 1: Results for all models across an overview of all tasks. CSN refers to CodeSearchNet and SQA to StackQA. MLDRID refers to in-domain (fine-tuned on the training set) evaluation, and MLDR_OOD to out-of-domain.

ModernBERT’s strong results, coupled with its efficient runtime on long-context inputs, demonstrate that encoder-only models can be significantly improved through modern architectural choices and extensive pretraining on diversified data sources.

Limitations#

ModernBERT’s training data is primarily English and code, so performance may be lower for other languages. While it can handle long sequences efficiently, using the full 8,192 tokens window may be slower than short-context inference. Like any large language model, ModernBERT may produce representations that reflect biases present in its training data. Verify critical or sensitive outputs before relying on them.

Training#

  • Architecture: Encoder-only, Pre-Norm Transformer with GeGLU activations.
  • Sequence Length: Pre-trained up to 1,024 tokens, then extended to 8,192 tokens.
  • Data: 2 trillion tokens of English text and code.
  • Optimizer: StableAdamW with trapezoidal LR scheduling and 1-sqrt decay.
  • Hardware: Trained on 8x H100 GPUs.

See the paper for more details.

License#

We release the ModernBERT model architectures, model weights, training codebase under the Apache 2.0 license.

Citation#

If you use ModernBERT in your work, please cite:

@misc{modernbert,
      title={Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference}, 
      author={Benjamin Warner and Antoine Chaffin and Benjamin Clavié and Orion Weller and Oskar Hallström and Said Taghadouini and Alexis Gallagher and Raja Biswas and Faisal Ladhak and Tom Aarsen and Nathan Cooper and Griffin Adams and Jeremy Howard and Iacopo Poli},
      year={2024},
      eprint={2412.13663},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2412.13663}, 
}

Files

16 files · 3.13 GBWeights 599 MB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 16 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md8.43 KB40539466fa1117be4693b8f1fdfdac81fac3c5db472ff57bc05d013d48eafa82
config.json1.19 KB1609d59e627c33eaed524b4f01e546d42e84190a079a5a5ded84b212c41c324f
model.safetensors599 MB340ac08b74eef0d7bdec2d7981a6a3d4249bf0e6aab60634b72ad02c2b8023a9
onnx/model.onnx599 MB0f6e8bf251fbf4109d3ba351cefd30b5ea7477f47cd18c1196528dd19fa2b674
onnx/model_bnb4.onnx218 MB7814510559de60908d3a29ffb86967017bd580176d43859da9624f07404171a4
onnx/model_fp16.onnx300 MBd9e191270aaf3a13d1108d3443c3d22f3c9353e4f4fa4211db5c7802b788de32
onnx/model_int8.onnx151 MBfba16e64c4df66d18dcbd14988354cb062f7fc7ba3a9d58b81881c81b9e99dac
onnx/model_q4.onnx225 MB21d1de44c781aa92bfbe0a32446db9314f40a08a8b450e413b421768cf15682e
onnx/model_q4f16.onnx140 MB97c0b382317d209a0cc19bbc31639c910dcd3c0617dd76e0a5ce6752c5efc0b7
onnx/model_quantized.onnx151 MBfba16e64c4df66d18dcbd14988354cb062f7fc7ba3a9d58b81881c81b9e99dac
onnx/model_uint8.onnx151 MB755b789bfd7bc10fef02e043dbdc7456c864d0468c9b48055a5ed6f642ec13d1
pytorch_model.bin599 MB9a3b4d34f2367ab3024859dfd744bc898792ec54c577408f78d1f5e44d2cf412
special_tokens_map.json694 Bea97ecdbcc73713039d8d64dbb05e3689495c96657fbd9a18f5bed381be81049
tokenizer.json2.13 MB9fd55248d51d33976b324fc11592e28071da7d41e0e9401dfb7082e30574b7b1
tokenizer_config.json20.8 KB3cd2017ff46d0a527e5d39cae39272eccfa1f19bb9f89b05d166aab2e38354e2
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
8949b909ec pinned now2026-11-15 02:25 UTC16 files · 3.13 GB

Use it

$ fw get answerdotai/ModernBERT-base
# manifest sha256 86b4a2a44759… · 3.13 GB · 16 files
$ fw verify ./ModernBERT-base answerdotai/ModernBERT-base
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/answerdotai/ModernBERT-base.json --dir ./ModernBERT-base $ python3 fw.py verify ./ModernBERT-base ./answerdotai__ModernBERT-base.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download answerdotai/ModernBERT-base --revision 8949b909ec900327062f0ebf497f51aef5e6f0c8 --local-dir ./ModernBERT-base

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
40539466fa1117be4693b8f1fdfdac81fac3c5db472ff57bc05d013d48eafa82
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: answerdotai <huggingface.co/answerdotai>Newsgroups: alt.freeweights.visionSubject: ModernBERT-baseDate: 2026-11-15Commit: 8949b90Signed: 2DC28CC7B26A283B ✓
Upstream
answerdotai/ModernBERT-base
Pinned commit
8949b909ec900327062f0ebf497f51aef5e6f0c8
Manifest
ModernBERT-base.json · .minisig
Manifest sha256
86b4a2a447596f6d92f191bbdb96180f98dffca5de5ecdd93dbea9b73623bd54
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 02:25 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/answerdotai/ModernBERT-base.json $ curl -O https://freeweights.allternit.com/manifests/answerdotai/ModernBERT-base.json.minisig $ minisign -Vm ModernBERT-base.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

11 models in the catalog name this one as their parent.

Fine-tunes
9
Quantizations
2
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download answerdotai/ModernBERT-base
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. ModernBERT-base.json. Provenance. Takedown history: none.

Variants

2 quantized or adapter builds of ModernBERT-base. Each has its own license check and page.

From: dima806 <huggingface.co/dima806>Subject: ai_vs_real_image_detection
From: legekka <huggingface.co/legekka>Subject: AI-Anime-Image-Detector-ViT
From: onnx-community <huggingface.co/onnx-community>Subject: AI-Anime-Image-Detector-ViT-ONNX
From: AICodexLab <huggingface.co/AICodexLab>Subject: answerdotai-ModernBERT-base-ai-detector
From: onnx-community <huggingface.co/onnx-community>Subject: answerdotai-ModernBERT-base-ai-detector-ONNX
From: onnx-community <huggingface.co/onnx-community>Subject: bart-large-cnn-ONNX