You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

This model was pretrained on Dutch web text (CulturaX) that was not filtered on the text-and-data-mining reservations of site owners. By requesting access you agree to use the model in accordance with applicable law, including copyright and data-protection law.

Log in or Sign Up to review the conditions and access this model content.

dmbert-230m-culturax

A Dutch ModernBERT encoder with 230M parameters, pretrained from scratch with masked language modelling on the Dutch part of CulturaX: about 161 billion tokens, two passes over the corpus, in sequences of up to 1,024 tokens. Trained with JAX/Flax on a Cloud TPU v4-32. This is a base model: fine-tune it for classification, token classification, extractive question answering or retrieval.

Related model

dmbert-230m-fineweb2-optout has the same architecture, tokenizer and training recipe, and was pretrained on the Dutch part of FineWeb-2, after removing the documents of sites whose machine-readable reservation of text and data mining a check in November 2026 found, and after replacing more kinds of personal data by placeholders. Both models are in the evaluation and the memorization test below.

Usage

Fill-mask

from transformers import pipeline

fill = pipeline("fill-mask", model="yhavinga/dmbert-230m-culturax")
for r in fill("Amsterdam is de<mask>van Nederland.", top_k=5):
    print(r["token_str"], round(r["score"], 3))

This prints hoofdstad (0.996), stad (0.004), grootste, hoofdplaats and gemeente.

How to write <mask>. In this tokenizer a word carries its leading space (▁hoofdstad), and the text after a special token such as <mask> is tokenized as if it starts a new text, with a ▁ in front. Written without spaces around it, as above (de<mask>van), the input ids are exactly those of the pretraining, where <mask> replaced the token ▁hoofdstad of "de hoofdstad van". With spaces (de <mask> van) the ids contain an extra lone ▁ before the mask and ▁▁ + van after it, which the model did not see in pretraining: the pipeline then ranks digits first and hoofdstad 31st. When punctuation follows the mask (kopje<mask>.), the tokenizer still puts a ▁ before the punctuation; to get exactly the pretraining form, mask a token at id level:

import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer

tok = AutoTokenizer.from_pretrained("yhavinga/dmbert-230m-culturax")
model = AutoModelForMaskedLM.from_pretrained("yhavinga/dmbert-230m-culturax")
ids = tok("Ik drink elke ochtend een kopje koffie.")["input_ids"]
ids[tok.convert_ids_to_tokens(ids).index("▁koffie")] = tok.mask_token_id
with torch.no_grad():
    logits = model(input_ids=torch.tensor([ids])).logits[0, ids.index(tok.mask_token_id)]
print(tok.convert_ids_to_tokens(logits.topk(5).indices))

Fine-tuning

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

tok = AutoTokenizer.from_pretrained("yhavinga/dmbert-230m-culturax")
model = AutoModelForSequenceClassification.from_pretrained("yhavinga/dmbert-230m-culturax", num_labels=2)
batch = tok(["Een prachtig boek.", "Wat een saai verhaal, ik heb het niet uitgelezen."],
            padding=True, truncation=True, max_length=1024, return_tensors="pt")
loss = model(**batch, labels=torch.tensor([1, 0])).loss
loss.backward()

The tokenizer truncates from the left (truncation_side="left"): with truncation=True, the end of a long text is kept. Our evaluation below used this setting. Set tok.truncation_side = "right" to keep the beginning instead. Pass max_length (at most 1,024, see Limitations): the tokenizer itself sets no maximum length.

Model details

Architecture ModernBERT: pre-norm Transformer encoder, rotary position embeddings, GeGLU, no bias terms in the encoder, alternating local and global attention
Layers / hidden size / heads / intermediate size 22 / 1,024 / 16 (head size 64) / 1,536
Attention global in every third layer (layers 0, 3, …, 21), the other layers a sliding window of 128 tokens
RoPE base 160,000 (global layers), 10,000 (local layers)
Parameters 230,110,592. The output layer is tied to the input embeddings; the file stores that matrix a second time, so the Hub's parameter count shows ~263M.
Masked-LM head dense layer, GELU and LayerNorm, then the tied decoder with a bias
Pretraining sequence length 1,024 tokens. max_position_embeddings (8,192) is the architecture's limit, not a trained length.
Weights float32, safetensors

Tokenizer

yhavinga/dutch-llama-tokenizer: a SentencePiece BPE tokenizer (Llama type, LlamaTokenizerFast) with byte fallback and 32,000 tokens, extended with <mask> (id 32,000) and 127 unused tokens to 32,128 entries, the size of the embedding matrix.

