Qdrant Shrinks MiniLM-L6 to Run Without PyTorch in Serverless Apps
Qdrant maintains an ONNX-converted port of all-MiniLM-L6-v2 that powers FastEmbed, giving CPU-only pipelines fast 384-dimensional sentence vectors without PyTorch.
ProTakeaways
- Qdrant maintains an ONNX port of all-MiniLM-L6-v2 for lightweight text embeddings.
- It powers FastEmbed, letting you generate 384-dim vectors without installing PyTorch.
- Runs on ONNX Runtime, ideal for CPU inference, serverless functions, and small container images.
- Released under Apache 2.0, no hosted inference provider, intended for local or self-hosted use.
- Best for dense retrieval, semantic search, clustering, and RAG ingestion pipelines.
- A separate attention-weights variant exists for BM42 hybrid search.
If you have ever pip-installed sentence-transformers just to compute embeddings and watched several gigabytes of PyTorch wheels download into your container, Qdrant's ONNX port of all-MiniLM-L6-v2 is aimed squarely at your pain. It ports the weights of sentence-transformers/all-MiniLM-L6-v2 to ONNX so they can be pulled down and executed by Qdrant's FastEmbed library without any deep-learning framework in the loop.
Why repackaging a 22M-parameter model matters
The original all-MiniLM-L6-v2 is already tiny by modern standards, producing 384-dimensional embeddings from a 6-layer BERT. The value here is the packaging, not the architecture. By converting the weights to ONNX, Qdrant lets you run inference through FastEmbed instead of PyTorch, and the difference in operational footprint is significant.
FastEmbed is a lightweight Python library from Qdrant scoped to one job: embeddings and reranking, without dragging in PyTorch. Instead of a full training framework, it runs the model through ONNX Runtime, a small engine built only for executing already-trained models. You get the same vectors with a fraction of the install size and much quicker startup. That combination explains why this repo shows up as a dependency in so many RAG stacks, and why it fits neatly into serverless environments like AWS Lambda. ONNX Runtime also gives you consistent inference across CPUs, GPUs, and specialized accelerators.
Using it in three lines
The intended entry point is FastEmbed, which pulls the ONNX weights automatically the first time you instantiate the model:
from fastembed import TextEmbedding
documents = [
"You should stay, study and sprint.",
"History can only prepare us to be surprised yet again.",
]
model = TextEmbedding(model_name="sentence-transformers/all-MiniLM-L6-v2")
embeddings = list(model.embed(documents))
You can also load it directly with AutoModel.from_pretrained("Qdrant/all-MiniLM-L6-v2-onnx") through Transformers if you want to bypass FastEmbed, but you lose most of the size and startup benefits. The weights are released under Apache 2.0, so commercial use is unrestricted, and there is no hosted inference endpoint attached. This is meant to run locally or inside your own service.
What it is genuinely good at
- Dense retrieval for RAG: the 384-dim vectors are cheap to store and search, and pair naturally with Qdrant collections.
- Semantic similarity and clustering: the ONNX build keeps the semantic quality of the original checkpoint while trimming the runtime cost, which suits document deduplication, nearest-neighbor lookups, and lightweight text classification.
- Serverless workloads: cold starts on Lambda or Cloud Run stop being dominated by importing torch.
- Hybrid search building blocks: it slots in as the dense side of a hybrid pipeline alongside a sparse encoder like SPLADE.
Where it falls short
This is still a 2021-era MiniLM, so it lags newer embedding models on the MTEB leaderboard, and it is English-only. It also does not expose the attention-weight outputs some Qdrant users need for BM42-style hybrid search. For that case there is a separate variant with attentions, an ONNX port adjusted to return attention weights specifically for BM42 retrieval.
There has also been ongoing community friction about numerical parity and speed against the PyTorch original. Users have opened FastEmbed issues reporting inconsistent vectors compared with sentence-transformers in earlier versions, and separately questioning why FastEmbed can be slower than plain sentence-transformers on some single-sentence workloads. Both are now largely tuning problems around batch size and ONNX Runtime execution providers rather than fundamental correctness issues, but they are worth benchmarking on your own hardware before committing.
Where it fits in your stack
The mental model is simple. If you are training embeddings, fine-tuning, or need GPU-only throughput at massive scale, stay with sentence-transformers and PyTorch. If you are shipping a retrieval service, ingesting documents in a background worker, or embedding queries inside a latency-sensitive API on CPU, the Qdrant ONNX port plus FastEmbed is one of the smallest, fastest ways to get 384-dimensional vectors out the door, and it is what many production Qdrant deployments quietly use by default.