Instructions to use rolf-mozilla/multilingual-e5-small-enfr-pruned-q8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use rolf-mozilla/multilingual-e5-small-enfr-pruned-q8 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'rolf-mozilla/multilingual-e5-small-enfr-pruned-q8');
multilingual-e5-small β EN+FR vocabulary-pruned, q8 ONNX
Experimental artifact for Mozilla Smart Window embedding evaluation. An int8
ONNX build of intfloat/multilingual-e5-small with the token embedding
table reduced to the tokens English and French text actually uses.
Derived from Xenova/multilingual-e5-small's onnx/model_quantized.onnx β the
same file Firefox's ML engine pulls today.
What changed
Only the vocabulary. The encoder is byte-for-byte the original.
| original | this build | |
|---|---|---|
| vocab rows | 250,037 | 18,572 |
onnx/model_quantized.onnx |
118.31 MB | 29.43 MB |
tokenizer.json |
17.08 MB | 0.94 MB |
| total download | 135.39 MB | 30.37 MB |
That is a 4.46x smaller payload. The embedding table was 81.2% of the original weights; the remaining 21.88 MB encoder is untouched, and is a hard floor for this technique.
Why the retained rows are bit-identical
In the source graph the embedding is quantized per tensor (scalar
weight_scale / weight_zero_point) and read by a plain Gather on
input_ids; the only graph output is last_hidden_state, so there is no LM
head and no second vocab-sized tensor. Dropping rows therefore cannot perturb
the rows that remain. Token ids were renumbered to the new row indices by
filtering the positional Unigram model.vocab list in tokenizer.json;
<s>/<pad>/</s>/<unk> keep ids 0-3.
The only behavioural change is re-segmentation: with fewer pieces available, the SentencePiece Unigram model splits some rare words differently.
How the vocabulary was chosen
Token frequencies over ~224k EN+FR texts spanning five domains (MASSIVE intents en/fr, SciFact, SyntecRetrieval, WikiText-2, browser-history retrieval en/fr), keeping every token seen at least 50 times.
The evaluation texts below were held out of that corpus, so the accuracy numbers measure generalization rather than the keep-set fitting its own test.
Accuracy
Per-query retrieval on memory_usage_eval (500 queries, each with 11-21
candidate memories, 2-4 gold; macro-averaged; mean pooling + L2 normalization):
| EN nDCG@5 | EN MRR@10 | FR nDCG@5 | FR MRR@10 | |
|---|---|---|---|---|
| original q8 | 0.7188 | 0.8665 | 0.5599 | 0.7431 |
| this build | 0.6963 | 0.8525 | 0.5460 | 0.7298 |
| delta | -0.0225 | -0.0140 | -0.0139 | -0.0133 |
<unk> rate is 0 on both eval sets and mean sequence length grows ~0.2%, so
there is no truncation or latency cost.
A less aggressive keep-set (min count 2, 34,148 rows, 35.0 MB) costs only about -0.003 nDCG@5 but shrinks 3.4x instead of 4x. This repo is the size-favouring end of that trade.
Not for non-Latin input
This build has no rows for CJK, Cyrillic, Arabic, Devanagari or other
non-Latin scripts, and the source tokenizer has no byte fallback, so such text
degrades to <unk>. It is an EN+FR-only model by construction.
Usage
import { pipeline } from '@huggingface/transformers';
const extractor = await pipeline('feature-extraction', 'rolf-mozilla/multilingual-e5-small-enfr-pruned-q8');
const out = await extractor(['bonjour le monde'], { pooling: 'mean', normalize: true });
Mean pooling, matching the upstream model. No query/passage prefix was used in the evaluation above.
Provenance
Built by scripts/build_pruned_e5_repo.py in Mozilla's
multilingual_embeddings_eval bundle. Inherits the MIT license of
intfloat/multilingual-e5-small. Temporary evaluation artifact β expect it to be deleted.
- Downloads last month
- 47
Model tree for rolf-mozilla/multilingual-e5-small-enfr-pruned-q8
Base model
intfloat/multilingual-e5-small