Multilingual E5 Small
| Entity Passport | |
| Registry ID | hf-model--intfloat--multilingual-e5-small |
| License | MIT |
| Provider | huggingface |
Cite this model
Academic & Research Attribution
@misc{hf_model__intfloat__multilingual_e5_small,
author = {intfloat},
title = {Multilingual E5 Small Model},
year = {2026},
howpublished = {\url{https://huggingface.co/intfloat/multilingual-e5-small}},
note = {Accessed via Free2AITools Knowledge Fortress}
} ๐ฌTechnical Deep Dive
Full Specifications [+]โพ
Quick Commands
huggingface-cli download intfloat/multilingual-e5-small pip install -U transformers โ๏ธ Nexus Index V2.0
๐ฌ Index Insight
FNI V2.0 for Multilingual E5 Small: Semantic (S:50), Authority (A:0), Popularity (P:75), Recency (R:95), Quality (Q:65).
Verification Authority
๐ What's Next?
Technical Deep Dive
Multilingual-E5-small
Multilingual E5 Text Embeddings: A Technical Report. Liang Wang, Nan Yang, Xiaolong Huang, Linjun Yang, Rangan Majumder, Furu Wei, arXiv 2024
This model has 12 layers and the embedding size is 384.
Usage
Below is an example to encode queries and passages from the MS-MARCO passage ranking dataset.
import torch.nn.functional as F
from torch import Tensor
from transformers import AutoTokenizer, AutoModel
def average_pool(last_hidden_states: Tensor,
attention_mask: Tensor) -> Tensor:
last_hidden = last_hidden_states.masked_fill(~attention_mask[..., None].bool(), 0.0)
return last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
# Each input text should start with "query: " or "passage: ", even for non-English texts.
# For tasks other than retrieval, you can simply use the "query: " prefix.
input_texts = ['query: how much protein should a female eat',
'query: ๅ็็ๅฎถๅธธๅๆณ',
"passage: As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
"passage: 1.ๆธ
็ๅ็ไธ ๅๆ:ๅซฉๅ็ๅไธช ่ฐๆ:่ฑใ็ใ็ฝ็ณใ้ธก็ฒพ ๅๆณ: 1ใๅ็็จๅ่่็ๅๅป่กจ้ขไธๅฑ็ฎ,็จๅบๅญๅฎๅป็ค 2ใๆฆๆ็ปไธ(ๆฒกๆๆฆ่ๆฟๅฐฑ็จๅๆ
ขๆ
ขๅๆ็ปไธ) 3ใ้
็ง็ญๆพๆฒน,ๅ
ฅ่ฑ่ฑ็
ธๅบ้ฆๅณ 4ใๅ
ฅๅ็ไธๅฟซ้็ฟป็ไธๅ้ๅทฆๅณ,ๆพ็ใไธ็น็ฝ็ณๅ้ธก็ฒพ่ฐๅณๅบ้
2.้ฆ่ฑ็ๅ็ ๅๆ:ๅ็1ๅช ่ฐๆ:้ฆ่ฑใ่ๆซใๆฉๆฆๆฒนใ็ ๅๆณ: 1ใๅฐๅ็ๅป็ฎ,ๅๆ็ 2ใๆฒน้
8ๆ็ญๅ,ๅฐ่ๆซๆพๅ
ฅ็้ฆ 3ใ็้ฆๅ,ๅฐๅ็็ๆพๅ
ฅ,็ฟป็ 4ใๅจ็ฟป็็ๅๆถ,ๅฏไปฅไธๆถๅฐๅพ้
้ๅ ๆฐด,ไฝไธ่ฆๅคชๅค 5ใๆพๅ
ฅ็,็ๅ 6ใๅ็ๅทฎไธๅค่ฝฏๅ็ปตไบไนๅ,ๅฐฑๅฏไปฅๅ
ณ็ซ 7ใๆๅ
ฅ้ฆ่ฑ,ๅณๅฏๅบ้
"]
tokenizer = AutoTokenizer.from_pretrained('intfloat/multilingual-e5-small')
model = AutoModel.from_pretrained('intfloat/multilingual-e5-small')
# Tokenize the input texts
batch_dict = tokenizer(input_texts, max_length=512, padding=True, truncation=True, return_tensors='pt')
outputs = model(**batch_dict)
embeddings = average_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
# normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T) * 100
print(scores.tolist())
Supported Languages
This model is initialized from microsoft/Multilingual-MiniLM-L12-H384 and continually trained on a mixture of multilingual datasets. It supports 100 languages from xlm-roberta, but low-resource languages may see performance degradation.
Training Details
Initialization: microsoft/Multilingual-MiniLM-L12-H384
First stage: contrastive pre-training with weak supervision
| Dataset | Weak supervision | # of text pairs |
|---|---|---|
| Filtered mC4 | (title, page content) | 1B |
| CC News | (title, news content) | 400M |
| NLLB | translation pairs | 2.4B |
| Wikipedia | (hierarchical section title, passage) | 150M |
| Filtered Reddit | (comment, response) | 800M |
| S2ORC | (title, abstract) and citation pairs | 100M |
| Stackexchange | (question, answer) | 50M |
| xP3 | (input prompt, response) | 80M |
| Miscellaneous unsupervised SBERT data | - | 10M |
Second stage: supervised fine-tuning
| Dataset | Language | # of text pairs |
|---|---|---|
| MS MARCO | English | 500k |
| NQ | English | 70k |
| Trivia QA | English | 60k |
| NLI from SimCSE | English | <300k |
| ELI5 | English | 500k |
| DuReader Retrieval | Chinese | 86k |
| KILT Fever | English | 70k |
| KILT HotpotQA | English | 70k |
| SQuAD | English | 87k |
| Quora | English | 150k |
| Mr. TyDi | 11 languages | 50k |
| MIRACL | 16 languages | 40k |
For all labeled datasets, we only use its training set for fine-tuning.
For other training details, please refer to our paper at https://arxiv.org/pdf/2402.05672.
Benchmark Results on [Mr. TyDi](https://arxiv.org/abs/2108.08787)
| Model | Avg MRR@10 | ar | bn | en | fi | id | ja | ko | ru | sw | te | th | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BM25 | 33.3 | 36.7 | 41.3 | 15.1 | 28.8 | 38.2 | 21.7 | 28.1 | 32.9 | 39.6 | 42.4 | 41.7 | |
| mDPR | 16.7 | 26.0 | 25.8 | 16.2 | 11.3 | 14.6 | 18.1 | 21.9 | 18.5 | 7.3 | 10.6 | 13.5 | |
| BM25 + mDPR | 41.7 | 49.1 | 53.5 | 28.4 | 36.5 | 45.5 | 35.5 | 36.2 | 42.7 | 40.5 | 42.0 | 49.2 | |
| multilingual-e5-small | 64.4 | 71.5 | 66.3 | 54.5 | 57.7 | 63.2 | 55.4 | 54.3 | 60.8 | 65.4 | 89.1 | 70.1 | |
| multilingual-e5-base | 65.9 | 72.3 | 65.0 | 58.5 | 60.8 | 64.9 | 56.6 | 55.8 | 62.7 | 69.0 | 86.6 | 72.7 | |
| multilingual-e5-large | 70.5 | 77.5 | 73.2 | 60.8 | 66.8 | 68.5 | 62.5 | 61.6 | 65.8 | 72.7 | 90.2 | 76.2 |
MTEB Benchmark Evaluation
Check out unilm/e5 to reproduce evaluation results on the BEIR and MTEB benchmark.
Support for Sentence Transformers
Below is an example for usage with sentence_transformers.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('intfloat/multilingual-e5-small')
input_texts = [
'query: how much protein should a female eat',
'query: ๅ็็ๅฎถๅธธๅๆณ',
"passage: As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 i s 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or traini ng for a marathon. Check out the chart below to see how much protein you should be eating each day.",
"passage: 1.ๆธ
็ๅ็ไธ ๅๆ:ๅซฉๅ็ๅไธช ่ฐๆ:่ฑใ็ใ็ฝ็ณใ้ธก็ฒพ ๅๆณ: 1ใๅ็็จๅ่่็ๅๅป่กจ้ขไธๅฑ็ฎ ,็จๅบๅญๅฎๅป็ค 2ใๆฆๆ็ปไธ(ๆฒกๆๆฆ่ๆฟๅฐฑ็จๅๆ
ขๆ
ขๅๆ็ปไธ) 3ใ้
็ง็ญๆพๆฒน,ๅ
ฅ่ฑ่ฑ็
ธๅบ้ฆๅณ 4ใๅ
ฅๅ็ไธๅฟซ้็ฟป็ไธๅ้ๅทฆๅณ, ๆพ็ใไธ็น็ฝ็ณๅ้ธก็ฒพ่ฐๅณๅบ้
2.้ฆ่ฑ็ๅ็ ๅๆ:ๅ็1ๅช ่ฐๆ:้ฆ่ฑใ่ๆซใๆฉๆฆๆฒนใ็ ๅๆณ: 1ใๅฐๅ็ๅป็ฎ,ๅๆ็ 2ใๆฒน ้
8ๆ็ญๅ,ๅฐ่ๆซๆพๅ
ฅ็้ฆ 3ใ็้ฆๅ,ๅฐๅ็็ๆพๅ
ฅ,็ฟป็ 4ใๅจ็ฟป็็ๅๆถ,ๅฏไปฅไธๆถๅฐๅพ้
้ๅ ๆฐด,ไฝไธ่ฆๅคชๅค 5ใๆพๅ
ฅ็,็ๅ 6ใๅ็ๅทฎไธๅค่ฝฏๅ็ปตไบไนๅ,ๅฐฑๅฏไปฅๅ
ณ็ซ 7ใๆๅ
ฅ้ฆ่ฑ,ๅณๅฏๅบ้
"
]
embeddings = model.encode(input_texts, normalize_embeddings=True)
Package requirements
pip install sentence_transformers~=2.2.2
Contributors: michaelfeil
FAQ
1. Do I need to add the prefix "query: " and "passage: " to input texts?
Yes, this is how the model is trained, otherwise you will see a performance degradation.
Here are some rules of thumb:
Use "query: " and "passage: " correspondingly for asymmetric tasks such as passage retrieval in open QA, ad-hoc information retrieval.
Use "query: " prefix for symmetric tasks such as semantic similarity, bitext mining, paraphrase retrieval.
Use "query: " prefix if you want to use embeddings as features, such as linear probing classification, clustering.
2. Why are my reproduced results slightly different from reported in the model card?
Different versions of transformers and pytorch could cause negligible but non-zero performance differences.
3. Why does the cosine similarity scores distribute around 0.7 to 1.0?
This is a known and expected behavior as we use a low temperature 0.01 for InfoNCE contrastive loss.
For text embedding tasks like text retrieval or semantic similarity, what matters is the relative order of the scores instead of the absolute values, so this should not be an issue.
Citation
If you find our paper or models helpful, please consider cite as follows:
@article{wang2024multilingual,
title={Multilingual E5 Text Embeddings: A Technical Report},
author={Wang, Liang and Yang, Nan and Huang, Xiaolong and Yang, Linjun and Majumder, Rangan and Wei, Furu},
journal={arXiv preprint arXiv:2402.05672},
year={2024}
}
Limitations
Long texts will be truncated to at most 512 tokens.
โ ๏ธ Incomplete Data
Some information about this model is not available. Use with Caution - Verify details from the original source before relying on this data.
View Original Source โ๐ Limitations & Considerations
- โข Benchmark scores may vary based on evaluation methodology and hardware configuration.
- โข VRAM requirements are estimates; actual usage depends on quantization and batch size.
- โข FNI scores are relative rankings and may change as new models are added.
- โ License Unknown: Verify licensing terms before commercial use.
Social Proof
AI Summary: Based on Hugging Face metadata. Not a recommendation.
๐ก๏ธ Model Transparency Report
Technical metadata sourced from upstream repositories.
๐ Identity & Source
- id
- hf-model--intfloat--multilingual-e5-small
- slug
- intfloat--multilingual-e5-small
- source
- huggingface
- author
- intfloat
- license
- MIT
- tags
- sentence-transformers, pytorch, onnx, safetensors, openvino, bert, mteb, sentence transformers, sentence-similarity, multilingual, af, am, ar, as, az, be, bg, bn, br, bs, ca, cs, cy, da, de, el, en, eo, es, et, eu, fa, fi, fr, fy, ga, gd, gl, gu, ha, he, hi, hr, hu, hy, id, is, it, ja, jv, ka, kk, km, kn, ko, ku, ky, la, lo, lt, lv, mg, mk, ml, mn, mr, ms, my, ne, nl, no, om, or, pa, pl, ps, pt, ro, ru, sa, sd, si, sk, sl, so, sq, sr, su, sv, sw, ta, te, th, tl, tr, ug, uk, ur, uz, vi, xh, yi, z
โ๏ธ Technical Specs
- architecture
- null
- params billions
- null
- context length
- null
- pipeline tag
- sentence-similarity
๐ Engagement & Metrics
- downloads
- 5,770,477
- stars
- 0
- forks
- 0
Data indexed from public sources. Updated daily.