e5-small-v2

intfloat/e5-small-v2

intfloat 1M downloads mit Sentence Similarity
Frameworkssentence-transformerspytorchtfonnxsafetensorsopenvino
Languagesen
TagsbertmtebSentence Transformerssentence-similaritymodel-indextext-embeddings-inference
Downloads
1M
License
mit
Pipeline
Sentence Similarity
Author
intfloat

Run e5-small-v2 locally on a Q4KM hard drive

Looking for a plug‑and‑play solution? Get the e5‑small‑v2 model pre‑loaded on a high‑performance Q4KM SSD. Accelerate your semantic‑search pipelines without any setup hassle. Get this model on a Q4KM...

Shop Q4KM Drives

Technical Overview

Model ID: intfloat/e5-small-v2
Model Name: e5‑small‑v2
Author: intfloat

The e5‑small‑v2 model is a compact, high‑performance sentence‑embedding transformer built for the Hugging Face model card. It belongs to the Sentence‑Transformers family and is optimized for the sentence‑similarity pipeline, meaning it turns arbitrary text (sentences, paragraphs, or short documents) into dense vector representations that capture semantic meaning. These vectors can be directly used for similarity search, clustering, classification, retrieval, and reranking tasks.

Key capabilities include:

  • Multi‑language support: Although the primary evaluation language is English, the underlying architecture (a BERT‑style encoder) can be applied to any language supported by the tokenizer.
  • Fast inference: With a “small” footprint (≈ 60 M parameters) the model runs comfortably on consumer‑grade GPUs and even on CPUs for low‑throughput workloads.
  • Compatibility: Exported in torch, tf, onnx, openvino, and safetensors formats, making it easy to integrate into production pipelines, edge devices, or cloud services.
  • Benchmarked on MTEB: The model has been evaluated across a broad suite of tasks (classification, retrieval, clustering, STS, reranking) in the MTEB benchmark, demonstrating balanced performance across both semantic similarity and downstream classification.

Architecture highlights:

  • Backbone: A distilled BERT‑style encoder (12 layers, hidden size 384, 6 attention heads) – the “small” variant of the e5 family.
  • Training objective: Contrastive learning with a large corpus of sentence pairs, followed by a lightweight fine‑tuning on task‑specific datasets.
  • Pooling: Mean‑pool over the last hidden state, followed by L2‑normalization to produce unit‑length embeddings.
  • Framework: Implemented in PyTorch, with optional TensorFlow and ONNX export paths.

Intended use cases include:

  • Semantic search over product catalogs, knowledge bases, or Q&A archives.
  • Real‑time duplicate detection for user‑generated content.
  • Low‑latency recommendation engines that need fast similarity scoring.
  • Clustering of documents for topic modeling or data exploration.
  • Reranking of candidate passages in information‑retrieval pipelines.

Benchmark Performance

The e5‑small‑v2 model has been evaluated on the MTEB (Massive Text Embedding Benchmark) suite, which aggregates a wide variety of downstream tasks. For a sentence‑embedding model, the most relevant categories are Classification, Retrieval, Clustering, Semantic Textual Similarity (STS), and Reranking.

Selected results (test split, English):

  • Amazon Polarity Classification – Accuracy: 91.27 %, F1: 91.24 %, AP: 87.68 %.
  • Amazon Counterfactual Classification – Accuracy: 77.60 %, F1: 71.86 %, AP: 41.67 %.
  • AskUbuntu Duplicate Questions (Reranking) – MAP: 58.11 %, MRR: 71.56 %.
  • BIOSSES STS – Cosine‑Pearson: 78.47 %, Cosine‑Spearman: 79.43 %.
  • ArguAna Retrieval – MAP@10: 33.98 %, nDCG@10: 41.67 %, Recall@100: 92.39 %.
  • ArXiv Clustering (P2P) – V‑Measure: 42.12 %.

These metrics matter because they reflect the model’s ability to preserve semantic relationships (STS, Retrieval) while also being discriminative enough for downstream classification tasks. The high accuracy on Amazon Polarity shows that the embeddings are well‑aligned with sentiment signals, whereas the robust MAP and nDCG scores on ArguAna demonstrate effective nearest‑neighbor retrieval.

When compared to other “small” sentence‑transformers (e.g., sentence‑transformers/all‑MiniLM‑L6‑v2), e5‑small‑v2 typically offers a slightly higher F1 on sentiment‑heavy datasets and competitive retrieval scores, while maintaining a comparable parameter count. This makes it a strong candidate for latency‑sensitive applications that still demand high semantic fidelity.

Hardware Requirements

Because e5‑small‑v2 is designed for efficiency, its resource footprint is modest.

  • VRAM for inference: ~2 GB of GPU memory is sufficient for batch sizes up to 64 sentences (float16). For larger batches, 4 GB provides a comfortable headroom.
  • Recommended GPU: Any modern NVIDIA GPU with at least 4 GB VRAM (e.g., RTX 3060, GTX 1660 Ti) or an AMD GPU supporting ROCm. For production‑grade latency, the RTX 3070 (8 GB) or higher is advisable.
  • CPU requirements: On CPU‑only inference, a 4‑core modern processor (e.g., Intel i5‑12400 or AMD Ryzen 5 5600X) can achieve ~150 tokens/s using the torchscript or onnxruntime back‑ends.
  • Storage: The model files (including tokenizer, config, and weights) occupy roughly 300 MB when stored as safetensors. Adding ONNX and OpenVINO exports adds another ~150 MB.
  • Performance characteristics: With float16 quantization, latency per sentence drops to ~2 ms on a 4 GB GPU, making it suitable for real‑time similarity queries.

Use Cases

The e5‑small‑v2 model shines in scenarios where semantic similarity must be computed quickly and at scale.

  • Search & Retrieval: Power a “search‑as‑you‑type” feature for e‑commerce catalogs, returning the most semantically similar products in milliseconds.
  • Duplicate Detection: Identify near‑duplicate support tickets or forum posts to reduce manual triage effort.
  • Content Recommendation: Match users to articles, videos, or code snippets based on the semantic content of their queries.
  • Document Clustering: Organize large corpora (e.g., research papers, legal contracts) into thematic groups for exploratory analysis.
  • Reranking in QA Systems: After an initial BM25 retrieval, use e5‑small‑v2 embeddings to rerank the top‑k candidates for higher relevance.

Industries that benefit include:

  • Retail & e‑commerce – product similarity and recommendation.
  • Customer support – ticket deduplication and knowledge‑base retrieval.
  • Healthcare – clustering of clinical notes or medical literature.
  • FinTech – sentiment‑aware classification of financial news.
  • Education – semantic search across course materials.

Training Details

While the README does not expose the full training pipeline, the following can be inferred from the tags and benchmark results:

  • Methodology: The model was first pre‑trained using a contrastive loss on billions of sentence pairs harvested from the web (similar to the approach in arXiv:2212.03533). This phase teaches the encoder to bring semantically similar sentences close in the embedding space.
  • Fine‑tuning: Subsequent fine‑tuning on task‑specific datasets (e.g., Amazon Polarity, MTEB classification suites) refined the embeddings for downstream classification and retrieval.
  • Datasets: Large‑scale crawls for pre‑training; MTEB benchmark suites for evaluation; specific downstream corpora such as Amazon reviews, ArguAna, BIOSSES, and AskUbuntu for fine‑tuning.
  • Compute: Training a “small” transformer with contrastive objectives typically requires 2–4 A100‑40 GB GPUs for several days (≈ 200 k GPU‑hours). The exact figure is not disclosed, but the model size suggests a moderate compute budget.
  • Fine‑tuning capabilities: Because the model follows the Sentence‑Transformers API, users can further fine‑tune on custom data with a few epochs using the SentenceTransformer class, leveraging the same contrastive loss or a classification head.

Licensing Information

The repository lists the license as unknown, but the model card also includes the tag license:mit. In practice, this means the model weights are distributed under the MIT license, which is permissive and allows:

  • Free use for both personal and commercial projects.
  • Modification and redistribution of the model files.
  • Integration into proprietary software without the need to open‑source your own code.

If the license were truly unknown, the safest approach would be to treat the model as “non‑commercial unless explicitly permitted”. However, the presence of the MIT tag strongly suggests that commercial usage is allowed. Regardless, you should:

  • Provide attribution to intfloat and the original model name.
  • Include a copy of the MIT license file (if available) in any distribution.
  • Check the Hugging Face discussions for any community‑reported licensing clarifications.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives