Mixedbread Reranking Models
Crispy reranking models from Mixedbread. State-of-the-art models for search relevance, powered by reinforcement learning.
Features
- State-of-the-art performance - Outperforms leading open and closed-source rerankers on major benchmarks
- 100+ languages - Strong multilingual support out of the box
- Long context - Handle up to 8k tokens (32k-compatible)
- Code & SQL - Excellent at ranking code snippets and technical content
- Function Call Ranking - Supports reranking of function calls for multi-tool agents
- Fast inference - 8x faster than comparable models
- Easy integration - Drop-in improvement for existing search systems
- Open source - Apache 2.0-licensed, easy to customize
- Managed API - For production use with additional features. We support embeddings, reranking, and an end-to-end multi-modal retrieval solution.
Installation
pip install -U mxbai-rerank
Quick Start
from mxbai_rerank import MxbaiRerankV2
# Initialize the reranker
reranker = MxbaiRerankV2("mixedbread-ai/mxbai-rerank-base-v2") # or large-v2
# Example query and documents
query = "Who wrote 'To Kill a Mockingbird'?"
documents = [
"'To Kill a Mockingbird' is a novel by Harper Lee published in 1960.",
"The novel 'Moby-Dick' was written by Herman Melville.",
"Harper Lee was born in 1926 in Monroeville, Alabama."
]
results = reranker.rank(query=query, documents=documents)
print(results)
Models
We offer multiple model variants. For more details, see our mxbai-rerank-v2 technical blog post.
- mxbai-rerank-base-v2 (0.5B) - Best balance of speed and accuracy
- mxbai-rerank-large-v2 (1.5B) - Highest accuracy, still with excellent speed
Legacy Models
For more details, see our mxbai-rerank-v1 technical blog post.
- mxbai-rerank-xsmall-v1 (0.1B) - Fastest inference, lower accuracy
- mxbai-rerank-base-v1 (0.2B) - Smaller, faster model
- mxbai-rerank-large-v1 (1.5B) - Large model with highest accuracy
Performance
Benchmark Results
| Model | BEIR Avg | Multilingual | Chinese | Code Search | Latency (s) |
|---|---|---|---|---|---|
| mxbai-rerank-large-v2 | 57.49 | 29.79 | 84.16 | 32.05 | 0.89 |
| mxbai-rerank-base-v2 | 55.57 | 28.56 | 83.70 | 31.73 | 0.67 |
| mxbai-rerank-large-v1 | 49.32 | 21.88 | 72.53 | 30.72 | 2.24 |
*Latency measured on A100 GPU
Advanced Usage
Flash Attention Support
The v2 models automatically use Flash Attention 2 when available for faster inference:
pip install flash-attn --no-build-isolation
Long Context Support
reranker = MxbaiRerankV2(
"mixedbread-ai/mxbai-rerank-base-v2",
max_length=8192 # Default, can be adjusted up to model limits (32k for v2 models)
)
Instruction Support
results = reranker.rank(query=query, documents=documents, instruction="Figure out the best code snippet for the user query.")
API Access
For managed API access with additional features, such as object reranking and instructions:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
results = mxbai.rerank(
model="mixedbread-ai/mxbai-rerank-large-v2",
query="your query",
input=["doc1", "doc2", "doc3"]
)
Training Details
The models were trained using a three-step process:
- GRPO (Guided Reinforcement Prompt Optimization)
- Contrastive Learning
- Preference Learning
For more details, check our technical blog post.
Paper following soon.
Citation
If you use this work, please cite:
@online{v2rerank2025mxbai,
title={Baked-in Brilliance: Reranking Meets RL with mxbai-rerank-v2},
author={Sean Lee and Rui Huang and Aamir Shakir and Julius Lipp},
year={2024},
url={https://www.mixedbread.com/blog/mxbai-rerank-v2},
}
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a pull request or report an issue on GitHub.
Community & Support
Metadata
Release files for mxbai-rerank 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mxbai_rerank-0.1.6.tar.gz | 21.4 kB | Without provenance | Details for mxbai_rerank-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mxbai_rerank-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for mxbai_rerank-0.1.6-py3-none-any.whl |
Total release size: 39.9 kB
Release files / mxbai_rerank-0.1.6.tar.gz
| Download URL | mxbai_rerank-0.1.6.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d08e8464796429a7415314ce6de682bf9b538eb4ee5a7ddcd1a07839ee02879
|
|
BLAKE2b-256 checksum How to use checksums |
0f76a19c864a1025222d3304a888ed4ed9217bfdf55dbaf4ed37500ee03935e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / mxbai_rerank-0.1.6-py3-none-any.whl
| Download URL | mxbai_rerank-0.1.6-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aee94e7a14d5fba6520052ff2098f0f03db6cd9cc39553b7d2e82389deec9e05
|
|
BLAKE2b-256 checksum How to use checksums |
a62a503622b3a80272c662dabef421c9635168e5cbf6d51f0aa1883998561292
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for mxbai-rerank 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.