From: Alibaba-NLP <huggingface.co/Alibaba-NLP>Newsgroups: alt.freeweights.embedSubject:

E2Rank-4B

Date: 2026-11-15Commit: a391c99Signed: 2DC28CC7B26A283B ✓

Feature extraction model with 4B parameters. Safetensors weights, 8.06 GB in all. Published by Alibaba-NLP under Apache-2.0.

4B params8.06GBE2Rank-4Bsafetensorspermissive
FactsParams4BSize8.06 GBFormatssafetensorsTaskfeature extractionLicenseApache-2.0From sourcepermissive
$ fw get Alibaba-NLP/E2Rank-4B
# manifest sha256 da1b77c8cffe… · 8.06 GB · 13 files
$ fw verify ./E2Rank-4B Alibaba-NLP/E2Rank-4B
From sourceHosted (signed)Alibaba-NLP/E2Rank-4BLast check: 2026-11-15 04:16 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Fine-tune of Qwen3-4B.

Works with

Evaluate with

Overview

Size
8.06 GB
Weights
8.04 GB (safetensors)
Parameters
4B
Formats
safetensors
Task
feature extraction
License
Apache-2.0 (permissive)
Files
13, each with a sha256
Publisher
Alibaba-NLP
Added
2026-11-15
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Base model: Qwen/Qwen3-4B

Where these bytes come from
Publisher at the pinned commitโ†’You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 04:16 UTCpassed

Model card

From the publisher at commit a391c99. Shown as plain text with links; images open at the publisher.

E2Rank: Your Text Embedding can Also be an Effective and Efficient Listwise Reranker#

๐Ÿค– 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())

Transformers Usage

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

Transformers Usage

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

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.

Files

13 files ยท 8.06 GBWeights 8.04 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 13 files with their sha256
FileSizesha256
.gitattributes1.57 KB34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930
README.md17.7 KB4cf8514e60dffb758523efc01476c748843904f46f8d655119ad1405156e1965
added_tokens.json707 Bc0284b582e14987fbd3d5a2cb2bd139084371ed9acbae488829a1c900833c680
chat_template.jinja4.17 KBa55ee1b1660128b7098723e0abcd92caa0788061051c62d51cbe87d9cf1974d8
config.json721 B23e64d6cdc311eb6dd7710e4f6dc32f35ab57e79c3ec93a73b7e3346dd551eb3
merges.txt1.67 MB8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
model-00001-of-00002.safetensors4.97 GB261b7024cdd68c4237c36f32b1d80ef61ff830afefc1cfd9db68f53a47dc6e20
model-00002-of-00002.safetensors3.08 GB904c348efcbe0c5d50ffcd9635b3b6442ea892c1bb434bc4b7d7572beeab26b1
model.safetensors.index.json30.4 KB2ab62efae81fff88fb75aba67556a616bde0ed518e3fa427295f928bea85080b
special_tokens_map.json613 B76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json11.4 MB40536e5564c6a3f8f384c2b4e8a72b54234bc70e7744771306ed26f2c4ca326b
tokenizer_config.json5.59 KB6475b22cb5915109363d1b388a45a5ef3f87031c478675ee80992cd6cbc75e98
vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
a391c990dc pinned now2026-11-15 04:16 UTC13 files ยท 8.06 GB

Use it

$ fw get Alibaba-NLP/E2Rank-4B
# manifest sha256 da1b77c8cffe… · 8.06 GB · 13 files
$ fw verify ./E2Rank-4B Alibaba-NLP/E2Rank-4B
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/Alibaba-NLP/E2Rank-4B.json --dir ./E2Rank-4B $ python3 fw.py verify ./E2Rank-4B ./Alibaba-NLP__E2Rank-4B.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Alibaba-NLP/E2Rank-4B --revision a391c990dc87ec26d3d664ed9a2fe67e98e75e61 --local-dir ./E2Rank-4B
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("Alibaba-NLP/E2Rank-4B", revision="a391c990dc87ec26d3d664ed9a2fe67e98e75e61") model = AutoModel.from_pretrained("Alibaba-NLP/E2Rank-4B", revision="a391c990dc87ec26d3d664ed9a2fe67e98e75e61", device_map="auto")

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
4cf8514e60dffb758523efc01476c748843904f46f8d655119ad1405156e1965
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: Alibaba-NLP <huggingface.co/Alibaba-NLP>Newsgroups: alt.freeweights.embedSubject: E2Rank-4BDate: 2026-11-15Commit: a391c99Signed: 2DC28CC7B26A283B ✓
Upstream
Alibaba-NLP/E2Rank-4B
Pinned commit
a391c990dc87ec26d3d664ed9a2fe67e98e75e61
Manifest
E2Rank-4B.json ยท .minisig
Manifest sha256
da1b77c8cffe9b46029c2a250ab7f6a86b17a75b37d550e6614edfd43547ed00
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 04:16 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/Alibaba-NLP/E2Rank-4B.json $ curl -O https://freeweights.allternit.com/manifests/Alibaba-NLP/E2Rank-4B.json.minisig $ minisign -Vm E2Rank-4B.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

Qwen/Qwen3-4B ยท this model is a finetune of it

No model in the catalog names this one as its parent.

Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Alibaba-NLP/E2Rank-4B
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. E2Rank-4B.json. Provenance. Takedown history: none.
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens