all-MiniLM-L12-v2
by sentence-transformers
33M parameters, 384 dimensions, and a 128-token window that surprises almost everyone
sentence-transformers/all-MiniLM-L12-v2Deploy all-MiniLM-L12-v2
Single-tenantMixpeek has no managed extractor for this model. On a single-tenant deployment you upload the weights and a custom plugin serves them next to the rest of your pipeline.
Overview
all-MiniLM-L12-v2 is the small end of the sentence-transformers family: 33.4 million parameters producing 384-dimensional vectors, at 4.2 million downloads a month. The attraction is cost. A 384-dimensional index is a quarter the storage of a 1536-dimensional one, and the model is fast enough to embed a large corpus on CPU.
Its sequence limit is the detail that bites. sentence_bert_config.json sets max_seq_length to 128 tokens, which is roughly 90 English words. A 500-word chunk fed to this model is indexed on its first paragraph, and the rest of the chunk exists nowhere in the index. Nothing in the response indicates it happened. If your retrieval quality dropped when you moved to a cheaper embedding model, this is the first thing to check.
Within 128 tokens it is a capable English model, and it is a reasonable choice for short fields: titles, captions, product names, search queries, single sentences pulled from a transcript.
Architecture
6-layer-distilled BERT architecture at 12 layers in this variant, 384-dimensional hidden state, 33,360,512 parameters, 30,522-token vocabulary. Mean pooling then L2 normalization, giving a 384-dimensional unit vector. config.json allows 512 positions; sentence_bert_config.json sets max_seq_length to 128, and that is the limit in force through sentence-transformers.
Mixpeek SDK Integration
// Runs on your side; the vectors are upserted. Chunk to 128 TOKENS, not 128
// words and not 512: this model truncates at 128 and says nothing about it.
const res = await fetch(
"https://api.mixpeek.com/v1/namespaces/ns_your_namespace/documents/upsert",
{
method: "POST",
headers: {
Authorization: "Bearer API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
collection_id: "col_your_collection",
documents: [
{
document_id: "asset-00412-title",
// 384 floats, matching a 384-dimension vector index on the collection.
vectors: { "text-embedding": yourVector },
payload: { field: "title", source_key: "archive/2026/asset-00412" },
},
],
}),
},
);Capabilities
- 384-dimensional embeddings, a quarter of the storage of a 1536-dimensional index
- Fast enough for CPU-only ingestion of large corpora
- ONNX, OpenVINO and Rust builds published in the repo
- Symmetric encoding, no instruction prefix to get wrong
Use Cases on Mixpeek
Performance
Unbenchmarked here. The reason to pick it is storage and CPU cost, both of which you can compute exactly from the dimension count and your corpus size.
Common Pipeline Companions
Frequently Asked Questions
What is the maximum input length for all-MiniLM-L12-v2?
128 tokens. The repo's sentence_bert_config.json sets max_seq_length to 128, so text beyond that is truncated silently even though the BERT config permits 512 positions. This is the most common reason a switch to this model quietly lowers recall.
How does all-MiniLM-L12-v2 differ from all-MiniLM-L6-v2?
L12 has twice the layers, 33.4M parameters against roughly 22M, and both output 384 dimensions. L12 is slower per document and generally scores a little better. Both are English-only, and the sequence limits differ between the two repos, so read each one's sentence_bert_config.json rather than assuming.
Is 384 dimensions enough?
For short English fields, usually. Dimension count sets the ceiling on how much can be distinguished, and a title has little to distinguish. It is a poor fit for long passages, where the content exceeds both the window and the capacity of the vector.
Specification
Research Paper
MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers
arxiv.orgBuild a pipeline with all-MiniLM-L12-v2
Add this model to a processing pipeline alongside other extractors. Combine with retrieval stages for end-to-end search.
Run it on your own data, free