RuModernBertBase

RuModernBertBase is a Russian–English ModernBERT encoder from MTS AI. It was adapted from multilingual mmBERT-base with a new tokenizer and continued masked language modeling.

Intended use

Use the encoder as a backbone for supervised text classification, token classification, or ranking. It also exposes contextual token representations for frozen-feature experiments and as a starting point for training a retrieval model. The release contains encoder weights. Applications that require label predictions or masked-token prediction need a corresponding trained head.

Model details

Property Value
Architecture ModernBertModel
Encoder parameters 149,014,272
Transformer layers 22
Hidden size 768
Intermediate size 1,152
Attention heads 12
Vocabulary size 50,368 tokens
Configured maximum sequence length 8,192 tokens
Weight format FP32 Safetensors

Quick start

Install PyTorch and Transformers. The checkpoint configuration was exported with Transformers 5.24.1.

import torch
from transformers import AutoModel, AutoTokenizer

model_id = "MTSAIR/RuModernBertBase"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id).eval()

texts = ["Как изменить тариф?", "Как перейти на другой тарифный план?"]
inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")

with torch.inference_mode():
    token_embeddings = model(**inputs).last_hidden_state

# Mean pooling over non-padding tokens as a simple starting point.
mask = inputs["attention_mask"].unsqueeze(-1).to(token_embeddings.dtype)
text_embeddings = (token_embeddings * mask).sum(dim=1) / mask.sum(dim=1).clamp_min(1)

Training

We initialized Base from jhu-clsp/mmBERT-base and replaced its vocabulary with a 50,368-token BPE vocabulary. We copied embeddings for matching tokens, summed the embeddings of the original subwords for new tokens, and mapped special tokens by role. The Transformer layers and normalization weights were carried over.

We continued MLM pretraining for approximately 88B tokens on Russian and English web text and code. The first stage processed roughly 76B tokens with a peak learning rate of 5e-4. The second processed roughly 12B tokens with stricter text filtering and a learning rate of 1e-4. Both stages used 15% masking and sequences of up to 1,024 tokens. The final-stage document mix was 73.2% Russian FineWeb-2, 24.4% English FineWeb, and 2.4% GitHub Code Clean.

Evaluation

MTS AI checkpoint RussianSuperGLUE accuracy Encodechka score
RuModernBertSmall 66.61% 60.8
RuModernBertSmallTripleMerge 67.07% 60.4
RuModernBertBase 71.29% 64.2
RuModernBertBaseTripleMerge 72.40% 65.7

The Base Triple-Merge variant improved mean RussianSuperGLUE accuracy by 1.11 percentage points and mean Encodechka score by 1.5 points in this evaluation.

RussianSuperGLUE

We fine-tuned the encoder and a task-specific head on each of seven RussianSuperGLUE tasks. We selected hyperparameters from 27 combinations using five seeds per combination, then ran the selected configuration on ten fresh seeds. The table shows validation accuracy in percent, with standard deviation across those ten seeds. The aggregate weights all seven tasks equally.

Task Validation accuracy (%)
RCB 52.32 ± 1.61
PARus 58.50 ± 1.84
MuSeRC 87.49 ± 0.72
TERRa 76.87 ± 1.21
RUSSE 96.66 ± 0.13
RWSD 57.21 ± 2.04
DaNetQA 70.00 ± 2.62
Mean 71.29%

Encodechka

For Encodechka, we froze the encoder and evaluated its representations directly or with a lightweight classifier, depending on the task. Scores use each task's own metric, scaled by 100. The aggregate weights all ten tasks equally.

Task Score (0–100 scale)
STS-B 68.9
Paraphraser 56.7
XNLI 34.7
Sentiment 76.1
Toxicity 96.6
Inappropr. 76.9
Intents 77.7
IntentsX 61.2
FactRu 46.3
RuDReC 46.9
Mean 64.2

Limitations

  • We report evaluation results on Russian benchmarks. Training also included English data.
  • The MTS AI adaptation stages used sequences of up to 1,024 tokens. The model and tokenizer configuration allow up to 8,192 tokens. Quality at the configured maximum sequence length remains to be evaluated.
  • For retrieval, validate pooling and ranking quality on your own data. The mean pooling example demonstrates feature extraction.
  • A data audit found three English STS-B validation pairs, with similarity labels, in the post-training corpus. Encodechka contains their Russian translations. The table reports the full 10-task aggregate. Excluding STS-B, the Base variant's Triple-Merge gain remained 1.5 points across the other nine tasks.

References

Downloads last month
-
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MTSAIR/RuModernBertBase

Finetuned
(223)
this model
Finetunes
1 model

Papers for MTSAIR/RuModernBertBase