/ Модель

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

Контекст
512 токенов
Параметры
77,5 млн
Лицензия
Apache 2.0
Архитектура
deberta-v2 · dense
Библиотека
transformers
Опубликована
29 фев 2024

mxbai-rerank-xsmall-v1

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

Компактный англоязычный реранкер Mixedbread AI, который переупорядочивает результаты поиска по релевантности запросу.

661 тыс.скачиваний за 30 дней59лайковвеса обновлены2 апр 2025

Бенчмарки

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

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

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

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

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

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

mxbai-rerank-xsmall-v1 — компактная модель-реранкер от Mixedbread AI из семейства crispy rerank. Она оценивает релевантность пары «запрос — текст» и предназначена для повторной сортировки результатов поиска, например, после полнотекстового поиска или первичного извлечения кандидатов. Модель построена на архитектуре DeBERTa-v2 с классификационной головой и содержит 77,5 млн параметров; максимальная длина контекста — 512 токенов. Для работы авторы рекомендуют актуальную версию sentence-transformers.

Модель ориентирована на улучшение поиска и, согласно README, хорошо сочетается с поиском по ключевым словам. В метаданных указан английский язык. Репозиторий содержит веса в форматах Safetensors и ONNX. Лицензия — Apache-2.0.

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

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

Ограничения

Контекст ограничен 512 токенами, а язык, заявленный в карточке, — английский. Модель предназначена для ранжирования пар запроса и текста, а не для генерации ответов.

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

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

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

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

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

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

Открыть на Hugging Face

mxbai-rerank-xsmall-v1

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

We have three models:

Quickstart

Currently, the best way to use our models is with the most recent version of sentence-transformers.

pip install -U sentence-transformers

Let's say you have a query, and you want to rerank a set of documents. You can do that with only one line of code:

from sentence_transformers import CrossEncoder

# Load the model, here we use our base sized model
model = CrossEncoder("mixedbread-ai/mxbai-rerank-xsmall-v1")


# 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. 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)

Install transformers.js

npm i @xenova/transformers

Let's say you have a query, and you want to rerank a set of documents. In JavaScript, you need to add a function:

import { AutoTokenizer, AutoModelForSequenceClassification } from '@xenova/transformers';

const model_id = 'mixedbread-ai/mxbai-rerank-xsmall-v1';
const model = await AutoModelForSequenceClassification.from_pretrained(model_id);
const tokenizer = await AutoTokenizer.from_pretrained(model_id);

/**
 * Performs ranking with the CrossEncoder on the given query and documents. Returns a sorted list with the document indices and scores.
 * @param {string} query A single query
 * @param {string[]} documents A list of documents
 * @param {Object} options Options for ranking
 * @param {number} [options.top_k=undefined] Return the top-k documents. If undefined, all documents are returned.
 * @param {number} [options.return_documents=false] If true, also returns the documents. If false, only returns the indices and scores.
 */
async function rank(query, documents, {
    top_k = undefined,
    return_documents = false,
} = {}) {
    const inputs = tokenizer(
        new Array(documents.length).fill(query),
        {
            text_pair: documents,
            padding: true,
            truncation: true,
        }
    )
    const { logits } = await model(inputs);
    return logits
        .sigmoid()
        .tolist()
        .map(([score], i) => ({
            corpus_id: i,
            score,
            ...(return_documents ? { text: documents[i] } : {})
        }))
        .sort((a, b) => b.score - a.score)
        .slice(0, top_k);
}

// Example usage:
const query = "Who wrote 'To Kill a Mockingbird'?"
const 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."
]

const results = await rank(query, documents, { return_documents: true, top_k: 3 });
console.log(results);

Using API

You can use the large model via our API as follows:

from mixedbread_ai.client import MixedbreadAI

mxbai = MixedbreadAI(api_key="{MIXEDBREAD_API_KEY}")

res = mxbai.reranking(
  model="mixedbread-ai/mxbai-rerank-large-v1",
  query="Who is the author of To Kill a Mockingbird?",
  input=[
    "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."
  ],
  top_k=3,
  return_input=false
)

print(res.data)

The API comes with additional features, such as a continous trained reranker! Check out the docs for more information.

Evaluation

Our reranker models are designed to elevate your search. They work extremely well in combination with keyword search and can even outperform semantic search systems in many cases.

ModelNDCG@10Accuracy@3
Lexical Search (Lucene)38.066.4
BAAI/bge-reranker-base41.666.9
BAAI/bge-reranker-large45.270.6
cohere-embed-v3 (semantic search)47.570.9
mxbai-rerank-xsmall-v143.970.0
mxbai-rerank-base-v146.972.3
mxbai-rerank-large-v148.874.9

The reported results are aggregated from 11 datasets of BEIR. We used Pyserini to evaluate the models. Find more in our blog-post and on this spreadsheet.

Community

Please join our Discord Community and share your feedback and thoughts! We are here to help and also always happy to chat.

Citation

@online{rerank2024mxbai,
  title={Boost Your Search With The Crispy Mixedbread Rerank Models},
  author={Aamir Shakir and Darius Koenig and Julius Lipp and Sean Lee},
  year={2024},
  url={https://www.mixedbread.ai/blog/mxbai-rerank-v1},
}

License

Apache 2.0

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей