Model reference · open weights
all_datasets_v4_MiniLM-L6 is an open-weight embedding model from flax-sentence-embeddings. all_datasets_v4_MiniLM-L6 (BF16) weighs 91 MB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the flax-sentence-embeddings/all_datasets_v4_MiniLM-L6 model card, 2026-10-01
What it is
| Released by | flax-sentence-embeddings |
|---|---|
| Released | 2022-03-02 |
| VRAM | 91 MB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
From the model card
The project aims to train sentence embedding models on very large sentence level datasets using a self-supervised contrastive learning objective. We used the pretrained 'MiniLM-L6-H384-uncased' model and fine-tuned in on a 1B sentence pairs dataset. We use a contrastive learning objective: given a sentence from the pair, the model should predict which out of a set of randomly sampled other sentences, was actually paired with it in our dataset.
We developped this model during the Community week using JAX/Flax for NLP & CV, organized by Hugging Face. We developped this model as part of the project: Train the Best Sentence Embedding Model Ever with 1B Training Pairs. We benefited from efficient hardware infrastructure to run the project: 7 TPUs v3-8, as well as intervention from Google’s Flax, JAX, and Cloud team member about efficient deep learning frameworks.
Our model is intented to be used as a sentence encoder. Given an input sentence, it ouptuts a vector which captures the sentence semantic information. The sentence vector may be used for information retrieval, clustering or sentence similarity tasks.
Here is how to use this model to get the features of a given text using SentenceTransformers library:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('flax-sentence-embeddings/all_datasets_v4_MiniLM-L6')
text = "Replace me by any text you'd like."
text_embbedding = model.encode(text)
# array([-0.01559514, 0.04046123, 0.1317083 , 0.00085931, 0.04585106,
# -0.05607086, 0.0138078 , 0.03569756, 0.01420381, 0.04266302 ...],
# dtype=float32)
We use the pretrained 'MiniLM-L6-H384-uncased' which is a 6 layer version of 'microsoft/MiniLM-L12-H384-uncased' by keeping only every second layer. Please refer to the model card for more detailed information about the pre-training procedure.
We fine-tune the model using a contrastive objective. Formally, we compute the cosine similarity from each possible sentence pairs from the batch. We then apply the cross entropy loss by comparing with true pairs.
We trained ou model on a TPU v3-8. We train the model during 540k steps using a batch size of 1024 (128 per TPU core). We use a learning rate warm up of 500. The sequence length was limited to 128 tokens. We used the AdamW optimizer with a 2e-5 learning rate. The full training script is accessible in this current repository.
We use the concatenation from multiple datasets to fine-tune our model. The total number of sentence pairs is above 1 billion sentences.
We sampled each dataset given a weighted probability which configuration is detailed in the data_config.json file.
| Dataset | Paper | Number of training tuples |
|---|---|---|
| GOOAQ: Open Question Answering with Diverse Answer Types | paper | 3,012,496 |
| Stack Exchange | - | 364,001 |
| Flickr 30k | paper | 317,695 |
| [COCO 2020](COCO 2020) | paper | 828,395 |
| Code Search | - | 1,151,414 |
| TriviaqQA | - | 73,346 |
| SQuAD2.0 | paper | 87,599 |
| Natural Questions (NQ) | paper | 100,231 |
| Simple Wikipedia | paper | 102,225 |
| Quora Question Pairs | - | 103,663 |
| Altlex | paper | 112,696 |
| Wikihow | paper | 128,542 |
| Sentence Compression | paper | 180,000 |
| AllNLI (SNLI and MultiNLI | paper SNLI, paper MultiNLI | 277,230 |
| Eli5 | paper | 325,475 |
| SPECTER | paper | 684,100 |
| S2ORC Title/Abstract | paper | 41,769,185 |
| S2ORC Citation/Citation | paper | 52,603,982 |
| S2ORC Citation/Abstract | paper | 116,288,806 |
| [PAQ](https://github.com/faceb |
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.