token id
<unk> 0
<s> (BOS, CLS) 1
</s> (EOS, SEP) 2
<pad> 20,277
<mask> 32,000
  • A single text is encoded as <s> text (no </s>), a pair as <s> A <s> B. Our sentence-pair evaluation (SICK-NL) used this default.
  • In pretraining every document was tokenized without special tokens and cut into pieces of at most 1,024 tokens; every piece starts with <s>, and the piece with the end of the document ends with </s>.
  • Character offsets (return_offsets_mapping=True) are exact: for every token, text[start:end] is the token's text with ▁ read as a space. A word after a space therefore has a span that begins at that space (▁hoofdstad in "De hoofdstad" covers " hoofdstad"); the first word of a text, and of each sequence of a pair, begins at the word itself. Byte-fallback tokens of one character share that character's span. Strip the space when you need the span of the word alone. Checked on 12 texts (455 tokens, with punctuation, accents, emoji, runs of whitespace and a literal <mask>) and on the overlapping windows of a question–context pair (return_overflowing_tokens).

Training data

The Dutch part (config nl) of uonlp/CulturaX, revision 6a8734bc69fefcbb7735f4f9250f43e4cd7a442e: 117,392,666 documents, 80.7 billion tokens with this tokenizer. CulturaX combines mC4 (version 3.1.0) and the OSCAR corpora 20.19 to 23.01, cleaned and deduplicated by its authors (Nguyen et al., 2024) with "language identification, URL-based filtering, metric-based cleaning, document refinement, and data deduplication" (from the dataset card). The only filter of our own is the one under Benchmark data; there was no other filtering or deduplication.

Opt-outs

The data was not filtered on text-and-data-mining reservations of site owners (robots.txt rules for AI crawlers, TDMRep, ai.txt).

Personal data

The data was not filtered on personal data beyond CulturaX's own cleaning.

Benchmark data

Every document whose URL host is hebban.nl or a subdomain of it was removed before shuffling, because the book reviews of the DBRD benchmark come from that site. That removed 45,781 documents (all from www.hebban.nl, 35.6M tokens), leaving 117,346,885 documents. We did not check the other evaluation sets for overlap with the training data.

Training

Hardware Cloud TPU v4-32 (16 chips, 4 hosts), data parallel
Objective masked language modelling: 15% of the non-special tokens, of which 80% replaced by <mask>, 10% by a random token, 10% unchanged
Batch 128 sequences of 1,024 positions (131,072 per step), packed: several documents per sequence with block-diagonal attention (no attention between documents) and positions restarting at each document; ~94.6% of the positions are real tokens
Steps 1,306,000, about 161 billion tokens: two passes over the corpus, each document twice and in a different order in the second pass (the last ~760 steps begin a third pass)
Optimizer AdamW (β1 0.9, β2 0.999, ε 1e-8), weight decay 0.01 (not on norms and biases), gradient clipping at global norm 1.0
Learning rate warmup-stable-decay: linear warmup over 1,250 steps to 4.8e-4, constant, then a cooldown of the form 1 − √(fraction of the cooldown) to 1e-6 over the last 266,000 steps (from step 1,040,000) (Hägele et al., 2024)
Precision bfloat16 compute with float32 parameters, optimizer state and logits. Steps 1,010,000 to 1,020,000 were computed in float32: at step 1,012,690 bfloat16 gave non-finite gradients for 57 steps in a row, and training resumed from step 1,010,000 in float32, then continued in bfloat16
Non-finite gradients a step whose gradients were not finite left parameters and optimizer state unchanged (optax.apply_if_finite): 1,188 of the 1,306,000 steps (0.09%), all between steps 173,540 and 829,350
Sequence length 1,024 tokens; longer documents were split into pieces, not truncated
Code github.com/yhavinga/mbert-jax, branch final-run (scripts/train_minimal.py; protocol in experiments/final/protocol.md)

Estimated training compute: about 2.2·10^20 FLOP (6 × parameters × tokens), well below the indicative threshold of 10^23 FLOP in the European Commission's guidelines on general-purpose AI models.

Evaluation

All models below went through the same fine-tuning and evaluation code with the same data splits, seeds and hyperparameters; nothing was tuned per model. dmbert-230m-fineweb2-optout is the related model above. RobBERT-2023-base (124.5M parameters, revision 1164b2d) and RobBERT-2026 (a NeoBERT, 275M parameters, revision a406b1a) were run as JAX re-implementations whose masked-LM logits match their PyTorch code. Each fine-tuned number is the mean over three seeds (42, 43, 44) with the range (max − min) in brackets, in percentage points, on the test split after the last epoch (no early stopping, no checkpoint selection).

Task Metric dmbert-230m-culturax (this model) dmbert-230m-fineweb2-optout RobBERT-2023-base RobBERT-2026
DBRD, 1,024 tokens accuracy 96.12 [0.28] 95.86 [1.14] — —
DBRD, 512 tokens accuracy 96.05 [0.52] 96.02 [0.90] 94.93 [0.80] 93.15 [3.03]
SICK-NL accuracy 87.23 [0.76] 84.19 [1.64] 83.95 [0.72] 78.32 [0.95]
SQuAD-NL v1.1 F1 84.74 [0.60] 82.79 [1.33] 84.43 [0.64] 76.99 [0.91]
SQuAD-NL v1.1 exact match 72.70 [1.18] 69.85 [0.42] 73.94 [0.59] 64.92 [2.03]
CoNLL-2002 entity F1 91.86 [0.49] 90.12 [0.29] 90.47 [0.71] 85.85 [0.86]
POS, UD Dutch LassySmall UPOS accuracy 97.90 [0.26] 97.58 [0.08] 97.91 [0.09] 97.62 [0.24]
POS, UD Dutch Alpino UPOS accuracy 97.71 [0.52] 97.38 [0.16] 97.50 [0.40] 97.31 [0.43]
BLiMP-NL (zero-shot) accuracy 94.94 94.76 83.74 82.23

Bold: higher than each of the other models in its row by more than the larger seed range of the pair (BLiMP-NL: by more than 0.5 points). DBRD at 1,024 tokens only for the dmbert models: RobBERT-2023 accepts at most 512 tokens, and RobBERT-2026 was pretrained on 512.

Tasks and data.

  • DBRD (van der Burgh & Verberne, 2019): sentiment of book reviews, binary. Texts truncated from the left to 1,024 or 512 tokens (the end of a review is kept). 2,112 of the 2,224 test reviews are scored (whole evaluation batches).
  • SICK-NL (Wijnholds & Moortgat, 2021): natural language inference, three classes, as a sentence pair. 4,864 of the 4,906 test pairs are scored.
  • SQuAD-NL v1.1 (GroNLP/squad-nl-v1.1): extractive question answering, answerable questions only, 1,183 test questions; windows of 384 tokens with a stride of 128; EM and F1 with the official SQuAD v1.1 normalization. This is not DUMB's SQuAD-NL v2.0.
  • CoNLL-2002 (Tjong Kim Sang, 2002): named entity recognition on the Dutch data (persons, organizations, locations and miscellaneous names; IOB2 tags), trained on ned.train and tested on ned.testb (5,195 sentences, 3,941 entities); micro-averaged F1 over entities, where a predicted entity counts when its type and both boundaries are right; label at each word's first token.
  • POS: UPOS tagging on UD Dutch LassySmall and UD Dutch Alpino (release 2.18), accuracy over all words of the test split, label at each word's first token.
  • BLiMP-NL (Suijkerbuijk et al., 2025): 8,400 minimal pairs of 84 paradigms, scored without fine-tuning with the masked-LM head: a pair counts as right when the grammatical sentence has the higher pseudo-log-likelihood (PLL-word-l2r of Kauf & Ivanova, 2023, the metric of the BLiMP-NL paper).

Fine-tuning hyperparameters, the same for every model:

DBRD, SICK-NL SQuAD-NL, CoNLL-2002, POS
Epochs 3 3
Learning rate 5e-5, constant (no warmup, no decay) 5e-5, linear decay to 0, no warmup
Batch (examples per update) DBRD 192, SICK-NL 256 32
Optimizer AdamW, weight decay 0.01 AdamW, weight decay 0.01
Max length DBRD 1,024 or 512, SICK-NL 512 SQuAD-NL 384 (stride 128), CoNLL-2002 and POS 512
Precision float32 float32
Head (dmbert models) the pretrained head transformation (dense, GELU, LayerNorm) on <s>, then a new linear classifier the pretrained head transformation per token, then a new linear layer (start and end for SQuAD-NL)

The RobBERT models get the task heads of their own Hugging Face classes (RobBERT-2026's classes have no token head; it gets the same form as RobBERT-2023). These hyperparameters were not tuned for any model, and they are not the settings the RobBERT authors used for their own published results, so the RobBERT numbers here differ from theirs.

RobBERT-2023 needed an offset correction for SQuAD-NL

Its fast tokenizer returns word offsets that start one character late (ĠDe → "e"). Our evaluation turns off trim_offsets in its post-processor: same token ids, correct offsets. Without the correction RobBERT-2023 scores F1 68.21 / EM 14.12 on SQuAD-NL (seed 42) instead of 84.08 / 73.63. The tokenizer of the dmbert models is not affected.

Memorization test

Both dmbert models were trained on web text, so we measured whether a model gives back passages of the documents it was trained on.

Does a model reconstruct documents it was trained on better than comparable documents it never saw? The sample: 1,000 documents of FineWeb-2's Dutch test split, filtered as for dmbert-230m-fineweb2-optout and not in its training data (drawn at random among those of 64 to 1,022 tokens), and for each of them a document of the training data of dmbert-230m-fineweb2-optout with the same number of tokens (from 50,000 training documents drawn at random); 383 tokens per document on average. Each document is scored alone, in float32, with masks that depend only on the document, so both models see the same masks:

  • MLM: 15% of the tokens masked as in pretraining, three mask seeds; the loss and the accuracy on the masked tokens;
  • span: 16 consecutive tokens replaced by <mask> at a random position, three positions per document; the share of right tokens, and the share of spans whose 16 tokens are all right.

The difference training − held-out is the mean over the 1,000 matched pairs, with a 95% bootstrap interval (10,000 resamples) in brackets and a two-sided sign-flip permutation p-value (10,000 permutations).

Model Documents MLM loss MLM accuracy span accuracy spans all right
dmbert-230m-culturax (this model) training data of dmbert-230m-fineweb2-optout 0.7497 0.8153 0.1749 1 of 3,000
held-out 0.7706 0.8122 0.1787 0 of 3,000
difference −0.0208 [−0.0509, +0.0087], p 0.18 +0.0032 [−0.0029, +0.0091], p 0.31 −0.0039 [−0.0105, +0.0030], p 0.28 +0.0003 [0, +0.0010], p 1.00
dmbert-230m-fineweb2-optout its training data 0.7331 0.8198 0.1769 2 of 3,000
held-out 0.7319 0.8193 0.1831 0 of 3,000
difference +0.0012 [−0.0266, +0.0291], p 0.93 +0.0004 [−0.0054, +0.0064], p 0.88 −0.0062 [−0.0130, +0.0009], p 0.09 +0.0007 [0, +0.0017], p 0.50

For dmbert-230m-fineweb2-optout none of the four differences is distinguishable from chance: every 95% interval contains 0, and no p-value is below 0.05. This model was trained on CulturaX, not on these documents, so for it both groups are documents it did not train on: its row shows what the test gives without memorization. Some of these documents may also occur in CulturaX, since both corpora come from Common Crawl; we did not measure how many. Whether this model memorized its own training data was not tested: it was trained on all Dutch documents of CulturaX except those of www.hebban.nl, so CulturaX has no held-out documents of the same kind to compare with. The test covers 1,000 documents and these two kinds of reconstruction; it does not show that no training text can be recovered from a model.

Conclusion: for dmbert-230m-fineweb2-optout no memorization shows up at the size this test can detect (about 0.03 in MLM loss or 0.6 points in MLM accuracy); for this model the test says nothing about its own training data.

Limitations

  • Pretrained on sequences of at most 1,024 tokens. The rotary embeddings accept longer inputs, but the model has not been trained or evaluated on them.
  • Trained on web text only (CulturaX: mC4 and OSCAR, both from Common Crawl). It reflects the content, opinions and biases of the Dutch web, and the corpus can contain personal information and text whose owners reserved it from text and data mining (see "Opt-outs" and "Personal data").
  • Dutch only; other languages were not part of the training data.
  • hebban.nl was excluded to keep DBRD out of the training data. We did not check the other evaluation sets for overlap with the training data.
  • No evaluation of social bias or safety.

License

Apache 2.0, for the model weights, configuration and tokenizer files in this repository. The tokenizer yhavinga/dutch-llama-tokenizer is also Apache 2.0. The training data, CulturaX, follows the licences of mC4 (ODC-BY, with the Common Crawl terms of use) and OSCAR (CC0 for the packaging; the texts belong to their authors). The model does not generate text and does not redistribute the corpus.

Acknowledgements

Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC).

Citation

@misc{dmbert_230m_culturax,
  title  = {dmbert-230m-culturax: a Dutch ModernBERT encoder},
  author = {Yeb Havinga},
  year   = {2026},
  publisher = {Hugging Face},
  url    = {https://huggingface.co/yhavinga/dmbert-230m-culturax}
}
Downloads last month
68
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train yhavinga/dmbert-230m-culturax

Collection including yhavinga/dmbert-230m-culturax

Papers for yhavinga/dmbert-230m-culturax