/ Модель

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

Контекст
40 960 токенов
Параметры
3,7 млрд
Размер весов
8 ГБ
Лицензия
Apache 2.0
Архитектура
qwen3 · dense
Базовая модель
Qwen3-4B
Опубликована
24 окт 2025

E2Rank-4B

ЭмбеддингиТекст → embedding8 профессий

Текстовая модель Alibaba-NLP на базе Qwen3-4B для создания эмбеддингов и эффективного спискового переранжирования документов.

147скачиваний за 30 дней3лайкавеса обновлены28 окт 2025

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

Alibaba-NLP/E2Rank-4B — модель для текстовых эмбеддингов и спискового переранжирования, разработанная Alibaba-NLP на основе Qwen3-4B. Она преобразует запросы и документы в векторы, которые можно сопоставлять по косинусному сходству для поиска и ранжирования. При переранжировании список кандидатов включается в специальный запрос, чтобы учесть взаимный контекст документов.

Модель имеет плотную архитектуру Qwen3, около 3,7 млрд параметров, размер эмбеддинга 2560 и контекст до 40 960 токенов. Карточка описывает её как поддерживающую инструкции; модель обучена для эмбеддингов и переранжирования. Авторы сообщают о результатах на BEIR и MTEB, но это не гарантирует аналогичного качества на конкретных данных. Для получения эмбеддингов нужно вручную добавлять специальный токен в конец каждого входного текста.

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

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

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

Ограничения

Для эмбеддингов требуется вручную добавлять специальный токен в конец каждого входного текста. Предоставленные данные не подтверждают поддержку языков помимо английского и не позволяют оценить качество на конкретном наборе документов.

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

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

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

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

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

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

Открыть на Hugging Face

🤖 Website | 📄 Arxiv Paper | 🤗 Huggingface Collection | 🚩 Citation

📌 Introduction

We introduce E2Rank, meaning Efficient Embedding-based Ranking (also meaning Embedding-to-Rank), which extends a single text embedding model to perform both high-quality retrieval and listwise reranking, thereby achieving strong effectiveness with remarkable efficiency.

By applying cosine similarity between the query and document embeddings as a unified ranking function, the listwise ranking prompt, which is constructed from the original query and its candidate documents, serves as an enhanced query enriched with signals from the top-K documents, akin to pseudo-relevance feedback (PRF) in traditional retrieval models. This design preserves the efficiency and representational quality of the base embedding model while significantly improving its reranking performance.

Empirically, E2Rank achieves state-of-the-art results on the BEIR reranking benchmark and demonstrates competitive performance on the reasoning-intensive BRIGHT benchmark, with very low reranking latency. We also show that the ranking training process improves embedding performance on the MTEB benchmark. Our findings indicate that a single embedding model can effectively unify retrieval and reranking, offering both computational efficiency and competitive ranking accuracy.

Our work highlights the potential of single embedding models to serve as unified retrieval-reranking engines, offering a practical, efficient, and accurate alternative to complex multi-stage ranking systems.

🚀 Quick Start

Model List

Supported TaskModel NameSizeLayersSequence LengthEmbedding DimensionInstruction Aware
Embedding + RerankingAlibaba-NLP/E2Rank-0.6B0.6B2832K1024Yes
Embedding + RerankingAlibaba-NLP/E2Rank-4B4B3632K2560Yes
Embedding + RerankingAlibaba-NLP/E2Rank-8B8B3632K4096Yes
Embedding OnlyAlibaba-NLP/E2Rank-0.6B-Embedding-Only0.6B2832K1024Yes
Embedding OnlyAlibaba-NLP/E2Rank-0.6B-Embedding-Only4B3632K2560Yes
Embedding OnlyAlibaba-NLP/E2Rank-0.6B-Embedding-Only8B3632K4096Yes

Note:

  • Embedding Only indicates that the model is trained only with the constrative learning and support embedding tasks, while Embedding + Reranking indicates the full E2Rank model trained with both embedding and reranking objectives (for more detals, please refer to the paper).
  • Instruction Aware notes whether the model supports customizing the input instruction according to different tasks.

Usage

Embedding Model

The usage of E2Rank as an embedding model is similar to Qwen3-Embedding. The only difference is that Qwen3-Embedding will automatically append an EOS token, while E2Rank requires users to manully append the special token <|endoftext|> at the end of each input text.

vLLM Usage (recommended)

# Requires vllm>=0.8.5
import torch
import vllm
from vllm import LLM
from vllm.config import PoolerConfig

def get_detailed_instruct(task_description: str, query: str) -> str:
    return f'Instruct: {task_description}\nQuery:{query}'

# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'

queries = [
    get_detailed_instruct(task, 'What is the capital of China?'),
    get_detailed_instruct(task, 'Explain gravity')
]
# No need to add instruction for retrieval documents
documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]
input_texts = queries + documents
input_texts = [t + "<|endoftext|>" for t in input_texts]

model = LLM(
    model="Alibaba-NLP/E2Rank-4B",
    task="embed", 
    override_pooler_config=PoolerConfig(pooling_type="LAST", normalize=True)
)

outputs = model.embed(input_texts)
embeddings = torch.tensor([o.outputs.embedding for o in outputs])
scores = (embeddings[:2] @ embeddings[2:].T)
print(scores.tolist())
# Requires transformers>=4.51.0
import torch
import torch.nn.functional as F

from torch import Tensor
from transformers import AutoTokenizer, AutoModel


def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor:
    left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
    if left_padding:
        return last_hidden_states[:, -1]
    else:
        sequence_lengths = attention_mask.sum(dim=1) - 1
        batch_size = last_hidden_states.shape[0]
        return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]


def get_detailed_instruct(task_description: str, query: str) -> str:
    return f'Instruct: {task_description}\nQuery:{query}'

# Each query must come with a one-sentence instruction that describes the task
task = 'Given a web search query, retrieve relevant passages that answer the query'

queries = [
    get_detailed_instruct(task, 'What is the capital of China?'),
    get_detailed_instruct(task, 'Explain gravity')
]
# No need to add instruction for retrieval documents
documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]
input_texts = queries + documents
input_texts = [t + "<|endoftext|>" for t in input_texts]

tokenizer = AutoTokenizer.from_pretrained('Alibaba-NLP/E2Rank-4B', padding_side='left')
model = AutoModel.from_pretrained('Alibaba-NLP/E2Rank-4B')

max_length = 8192

# Tokenize the input texts
batch_dict = tokenizer(
    input_texts,
    padding=True,
    truncation=True,
    max_length=max_length,
    return_tensors="pt",
)
batch_dict.to(model.device)
with torch.no_grad():
    outputs = model(**batch_dict)
    embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])

    # normalize embeddings
    embeddings = F.normalize(embeddings, p=2, dim=1)
    scores = (embeddings[:2] @ embeddings[2:].T)

print(scores.tolist())

Reranking

For using E2Rank as a reranker, you only need to perform additional processing on the query by adding (part of) the docs that needs to be reranked to the listwise prompt, while the rest is the same as using the embedding model.

vLLM Usage (recommended)

# Requires vllm>=0.8.5
import torch
import vllm
from vllm import LLM
from vllm.config import PoolerConfig

model = LLM(
    model="./checkpoints/E2Rank-4B",
    task="embed", 
    override_pooler_config=PoolerConfig(pooling_type="LAST", normalize=True)
)
tokenizer = model.get_tokenizer()

def get_listwise_prompt(task_description: str, query: str, documents: list[str], num_input_docs: int = 20) -> str:
    input_docs = documents[:num_input_docs]
    input_docs = "\n".join([f"[{i}] {doc}" for i, doc in enumerate(input_docs, start=1)])
    messages = [{
        "role": "user", 
        "content": f'{task_description}\nDocuments:\n{input_docs}Search Query:{query}'
    }]
    text = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True,
        enable_thinking=False,
    )
    return text

task = 'Given a web search query and some relevant documents, rerank the documents that answer the query:'

queries = [
    'What is the capital of China?',
    'Explain gravity'
]

# No need to add instruction for retrieval documents
documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]
documents = [doc + "<|endoftext|>" for doc in documents]

pseudo_queries = [
    get_listwise_prompt(task, queries[0], documents),
    get_listwise_prompt(task, queries[1], documents)
]  # no need to add the EOS token here

input_texts = pseudo_queries + documents

outputs = model.embed(input_texts)
embeddings = torch.tensor([o.outputs.embedding for o in outputs])
scores = (embeddings[:2] @ embeddings[2:].T)
print(scores.tolist())
# Requires transformers>=4.51.0
import torch
import torch.nn.functional as F

from torch import Tensor
from transformers import AutoTokenizer, AutoModel


tokenizer = AutoTokenizer.from_pretrained('./checkpoints/E2Rank-4B', padding_side='left')
model = AutoModel.from_pretrained('./checkpoints/E2Rank-4B')


def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor:
    left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
    if left_padding:
        return last_hidden_states[:, -1]
    else:
        sequence_lengths = attention_mask.sum(dim=1) - 1
        batch_size = last_hidden_states.shape[0]
        return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]


def get_listwise_prompt(task_description: str, query: str, documents: list[str], num_input_docs: int = 20) -> str:
    input_docs = documents[:num_input_docs]
    input_docs = "\n".join([f"[{i}] {doc}" for i, doc in enumerate(input_docs, start=1)])
    messages = [{
        "role": "user", 
        "content": f'{task_description}\nDocuments:\n{input_docs}Search Query:{query}'
    }]
    text = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True,
        enable_thinking=False,
    )
    return text

