mixedbread-ai / mxbai-embed-xsmall-v1

huggingface.co
Total runs: 28.9K
24-hour runs: 0
7-day runs: 2.1K
30-day runs: 4.7K
Model's Last Updated: March 13 2025
feature-extraction

Introduction of mxbai-embed-xsmall-v1

Model Details of mxbai-embed-xsmall-v1

The crispy sentence embedding family from Mixedbread .

mixedbread-ai/mxbai-embed-xsmall-v1

This model is an open-source English embedding model developed by Mixedbread . It's built upon sentence-transformers/all-MiniLM-L6-v2 and trained with the AnglE loss and Espresso . Read more details in our blog post .

In a bread loaf :

Performance
Binary Quantization and Matryoshka

Our model supports both binary quantization and Matryoshka Representation Learning (MRL) , allowing for significant efficiency gains:

  • Binary quantization: Retains 93.9% of performance while increasing efficiency by a factor of 32
  • MRL: A 33% reduction in vector size still leaves 96.2% of model performance

These optimizations can lead to substantial reductions in infrastructure costs for cloud computing and vector databases. Read more here .

Quickstart

Here are several ways to produce German sentence embeddings using our model.

angle-emb
pip install -U angle-emb
from angle_emb import AnglE
from angle_emb.utils import cosine_similarity

# 1. Specify preferred dimensions
dimensions = 384

# 2. Load model and set pooling strategy to avg
model = AnglE.from_pretrained(
    "mixedbread-ai/mxbai-embed-xsmall-v1",
    pooling_strategy='avg').cuda()

query = 'A man is eating a piece of bread'

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

# 3. Encode
embeddings = model.encode(docs, embedding_size=dimensions)

for doc, emb in zip(docs[1:], embeddings[1:]):
    print(f'{query} ||| {doc}', cosine_similarity(embeddings[0], emb))
Sentence Transformers
python -m pip install -U sentence-transformers
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim

# 1. Specify preferred dimensions
dimensions = 384

# 2. Load model
model = SentenceTransformer("mixedbread-ai/mxbai-embed-xsmall-v1", truncate_dim=dimensions)

query = 'A man is eating a piece of bread'

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


# 3. Encode
embeddings = model.encode(docs)

similarities = cos_sim(embeddings[0], embeddings[1:])
print('similarities:', similarities)
transformers
pip install -U transformers
from typing import Dict

import torch
import numpy as np
from transformers import AutoModel, AutoTokenizer
from sentence_transformers.util import cos_sim

def pooling(outputs: torch.Tensor, inputs: Dict) -> np.ndarray:
    outputs = torch.sum(
      outputs * inputs["attention_mask"][:, :, None], dim=1) / torch.sum(inputs["attention_mask"])
    return outputs.detach().cpu().numpy()

# 1. Load model
model_id = 'mixedbread-ai/mxbai-embed-xsmall-v1'
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id).cuda()

query = 'A man is eating a piece of bread'

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

# 2. Encode
inputs = tokenizer(docs, padding=True, return_tensors='pt')
for k, v in inputs.items():
    inputs[k] = v.cuda()
outputs = model(**inputs).last_hidden_state
embeddings = pooling(outputs, inputs)

# 3. Compute similarity scores
similarities = cos_sim(embeddings[0], embeddings[1:])
print('similarities:', similarities)
Batched API
python -m pip install batched
import uvicorn
import batched
from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
from sentence_transformers import SentenceTransformer
from pydantic import BaseModel
 
app = FastAPI()
 
model = SentenceTransformer('mixedbread-ai/mxbai-embed-xsmall-v1')
model.encode = batched.aio.dynamically(model.encode)
 
class EmbeddingsRequest(BaseModel):
    input: str | list[str]
 
@app.post("/embeddings")
async def embeddings(request: EmbeddingsRequest):
    return ORJSONResponse({"embeddings": await model.encode(request.input)})
 
if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)
Community

Join our discord community to share your feedback and thoughts. We're here to help and always happy to discuss the exciting field of machine learning!

License

Apache 2.0

Citation
@online{xsmall2024mxbai,
  title={Every Byte Matters: Introducing mxbai-embed-xsmall-v1},
  author={Sean Lee and Julius Lipp and Rui Huang and Darius Koenig},
  year={2024},
  url={https://www.mixedbread.ai/blog/mxbai-embed-xsmall-v1},
}

Runs of mixedbread-ai mxbai-embed-xsmall-v1 on huggingface.co

28.9K
Total runs
0
24-hour runs
670
3-day runs
2.1K
7-day runs
4.7K
30-day runs

More Information About mxbai-embed-xsmall-v1 huggingface.co Model

More mxbai-embed-xsmall-v1 license Visit here:

https://choosealicense.com/licenses/apache-2.0

mxbai-embed-xsmall-v1 huggingface.co

mxbai-embed-xsmall-v1 huggingface.co is an AI model on huggingface.co that provides mxbai-embed-xsmall-v1's model effect (), which can be used instantly with this mixedbread-ai mxbai-embed-xsmall-v1 model. huggingface.co supports a free trial of the mxbai-embed-xsmall-v1 model, and also provides paid use of the mxbai-embed-xsmall-v1. Support call mxbai-embed-xsmall-v1 model through api, including Node.js, Python, http.

mxbai-embed-xsmall-v1 huggingface.co Url

https://huggingface.co/mixedbread-ai/mxbai-embed-xsmall-v1

mixedbread-ai mxbai-embed-xsmall-v1 online free

mxbai-embed-xsmall-v1 huggingface.co is an online trial and call api platform, which integrates mxbai-embed-xsmall-v1's modeling effects, including api services, and provides a free online trial of mxbai-embed-xsmall-v1, you can try mxbai-embed-xsmall-v1 online for free by clicking the link below.

mixedbread-ai mxbai-embed-xsmall-v1 online free url in huggingface.co:

https://huggingface.co/mixedbread-ai/mxbai-embed-xsmall-v1

mxbai-embed-xsmall-v1 install

mxbai-embed-xsmall-v1 is an open source model from GitHub that offers a free installation service, and any user can find mxbai-embed-xsmall-v1 on GitHub to install. At the same time, huggingface.co provides the effect of mxbai-embed-xsmall-v1 install, users can directly use mxbai-embed-xsmall-v1 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

mxbai-embed-xsmall-v1 install url in huggingface.co:

https://huggingface.co/mixedbread-ai/mxbai-embed-xsmall-v1

Url of mxbai-embed-xsmall-v1

mxbai-embed-xsmall-v1 huggingface.co Url

Provider of mxbai-embed-xsmall-v1 huggingface.co

mixedbread-ai
ORGANIZATIONS

Other API from mixedbread-ai