The Russian version of the modernized bidirectional encoder-only Transformer model,
ModernBERT
.
RuModernBERT was pre-trained on approximately 2 trillion tokens of Russian, English, and code data with a context length of up to 8,192 tokens, using data from the internet, books, scientific sources, and social media.
Don't forget to update
transformers
and install
flash-attn
if your GPU supports it.
from transformers import AutoTokenizer, AutoModelForMaskedLM
# Prepare model
model_id = "deepvk/RuModernBERT-small"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(model_id, attn_implementation="flash_attention_2")
model = model.eval()
# Prepare input
text = "Мама мыла [MASK]."
inputs = tokenizer(text, return_tensors="pt")
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
# Make prediction
outputs = model(**inputs)
# Show prediction
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: посуду
Training Details
This is the small version with 35 million parameters.
Tokenizer
We trained a new tokenizer following the original configuration.
We maintained the size of the vocabulary and added the same special tokens.
The tokenizer was trained on a mixture of Russian and English from FineWeb.
Dataset
Pre-training includes three main stages: massive pre-training, context extension, and cooldown.
Unlike the original model, we did not use the same data for all stages.
For the second and third stages, we used cleaner data sources.
Data Source
Stage 1
Stage 2
Stage 3
FineWeb (En+Ru)
✅
❌
❌
CulturaX-Ru-Edu (Ru)
❌
✅
❌
Wiki (En+Ru)
✅
✅
✅
ArXiv (En)
✅
✅
✅
Book (En+Ru)
✅
✅
✅
Code
✅
✅
✅
StackExchange (En+Ru)
✅
✅
✅
Social (Ru)
✅
✅
✅
Total Tokens
1.3T
250B
50B
Context length
In the first stage, the model was trained with a context length of
1,024
.
In the second and third stages, it was extended to
8,192
.
Evaluation
To evaluate the model, we measure quality on the
encodechka
and
Russian Super Glue (RSG)
benchmarks.
For RSG, we perform a grid search for optimal hyperparameters and report metrics from the
dev
split.
For a fair comparison, we compare the RuModernBERT model only with raw encoders that were not trained on retrieval or sentence embedding tasks.
@misc{deepvk2025rumodernbert,
title={RuModernBERT: Modernized BERT for Russian},
author={Spirin, Egor and Malashenko, Boris and Sokolov Andrey},
url={https://huggingface.co/deepvk/rumodernbert-base},
publisher={Hugging Face}
year={2025},
}
Runs of deepvk RuModernBERT-small on huggingface.co
4.4K
Total runs
0
24-hour runs
1.2K
3-day runs
3.5K
7-day runs
3.5K
30-day runs
More Information About RuModernBERT-small huggingface.co Model
RuModernBERT-small huggingface.co is an AI model on huggingface.co that provides RuModernBERT-small's model effect (), which can be used instantly with this deepvk RuModernBERT-small model. huggingface.co supports a free trial of the RuModernBERT-small model, and also provides paid use of the RuModernBERT-small. Support call RuModernBERT-small model through api, including Node.js, Python, http.
RuModernBERT-small huggingface.co is an online trial and call api platform, which integrates RuModernBERT-small's modeling effects, including api services, and provides a free online trial of RuModernBERT-small, you can try RuModernBERT-small online for free by clicking the link below.
deepvk RuModernBERT-small online free url in huggingface.co:
RuModernBERT-small is an open source model from GitHub that offers a free installation service, and any user can find RuModernBERT-small on GitHub to install. At the same time, huggingface.co provides the effect of RuModernBERT-small install, users can directly use RuModernBERT-small installed effect in huggingface.co for debugging and trial. It also supports api for free installation.