AI SeedbankHelp preserve open and free AI for humanity's future

← All models

sentence-transformers_all-MiniLM-L6-v2

sentence-transformers · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


base_model:

  • nreimers/MiniLM-L6-H384-uncased language: en license: apache-2.0 library_name: sentence-transformers tags:
  • sentence-transformers
  • feature-extraction
  • sentence-similarity
  • transformers datasets:
  • s2orc
  • flax-sentence-embeddings/stackexchange_xml
  • ms_marco
  • gooaq
  • yahoo_answers_topics
  • code_search_net
  • search_qa
  • eli5
  • snli
  • multi_nli
  • wikihow
  • natural_questions
  • trivia_qa
  • embedding-data/sentence-compression
  • embedding-data/flickr30k-captions
  • embedding-data/altlex
  • embedding-data/simple-wiki
  • embedding-data/QQP
  • embedding-data/SPECTER
  • embedding-data/PAQ_pairs
  • embedding-data/WikiAnswers pipeline_tag: sentence-similarity

all-MiniLM-L6-v2

This is a sentence-transformers model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search.

Usage (Sentence-Transformers)

Using this model becomes easy when you have sentence-transformers installed:

pip install -U sentence-transformers

Then you can use the model like this:

from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
embeddings = model.encode(sentences)
print(embeddings)

Usage (HuggingFace Transformers)

Without sentence-transformers, you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.

from transformers import AutoTokenizer, AutoModel
import torch
import torch.nn.functional as F

#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0] #First element of model_output contains all token embeddings
    input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)


# Sentences we want sentence embeddings for
sentences = ['This is an example sentence', 'Each sentence is converted']

# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained('sentence-transformers/all-MiniLM-L6-v2')
model = AutoModel.from_pretrained('sentence-transformers/all-MiniLM-L6-v2')

# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')

# Compute token embeddings
with torch.no_grad():
    model_output = model(**encoded_input)

# Perform pooling
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])

# Normalize embeddings
sentence_embeddings = F.normalize(sentence_embeddings, p=2, dim=1)

print("Sentence embeddings:")
print(sentence_embeddings)

Background

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 nreimers/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 developed this model during the Community week using JAX/Flax for NLP & CV, organized by Hugging Face. We developed 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 Googles Flax, JAX, and Cloud team member about efficient deep learning frameworks.

Intended uses

Our model is intended to be used as a sentence and short paragraph encoder. Given an input text, it outputs a vector which captures the semantic information. The sentence vector may be used for information retrieval, clustering or sentence similarity tasks.

By default, input text longer than 256 word pieces is truncated.

Training procedure

Pre-training

We use the pretrained nreimers/MiniLM-L6-H384-uncased model. Please refer to the model card for more detailed information about the pre-training procedure.

Fine-tuning

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.

Hyper parameters

We trained our model on a TPU v3-8. We train the model during 100k 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: train_script.py.

Training data

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
Reddit comments (2015-2018) paper 726,484,430
S2ORC Citation pairs (Abstracts) paper 116,288,806
WikiAnswers Duplicate question pairs paper 77,427,422
PAQ (Question, Answer) pairs paper 64,371,441
S2ORC Citation pairs (Titles) paper 52,603,982
S2ORC (Title, Abstract) paper 41,769,185
Stack Exchange (Title, Body) pairs - 25,316,456
Stack Exchange (Title+Body, Answer) pairs - 21,396,559
Stack Exchange (Title, Answer) pairs - 21,396,559
MS MARCO triplets paper 9,144,553
GOOAQ: Open Question Answering with Diverse Answer Types paper 3,012,496
Yahoo Answers (Title, Answer) paper 1,198,260
Code Search - 1,151,414
COCO Image captions paper 828,395
SPECTER citation triplets paper 684,100
Yahoo Answers (Question, Answer) paper 681,164
Yahoo Answers (Title, Question) paper 659,896
SearchQA paper 582,261
Eli5 paper 325,475
Flickr 30k paper 317,695
Stack Exchange Duplicate questions (titles) 304,525
AllNLI (SNLI and MultiNLI paper SNLI, paper MultiNLI 277,230
Stack Exchange Duplicate questions (bodies) 250,519
Stack Exchange Duplicate questions (titles+bodies) 250,460
Sentence Compression paper 180,000
Wikihow paper 128,542
Altlex paper 112,696
Quora Question Triplets - 103,663
Simple Wikipedia paper 102,225
Natural Questions (NQ) paper 100,231
SQuAD2.0 paper 87,599
TriviaQA - 73,346
Total 1,170,060,424

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:2e0726058182c1252426296311b39f4419336da9&dn=sentence-transformers_all-MiniLM-L6-v2

Open magnet in torrent client · infohash 2e0726058182c1252426296311b39f4419336da9

Files & hashes

PathSizesha1sha256
1_Pooling/config.json190 B (190 B)d1514c3162bbe87b343f565fadc62e6c06f04f034be450dde3b0273bb9787637cfbd28fe04a7ba6ab9d36ac48e92b11e350ffc23
README.md10.3 KB (10,502 B)44af2e3b0fa3a0b6239e48422972bf755f28fde0dcd602d2fd35c203a247304a06fec6654a12f7941b739f9221a064fe8dc3b7f0
config.json612 B (612 B)72b987fd805cfa2b58c4c8c952b274a11bfd5a00953f9c0d463486b10a6871cc2fd59f223b2c70184f49815e7efbcab5d8908b41
config_sentence_transformers.json116 B (116 B)fd1b291129c607e5d49799f87cb219b27f98acdf061ca9d39661d6c6d6de5ba27f79a1cd5770ea247f8d46412a68a498dc5ac9f3
data_config.json38.3 KB (39,265 B)2e85f0eac205cf444bdf97ede4935603ca6a041632edcb108fc2516b920734a862ae0692bcae1c5d45d5f8d972cb0d53434a4c54
model.safetensors86.7 MB (90,868,376 B)22b78143b3483ebdc945dc51b3715081fb0dd59153aa51172d142c89d9012cce15ae4d6cc0ca6895895114379cacb4fab128d9db
modules.json349 B (349 B)952a9b81c0bfd99800fabf352f69c7ccd46c5e4384e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
openvino/openvino_model.bin86.1 MB (90,265,744 B)34594ae46dc48de5246d81cc2249ff202e9b6bea8b86cab4722e2aefab310cf96d4d5a9eb3b187f7d9670a082afc55c7fa0d392a
openvino/openvino_model.xml206.4 KB (211,315 B)5d24a16700f0198908929370f59330fb8d486b1bf87dd1482b2a745f8c699b81ddd9cbcad666a193be4693abcea44b7ac8c67c1e
openvino/openvino_model_qint8_quantized.bin21.9 MB (22,933,664 B)6293fce89b93572976838558d48f5bd2affc5580c92ea4af3c6bc7b4a0f3b3d61b147c850f4dbdd7c9e7beee0c0c70dc12da289b
openvino/openvino_model_qint8_quantized.xml359.4 KB (368,006 B)7152d195a075cf3f3dc3c3d6308d845f88e0117fa19425e3f56f7736f752923f0a0b5a8d61c7878017f02e1fc9086615391105dd
pytorch_model.bin86.7 MB (90,888,945 B)7bb32840934678dfe0fd866115bf411717f58663c3a85f238711653950f6a79ece63eb0ea93d76f6a6284be04019c53733baf256
rust_model.ot86.7 MB (90,887,379 B)d5075469f82dede226282bba7e3ff7d737a06f712d98d96d278348988f2744e6445b8bc16d921c3f6e17c667362f3cb353007aea
sentence_bert_config.json53 B (53 B)59d594003bf59880a884c574bf88ef7555bb0202fc1993fde0a95c24ec6c022539d41cf6e2f7c9721e5415d6fb6897472a9cd4b7
special_tokens_map.json112 B (112 B)e7b0375001f109a6b8873d756ad4f7bbb15fbaa5303df45a03609e4ead04bc3dc1536d0ab19b5358db685b6f3da123d05ec200e3
tokenizer.json455.3 KB (466,247 B)cb202bfe2e3c98645018a6d12f182a434c9d3e02be50c3628f2bf5bb5e3a7f17b1f74611b2561a3a27eeab05e5aa30f411572037
tokenizer_config.json350 B (350 B)c79f2b6a0cea6f4b564fed1938984bace9d30ff0acb92769e8195aabd29b7b2137a9e6d6e25c476a4f15aa4355c233426c61576b
train_script.py12.8 KB (13,156 B)82b47b6277499b8f17d139d0c651a6f961c06124f9b98b9d203d728cbf93ccdbae84131ab926541b56196f11d1385fed0b4d1a07
vocab.txt226.1 KB (231,508 B)fb140275c155a9c7c5a3b3e0e77a9e839594a93807eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3

Cite this release

Canonical URL
https://aiseedbank.org/models/sentence-transformers_all-MiniLM-L6-v2/
Slug
sentence-transformers_all-MiniLM-L6-v2
Infohash
2e0726058182c1252426296311b39f4419336da9
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: sentence-transformers_all-MiniLM-L6-v2.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorysentence-transformers/all-MiniLM-L6-v2
Revision (pinned)1110a243fdf4706b3f48f1d95db1a4f5529b4d41
Fetched at2026-09-04T05:35:23Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T05:35:28Z

apache-2.0369.2 MB (387,185,889 bytes)sentence-transformerspytorchrustonnxsafetensorsopenvinobertfeature-extractionsentence-similaritytransformerseval-resultstext-embeddings-inferenceendpoints_compatible2 languages (tf, en)paper: 1904.06472paper: 2102.07033paper: 2104.08727paper: 1704.05179paper: 1810.09305