all-MiniLM-L6-v2 is a lightweight sentence-transformers model that maps sentences and short paragraphs into 384-dimensional dense vectors optimized for semantic tasks. Designed for high-speed, low-resource environments, it supports clustering, semantic search, and similarity comparison. Based on the MiniLM architecture, the model uses a contrastive learning objective trained on over 1 billion sentence pairs from diverse datasets like Reddit, WikiAnswers, and Stack Exchange. It outperforms many larger models in embedding quality relative to size and is available in PyTorch, TensorFlow, ONNX, and other formats. all-MiniLM-L6-v2 can be used with the sentence-transformers library or directly via Hugging Face Transformers with custom pooling. Text longer than 256 tokens is truncated, making it ideal for short-form text processing. Released under the Apache 2.0 license, the model is widely adopted across academic and commercial applications for its balance of performance and efficiency.
Features
- Maps sentences to 384-dimensional embeddings
- Trained on over 1 billion sentence pairs using contrastive loss
- Optimized for semantic similarity, clustering, and retrieval
- Extremely lightweight with only 22.7M parameters
- Supports multiple frameworks (PyTorch, TensorFlow, ONNX, Rust, OpenVINO)
- Compatible with Hugging Face Transformers and sentence-transformers
- Truncates input beyond 256 word pieces for efficient processing
- Open-source under Apache 2.0, widely used in research and production