Small encoders that classify and embed
Most production NLP still runs on encoders. They do classification, entity recognition and re-ranking, they are the backbones of embedding models, and they sit inside our own GLiNER and GLiClass. The encoder is called on every document and every query, so its size and speed matter more than its place on a leaderboard.
The strongest small encoders for classification are trained with replaced-token detection (RTD), the objective of ELECTRA and DeBERTaV3. The same models are known to be poor backbones for embeddings: after the same retrieval fine-tuning, DeBERTaV3-base reaches about half the BEIR score of BERT-base. So in practice you choose: an RTD model for classification, or a masked-language model for embeddings. We wanted one compact model for both. ModernELECTRA is the pre-training recipe we built for that, and EdgeCoder-31M and EdgeCoder-Multilingual-61M are the first two models trained with it.
Why RTD fails at embeddings
In RTD, a small generator replaces some tokens, and the model decides for every token whether it is original or replaced. That is one bit per token. It is an efficient training signal and it teaches the model to tell apart even semantically close tokens, which is why RTD models are strong classifiers.
But nothing in this objective asks the final layer to remember which token stands at a position or what is around it. The model can drop everything it does not need to spot an implausible replacement. A sentence embedding is an average of those final states, so it is built from exactly the information RTD lets the model throw away.
How it works

We keep RTD as the main objective and add one small auxiliary task, boundary-window reconstruction. For every token we sample a window of 3 to 12 tokens around it and predict the original token from only two hidden states: the ones at the left and right borders of the window. The token's own state is not used.
Every token is a target, and every token is also a border for its neighbours. A final-layer state can only do this job if it carries the identities of the tokens up to ten positions to its left and right. That is the content a pooled embedding needs.
The task adds one small feed-forward block during training and nothing at inference. Its weight in the loss is 0.003, so RTD stays the dominant signal. The weight is a real trade-off: more of the window task improves MTEB and lowers GLUE, less does the opposite.
Two models
EdgeCoder-31M. English, 8 layers, 31M parameters, of which 14M are outside the embedding table.
EdgeCoder-Multilingual-61M. 46 languages, 16 layers, 61M parameters. It covers all official EU languages, twelve Slavic languages and the largest global markets.
Both are DeBERTa-v3-style encoders with a context of up to 8192 tokens. They load with transformers as ordinary DeBERTa-v2 checkpoints.
Results

Classification. EdgeCoder-31M reaches 86.0 on GLUE. Models of the same size score 83.5 (Ettin-Enc-32m) and 84.6 (MiniLM-L12), and BERT-base, with 3.5 times more parameters, scores 84.7. The multilingual model reaches 85.1, ahead of mmBERT-small (84.7), which is 2.3 times larger.
Embeddings. We fine-tune each backbone once on MS MARCO and evaluate on MTEB English v2. EdgeCoder-31M scores 51.1. The masked-language models of its size score between 50.9 and 51.3. The collapse that RTD models usually show here does not happen.

Cross-lingual transfer. On the XTREME languages it was trained on, the multilingual model averages 67.8, ahead of Multilingual MiniLM (67.3) and behind mmBERT-small (70.0), with about half their parameters.
Where it is weaker. On MTEB Multilingual the model is behind the baselines on average (43.8 against 47.1 to 50.7), mostly on bitext mining and reranking. It is competitive on retrieval. Languages outside its 46 are not supported, and we did not run a controlled ablation without the window task: at a trillion tokens per run that was outside our budget.
FlashDeBERTa

DeBERTa's attention adds two position terms to the usual scores, so standard fused attention kernels cannot be used, and the reference implementation stores several n×n matrices per head. At 8192 tokens that does not fit in memory.
FlashDeBERTa is our open-source implementation of this attention as fused GPU kernels that never store an n×n matrix. On DeBERTa-v3-base at 4096 tokens it is 10 times faster and uses 93% less memory than the reference implementation; at 8192 tokens the reference runs out of memory on the same GPU. It loads existing DeBERTa-v2 and v3 checkpoints without changes, and it is what made long-context pre-training of these models practical.
Training
Each model saw about one trillion tokens. The generator is trained first and then frozen, and replacements are sampled from it at a temperature that falls from 1.5 to about 0.9, so the task gets harder as training goes on. Most of the training runs at 512 tokens, followed by a shorter phase on long documents of up to 8192 tokens. The English corpus mixes web text, news, scientific papers, PDFs, books, legal text, code and mathematics; the multilingual corpus adds web pages and PDFs in 45 more languages.
Try it
The models are on Hugging Face: knowledgator/EdgeCoder-31M and knowledgator/EdgeCoder-Multilingual-61M. For long inputs, install FlashDeBERTa with pip install flashdeberta.
FlashDeBERTa on GitHub: https://github.com/Knowledgator/FlashDeBERTa
Read more in our paper: https://arxiv.org/abs/2611.31495