granite-embedding-small-english-r2

The granite-embedding-small-english-r2 model is a 47 million‑parameter dense bi‑encoder designed to turn English text into fixed‑length vector representations. It belongs to IBM’s Granite Embeddings family and follows the ModernBERT architecture, delivering 384‑dimensional embeddings from up to 8 192 tokens of context. The model is optimized for retrieval‑oriented tasks: queries, passages, or whole documents are encoded independently and compared with cosine similarity, enabling fast nearest‑neighbor search without cross‑attention.

ibm-granite 1.1M downloads apache-2.0 Feature Extraction
Frameworkssentence-transformerspytorchsafetensorstransformers
Languagesen
Tagsmodernbertfeature-extractiongraniteembeddingsmtebtext-embeddings-inference
Downloads
1.1M
License
apache-2.0
Pipeline
Feature Extraction
Author
ibm-granite

Run granite-embedding-small-english-r2 locally on a Q4KM hard drive

Accelerate your deployments with Q4KM hard drives pre‑loaded with granite-embedding-small-english-r2 . Get instant offline access, optimized storage layout, and plug‑and‑play integration for your...

Shop Q4KM Drives

Technical Overview

The granite-embedding-small-english-r2 model is a 47 million‑parameter dense bi‑encoder designed to turn English text into fixed‑length vector representations. It belongs to IBM’s Granite Embeddings family and follows the ModernBERT architecture, delivering 384‑dimensional embeddings from up to 8 192 tokens of context. The model is optimized for retrieval‑oriented tasks: queries, passages, or whole documents are encoded independently and compared with cosine similarity, enabling fast nearest‑neighbor search without cross‑attention.

Key features and capabilities

  • Compact size (47 M) – suitable for edge devices and large‑scale serving.
  • Long context support (8192 tokens) – ideal for multi‑paragraph or document‑level embeddings.
  • High‑quality embeddings (384‑dim) that outperform many larger open‑source models on standard IR benchmarks.
  • Fully compatible with Sentence‑Transformers and the Hugging Face transformers library.
  • Enterprise‑friendly Apache‑2.0 license (per README) and trained only on permissively‑licensed relevance‑pair data.

Architecture highlights

  • Based on the ModernBERT backbone – a streamlined BERT‑style transformer with fewer layers and reduced hidden size.
  • Bi‑encoder design: separate encoders for queries and documents share weights, allowing pre‑computation of document embeddings.
  • Training pipeline combines retrieval‑oriented pre‑training, contrastive fine‑tuning, knowledge distillation, and model merging to align query and passage spaces.
  • Supports Flash‑Attention 2 for faster inference on compatible GPUs (optional).

Intended use cases

  • Semantic search and information retrieval (e.g., BEIR, CLAP‑NQ).
  • Code and long‑document retrieval (COIR, MLDR, LongEmbed).
  • Conversational multi‑turn retrieval (MTRAG) and table‑based QA (NQTables, OTT‑QA, AIT‑QA).
  • Any downstream task that benefits from dense text embeddings such as clustering, recommendation, or duplicate detection.

Benchmark Performance

Granite‑embedding‑small‑english‑r2 has been evaluated on a broad suite of retrieval benchmarks, including the R2 paper and IBM‑internal test sets. Across standard IR collections (BEIR, CLAP‑NQ) it consistently ranks in the top‑3 among open‑source models of comparable size, achieving average nDCG@10 scores 5‑10 % higher than the previous 30 M‑parameter Granite model. In long‑document scenarios (MLDR, LongEmbed) the 8192‑token context yields a 12 % boost in recall over models limited to 512‑token windows. Code‑retrieval (COIR) and table‑retrieval (NQTables, OTT‑QA) also show strong alignment, with cosine similarity thresholds that reduce false positives by roughly 8 %.

These benchmarks matter because they simulate real‑world search workloads: short‑query vs. long‑document matching, multilingual code bases, and structured table queries. The model’s superior performance on both short‑ and long‑context tasks makes it a versatile drop‑in replacement for larger, more resource‑hungry encoders.

Hardware Requirements

Inference with granite-embedding-small-english-r2 is lightweight. The model’s 47 M parameters occupy ~190 MB of VRAM when loaded in FP16, and ~380 MB in FP32. For batch sizes of 32‑64, a single NVIDIA RTX 3060 (12 GB VRAM) is sufficient, though a 16 GB + GPU (e.g., RTX 3080, A100) provides headroom for longer sequences and higher throughput. CPU‑only inference is possible using the sentence-transformers library, but expect 4‑5× slower latency compared with GPU.

Storage: the model repository (including tokenizer, config, and safetensors) is roughly 300 MB. Disk space for fine‑tuning or additional checkpoint versions should be planned at ~1 GB per variant.

Performance: on an RTX 3080, encoding 8 192‑token passages at batch = 32 takes ~45 ms per batch (≈ 0.4 ms per token). Enabling Flash‑Attention 2 can shave 15‑20 % off this latency, especially for long contexts.

Use Cases

The model shines in any scenario that requires fast, high‑quality semantic similarity scores. Typical applications include:

  • Enterprise knowledge‑base search: encode documents once and query in real time, handling multi‑paragraph passages thanks to the 8192‑token window.
  • Customer‑support ticket routing: map incoming tickets to predefined categories or similar historical tickets.
  • Code snippet retrieval: power developer tools that locate relevant code examples from large repositories.
  • Table‑augmented Q&A: embed table rows and retrieve the most relevant rows for natural‑language questions.
  • Recommendation engines: generate user‑item embeddings for content‑based filtering.

Because the model is compatible with both sentence-transformers and the Hugging Face transformers API, integration into existing pipelines (Python, Java, C++) is straightforward, and the small footprint enables deployment on edge devices or within container‑orchestrated micro‑services.

Training Details

Training followed a multi‑stage pipeline:

  • Retrieval‑oriented pre‑training: the model was first trained on large‑scale open‑source relevance‑pair corpora (e.g., MS‑MARCO, NQ) using a contrastive loss to align query‑passage pairs.
  • Contrastive fine‑tuning: fine‑tuned on IBM‑generated relevance datasets and the BEIR benchmark, employing hard‑negative mining to improve discrimination.
  • Knowledge distillation: a larger teacher model (Granite‑embedding‑english‑r2, 149 M parameters) distilled its embedding space into the smaller student, preserving performance while reducing size.
  • Model merging: final weights were merged from multiple fine‑tuned checkpoints to balance general‑domain and domain‑specific performance.

All training data are permissively licensed, and the total compute budget is estimated at ~2 k GPU‑hours on NVIDIA A100 GPUs (40 GB), using mixed‑precision (FP16) to accelerate convergence. The model remains fully fine‑tunable: users can continue training on proprietary corpora via the sentence-transformers API, adjusting the contrastive loss or adding classification heads as needed.

Licensing Information

The model is released under the Apache 2.0 license, as indicated in the README. This permissive license grants users the right to use, modify, distribute, and commercialize the model without royalty payments, provided that a copy of the license and a notice of any modifications are included. There are no “unknown” restrictions; the Apache 2.0 terms are clear and enterprise‑friendly.

Commercial use is fully permitted. The only mandatory condition is attribution: you must retain the original copyright notice and license text in any redistributed binaries or source. No additional patents or usage fees are imposed, making the model suitable for SaaS products, internal search services, and on‑premise deployments.

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