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

← All models

sentence-transformers_multi-qa-MiniLM-L6-cos-v1

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.


language:

  • en library_name: sentence-transformers tags:
  • sentence-transformers
  • feature-extraction
  • sentence-similarity
  • transformers datasets:
  • flax-sentence-embeddings/stackexchange_xml
  • ms_marco
  • gooaq
  • yahoo_answers_topics
  • search_qa
  • eli5
  • natural_questions
  • trivia_qa
  • embedding-data/QQP
  • embedding-data/PAQ_pairs
  • embedding-data/Amazon-QA
  • embedding-data/WikiAnswers pipeline_tag: sentence-similarity

multi-qa-MiniLM-L6-cos-v1

This is a sentence-transformers model: It maps sentences & paragraphs to a 384 dimensional dense vector space and was designed for semantic search. It has been trained on 215M (question, answer) pairs from diverse sources. For an introduction to semantic search, have a look at: SBERT.net - 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, util

query = "How many people live in London?"
docs = ["Around 9 Million people live in London", "London is known for its financial district"]

#Load the model
model = SentenceTransformer('sentence-transformers/multi-qa-MiniLM-L6-cos-v1')

#Encode query and documents
query_emb = model.encode(query)
doc_emb = model.encode(docs)

#Compute dot score between query and all document embeddings
scores = util.dot_score(query_emb, doc_emb)[0].cpu().tolist()

#Combine docs & scores
doc_score_pairs = list(zip(docs, scores))

#Sort by decreasing score
doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)

#Output passages & scores
for doc, score in doc_score_pairs:
    print(score, doc)

PyTorch 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 correct 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 average of all tokens
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output.last_hidden_state
    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)


#Encode text
def encode(texts):
    # Tokenize sentences
    encoded_input = tokenizer(texts, padding=True, truncation=True, return_tensors='pt')

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

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

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


# Sentences we want sentence embeddings for
query = "How many people live in London?"
docs = ["Around 9 Million people live in London", "London is known for its financial district"]

# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/multi-qa-MiniLM-L6-cos-v1")
model = AutoModel.from_pretrained("sentence-transformers/multi-qa-MiniLM-L6-cos-v1")

#Encode query and docs
query_emb = encode(query)
doc_emb = encode(docs)

#Compute dot score between query and all document embeddings
scores = torch.mm(query_emb, doc_emb.transpose(0, 1))[0].cpu().tolist()

#Combine docs & scores
doc_score_pairs = list(zip(docs, scores))

#Sort by decreasing score
doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)

#Output passages & scores
for doc, score in doc_score_pairs:
    print(score, doc)

TensorFlow Usage (HuggingFace Transformers)

Similarly to the PyTorch example above, to use the model with TensorFlow you pass your input through the transformer model, then you have to apply the correct pooling-operation on-top of the contextualized word embeddings.

from transformers import AutoTokenizer, TFAutoModel
import tensorflow as tf

#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output.last_hidden_state
    input_mask_expanded = tf.cast(tf.tile(tf.expand_dims(attention_mask, -1), [1, 1, token_embeddings.shape[-1]]), tf.float32)
    return tf.math.reduce_sum(token_embeddings * input_mask_expanded, 1) / tf.math.maximum(tf.math.reduce_sum(input_mask_expanded, 1), 1e-9)


#Encode text
def encode(texts):
    # Tokenize sentences
    encoded_input = tokenizer(texts, padding=True, truncation=True, return_tensors='tf')

    # Compute token embeddings
    model_output = model(**encoded_input, return_dict=True)

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

    # Normalize embeddings
    embeddings = tf.math.l2_normalize(embeddings, axis=1)

    return embeddings


# Sentences we want sentence embeddings for
query = "How many people live in London?"
docs = ["Around 9 Million people live in London", "London is known for its financial district"]

# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/multi-qa-MiniLM-L6-cos-v1")
model = TFAutoModel.from_pretrained("sentence-transformers/multi-qa-MiniLM-L6-cos-v1")

#Encode query and docs
query_emb = encode(query)
doc_emb = encode(docs)

#Compute dot score between query and all document embeddings
scores = (query_emb @ tf.transpose(doc_emb))[0].numpy().tolist()

#Combine docs & scores
doc_score_pairs = list(zip(docs, scores))

#Sort by decreasing score
doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)

#Output passages & scores
for doc, score in doc_score_pairs:
    print(score, doc)

Technical Details

In the following some technical details how this model must be used:

Setting Value
Dimensions 384
Produces normalized embeddings Yes
Pooling-Method Mean pooling
Suitable score functions dot-product (util.dot_score), cosine-similarity (util.cos_sim), or euclidean distance

Note: When loaded with sentence-transformers, this model produces normalized embeddings with length 1. In that case, dot-product and cosine-similarity are equivalent. dot-product is preferred as it is faster. Euclidean distance is proportional to dot-product and can also be used.


Background

The project aims to train sentence embedding models on very large sentence level datasets using a self-supervised contrastive learning objective. 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 Googles Flax, JAX, and Cloud team member about efficient deep learning frameworks.

Intended uses

Our model is intented to be used for semantic search: It encodes queries / questions and text paragraphs in a dense vector space. It finds relevant documents for the given passages.

Note that there is a limit of 512 word pieces: Text longer than that will be truncated. Further note that the model was just trained on input text up to 250 word pieces. It might not work well for longer text.

Training procedure

The full training script is accessible in this current repository: train_script.py.

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.

Training

We use the concatenation from multiple datasets to fine-tune our model. In total we have about 215M (question, answer) pairs. We sampled each dataset given a weighted probability which configuration is detailed in the data_config.json file.

The model was trained with MultipleNegativesRankingLoss using Mean-pooling, cosine-similarity as similarity function, and a scale of 20.

Dataset Number of training tuples
WikiAnswers Duplicate question pairs from WikiAnswers 77,427,422
PAQ Automatically generated (Question, Paragraph) pairs for each paragraph in Wikipedia 64,371,441
Stack Exchange (Title, Body) pairs from all StackExchanges 25,316,456
Stack Exchange (Title, Answer) pairs from all StackExchanges 21,396,559
MS MARCO Triplets (query, answer, hard_negative) for 500k queries from Bing search engine 17,579,773
GOOAQ: Open Question Answering with Diverse Answer Types (query, answer) pairs for 3M Google queries and Google featured snippet 3,012,496
Amazon-QA (Question, Answer) pairs from Amazon product pages 2,448,839
Yahoo Answers (Title, Answer) pairs from Yahoo Answers 1,198,260
Yahoo Answers (Question, Answer) pairs from Yahoo Answers 681,164
Yahoo Answers (Title, Question) pairs from Yahoo Answers 659,896
SearchQA (Question, Answer) pairs for 140k questions, each with Top5 Google snippets on that question 582,261
ELI5 (Question, Answer) pairs from Reddit ELI5 (explainlikeimfive) 325,475
Stack Exchange Duplicate questions pairs (titles) 304,525
Quora Question Triplets (Question, Duplicate_Question, Hard_Negative) triplets for Quora Questions Pairs dataset 103,663
Natural Questions (NQ) (Question, Paragraph) pairs for 100k real Google queries with relevant Wikipedia paragraph 100,231
SQuAD2.0 (Question, Paragraph) pairs from SQuAD2.0 dataset 87,599
TriviaQA (Question, Evidence) pairs 73,346
Total 214,988,242

Magnet link

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

magnet:?xt=urn:btih:013e8ea1f28441cb4910ae60a5e332e2c951697a&dn=sentence-transformers_multi-qa-MiniLM-L6-cos-v1

Open magnet in torrent client · infohash 013e8ea1f28441cb4910ae60a5e332e2c951697a

Files & hashes

PathSizesha1sha256
1_Pooling/config.json190 B (190 B)d1514c3162bbe87b343f565fadc62e6c06f04f034be450dde3b0273bb9787637cfbd28fe04a7ba6ab9d36ac48e92b11e350ffc23
README.md11.3 KB (11,586 B)49291b15aecddcea5f99be93dde87cbfdfb3127b516c81b58be758ff4a521ec86d6f30668c68644e2d55d5dcbba3e60f4ca5efe0
config.json612 B (612 B)72b987fd805cfa2b58c4c8c952b274a11bfd5a00953f9c0d463486b10a6871cc2fd59f223b2c70184f49815e7efbcab5d8908b41
config_sentence_transformers.json116 B (116 B)fd1b291129c607e5d49799f87cb219b27f98acdf061ca9d39661d6c6d6de5ba27f79a1cd5770ea247f8d46412a68a498dc5ac9f3
data_config.json24.9 KB (25,457 B)a3294881c9834ac6fb99d420008f30b741fe7e86163295fe27834a12a37d9ef1a6175a6c1c530a48ee42b640149b518e0bedae62
model.safetensors86.7 MB (90,868,376 B)63533a29b270d4e5b37cac5a23275e7b0d841f1f7bec4fd9eba43073d5c5dcf1b79b0a3397608fa063e6f626d6f8fd70a81f2d8c
modules.json349 B (349 B)952a9b81c0bfd99800fabf352f69c7ccd46c5e4384e40c8e006c9b1d6c122e02cba9b02458120b5fb0c87b746c41e0207cf642cf
openvino/openvino_model.bin86.1 MB (90,265,744 B)6f770b20a67d92f1efcd4d2477e9f3be0a32f9ea89f9ad00a782cba3234270239daec47a1067b63399b512c1b7c622214d639c35
openvino/openvino_model.xml206.6 KB (211,556 B)065b86b2315d820a9c3ba3e20966308dcce8dafd1781e6f985774bda5f990c9a8e104251ecdfbd35b5e5c4d516bcb6b479fd2e41
openvino/openvino_model_qint8_quantized.bin21.9 MB (22,933,664 B)41137fcd9f7ad3d29258bf8b0e8212173c2e8d48a7ca78e428d963e69b7cb9c948cdc8af1a3e319f0cd3a4882a7f2b49153ec563
openvino/openvino_model_qint8_quantized.xml359.8 KB (368,481 B)c9ff85c878c8f436dc5902467165bab4fd7288a4d68b5f63bc97ca5e75a4a665b56fbd8407aa6cfa2fa219190e8db43418ae9eda
pytorch_model.bin86.7 MB (90,888,945 B)efd50d98e8a1e8465dd4b72d0497fa231e70365bdf507ec1743de52aa0a1b401183c5fd8ca18e846689421ea6c94cae014d9b26b
sentence_bert_config.json53 B (53 B)f789d99277496b282d19020415c5ba9ca79ac875ec8e29d6dcb61b611b7d3fdd2982c4524e6ad985959fa7194eacfb655a8d0d51
special_tokens_map.json112 B (112 B)e7b0375001f109a6b8873d756ad4f7bbb15fbaa5303df45a03609e4ead04bc3dc1536d0ab19b5358db685b6f3da123d05ec200e3
tokenizer.json455.3 KB (466,247 B)9c190aac0fb9edc2293b69b82c6d5d5d21e67dd97fa9272f7ef1ebd1666bb3bfd9d4707660ff0076ca9d1671cd9a9c6e18e03331
tokenizer_config.json383 B (383 B)d50701956f8e35e7507e6b74547a71e62ca39cad857c5db35e9664bd0ea1db3a5ee62c0ce86d79e3ec85861ca1680bd7aaff12f8
train_script.py13.5 KB (13,846 B)131d011c947fb9e8994a79f40d0325bd10daa858bce066a581adba92898dab6683b32779640bbe2b062b5fb8191b57fde584b1a2
vocab.txt226.1 KB (231,508 B)fb140275c155a9c7c5a3b3e0e77a9e839594a93807eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3

Cite this release

Canonical URL
https://aiseedbank.org/models/sentence-transformers_multi-qa-MiniLM-L6-cos-v1/
Slug
sentence-transformers_multi-qa-MiniLM-L6-cos-v1
Infohash
013e8ea1f28441cb4910ae60a5e332e2c951697a
License
no license recorded
Signing key fingerprint
85a3b32c3712427b

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

Provenance

Upstream repositorysentence-transformers/multi-qa-MiniLM-L6-cos-v1
Revision (pinned)b207367332321f8e44f96e224ef15bc607f4dbf0
Fetched at2026-09-04T05:37:28Z
License at fetchno license recorded
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T05:37:32Z

no license recorded282.6 MB (296,287,225 bytes)sentence-transformerspytorchonnxsafetensorsopenvinobertfeature-extractionsentence-similaritytransformerstext-embeddings-inferenceendpoints_compatible2 languages (tf, en)