Introducing NandiBERT
Open encoders for English and Indic languages: state of the art in Indic, among the best in English, in two sizes under Apache 2.0.
Encoders do the quiet work behind search, classification, tagging and retrieval-augmented generation. Until now, a team building for English and Indic languages had to choose: an English encoder that is strong in English, or an Indic encoder that is strong in Indic. NandiBERT is built so that choice goes away.
We are releasing two sizes with open weights under Apache 2.0: NandiBERT-150M (146M encoder parameters, 16,384-token context) and NandiBERT-450M (445M encoder parameters, 32,768-token context). Both share one 100,352-token vocabulary covering English, 13 Indic languages, Bahasa Indonesia, Malay and Arabic.
- Indic: NandiBERT-450M beats IndicBERT v2 on all seven Indic tasks we report (average 73.2 against 65.9). NandiBERT-150M beats it on average (67.4 against 66.6) with 46% fewer parameters.
- English: both models rank second on average among English-only encoders of their size, ahead of ModernBERT and Ettin. UltraBERT, which is English-only, leads in both size classes.
- Long documents: both models read whole documents in one pass, without chunking.
One encoder, many languages
Both sizes share the same design and tokenizer, so what you learn on one carries to the other.
| Spec | NandiBERT-150M | NandiBERT-450M |
|---|---|---|
| Architecture | Bidirectional Transformer encoder | Bidirectional Transformer encoder |
| Encoder parameters | 146M | 445M |
| Layers | 28 | 28 |
| Hidden size | 768 | 1,024 |
| Attention | Grouped-query: 6 query heads, 2 key-value heads, head dimension 128, QK-norm | Grouped-query: 8 query heads, 2 key-value heads, head dimension 128, QK-norm |
| Feed-forward | SwiGLU, intermediate size 1,280 | SwiGLU, intermediate size 3,712 |
| Embeddings | Factorized, rank 192 | Factorized, rank 512 |
| Vocabulary | 100,352 tokens | 100,352 tokens |
| Context | 16,384 tokens | 32,768 tokens |
| Positions | RoPE, base 1,000,000 | RoPE, base 1,000,000 |
| Objective | Masked language modeling, whole-word masking | Masked language modeling, whole-word masking |
| License | Apache 2.0 | Apache 2.0 |
Architecture
Both models have 28 layers. NandiBERT-150M uses a hidden size of 768, while NandiBERT-450M uses 1,024.
Each layer uses full bidirectional grouped-query attention (GQA) with Query and Keys normalized before attention (QK-norm).
Keeping the MLM head. An encoder is usually fine-tuned on its last hidden layer, with the masked-language-modeling head thrown away. We benchmarked NandiBERT both ways. Keeping the head performed better, so the results in this post use it.
Why we use factorized embeddings
NandiBERT is multilingual, so its vocabulary has to be large. It covers English, Indic languages, Bahasa Indonesia, Malay and Arabic, in many different scripts, and each script needs its own tokens so that words are not broken into fragments. The result is a 100,352-token vocabulary, and an embedding table grows with the vocabulary. Stored as a plain table, it would cost 77M parameters in the 150M model, half its budget, and 103M in the 450M model.
A full embedding table would use a substantial portion of the parameter budget. We instead use factorized embeddings, storing token embeddings in a smaller rank-192 or rank-512 representation and projecting them to the model's hidden size. Factorization is applied only to the embedding layer; the language modeling (LM) head is untied and is not factorized. This reduces the embedding parameters while leaving more room for the encoder layers.
A tokenizer that wastes few tokens
We measure tokenizer efficiency using fertility, the average number of tokens produced per word. Lower fertility means a text requires fewer tokens, allowing more text to fit within the same context window.
We compare against the tokenizer of Sarvam-105B, tokenizer only. Sarvam-105B's vocabulary has 262,144 entries, 2.6 times ours. The table covers the Indic languages in native script, plus English, Nepali, Arabic, Bahasa Indonesia and Malay. Each language is measured on 10 to 20 short sentences, so treat the numbers as indicative.
| Language | NandiBERT (100K) | Sarvam-105B (262K) | Gap |
|---|---|---|---|
| Hindi | 1.43 | 1.22 | −17% |
| Bengali | 1.65 | 1.48 | −12% |
| Tamil | 2.22 | 2.26 | +2% |
| Telugu | 2.22 | 2.37 | +6% |
| Marathi | 1.80 | 1.87 | +4% |
| Gujarati | 1.77 | 1.87 | +5% |
| Kannada | 2.10 | 2.46 | +15% |
| Malayalam | 2.42 | 2.73 | +11% |
| Punjabi | 1.67 | 1.59 | −5% |
| Odia | 1.96 | 1.83 | −7% |
| Assamese | 1.95 | 3.14 | +38% |
| Indic average (11, without Nepali) | 1.93 | 2.08 | +7% |
| English | 1.33 | 1.14 | −16% |
| Nepali | 1.85 | 2.17 | +15% |
| Arabic | 2.15 | 2.10 | −2% |
| Bahasa Indonesia | 1.42 | 1.43 | +1% |
| Malay | 1.51 | 1.64 | +8% |
Fertility is tokens per word, lower is better (bold marks the better value). Gap is the relative reduction in tokens for NandiBERT over Sarvam-105B; a negative value means NandiBERT uses more tokens.
Tokenizer fertility by language, tokens per word (lower is better).
With a vocabulary 2.6 times smaller, NandiBERT has lower fertility on 10 of these 16 languages. The gains are largest on Assamese (38% fewer tokens), Kannada and Nepali (15% each) and Malayalam (11%). Sarvam-105B's larger vocabulary is better on English, Hindi, Bengali, Punjabi, Odia and Arabic.
Training data
NandiBERT was trained on 1.1 trillion tokens covering English, the Indic languages, Bahasa Indonesia, Malay and Arabic, together with code and mathematics. We followed standard best practice for data preparation: the data was deduplicated, cleaned and filtered before training.
We also generated 100B tokens of synthetic data: 75B for Indic languages and 25B for English, covering code and mathematics.
The mixture by category:
| Category | Share | Sources (share within the category) |
|---|---|---|
| English | 50% | DCLM 40%, FineWeb-Edu 40%, FLAN 10%, Wikipedia 5%, synthetic 5% |
| Math | 10% | FineMath-4 25%, InfiMath-4 25%, MegaMath 50% |
| Code | 10% | Stack-Edu 100% |
| Multilingual | 20% | synthetic 75%, CulturaX 12.5%, romanized and transliterated data 12.5% |
| Reference | 10% | arXiv papers 25%, peS2o 50%, Cosmopedia-v2 25% |
Training
Objective. We train using masked language modeling with whole-word masking: 15% of words are selected, and all sub-word tokens belonging to a selected word are masked together. Of the selected tokens, 98% are replaced with the mask token, while 2% are left unchanged. Documents are packed into sequences, and attention is restricted to tokens from the same document, ensuring that the model never attends across document boundaries.
For instance:
English example: Given the sentence "The cat is sleeping", whole-word masking might select sleeping. If the tokenizer splits it into two sub-tokens, sleep and ##ing, the model receives "The cat is [MASK] [MASK]" and learns to predict both sub-tokens (sleep and ##ing). This ensures that all sub-tokens belonging to a selected word are masked together.
Hindi example: Given the sentence "बच्चे खेल रहे हैं" (Children are playing), whole-word masking might select बच्चे. If the tokenizer splits it into two sub-tokens, for example, बच and ##्चे, the model receives "[MASK] [MASK] खेल रहे हैं" and learns to predict both sub-tokens. This ensures that the entire word is masked rather than just part of it.
Optimization. We use AdamW with β₁ = 0.9, β₂ = 0.95, ε = 10⁻⁸ and weight decay 0.1 (not applied to embeddings and normalization weights), and clip gradients to a norm of 1.0. The learning rate follows a warmup-stable-decay schedule with a final linear decay to 10⁻⁶. Training uses bfloat16 mixed precision.
Hardware. Pre-training took 168 hours on 16 NVIDIA B300 GPUs across two nodes.
Context growth. Training at short sequences is much cheaper, so we start short and grow. Training begins at a context of 2,048 tokens, then extends to 4,096, then 16,384 and finally 32,768 tokens. The extension happens over the last 200 billion tokens of training. Both models use a RoPE base of 1,000,000 from the first step.
We provide more details in our technical report.
Two 150M models
We developed three models. First, NandiBERT-450M was trained from scratch on 1.1 Trillion tokens. We then developed two separate 150M encoder models using different approaches.
For the first 150M model, we started with Nandi-Mini-150M, an existing decoder-only model. We converted it into an encoder model by enabling bidirectional attention and then performed continual pretraining.
For the second 150M model, we started with NandiBERT-450M, pruning it from 450M to 150M parameters while retaining approximately 99% of the original model's performance. We then further trained the pruned model using NandiBERT-450M as the teacher through knowledge distillation on 500B tokens. This approach achieved slightly better overall performance than the first 150M model. We release this model as NandiBERT-150M.
We describe the pruning and distillation training recipe used to develop NandiBERT-150M in our technical report.
Results on Indic languages
Until now, IndicBERT v2 was the state of the art among Indic encoders. We compared both NandiBERT models with it on seven IndicXTREME tasks: four for classification (IndicSentiment, IndicXNLI, IndicCOPA and IndicXParaphrase), two for structure prediction (Naamapadam NER and MASSIVE slot-filling) and one for question answering (IndicQA). Classification scores are accuracy; the others are F1.
| Model | Params | Sentiment | XNLI | COPA | XParaphrase | NER | Slot-fill | QA | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| IndicBERT v2 | 272M | 91.2 | 73.7 | 64.6 | 56.9 | 73.2 | 58.1 | 48.3 | 66.57 |
| NandiBERT-150M | 146M | 91.3 | 75.9 | 66.4 | 60.6 | 77.4 | 54.0 | 46.0 | 67.37 |
| IndicBERT v2 | 272M | 88.3 | 74.3 | 63.0 | 57.0 | 72.4 | 57.3 | 49.2 | 65.93 |
| NandiBERT-450M | 445M | 92.9 | 81.3 | 76.1 | 77.8 | 72.5 | 61.0 | 51.0 | 73.23 |
Each NandiBERT result is the average of three seeds. IndicBERT v2 is compared in the same setup for each size, so its scores differ between the two blocks.
Scores on seven Indic tasks and their average. (a) NandiBERT-150M; (b) NandiBERT-450M.
NandiBERT-450M is ahead on all seven tasks and averages 73.2 against 65.9. The widest margins are on IndicXParaphrase (77.8 against 57.0) and IndicCOPA (76.1 against 63.0).
NandiBERT-150M is ahead on five of seven tasks and on average (67.4 against 66.6), with 146M parameters to IndicBERT v2's 272M. IndicBERT v2 keeps the lead on MASSIVE slot-filling and IndicQA.
Results on English
We compared each model with English encoders of similar size on ten benchmarks: five for classification and understanding (GLUE, SQuAD 2.0, MultiCoNER v2, Few-NERD and RewardBench) and five for retrieval (BEIR, RAR-b Code, RAR-b Math, MLDR and LongEmbed). Every baseline is English-only. The average is the unweighted mean of the ten tasks, and NandiBERT results are the mean over three seeds.
| Model | Params | GLUE | SQuAD 2.0 | MultiCoNER v2 | Few-NERD | RewardBench | BEIR | RAR-b Code | RAR-b Math | MLDR | LongEmbed | Avg. |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BERT-base | 110M | 84.7 | 76.3 | 53.8 | 66.6 | 59.4 | 36.7 | 6.6 | 27.5 | 29.0 | 29.3 | 46.99 |
| RoBERTa-base | 125M | 86.4 | 83.7 | 56.5 | 67.1 | 63.2 | 39.6 | 11.7 | 33.4 | 28.7 | 33.8 | 50.41 |
| MosaicBERT-base | 137M | 85.4 | 79.4 | 57.8 | 65.7 | 62.5 | 41.4 | 12.7 | 30.9 | 29.6 | 40.5 | 50.59 |
| NomicBERT-2048 | 137M | 84.0 | 82.7 | 60.1 | 66.9 | 64.1 | 42.0 | 13.8 | 30.2 | 29.9 | 45.0 | 51.87 |
| GTE-en-MLM-base | 137M | 85.6 | 82.7 | 59.2 | 66.4 | 63.4 | 42.4 | 12.0 | 33.6 | 37.1 | 58.5 | 54.09 |
| ModernBERT-base | 149M | 88.4 | 86.7 | 57.4 | 66.7 | 68.0 | 42.6 | 29.6 | 46.1 | 37.7 | 63.2 | 58.64 |
| Ettin-Encoder-150M | 149M | 88.9 | 87.4 | 57.4 | 66.5 | 70.3 | 42.4 | 31.8 | 47.1 | 35.9 | 60.1 | 58.78 |
| UltraBERT-150M | 152M | 89.5 | 89.2 | 57.9 | 67.4 | 73.0 | 45.2 | 39.1 | 55.4 | 43.5 | 72.0 | 63.22 |
| NandiBERT-150M | 146M | 87.1 | 87.6 | 56.9 | 68.1 | 71.2 | 44.5 | 32.8 | 49.4 | 41.2 | 71.1 | 60.99 |
| BERT-large | 334M | 85.2 | 81.8 | 57.7 | 67.8 | 62.6 | 38.6 | 12.2 | 33.0 | 29.8 | 30.0 | 49.87 |
| RoBERTa-large | 355M | 88.9 | 89.4 | 62.3 | 68.1 | 68.5 | 42.8 | 20.3 | 37.8 | 29.5 | 32.2 | 53.98 |
| GTE-en-MLM-large | 434M | 87.6 | 87.2 | 63.0 | 67.1 | 62.2 | 39.4 | 13.5 | 32.0 | 40.8 | 57.0 | 54.98 |
| NeoBERT | 222M | 89.0 | 86.6 | 57.4 | 66.4 | 57.6 | 42.9 | 17.3 | 33.4 | 21.7 | 32.4 | 50.47 |
| LFM2.5-Encoder-350M | 355M | 89.2 | 87.2 | 62.7 | 67.9 | 68.5 | 47.3 | 38.6 | 50.2 | 44.5 | 71.7 | 62.78 |
| Ettin-Encoder-400M | 395M | 90.8 | 90.4 | 62.3 | 67.8 | 76.7 | 45.9 | 38.5 | 54.0 | 40.9 | 64.3 | 63.16 |
| ModernBERT-large | 395M | 90.4 | 89.8 | 60.9 | 67.6 | 72.8 | 45.2 | 34.0 | 46.1 | 39.9 | 63.5 | 61.02 |
| UltraBERT-380M | 380M | 91.0 | 90.9 | 63.5 | 68.3 | 78.8 | 47.7 | 47.0 | 61.7 | 44.1 | 74.9 | 66.79 |
| NandiBERT-450M | 445M | 89.9 | 89.7 | 61.4 | 68.5 | 74.7 | 46.1 | 37.4 | 52.8 | 41.5 | 71.4 | 63.34 |
Base class (≤152M) rows come first, then the large class (222M–445M). Bold marks the best value within each size class.
Average over ten English benchmarks. (a) Base class; (b) large class. NandiBERT is the only multilingual model in these charts; all baselines are English-only.
NandiBERT-150M averages 61.0, second to UltraBERT-150M (63.2) and ahead of Ettin-Encoder-150M and ModernBERT-base. It ranks first on Few-NERD, and second on SQuAD 2.0, RewardBench and all five retrieval tasks.
NandiBERT-450M averages 63.3, second to UltraBERT-380M (66.8) and ahead of Ettin-Encoder-400M, LFM2.5-Encoder-350M and ModernBERT-large. It ranks first on Few-NERD.
Long documents. On MLDR and LongEmbed, NandiBERT-150M scores 41.2 and 71.1, and NandiBERT-450M scores 41.5 and 71.4. Both models accept whole documents in a single pass (16K and 32K tokens), so long inputs do not need to be split into chunks.
Use it
The architecture is custom, so loading it needs trust_remote_code=True. Everything else is standard Hugging Face.
import torch
from transformers import AutoModelForMaskedLM, AutoTokenizer
model_id = "FrontiersMind/NandiBERT-150M" # or FrontiersMind/NandiBERT-450M
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(
model_id, dtype=torch.bfloat16, trust_remote_code=True, device_map="cuda"
)
texts = [
f"The capital of France is {tokenizer.mask_token}.",
f"भारत की राजधानी {tokenizer.mask_token} है।",
]
for text in texts:
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
logits = model(**inputs).logits
mask_index = (inputs.input_ids == tokenizer.mask_token_id).nonzero()[0, 1]
print(tokenizer.decode(logits[0, mask_index].argmax()))
For classification, tagging or retrieval, fine-tune the encoder on your task as you would any BERT-style model. For token classification with the MLM head, a learning rate around 3×10⁻⁵ works well; much lower learning rates (for example 5×10⁻⁶) give clearly worse results.
Where NandiBERT fits
Reach for NandiBERT-150M when latency and memory matter: high-volume classification, tagging and reranking, on hardware you own. Reach for NandiBERT-450M when inputs are long or Indic accuracy matters most. Both are a strong place to start a fine-tune in any of the languages they cover, because one model serves all of them.
These are base encoders, so they need fine-tuning for most tasks, and they do not generate text. They are not sentence-embedding models yet. In English alone, an English-only specialist such as UltraBERT still leads the average in each size class.
Coming soon: EmbeddingNandi
An encoder becomes a search engine once it learns to turn a whole passage into one vector. EmbeddingNandi is that next step: sentence-embedding models fine-tuned from NandiBERT-150M and NandiBERT-450M, for semantic search, retrieval-augmented generation, clustering and deduplication, across the same languages. Planned names are EmbeddingNandi-150M for fast multilingual retrieval and EmbeddingNandi-450M for long-document retrieval.
Citation
@misc{frontiersmind2026nandibert,
title = {NandiBERT: Open Encoders for English and Indic Languages},
author = {{FrontiersMind}},
year = {2026},
howpublished = {\url{https://huggingface.co/FrontiersMind/NandiBERT-450M}}
}
NandiBERT is released under the Apache 2.0 license.





