Feature Extraction
Transformers
Safetensors
English
Russian
modernbert
encoder
model-merging
text-embeddings-inference

RuModernBertBaseTripleMerge

RuModernBertBaseTripleMerge is a post-trained Russian–English ModernBERT encoder from MTS AI. It combines three training branches initialized from RuModernBertBase.

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/RuModernBertBaseTripleMerge"
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

The branches start from RuModernBertBase.

We post-trained three branches using dialogues from ZeroAgency's Russian dataset.

  1. CLM50 averages two checkpoints equally. The first follows causal language modeling on 90M assistant-response target tokens. The second follows a return to bidirectional attention and roughly 10M tokens of MLM training on natural text.
  2. Future-CLS uses the context's [CLS] representation to help an auxiliary encoder recover a heavily masked continuation while the main encoder learns with MLM. The auxiliary encoder is discarded after training.
  3. Span injection combines MLM with detecting a span replaced by a fragment from another dialogue and locating its boundaries.

Triple-Merge averages the three branches with equal weight. The resulting checkpoint is a single bidirectional encoder with the same architecture and tokenizer as its starting checkpoint.

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

Relative to the original Base checkpoint, Triple-Merge improved mean RussianSuperGLUE accuracy by 1.11 percentage points and mean Encodechka score by 1.5 points.

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.55 ± 1.87
PARus 61.60 ± 4.84
MuSeRC 87.26 ± 0.58
TERRa 78.76 ± 0.78
RUSSE 97.07 ± 0.36
RWSD 56.18 ± 0.58
DaNetQA 73.41 ± 3.31
Mean 72.40%

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 69.9
Paraphraser 57.2
XNLI 36.9
Sentiment 77.5
Toxicity 96.7
Inappropr. 77.7
Intents 78.7
IntentsX 64.5
FactRu 52.3
RuDReC 45.2
Mean 65.7

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
36
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/RuModernBertBaseTripleMerge

Finetuned
(1)
this model

Dataset used to train MTSAIR/RuModernBertBaseTripleMerge

Papers for MTSAIR/RuModernBertBaseTripleMerge