/ Модель

Характеристики

Контекст
32 768 токенов
Параметры
494 млн
Лицензия
Apache 2.0
Архитектура
qwen2 · dense
Библиотека
transformers
Опубликована
14 мар 2025

mxbai-rerank-base-v2-seq

Классификация текстаТекст → label10 профессий

Многоязычный классификатор Mixedbread на базе Qwen2, который ранжирует документы по релевантности запросу для поиска и RAG.

64скачиваний за 30 дней8лайковвеса обновлены2 апр 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

michaelfeil/mxbai-rerank-base-v2-seq — вариант семейства Mixedbread mxbai-rerank, переписанный как классификатор на базе плотной архитектуры Qwen2. Модель предназначена для ранжирования текстов: она оценивает релевантность документов запросу и подходит для поиска и конвейеров RAG. В README заявлены поддержка кода, длинного контекста и более 100 языков; метаданные указывают 494 млн параметров и контекст до 32 768 токенов. Указанные в карточке языки включают английский, китайский, немецкий, японский, корейский, испанский, французский, арабский, бенгальский, русский, индонезийский, тайский, суахили и телугу.

README сообщает о сильных результатах на бенчмарках поиска и эффективности, но технический отчёт ещё готовится, а независимые условия сравнения в карточке описаны ограниченно. Модель опубликована в формате safetensors и распространяется по лицензии Apache-2.0. Для вызова через API классификации требуется специальный шаблон промпта; конкретный шаблон в доступном README не приведён.

Сценарии применения

  • переранжирование результатов поиска по запросу
  • выбор наиболее релевантных фрагментов для RAG
  • поиск по многоязычным документам
  • поиск фрагментов кода по описанию
  • ранжирование длинных текстов по соответствию запросу

Ограничения

Для API классификации нужен специальный шаблон промпта. Заявления о качестве и поддержке более 100 языков приведены в README, но технический отчёт к модели ещё не опубликован.

Для каких профессий подходит10

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Rewritten Mixedbread Reranker as classifier

This repo is the Mixedbread reranker rewritten as Classifier that is as of March 2025 the most powerful reranker, e.g. for RAG.

FP8 Deployment on H100

build_commands: []
environment_variables: {}
external_package_dirs: []
model_metadata:
  example_model_input:
    input: 'ERROR: This redirects to the embedding endpoint. Use the /sync API to
      reach /sync/predict'
model_name: BEI-mixedbread-ai-mxbai-rerank-base-v2-reranker-fp8-truss-example
python_version: py39
requirements: []
resources:
  accelerator: L4
  cpu: '1'
  memory: 10Gi
  use_gpu: true
secrets: {}
system_packages: []
trt_llm:
  build:
    base_model: encoder
    checkpoint_repository:
      repo: michaelfeil/mxbai-rerank-base-v2-seq
      revision: main
      source: HF
    max_num_tokens: 32768
    max_seq_len: 1000001
    num_builder_gpus: 4
    quantization_type: fp8

To push the deployment on Baseten.co

truss push --publish

More info: https://github.com/basetenlabs/truss-examples/tree/main/11-embeddings-reranker-classification-tensorrt/BEI-mixedbread-ai-mxbai-rerank-base-v2-reranker-fp8

Usage as classifier

For usage with Baseten.co or with github.com/michaelfeil/infinity, you should use the classification API. You need to manually create the following prompt template that is very specfic to this model. This template follows the reference implementation at https://github.com/mixedbread-ai/mxbai-rerank/tree/main.

def create_mxbai_v2_reranker_prompt_template(query: str, document: str, instruction: str = "") -> str:
    """
    Create a carefully formatted chat template string (without tokenizer) for ranking relevance.

    Parameters:
        query (str): The search query.
        document (str): The document text to evaluate.
        instruction (str): Special instructions (e.g., "You are an expert for Mockingbirds.")

    Returns:
        str: The formatted chat template.
    """
    instruction = f"instruction: {instruction}\n" if instruction else ""    
    # fixed system prompt, keep as is.
    system_prompt = "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."
    assert not "\n" in system_prompt
    assert not "\n" in instruction[:-1]
    assert isinstance(query, str)
    assert isinstance(document, str)
    templated = (
        # keep spacing, newlines as is.
        # template for mixedbread reranker v2
        # https://huggingface.co/michaelfeil/mxbai-rerank-base-v2-seq/
       f"<|endoftext|><|im_start|>system\n{system_prompt}\n"
        "<|im_end|>\n"
        "<|im_start|>user\n"
        f"{instruction}"
        f"query: {query} \n"
        f"document: {document} \n"
        "You are a search relevance expert who evaluates how well documents match search queries. "
        "For each query-document pair, carefully analyze the semantic relationship between them, then provide your binary relevance judgment (0 for not relevant, 1 for relevant).\n"
        "Relevance:<|im_end|>\n"
        "<|im_start|>assistant\n"
    )
    return templated

🍞 mxbai-rerank-base-v2

This is the base model in our family of powerful reranker models. You can learn more about the models in our blog post.

We have two models:

The technical report is coming soon!

🌟 Features

  • state-of-the-art performance and strong efficiency
  • multilingual support (100+ languages, outstanding English and Chinese performance)
  • code support
  • long-context support

⚙️ Usage

  1. Install mxbai-rerank
pip install mxbai-rerank
  1. Inference
from mxbai_rerank import MxbaiRerankV2

model = MxbaiRerankV2("mixedbread-ai/mxbai-rerank-base-v2")

query = "Who wrote 'To Kill a Mockingbird'?"
documents = [
    "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
    "The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil.",
    "Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
    "Jane Austen was an English novelist known primarily for her six major novels, which interpret, critique and comment upon the British landed gentry at the end of the 18th century.",
    "The 'Harry Potter' series, which consists of seven fantasy novels written by British author J.K. Rowling, is among the most popular and critically acclaimed books of the modern era.",
    "'The Great Gatsby', a novel written by American author F. Scott Fitzgerald, was published in 1925. The story is set in the Jazz Age and follows the life of millionaire Jay Gatsby and his pursuit of Daisy Buchanan."
]

# Lets get the scores
results = model.rank(query, documents, return_documents=True, top_k=3)

print(results)

Performance

Benchmark Results

ModelBEIR AvgMultilingualChineseCode SearchLatency (s)
mxbai-rerank-large-v257.4929.7984.1632.050.89
mxbai-rerank-base-v255.5728.5683.7031.730.67
mxbai-rerank-large-v149.3221.8872.5330.722.24

*Latency measured on A100 GPU

Training Details

The models were trained using a three-step process:

  1. GRPO (Guided Reinforcement Prompt Optimization)
  2. Contrastive Learning
  3. Preference Learning

For more details, check our technical blog post.

Paper following soon.

🎓 Citation

@online{rerank2025mxbai,
  title={Every Byte Matters: Introducing mxbai-embed-xsmall-v1},
  author={Sean Lee and Aamir Shakir and Julius Lipp and Rui Huang},
  year={2025},
  url={https://www.mixedbread.com/blog/mxbai-rerank-v2},
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
Qwen2ForSequenceClassification
Ревизия весов
a9f8986

0 моделей