Mixedbread

mxbai-embed-large-v1

Discover mxbai-embed-large-v1, our state-of-the-art English embedding model. Learn about its powerful performance, versatility across various NLP tasks, and how to effectively use it for semantic search, information retrieval, and other applications.

Parameters 340M
Context Window 512
Price / 1M tokens $0.00
Languages EN

Model Description

is our powerful English embedding model that provides state-of-the-art performance among efficiently sized models. It outperforms closed source models like OpenAI's text-embedding-ada-002.

The model was trained on a vast dataset of over 700 million pairs using contrastive training and fine-tuned on more than 30 million high-quality triplets using the AnglE loss function. This extensive training enables the model to adapt to a wide range of topics and domains, making it suitable for various real-world applications and use cases.

mxbai-embed-large-v1 is well-suited for . This helps you save 32x storage and achieve 40x faster retrieval, while maintaining over 96% of the performance.

mxbai-embed-large-v1 achieves top performance on the Massive Text Embedding Benchmark (MTEB), which measures embedding models across seven tasks: classification, clustering, pair classification, re-ranking, retrieval, semantic textual similarity, and summarization. The model's strong performance across these diverse tasks demonstrates its versatility and robustness.

Compare with other models

ModelContext WindowDimensionsInput Price (/1M tokens)
mxbai Embed Large v1512 1024$0.00
deepset mxbai embed german large v1512 1024$0.00
mxbai embed 2d large v1512 1024$0.00
mxbai embed xsmall v14.1K 384$0.00
mxbai colbert large v1512 1024$0.00

Calculate Sentence Similarities

The following code illustrates how to compute similarities between sentences using the cosine similarity score function.

import torch
from mixedbread import Mixedbread
from sentence_transformers.util import semantic_search

mxbai = Mixedbread(api_key="YOUR_API_KEY")
model = "mixedbread-ai/mxbai-embed-large-v1"

docs = [
    "A man is eating food.",
    "A man is eating pasta.",
]

res = mxbai.embed(
    model=model,
    input=docs,
    normalized=True,
    encoding_format='float'
)

embeddings_list = [item.embedding for item in res.data]

query_tensor = torch.tensor([embeddings_list[0]])
corpus_tensor = torch.tensor([embeddings_list[1]])

hits = semantic_search(query_tensor, corpus_tensor, top_k=1)

similarity_score = 0.0
if hits and hits[0]:
    similarity_score = hits[0][0]['score']

print(f"Similarity (using semantic_search): {similarity_score:.4f}")

The following code snippet demonstrates the retrieval of information related to a specific query from a given corpus. Note that the prompt Represent this sentence for searching relevant passages: is used for the query.

import torch
from mixedbread import Mixedbread
from sentence_transformers.util import semantic_search

mxbai = Mixedbread(api_key="YOUR_API_KEY")
model = "mixedbread-ai/mxbai-embed-large-v1"

prompt = 'Represent this sentence for searching relevant passages:'
query = "A man is eating a piece of bread"

docs = [
    "A man is eating food.",
    "A man is eating pasta.",
    "The girl is carrying a baby.",
    "A man is riding a horse.",
]

query_res = mxbai.embed(
    model=model,
    prompt=prompt,
    input=[query],
    normalized=True,
    encoding_format='float'
)

docs_res = mxbai.embed(
    model=model,
    input=docs,
    normalized=True,
    encoding_format='float'
)

query_embedding_list = query_res.data[0].embedding
docs_embeddings_list = [item.embedding for item in docs_res.data]

query_tensor = torch.tensor([query_embedding_list])
docs_tensor = torch.tensor(docs_embeddings_list)

hits = semantic_search(query_tensor, docs_tensor, top_k=len(docs))

print(f"Query: {query}\n")
print("Results (sorted by relevance):")
for hit in hits[0]:
    doc_index = hit['corpus_id']
    score = hit['score']
    print(f"Score: {score:.4f}\tDocument: {docs[doc_index]}")

Last updated: May 6, 2025