talira

all-MiniLM-L6-v2

Sentence Transformers model that maps sentences and paragraphs to a 384-dimensional vector space

open sourceApache-2.0self-hostablefree

all-MiniLM-L6-v2 is a small Sentence Transformers model: a six-layer MiniLM (nreimers/MiniLM-L6-H384-uncased) fine-tuned with a contrastive objective on more than a billion sentence pairs, which maps sentences and short paragraphs to 384-dimensional vectors for semantic search, clustering and sentence similarity. It was built during Hugging Face's community week using JAX/Flax, truncates input longer than 256 word pieces, and uses mean pooling. It has about 22M parameters, is the default model of candle's BERT example and is built into fastembed-rs; the weights are Apache-2.0.

Problems it solves

  • a tiny sentence embedding model that runs fast on any laptop CPU
  • group similar sentences together without training anything
  • check whether two short texts mean the same thing
  • a lightweight model for semantic search over titles and short descriptions
  • the classic starter model for learning how embeddings and vector search work
  • embed short texts in a mobile or desktop app with a model of under 100 MB
  • find duplicate questions in a forum or FAQ by meaning
  • a well-supported embedding model that every vector database tutorial and library already knows
  • suggest related articles from their titles alone

Features

  • 384-dimensional embeddings
  • about 22M parameters, six layers
  • fine-tuned on more than 1 billion sentence pairs
  • mean pooling, normalised vectors
  • input truncated at 256 word pieces
  • Apache-2.0 licence
  • default model of candle's BERT example
  • built into fastembed-rs, also as a quantized variant
  • in the Ollama library as all-minilm

Limitations

  • Doesn't read inputs longer than 256 word pieces: longer text is truncated1
  • Doesn't cover languages other than English: its model card lists English only1

Alternatives

The same job

These do what all-MiniLM-L6-v2 does.

  1. bge-small-en-v1.5 BAAI's small English general embedding model, version 1.5
  2. potion-base-8M Minish's small static English embedding model, distilled from bge-base-en-v1.5
  3. snowflake-arctic-embed-xs Snowflake's tiny Arctic Embed retrieval model: 22M parameters, 384 dimensions
  4. multilingual-e5-small Small multilingual E5 text embedding model: 12 layers, 384 dimensions, 100 languages
  5. snowflake-arctic-embed-s Snowflake's small Arctic Embed retrieval model: 33M parameters, 384 dimensions
  6. potion-retrieval-32M Minish's static embedding model optimised for retrieval

Compare all-MiniLM-L6-v2 with the top 3