Model reference · open weights

SFR-Embedding-2_R

Embeddings Salesforce Embeddings 1 build Non-commercial 18k dl/mo

SFR-Embedding-2_R is an open-weight embedding model from Salesforce. SFR-Embedding-2_R (BF16) weighs 14.2 GB; the smallest configuration that runs it is RTX 4060 Ti 16 GB.

  • SFR-Embedding-2_R is a 7.1B parameter feature-extraction model developed by Salesforce for research purposes.
  • It supports a context length of 32,768 tokens and is designed for English text.
  • The model is released under the cc-by-nc-4.0 license.

Summary of the Salesforce/SFR-Embedding-2_R model card, 2026-10-01

What it is

Released bySalesforce
Released2024-06-14
Parameters7.1B
VRAM14.2 GB for the weights

What it runs on

Memory and cards for SFR-Embedding-2_R (BF16)

14.2 GBweights, file size
1.1 GBruntime overhead
CardRunsMemory
RTX 3060 12 GBdoes not fit11.6 GB
RTX 4060 Ti 16 GBtight15.4 GB
RTX 3090 24 GBfits23.4 GB
RTX 4090 24 GBfits23.4 GB
RTX 5090 32 GBfits31.0 GB
L40S 48 GBfits44.0 GB
A100 80 GBfits78.2 GB
H100 80 GBfits78.1 GB
RTX PRO 6000 Blackwell 96 GBfits93.8 GB
DGX Spark (GB10) 128 GB unifiedfits107 GB
H200 141 GBfits138 GB
B200 180 GBfits176 GB

From the model card

What Salesforce says about SFR-Embedding-2_R

Read the model card

SFR-Embedding by Salesforce Research.

The model is for research purposes only.

More technical details will be updated later. Meanwhile, please refer to our previous work SFR-Embedding for details.

Ethical Considerations

This release is for research purposes only in support of an academic paper. Our models, datasets, and code are not specifically designed or evaluated for all downstream purposes. We strongly recommend users evaluate and address potential concerns related to accuracy, safety, and fairness before deploying this model. We encourage users to consider the common limitations of AI, comply with applicable laws, and leverage best practices when selecting use cases, particularly for high-risk scenarios where errors or misuse could significantly impact people’s lives, rights, or safety. For further guidance on use cases, refer to our AUP and AI AUP.

SFR-Embedding Team (∗indicates equal contributors, † indicates co-leaders).

  • Rui Meng*
  • Ye Liu*
  • Tong Niu
  • Shafiq Rayhan Joty
  • Caiming Xiong †
  • Yingbo Zhou †
  • Semih Yavuz †

Citation

@misc{SFR-embedding-2,
  title={SFR-Embedding-2: Advanced Text Embedding with Multi-stage Training},
  author={Rui Meng*, Ye Liu*, Shafiq Rayhan Joty, Caiming Xiong, Yingbo Zhou, Semih Yavuz},
  year={2024},
  url={https://huggingface.co/Salesforce/SFR-Embedding-2_R}
}

How to run

Transformers

The models can be used as follows:

import torch
import torch.nn.functional as F
from torch import Tensor
from transformers import AutoTokenizer, AutoModel

def last_token_pool(last_hidden_states: Tensor,
                 attention_mask: Tensor) -> Tensor:
    left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
    if left_padding:
        return last_hidden_states[:, -1]
    else:
        sequence_lengths = attention_mask.sum(dim=1) - 1
        batch_size = last_hidden_states.shape[0]
        return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]

def get_detailed_instruct(task_description: str, query: str) -> str:
    return f'Instruct: {task_description}\nQuery: {query}'

# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [
    get_detailed_instruct(task, 'How to bake a chocolate cake'),
    get_detailed_instruct(task, 'Symptoms of the flu')
]
# No need to add instruction for retrieval documents
passages = [
    "To bake a delicious chocolate cake, you'll need the following ingredients: all-purpose flour, sugar, cocoa powder, baking powder, baking soda, salt, eggs, milk, vegetable oil, and vanilla extract. Start by preheating your oven to 350°F (175°C). In a mixing bowl, combine the dry ingredients (flour, sugar, cocoa powder, baking powder, baking soda, and salt). In a separate bowl, whisk together the wet ingredients (eggs, milk, vegetable oil, and vanilla extract). Gradually add the wet mixture to the dry ingredients, stirring until well combined. Pour the batter into a greased cake pan and bake for 30-35 minutes. Let it cool before frosting with your favorite chocolate frosting. Enjoy your homemade chocolate cake!",
    "The flu, or influenza, is an illness caused by influenza viruses. Common symptoms of the flu include a high fever, chills, cough, sore throat, runny or stuffy nose, body aches, headache, fatigue, and sometimes nausea and vomiting. These symptoms can come on suddenly and are usually more severe than the common cold. It's important to get plenty of rest, stay hydrated, and consult a healthcare professional if you suspect you have the flu. In some cases, antiviral medications can help alleviate symptoms and reduce the duration of the illness."
]

# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('Salesforce/SFR-Embedding-2_R')
model = AutoModel.from_pretrained('Salesforce/SFR-Embedding-2_R')

# get the embeddings
max_length = 4096
input_texts = queries + passages
batch_dict = tokenizer(input_texts, max_length=max_length, padding=True, truncation=True, return_tensors="pt")
outputs = model(**batch_dict)
embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])

# normalize embeddings
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T) * 100
print(scores.tolist())
# [[40.132083892822266, 25.032529830932617], [15.006855010986328, 39.93733215332031]]

Sentence Transformers

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("Salesforce/SFR-Embedding-2_R")

def get_detailed_instruct(task_description: str, query: str) -> str:
    return f'Instruct: {task_description}\nQuery: {query}'

# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'
queries = [
    get_detailed_instruct(task, 'How to bake a chocolate cake'),
    get_detailed_instruct(task, 'Symptoms of the flu')
]
# No need to add instruction for retrieval documents
passages = [
    "To bake a delicious chocolate cake, you'll need the following ingredients: all-purpose flour, sugar, cocoa powder, baking powder, baking soda, salt, eggs, milk, vegetable oil, and vanilla extract. Start by preheating your oven to 350°F (175°C). In a mixing bowl, combine the dry ingredients (flour, sugar, cocoa powder, baking powder, baking soda, and salt). In a separate bowl, whisk together the wet ingredients (eggs, milk, vegetable oil, and vanilla extract). Gradually add the wet mixture to the dry ingredients, stirring until well combined

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

Benchmarks

Reported results

As published on the model card: the maker's own numbers, not measured by AxForge.

TaskDatasetMetricScore
ClassificationMTEB AmazonCounterfactualClassification (en)accuracy92.716
ClassificationMTEB AmazonCounterfactualClassification (en)ap69.479
ClassificationMTEB AmazonCounterfactualClassification (en)f188.025
ClassificationMTEB AmazonPolarityClassificationaccuracy97.311
ClassificationMTEB AmazonPolarityClassificationap96.267
ClassificationMTEB AmazonPolarityClassificationf197.310
ClassificationMTEB AmazonReviewsClassification (en)accuracy61.040
ClassificationMTEB AmazonReviewsClassification (en)f160.786
RetrievalMTEB ArguAnamap_at_137.767
RetrievalMTEB ArguAnamap_at_1053.908
RetrievalMTEB ArguAnamap_at_10054.583
RetrievalMTEB ArguAnamap_at_100054.584
RetrievalMTEB ArguAnamap_at_2054.509
RetrievalMTEB ArguAnamap_at_349.514
RetrievalMTEB ArguAnamap_at_552.060
RetrievalMTEB ArguAnamrr_at_138.265
RetrievalMTEB ArguAnamrr_at_1054.120
RetrievalMTEB ArguAnamrr_at_10054.781
RetrievalMTEB ArguAnamrr_at_100054.782
RetrievalMTEB ArguAnamrr_at_2054.707
RetrievalMTEB ArguAnamrr_at_349.716
RetrievalMTEB ArguAnamrr_at_552.248
RetrievalMTEB ArguAnandcg_at_137.767
RetrievalMTEB ArguAnandcg_at_1062.340
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms