Introducing EmbeddingNandi
Open long-context embedding models for English, Indic and Southeast Asian languages. Two sizes: 150M with a 16K window and 450M with a 32K window, with vectors you can cut down to 128 dimensions.
An encoder becomes a search engine once it learns to turn a whole passage into one vector. EmbeddingNandi is that step for NandiBERT: sentence-embedding models for semantic search, retrieval-augmented generation, clustering, deduplication and similarity, in English, 13 Indic languages, romanized Indic text such as Hinglish, Arabic, Indonesian and Malay.
We are releasing two sizes with open weights under Apache 2.0. EmbeddingNandi-150M reads 16,384 tokens and puts out 768-dimensional vectors. EmbeddingNandi-450M reads 32,768 tokens and puts out 1,024-dimensional vectors. Both are trained with Matryoshka Representation Learning, so the same vector can be shortened to 512, 256 or 128 dimensions when storage and speed matter more than the last fraction of a point.
On the benchmarks we report, EmbeddingNandi-450M has the best average across MTEB English, Code and Indic, and leads Code and Indic outright. EmbeddingNandi-150M leads Code and Indic in its class. This post covers how they were built, how to use them, and what Matryoshka truncation costs.
Overview
One Embedding Model, Many Languages
Both models are fine-tuned from the NandiBERT bidirectional encoders, so they inherit its 100K-token multilingual vocabulary, its grouped-query attention and its long context. One model serves queries and documents across every language the encoder covers, including queries and documents in different languages or scripts.
146M and 445M parameters, open weights under Apache 2.0
16,384 tokens for 150M, 32,768 for 450M
Matryoshka sizes down to 128, from 768 or 1,024
English, 13 Indic, Arabic, Indonesian and Malay
| Spec | EmbeddingNandi-150M | EmbeddingNandi-450M |
|---|---|---|
| Base model | NandiBERT-150M | NandiBERT-450M |
| Parameters | 146M | 445M |
| Layers / hidden size | 28 / 768 | 28 / 1,024 |
| Attention | Grouped-query: 6 query heads, 2 key-value heads | Grouped-query: 8 query heads, 2 key-value heads |
| Embedding dimension | 768 (Matryoshka: 512, 256, 128) | 1,024 (Matryoshka: 768, 512, 256, 128) |
| Pooling | Mean over all tokens, task prompt included | Mean over all tokens, task prompt included |
| Similarity | Cosine on L2-normalized output | Cosine on L2-normalized output |
| Max sequence length | 16,384 tokens | 32,768 tokens |
| Vocabulary | 100,352 tokens | 100,352 tokens |
| Weights | bfloat16 | bfloat16 |
| License | Apache 2.0 | Apache 2.0 |
Source: the EmbeddingNandi-150M and EmbeddingNandi-450M model cards. Indic languages: Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Nepali, Odia, Punjabi, Tamil, Telugu and Urdu.
Training
From Encoder to Embedding Model
A masked-language-model encoder produces contextual representations for each token, but it is not inherently trained to make one vector represent an entire passage for similarity search. Contrastive training adapts it for this: matching texts are brought closer together in the embedding space, while non-matching texts are distinguished from them. We train in three stages on top of the NandiBERT checkpoint.
Weak pairs, huge batches
Weakly supervised pairs are treated as matches based on indirect signals or automatically assigned labels, rather than carefully verified labels for every pair. This makes it possible to collect data at scale, but some pairs may be noisy. We train with batches of 16,384, giving each example a large pool of in-batch negatives.
Curated pairs
We then use a more carefully selected or filtered set of text pairs. Compared with weakly supervised pairs, these examples are intended to provide more reliable matching signals and help refine what the model treats as a match. Curated does not necessarily mean every pair was manually annotated.
Labelled fine-tuning
Retrieval, code, classification, clustering, similarity and bitext data in English and Indic languages, with up to three mined hard negatives per query.
Details That Matter
- Similarity data uses CoSENT loss, which teaches the model to rank more similar text pairs above less similar ones, rather than predicting an exact similarity score for each pair.
- A Matryoshka loss is applied at every supported size: 768, 512, 256 and 128 for the 150M model, and 1,024, 768, 512, 256 and 128 for the 450M model.
- The 450M model is also trained on documents up to 32K tokens, so its long window is used in training and not only at inference.
- The released 450M weights are an equal average of two fine-tuning runs.
- The output is the mean over all tokens, task prompt included, then L2 normalization, compared with cosine similarity.
Prompts
Task Prompts Steer the Embedding
EmbeddingNandi is trained with short task prompts in the EmbeddingGemma format, added in front of the text. The prompts are saved inside the model, so you pass a prompt name and Sentence Transformers adds the text. Using the right one gives the best quality.
There are two kinds of tasks. For asymmetric tasks such as search, queries and documents get different prompts. For symmetric tasks such as classification and similarity, every text gets the same prompt.
| Use case | Type | Prompt name | Query prompt | Document prompt |
|---|---|---|---|---|
| Web / document search | Asymmetric | SearchQuery | task: search result | query: {query} | title: none | text: {content} |
| Code search | Asymmetric | CodeRetrieval | task: code retrieval | query: {query} | title: none | text: {code} |
| Text classification | Symmetric | Classification | task: classification | query: {content} | Same prompt for every text |
| Clustering | Symmetric | Clustering | task: clustering | query: {content} | Same prompt for every text |
| Sentence similarity | Symmetric | SentenceSimilarity | task: sentence similarity | query: {content} | Same prompt for every text |
encode_query uses the SearchQuery prompt and encode_document uses the Document prompt. The model also holds prompts keyed by MTEB task type, such as Retrieval-query, STS and BitextMining; model.prompts lists them all.
Matryoshka
Matryoshka Dimension Truncation
A normal embedding is all or nothing: you use every dimension, whether the task needs it or not. Matryoshka Representation Learning trains the model so that shorter prefixes of an embedding remain useful on their own. For example, a 1,024-dimensional embedding can be shortened to 512, 256 or 128 dimensions by keeping only its first values. Think of Russian nesting dolls: each smaller representation is contained within the larger one. You do not need to train a separate model for each size.
To make this work, the training loss is applied at each of these sizes at the same time. The early dimensions are pushed to carry the most general meaning, and the later dimensions add finer detail. That is why quality falls gradually as the vector is cut, as the chart below shows.
The supported sizes are the ones the model was trained with: 768, 512, 256 and 128 for EmbeddingNandi-150M, and 1,024, 768, 512, 256 and 128 for EmbeddingNandi-450M. Shorter vectors use less storage and make search faster, at some cost in quality.
What Truncation Costs
We measured EmbeddingNandi-450M at every size on a 28-task subset of the three benchmarks: 13 English, 6 Code and 9 Indic tasks.
Quality Kept at Each Matryoshka Size, EmbeddingNandi-450M
Quality Against Embedding Dimension
Share of the 1,024-dimension quality kept at each Matryoshka size. The axis starts at 96%.
| Dimension | Storage | MTEB(eng, v2) | MTEB(Code, v1) | MTEB(Indic, v1) | Average | Change vs 1024 |
|---|---|---|---|---|---|---|
| 1024 | 100% | 67.41 | 73.73 | 80.29 | 73.81 | 0.00 |
| 768 | 75% | 67.23 | 73.56 | 80.09 | 73.63 | -0.18 |
| 512 | 50% | 66.99 | 73.20 | 79.89 | 73.36 | -0.45 |
| 256 | 25% | 66.80 | 72.60 | 79.33 | 72.91 | -0.90 |
| 128 | 12.5% | 65.86 | 70.89 | 78.05 | 71.60 | -2.21 |
28-task subset (13 English, 6 Code and 9 Indic tasks), bfloat16, inputs up to 1,024 tokens, vectors re-normalized after truncation. These scores come from a subset and a shorter input length, so they are not comparable to the full benchmark numbers later in this post.
Halving the vector costs 0.45 points on average, and cutting it to a quarter costs 0.90. Even at 128 dimensions, one eighth of the storage, the model keeps 97% of its 1,024-dimension average.
What It Means for Storage
At float32, a million 1,024-dimensional vectors take about 4.1 GB. The same million at 256 dimensions take about 1.0 GB, and at 128 dimensions about 0.5 GB. For the 150M model, 768 dimensions is about 3.1 GB per million. Smaller vectors also mean faster nearest-neighbor search and less memory for the index, which is where most of the cost of a retrieval system lives.
Two Rules for Truncating
Why re-normalize? The full embedding is L2-normalized, so its length is 1. Truncation removes some values and usually changes that length. If you then compare truncated vectors with a dot product, their lengths affect the score as well as their directions. Re-normalizing the shortened vectors brings their lengths back to 1, making the dot product equivalent to cosine similarity. Cosine similarity itself already accounts for vector length, so re-normalization is not mathematically required when you use cosine similarity directly. In our checks, using dot product on truncated vectors without re-normalizing reduced scores by 0.5 to 2 points.
- Re-normalize after truncating. Normalize the shortened query and document vectors before storing them or comparing them with a dot product.
- Queries and documents must use the same size. If your document index uses 256-dimensional vectors, encode queries at 256 dimensions too. The vectors must have matching dimensions and use the same model and compatible embedding setup.
Pass truncate_dim and normalize_embeddings=True and Sentence Transformers does both for you:
query_embs = model.encode_query(queries, truncate_dim=256, normalize_embeddings=True)
doc_embs = model.encode_document(documents, truncate_dim=256, normalize_embeddings=True)
print(query_embs.shape) # (3, 256)
Or set the size once when loading the model. The vectors are then cut after the model's own normalization step, so they are no longer unit length. Pass normalize_embeddings=True when you store them or compare them with a dot product; model.similarity uses cosine, so its scores are not affected.
model_256 = SentenceTransformer(
"FrontiersMind/EmbeddingNandi-450M", trust_remote_code=True, truncate_dim=256
)
query_embs = model_256.encode_query(queries, normalize_embeddings=True)
Long Context
Whole Documents in One Embedding
A contract, a court judgment or a research paper rarely fits in 512 tokens, and cutting it into chunks loses the context that ties it together. EmbeddingNandi-150M embeds up to 16,384 tokens in one pass and EmbeddingNandi-450M embeds up to 32,768, so a full document can become a single vector.
16,384 tokens
Long documents without chunking, from a compact 146M-parameter model that is fast to serve.
32,768 tokens
Full contracts, reports and papers in one pass, with grouped-query attention keeping memory low on long inputs.
Texts longer than model.max_seq_length are truncated. Long inputs need more memory and time, so for short texts or limited memory you can lower the limit:
model.max_seq_length = 1024 # default is 16384 (150M) or 32768 (450M)
Benchmarks
Strongest on Indic and Code
We report mean task scores on three MTEB suites: MTEB(eng, v2) with 41 tasks, MTEB(Code, v1) with 12 tasks and MTEB(Indic, v1) with 20 tasks. All numbers come from the open-source MTEB library, version 2.26.19, at each model's maximum input length.
The 450M Class
We re-evaluated every model in this comparison ourselves with the same code, each with its official MTEB loader settings and documented maximum input length. EmbeddingNandi-450M was run with float32 compute, except Touche2020, which used bfloat16.
Average of Three Benchmarks, 450M Class
| Model | Params | MTEB(eng, v2) | MTEB(Code, v1) | MTEB(Indic, v1) | Average (all three) |
|---|---|---|---|---|---|
| EmbeddingNandi-450M | 445M | 67.61 | 78.42 | 76.62 | 74.22 |
| EmbeddingGemma 2 | 271M | 67.53 | 78.27 | 68.39 | 71.40 |
| Qwen3-Embedding-0.6B | 596M | 70.09 | 74.88 | 64.10 | 69.69 |
| pplx-embed-v1-0.6b | 596M | 62.01 | 75.21 | 63.83 | 67.02 |
| harrier-oss-v1-270m | 268M | 67.19 | 62.98 | 67.99 | 66.05 |
| multilingual-e5-large-instruct | 560M | 65.74 | 58.49 | 69.64 | 64.62 |
| LFM2.5-Embedding-350M | 354M | 60.33 | 44.27 | 34.94 | 46.51 |
Average is the mean of the three benchmark scores. Best score in each column is in bold. Qwen3-Embedding-0.6B, pplx-embed-v1-0.6b and multilingual-e5-large-instruct are larger models, at 596M, 596M and 560M parameters.
EmbeddingNandi-450M has the highest average, 74.22, ahead of EmbeddingGemma 2 at 71.40 and Qwen3-Embedding-0.6B at 69.69. It leads Code at 78.42 and Indic at 76.62, where it is 8.2 points ahead of EmbeddingGemma 2. In English it scores 67.61, level with EmbeddingGemma 2 at 67.53 and behind Qwen3-Embedding-0.6B at 70.09, which is a larger model.
MTEB(Indic, v1), 450M Class
MTEB(Code, v1), 450M Class
MTEB(Indic, v1) by task type
| Model | Mean (20) | Bitext Mining (2) | Classification (12) | Clustering (1) | Pair Classification (1) | Reranking (1) | Retrieval (2) | STS (1) |
|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-450M | 76.62 | 88.85 | 73.66 | 58.64 | 85.19 | 87.03 | 90.89 | 58.04 |
| EmbeddingGemma 2 | 68.39 | 62.88 | 70.46 | 31.65 | 75.14 | 85.34 | 83.84 | 36.81 |
| LFM2.5-Embedding-350M | 34.94 | 3.73 | 47.10 | 3.53 | 51.84 | 45.67 | 16.11 | -7.06 |
| Qwen3-Embedding-0.6B | 64.10 | 67.18 | 62.71 | 40.37 | 75.85 | 83.86 | 78.25 | 38.57 |
| pplx-embed-v1-0.6b | 63.83 | 68.60 | 62.91 | 26.56 | 64.34 | 86.30 | 83.54 | 40.22 |
| harrier-oss-v1-270m | 67.99 | 77.84 | 65.91 | 47.39 | 77.54 | 83.05 | 76.99 | 51.19 |
| harrier-oss-v1-0.6b | 70.64 | 80.32 | 68.59 | 51.45 | 79.50 | 82.48 | 81.23 | 53.26 |
| multilingual-e5-large-instruct | 69.64 | 80.25 | 66.62 | 51.41 | 74.54 | 85.89 | 84.51 | 51.94 |
MTEB(eng, v2) by task type
| Model | Mean (41) | Classification (8) | Clustering (8) | Pair Classification (3) | Reranking (2) | Retrieval (10) | STS (9) | Summarization (1) |
|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-450M | 67.61 | 89.44 | 53.55 | 83.48 | 47.71 | 52.29 | 81.44 | 26.20 |
| EmbeddingGemma 2 | 67.53 | 88.82 | 51.73 | 86.39 | 45.96 | 51.35 | 82.74 | 35.02 |
| LFM2.5-Embedding-350M | 60.33 | 69.94 | 40.93 | 80.44 | 45.18 | 54.42 | 76.23 | 24.41 |
| Qwen3-Embedding-0.6B | 70.09 | 85.60 | 53.96 | 85.33 | 47.33 | 59.55 | 86.45 | 32.89 |
| pplx-embed-v1-0.6b | 62.01 | 69.22 | 36.06 | 82.80 | 46.93 | 59.96 | 80.71 | 32.00 |
| harrier-oss-v1-270m | 67.19 | 85.74 | 53.58 | 80.89 | 45.61 | 53.21 | 82.91 | 28.21 |
| multilingual-e5-large-instruct | 65.74 | 75.28 | 51.65 | 86.20 | 46.53 | 53.65 | 84.56 | 30.59 |
MTEB(Code, v1) by task
| Model | Mean (12) | Apps | CodeEdit Search | CodeFeedback MT | CodeFeedback ST | CSN-CC | CodeSearchNet | TransOcean Contest | TransOcean DL | CosQA | COIR CSN | StackOverflow QA | Text2SQL |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-450M | 78.42 | 80.97 | 80.89 | 94.98 | 88.72 | 92.15 | 89.42 | 85.87 | 36.36 | 43.11 | 85.84 | 92.98 | 69.76 |
| EmbeddingGemma 2 | 78.27 | 89.27 | 80.50 | 88.23 | 82.15 | 96.64 | 90.78 | 83.67 | 36.36 | 51.40 | 86.89 | 87.38 | 65.96 |
| LFM2.5-Embedding-350M | 44.27 | 6.79 | 46.43 | 31.87 | 69.53 | 35.26 | 72.48 | 56.90 | 22.33 | 29.14 | 37.94 | 81.60 | 40.95 |
| Qwen3-Embedding-0.6B | 74.88 | 75.94 | 63.37 | 90.42 | 86.50 | 85.07 | 89.95 | 86.21 | 33.23 | 40.65 | 84.19 | 89.23 | 73.85 |
| pplx-embed-v1-0.6b | 75.21 | 79.03 | 76.36 | 85.58 | 84.70 | 88.08 | 89.80 | 86.35 | 36.83 | 43.60 | 82.38 | 90.69 | 59.12 |
| harrier-oss-v1-270m | 62.98 | 17.80 | 53.35 | 89.13 | 81.77 | 49.54 | 82.75 | 81.05 | 36.10 | 34.92 | 75.42 | 89.08 | 64.79 |
| multilingual-e5-large-instruct | 58.49 | 29.31 | 54.81 | 40.65 | 75.73 | 57.86 | 85.29 | 74.73 | 31.09 | 36.36 | 62.33 | 91.11 | 62.56 |
The 150M Class
EmbeddingNandi-150M was evaluated at its maximum input length of 16,384 tokens with float32 compute. Scores for the other models are published MTEB results, except the MTEB(Indic, v1) scores of granite-embedding-125m-english, which we ran ourselves with the same MTEB version at 512 tokens in float32.
Average of Three Benchmarks, 150M Class
Average Against Parameters
Average of the three benchmarks against model parameters, for models with all three scores. Orange points are EmbeddingNandi.
| Model | Params | MTEB(eng, v2) | MTEB(Code, v1) | MTEB(Indic, v1) | Average (all three) |
|---|---|---|---|---|---|
| EmbeddingNandi-150M | 146M | 65.85 | 75.80 | 74.33 | 71.99 |
| UltraBERT-Embed-150M | 151M | 67.24 | 73.30 | 42.16 | 60.90 |
| granite-embedding-english-r2 | 149M | 62.84 | 57.22 | 32.85 | 50.97 |
| granite-embedding-125m-english | 125M | 62.10 | 53.30 | 34.46 | 49.95 |
| bekko-embedding-v1-a25m | 123M | 62.25 | 60.27 | 65.43 | 62.65 |
| multilingual-e5-small | 118M | 59.69 | 53.53 | 62.15 | 58.46 |
| harrier-oss-v1-270m | 268M | 67.19 | 62.98 | 69.81 | 66.66 |
EmbeddingNandi-150M leads Code at 75.80 and Indic at 74.33, and its average of 71.99 is the highest of any model that has all three scores, ahead of harrier-oss-v1-270m at 66.66, which has nearly twice the parameters. In English it scores 65.85, behind UltraBERT-Embed-150M at 67.24 and harrier-oss-v1-270m at 67.19, and ahead of the granite, bekko and multilingual-e5-small models.
MTEB(Code, v1), 150M Class
MTEB(Indic, v1) by task type
| Model | Mean (20) | Bitext Mining (2) | Classification (12) | Clustering (1) | Pair Classification (1) | Reranking (1) | Retrieval (2) | STS (1) |
|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-150M | 74.33 | 84.36 | 72.19 | 54.32 | 82.57 | 86.07 | 87.40 | 53.95 |
| granite-embedding-125m-english | 34.46 | 5.54 | 44.68 | 3.04 | 51.75 | 49.23 | 17.94 | 2.07 |
| bekko-embedding-v1-a25m | 65.43 | 75.25 | 64.45 | 27.83 | 69.64 | 83.66 | 76.96 | 49.63 |
| multilingual-e5-small | 62.15 | 73.38 | 67.00 | 26.39 | 73.32 | 72.20 | 76.82 | 45.93 |
| harrier-oss-v1-270m | 69.81 | 81.54 | 70.84 | 52.51 | 80.12 | 61.90 | 66.38 | 75.35 |
MTEB(eng, v2) by task type
| Model | Mean (41) | Classification (8) | Clustering (8) | Pair Classification (3) | Reranking (2) | Retrieval (10) | STS (9) | Summarization (1) |
|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-150M | 65.85 | 87.78 | 50.54 | 82.43 | 46.52 | 49.75 | 81.15 | 24.95 |
| UltraBERT-Embed-150M | 67.24 | 81.74 | 49.70 | 85.33 | 47.50 | 57.20 | 83.03 | 34.89 |
| granite-embedding-english-r2 | 62.84 | 70.71 | 47.20 | 79.34 | 49.10 | 56.43 | 78.12 | 29.31 |
| granite-embedding-125m-english | 62.10 | 68.30 | 47.30 | 79.60 | 49.40 | 55.70 | 77.60 | 29.30 |
| bekko-embedding-v1-a25m | 62.25 | 74.70 | 44.64 | 83.57 | 45.60 | 49.74 | 80.68 | 32.34 |
| multilingual-e5-small | 59.69 | 70.69 | 41.36 | 84.09 | 43.19 | 46.43 | 79.84 | 29.22 |
| harrier-oss-v1-270m | 67.19 | 85.74 | 53.58 | 80.89 | 45.61 | 53.21 | 82.91 | 28.21 |
MTEB(Code, v1) by task
| Model | Mean (12) | Apps | CodeEdit Search | CodeFeedback MT | CodeFeedback ST | CSN-CC | CodeSearchNet | TransOcean Contest | TransOcean DL | CosQA | COIR CSN | StackOverflow QA | Text2SQL |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| EmbeddingNandi-150M | 75.80 | 70.65 | 77.57 | 93.84 | 87.51 | 88.40 | 88.54 | 83.10 | 35.69 | 40.13 | 84.44 | 91.51 | 68.20 |
| UltraBERT-Embed-150M | 73.30 | 68.50 | 62.21 | 84.37 | 86.40 | 93.73 | 90.03 | 88.08 | 37.23 | 36.29 | 82.23 | 92.43 | 58.05 |
| granite-embedding-english-r2 | 57.22 | 13.96 | 59.35 | 52.54 | 77.18 | 47.67 | 80.79 | 77.07 | 35.03 | 37.01 | 64.65 | 91.80 | 49.55 |
| granite-embedding-125m-english | 53.30 | 11.80 | 58.80 | 42.10 | 75.30 | 47.60 | 76.90 | 66.70 | 29.60 | 36.60 | 55.10 | 89.80 | 48.70 |
| harrier-oss-v1-270m | 62.98 | 17.80 | 53.35 | 89.13 | 81.77 | 49.54 | 82.75 | 81.05 | 36.10 | 34.92 | 75.42 | 89.08 | 64.79 |
Run
Run It Yourself
The architecture is custom, so loading needs trust_remote_code=True. Install Sentence Transformers 6.1.0 or newer with Transformers 5.20.2 or newer (the versions we tested):
pip install -U "sentence-transformers>=6.1.0" "transformers>=5.20.2"
For search, encode_query and encode_document add the right prompts for you. Queries and documents can be in English, an Indic script or romanized text, in any mix.
from sentence_transformers import SentenceTransformer
# use "FrontiersMind/EmbeddingNandi-150M" for the 150M model
model = SentenceTransformer("FrontiersMind/EmbeddingNandi-450M", trust_remote_code=True)
queries = [
"What causes the northern lights?",
"फ्रांस की राजधानी क्या है?",
"phone ki battery jaldi khatam kyun hoti hai",
]
documents = [
"The northern lights are caused by charged particles from the sun hitting the Earth's atmosphere.",
"पेरिस फ्रांस की राजधानी और सबसे बड़ा शहर है।",
"Phone batteries drain quickly when many apps run in the background and the screen is very bright.",
"The Amazon is the largest rainforest in the world.",
]
query_embs = model.encode_query(queries)
doc_embs = model.encode_document(documents)
print(query_embs.shape, doc_embs.shape) # (3, 1024) (4, 1024)
print(model.similarity(query_embs, doc_embs))
This is the similarity matrix EmbeddingNandi-450M produces for those inputs. Each query finds its own answer, whether the query is English, Hindi or Hinglish.
| Query | Northern lights (English) | पेरिस फ्रांस की राजधानी… (Hindi) | Phone batteries drain… (English) | The Amazon rainforest (English) |
|---|---|---|---|---|
| What causes the northern lights? | 0.756 | 0.096 | 0.174 | 0.184 |
| फ्रांस की राजधानी क्या है? | 0.136 | 0.808 | 0.036 | 0.229 |
| phone ki battery jaldi khatam kyun hoti hai | 0.187 | 0.074 | 0.600 | 0.001 |
Code Search and Similarity
For code search, encode the queries with CodeRetrieval and the code with Document:
code_queries = ["reverse a string in python"]
code_docs = ["def reverse(s):\n return s[::-1]", "def add(a, b):\n return a + b"]
q = model.encode(code_queries, prompt_name="CodeRetrieval")
d = model.encode(code_docs, prompt_name="Document")
print(model.similarity(q, d))
For a symmetric task, use the same prompt for every text. Here the Hinglish sentence lands next to its English meaning (0.75 on the 450M model) and far from the unrelated one (0.03):
texts = ["This phone is really good", "Yeh phone bahut accha hai", "My order was delivered late"]
embs = model.encode(texts, prompt_name="SentenceSimilarity")
print(model.similarity(embs, embs))
Numerical Precision
Run inference in bfloat16 or float32; the weights are stored in bfloat16. Use float32 on CPU, where it runs faster, and for long inputs: 4K tokens or more for the 150M model, 16K tokens or more for the 450M model. On GPU, bfloat16 uses much less memory.
import torch
dtype = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float32
model = SentenceTransformer(
"FrontiersMind/EmbeddingNandi-450M",
trust_remote_code=True,
model_kwargs={"dtype": dtype},
)
Use it with plain Transformers
import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer
model_id = "FrontiersMind/EmbeddingNandi-450M"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(model_id, trust_remote_code=True).to(device).eval()
QUERY_PROMPT = "task: search result | query: "
DOCUMENT_PROMPT = "title: none | text: "
def embed(texts, prompt, max_length=32768, dim=None):
inputs = tokenizer([prompt + t for t in texts], padding=True, truncation=True,
max_length=max_length, return_tensors="pt").to(device)
with torch.no_grad():
hidden = model(**inputs).last_hidden_state
# mean pooling over all tokens, prompt tokens included
mask = inputs["attention_mask"].unsqueeze(-1).to(hidden.dtype)
emb = (hidden * mask).sum(dim=1) / mask.sum(dim=1).clamp(min=1e-9)
if dim is not None: # Matryoshka: keep the first `dim` values
emb = emb[:, :dim]
return F.normalize(emb.float(), dim=-1)
scores = embed(queries, QUERY_PROMPT) @ embed(documents, DOCUMENT_PROMPT).TThis gives the same embeddings as Sentence Transformers, up to tiny bfloat16 rounding differences.
Family
The EmbeddingNandi Family
Both models are on Hugging Face with open weights.
EmbeddingNandi-150M
146M parameters, 768 dimensions and a 16K window, for fast multilingual retrieval and low-cost serving.
EmbeddingNandi-450M
445M parameters, 1,024 dimensions and a 32K window, for long documents and the strongest Indic and Code results.
Fit
Where EmbeddingNandi Fits
Reach for EmbeddingNandi-150M when latency, memory and serving cost matter: high-volume search, deduplication and clustering on hardware you own. Reach for EmbeddingNandi-450M when documents are long or Indic and code retrieval quality matter most. Either way, pick a Matryoshka size to fit your index: start at full size, then step down until quality starts to slip on your own data.
Use the task prompts, because the models are trained with them. And only the sizes listed above are supported for truncation, so pick one of them.
The Takeaway
EmbeddingNandi is one embedding model for English, Indic, Bahasa Indonesia, Malay and Arabic. It leads on Indic and Code, embeds whole documents up to 32K tokens, and gives you one vector you can shrink to 128 dimensions with a small, measured cost. The weights are open for you to run on your own infrastructure. That is where Sovereign Superintelligence starts.