task = 'Given a web search query and some relevant documents, rerank the documents that answer the query:'

queries = [
    'What is the capital of China?',
    'Explain gravity'
]

# No need to add instruction for retrieval documents
documents = [
    "The capital of China is Beijing.",
    "Gravity is a force that attracts two bodies towards each other. It gives weight to physical objects and is responsible for the movement of planets around the sun."
]
documents = [doc + "<|endoftext|>" for doc in documents]

pseudo_queries = [
    get_listwise_prompt(task, queries[0], documents),
    get_listwise_prompt(task, queries[1], documents)
]  # no need to add the EOS token here

input_texts = pseudo_queries + documents


max_length = 8192
# Tokenize the input texts
batch_dict = tokenizer(
    input_texts,
    padding=True,
    truncation=True,
    max_length=max_length,
    return_tensors="pt",
)
batch_dict.to(model.device)
with torch.no_grad():
    outputs = model(**batch_dict)
    embeddings = last_token_pool(outputs.last_hidden_state, batch_dict['attention_mask'])

    # normalize embeddings
    embeddings = F.normalize(embeddings, p=2, dim=1)
    scores = (embeddings[:2] @ embeddings[2:].T)

print(scores.tolist())

End-to-end search

Since E2Rank extends a single text embedding model to perform both high-quality retrieval and listwise reranking, you can directly use it to build an end-to-end search system. By reusing the embeddings computed during the retrieval stage, E2Rank only need to compute the pseudo query's embedding and can efficiently rerank the retrieved documents with minimal additional computational overhead.

Example code is coming soon.

📊 Evaluation

Reranking Benchmark

BEIR

CovidNFCorpusToucheDBPediaSciFactSignalNewsRobustAvg.
BM2559.4730.7544.2231.8067.8933.0539.5240.7043.43
Zero-shot Listwise Reranker
RankGPT-4o83.4139.6732.2645.5677.4134.2051.9260.2553.09
RankGPT-4o-mini80.0338.7330.9144.5473.1433.6450.9157.4151.16
RankQwen3-14B84.4538.9438.3044.5278.6433.5851.2459.6653.67
RankQwen3-32B83.4839.2237.1345.0078.2232.1251.0860.7453.37
Fine-tuned Listwise Reranker based on Qwen3
RankQwen3-0.6B78.3536.4137.5439.1971.0130.9644.4346.3148.03
RankQwen3-4B83.9139.8832.6643.9176.3732.1550.8159.3652.38
RankQwen3-8B85.3740.0531.7345.4478.9632.4852.3660.7253.39
Ours
E2Rank-0.6B79.1738.6041.9141.9673.4335.2652.7553.6752.09
E2Rank-4B83.3039.2043.1642.9577.1934.4852.7160.1654.14
E2Rank-8B84.0939.0842.0643.4477.4934.0154.2560.3454.35

Embedding Benchmark

MTEB (Eng, v1)

ModelsRetr.Rerank.Clust.PairClass.Class.STSSumm.Avg.
Instructor-xl49.2657.2944.7486.6273.1283.0632.3261.79
BGE-large-en-v1.554.2960.0346.0887.1275.9783.1131.6164.23
GritLM-7B53.1061.3048.9086.9077.0082.8029.4064.70
E5-Mistral-7b-v152.7860.3847.7888.4776.8083.7731.9064.56
Echo-Mistral-7b-v155.5258.1446.3287.3477.4382.5630.7364.68
LLM2Vec-Mistral-7B55.9958.4245.5487.9976.6384.0929.9664.80
LLM2Vec-Meta-LLaMA-3-8B56.6359.6846.4587.8075.9283.5830.9465.01
E2Rank-0.6B51.7455.9740.8583.9373.6681.4130.9061.25
E2Rank-4B55.3359.1044.2787.1477.0884.0330.0664.47
E2Rank-8B56.8959.5844.7586.9676.8184.5230.2365.03

Note: For baselines, we only compared with models that are trained using public datasets.

🚩 Citation

If this work is helpful, please kindly cite as:

@misc{liu2025e2rank,
      title={E2Rank: Your Text Embedding can Also be an Effective and Efficient Listwise Reranker}, 
      author={Qi Liu and Yanzhao Zhang and Mingxin Li and Dingkun Long and Pengjun Xie and Jiaxin Mao},
      year={2025},
      eprint={2510.22733},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2510.22733}, 
}

If you have any questions, feel free to contact us via qiliu6777[AT]gmail.com or create an issue.

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

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

GPU в ailist

Универсальный рантайм

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

Подбираем GPU…

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

0 моделей