Feature Extraction
Transformers
Safetensors
deberta-v2
electra
replaced-token-detection
encoder
long-context
flashdeberta
text-embeddings-inference
Instructions to use knowledgator/EdgeCoder-Multilingual-61M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use knowledgator/EdgeCoder-Multilingual-61M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="knowledgator/EdgeCoder-Multilingual-61M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, FlashDebertaV2ForWindowElectraTraining tokenizer = AutoTokenizer.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M") model = FlashDebertaV2ForWindowElectraTraining.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from knowledgator/EdgeCoder-Multilingual-61M: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/knowledgator/EdgeCoder-Multilingual-61M/resolve/main/README.md
- Command line
-
hf download hf://knowledgator/EdgeCoder-Multilingual-61M/README.md
-
curl -L -o README.md https://huggingface.co/knowledgator/EdgeCoder-Multilingual-61M/resolve/main/README.md
10.4 kB
| license: apache-2.0 | |
| language: | |
| - multilingual | |
| - en | |
| - ru | |
| - zh | |
| - es | |
| - de | |
| - fr | |
| - ja | |
| - it | |
| - pt | |
| - pl | |
| - nl | |
| - vi | |
| - id | |
| - ar | |
| - cs | |
| - tr | |
| - hu | |
| - sv | |
| - ro | |
| - uk | |
| - ko | |
| - el | |
| - "no" | |
| - da | |
| - fi | |
| - sk | |
| - bg | |
| - hi | |
| - hr | |
| - bs | |
| - lt | |
| - sl | |
| - he | |
| - bn | |
| - sr | |
| - lv | |
| - et | |
| - ms | |
| - ur | |
| - mk | |
| - la | |
| - be | |
| - mt | |
| - sw | |
| - ga | |
| - yi | |
| library_name: transformers | |
| pipeline_tag: feature-extraction | |
| tags: | |
| - deberta-v2 | |
| - electra | |
| - replaced-token-detection | |
| - encoder | |
| - multilingual | |
| - long-context | |
| - flashdeberta | |
|  | |
| # EdgeCoder-Multilingual-61M | |
| EdgeCoder-Multilingual-61M is a compact multilingual text encoder (61M parameters, 16 layers) for 46 languages, with a context of up to 8192 tokens. It is pre-trained with **ModernELECTRA**: replaced-token detection (RTD), as in ELECTRA and DeBERTaV3, plus a boundary-window reconstruction task. | |
| RTD encoders are strong on classification but usually weak as backbones for embedding models. EdgeCoder-Multilingual-61M keeps the classification quality of RTD and can also be fine-tuned into an embedding model. It is about half the size of other small multilingual encoders (118M to 141M parameters). | |
| - **Developed by:** [Knowledgator Engineering](https://knowledgator.com) | |
| - **English version:** [EdgeCoder-31M](https://huggingface.co/knowledgator/EdgeCoder-31M) | |
| - **Training and inference kernels:** [FlashDeBERTa](https://github.com/Knowledgator/FlashDeBERTa) | |
| - **Paper:** *ModernELECTRA: Replaced-Token Detection with Boundary-Window Reconstruction for Compact Encoders that Classify and Embed* <!-- TODO: add link --> | |
| ## Model details | |
| | | | | |
| |---|---| | |
| | Architecture | DeBERTa-v2 (disentangled relative attention, no absolute positions) | | |
| | Layers / hidden / FFN / heads | 16 / 384 / 1536 / 6 | | |
| | Token embedding | factorized: 128-d table with a linear projection to 384 | | |
| | Parameters | 61.0M (28.4M without the embedding table) | | |
| | Maximum sequence length | 8192 tokens | | |
| | Tokenizer | mDeBERTa-v3 SentencePiece (251,000 tokens) | | |
| | Languages | 46 | | |
| The repository contains the discriminator encoder. It has no masked-language-model head, so it is meant for fine-tuning and feature extraction, not for fill-mask. | |
| ### Languages | |
| Arabic, Belarusian, Bengali, Bosnian, Bulgarian, Chinese (Mandarin), Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Norwegian Bokmål, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Turkish, Ukrainian, Urdu, Vietnamese, Yiddish. | |
| English is the largest single language (about 47% of the pre-training tokens). The other languages are sampled with shares proportional to the square root of their available data. | |
| ## Usage | |
| The checkpoint is a standard DeBERTa-v2 model and loads with `transformers`: | |
| ```python | |
| from transformers import AutoTokenizer, AutoModel | |
| tokenizer = AutoTokenizer.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M") | |
| model = AutoModel.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M") | |
| inputs = tokenizer("EdgeCoder — компактний багатомовний енкодер.", return_tensors="pt") | |
| outputs = model(**inputs) | |
| hidden = outputs.last_hidden_state # (batch, seq_len, 384) | |
| ``` | |
| For fine-tuning, use the usual task heads, for example `AutoModelForSequenceClassification` or `AutoModelForTokenClassification`. | |
| ### Long inputs and faster inference with FlashDeBERTa | |
| The standard DeBERTa attention needs memory that grows quadratically with the sequence length. For long inputs, we recommend [FlashDeBERTa](https://github.com/Knowledgator/FlashDeBERTa), the implementation the model was trained with. It loads the same checkpoint: | |
| ```bash | |
| pip install flashdeberta -U | |
| ``` | |
| ```python | |
| import torch | |
| from transformers import AutoTokenizer | |
| from flashdeberta import FlashDebertaV2Model | |
| tokenizer = AutoTokenizer.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M") | |
| model = FlashDebertaV2Model.from_pretrained("knowledgator/EdgeCoder-Multilingual-61M").to("cuda") | |
| inputs = tokenizer(long_text, truncation=True, max_length=8192, return_tensors="pt").to("cuda") | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| ``` | |
| FlashDeBERTa also provides heads for sequence and token classification, question answering and multiple choice. | |
| ## Evaluation | |
| All numbers are from the paper. Baselines were run with the same protocols. | |
| ### GLUE (dev, English) | |
| Single seed, best run of a hyperparameter sweep that follows the Ettin protocol. | |
| | Model | Params | CoLA | SST-2 | MRPC | STS-B | QQP | MNLI | QNLI | RTE | Avg | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | mDistilBERT | 134.7M | 34.7 | 89.4 | 90.5 | 87.5 | 86.6 | 79.0 | 87.5 | 73.3 | 77.5 | | |
| | Multilingual MiniLM | 117.7M | 25.4 | 91.6 | 91.3 | 88.6 | 87.7 | 82.1 | 89.7 | 75.8 | 78.3 | | |
| | mmBERT-small | 140.5M | 61.8 | 93.1 | 91.6 | 90.3 | 88.6 | 85.8 | 91.9 | 81.9 | 84.7 | | |
| | **EdgeCoder-Multilingual-61M** | 61.0M | 58.3 | 91.4 | 92.1 | 90.2 | 91.5 | 84.8 | 91.2 | 81.6 | 85.1 | | |
| ### XTREME (zero-shot cross-lingual transfer) | |
| Models are fine-tuned on English and evaluated on the other languages. The learning rate and the checkpoint are selected on the English dev set only. Single seed. | |
| On the 26 XTREME languages that the model was pre-trained on: | |
| | Model | Params | XNLI | PAWS-X | XCOPA | XQuAD | MLQA | TyDiQA | WikiANN | UDPOS | Avg | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | mDistilBERT | 134.7M | 60.8 | 79.6 | 53.5 | 50.1 | 45.5 | 40.3 | 59.7 | 72.5 | 57.7 | | |
| | Multilingual MiniLM | 117.7M | 71.1 | 83.2 | 58.8 | 67.2 | 61.1 | 58.5 | 58.9 | 79.4 | 67.3 | | |
| | mmBERT-small | 140.5M | 73.8 | 85.4 | 62.8 | 73.0 | 66.2 | 66.8 | 59.4 | 72.4 | 70.0 | | |
| | **EdgeCoder-Multilingual-61M** | 61.0M | 71.5 | 83.5 | 59.1 | 69.4 | 62.0 | 62.0 | 57.4 | 77.9 | 67.8 | | |
| On all XTREME languages, including 16 that the model has never seen: | |
| | Model | Params | XNLI | PAWS-X | XCOPA | XQuAD | MLQA | TyDiQA | WikiANN | UDPOS | Avg | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | mDistilBERT | 134.7M | 59.3 | 79.6 | 52.7 | 47.4 | 45.5 | 39.3 | 53.9 | 68.8 | 55.8 | | |
| | Multilingual MiniLM | 117.7M | 70.9 | 83.2 | 58.3 | 66.3 | 61.1 | 58.3 | 55.2 | 77.8 | 66.4 | | |
| | mmBERT-small | 140.5M | 73.6 | 85.4 | 60.3 | 71.6 | 66.2 | 66.3 | 52.0 | 69.5 | 68.1 | | |
| | **EdgeCoder-Multilingual-61M** | 61.0M | 69.0 | 83.5 | 55.6 | 64.7 | 62.0 | 57.3 | 45.5 | 64.3 | 62.7 | | |
| ### MTEB | |
| Each backbone is fine-tuned once into a sentence embedding model on 1M English MS MARCO triplets (one epoch, mean pooling, contrastive loss) and then evaluated. The scores describe the backbone after this fine-tuning, not the checkpoint in this repository used as is. | |
| MTEB English v2 (41 tasks): | |
| | Model | Params | Class. | Clust. | PairCl. | Rerank. | Retr. | STS | Summ. | Mean (Type) | | |
| |---|---|---|---|---|---|---|---|---|---| | |
| | Multilingual MiniLM | 117.7M | 59.3 | 36.9 | 77.3 | 42.4 | 35.0 | 71.9 | 19.3 | 48.9 | | |
| | mDistilBERT | 134.7M | 59.0 | 38.3 | 75.9 | 42.7 | 38.4 | 72.4 | 19.4 | 49.4 | | |
| | mmBERT-small | 140.5M | 62.1 | 40.8 | 78.9 | 44.1 | 40.7 | 74.1 | 23.6 | 52.1 | | |
| | **EdgeCoder-Multilingual-61M** | 61.0M | 63.8 | 38.6 | 76.8 | 43.0 | 37.9 | 72.1 | 20.6 | 50.4 | | |
| MTEB Multilingual (131 tasks): | |
| | Model | Params | Bitext | PairCl. | Class. | STS | Retr. | MultiLab. | Clust. | Rerank. | Avg | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | mDistilBERT | 134.7M | 37.2 | 76.6 | 50.3 | 62.1 | 36.7 | 14.6 | 37.5 | 62.2 | 47.1 | | |
| | Multilingual MiniLM | 117.7M | 46.6 | 76.7 | 51.0 | 64.6 | 35.6 | 14.0 | 34.9 | 64.1 | 48.4 | | |
| | mmBERT-small | 140.5M | 50.5 | 77.4 | 50.4 | 64.8 | 41.9 | 15.5 | 38.7 | 66.1 | 50.7 | | |
| | **EdgeCoder-Multilingual-61M** | 61.0M | 25.0 | 71.9 | 48.3 | 58.5 | 41.3 | 15.3 | 35.4 | 54.5 | 43.8 | | |
| On MTEB Multilingual the model is competitive on retrieval and multilabel classification but behind the baselines on average. The gap comes mostly from bitext mining and reranking. Both categories include many languages outside the 46 the model covers, and bitext mining also depends on cross-lingual alignment that the English-only MS MARCO fine-tuning does not provide. | |
| ## Training | |
| - **Objective.** Replaced-token detection on every position, plus boundary-window reconstruction: each token is predicted from the two hidden states at the borders of a random window (3 to 12 tokens) that contains it. The window loss has weight 0.003. | |
| - **Generator.** A separate 8-layer generator is pre-trained with masked language modelling and then frozen. Replacements are sampled from it at a temperature that decreases from 1.5 to 0.93 during training. The masking rate is 30%. | |
| - **Data.** About 1.1 trillion tokens in 46 languages: web pages and PDF documents in all languages, plus English news, scientific papers, books, legal text, source code, mathematics and Q&A forums. | |
| - **Length curriculum.** 512 tokens for most of training, then a mix dominated by long documents of up to 8192 tokens. | |
| - **Hardware.** One node with 8 × NVIDIA H100 GPUs, bf16 mixed precision. | |
| ## Limitations | |
| - The model supports 46 languages. Languages outside this set are not supported, in particular scripts that are absent from pre-training (for example Thai, Tamil, Telugu, Malayalam, Burmese, Georgian). On token-level tasks in such languages it is far behind models pre-trained on 100 or more languages. | |
| - The model is a backbone. It needs fine-tuning for classification, token classification, retrieval or embedding tasks. | |
| - After English-only embedding fine-tuning, it is weak on bitext mining and multilingual reranking (see the MTEB Multilingual table). | |
| - Results are single runs with one seed, so differences below about one point should not be over-interpreted. | |
| - The paper does not include an ablation that isolates the effect of the window objective. | |
| ## Citation | |
| ```bibtex | |
| @misc{shtopko2026modernelectra, | |
| title = {{ModernELECTRA}: Replaced-Token Detection with Boundary-Window Reconstruction for Compact Encoders that Classify and Embed}, | |
| author = {Shtopko, Mykhailo and Stepanov, Ihor and Vodianytskyi, Dmytro and Lukashov, Oleksandr}, | |
| year = {2026}, | |
| eprint = {2611.31495}, | |
| archivePrefix = {arXiv}, | |
| primaryClass = {cs.CL}, | |
| url = {https://arxiv.org/abs/2611.31495} | |
| } | |
| ``` | |