Downloads · 30 days
0
Vladimirlv/ru-promptriever-qwen3-4b
ru-promptriever-qwen3-4b is a feature extraction model from Vladimirlv. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
[](https://arxiv.org/abs/2409.11136) [](https://huggingface.co/datasets/Vladimirlv/ru-promptriever-dataset) [](https://github.com/Vdmrl/ru-promptriever)
Downloads · 30 days
0
Access
Public
Updated Nov 2, 2026
Repo size
10.3 GB
Likes
2
Public
Click a slice to open those files.
.safetensors132 MB · 92%
From the Hugging Face model README
Compare ru-Promptriever with Promptriever, Qwen3-Embedding, multilingual-E5, BGE-M3, BM25, TART-Contriever, INSTRUCTOR-XL, E5-Mistral, and RepLLaMA. The best available score in each metric column is bold. Higher is better.
Each column names its benchmark and metric. p-MRR is shown in percentage points; other metrics use the 0–1 scale. Scroll horizontally to see all columns, or download the table as CSV.
| Model | mFollowIR-RU<br>nDCG@20 | mFollowIR-RU<br>p-MRR | InstructIR<br>nDCG@10 | InstructIR<br>Robustness@10 | RuBQ<br>nDCG@10 | SciFact<br>nDCG@10 | NFCorpus<br>nDCG@10 | FollowIR Robust04<br>MAP@1000 | FollowIR Robust04<br>p-MRR | FollowIR Core17<br>MAP@1000 | FollowIR Core17<br>p-MRR | FollowIR News21<br>nDCG@5 | FollowIR News21<br>p-MRR |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ru-Promptriever-4B (Ru+En) | 0.5350 | +17.28 | 0.9425 | 0.7193 | 0.6996 | 0.7338 | 0.3277 | 0.3301 | +14.11 | 0.3596 | +12.85 | 0.4827 | +6.58 |
| ru-Promptriever-4B (Ru-only) | 0.5354 | +14.00 | 0.9292 | 0.6711 | 0.6912 | 0.7252 | 0.3003 | 0.3025 | +13.34 | 0.3470 | +12.57 | 0.4911 | +4.51 |
| ru-Promptriever-1.7B | 0.5016 | +12.97 | 0.8991 | 0.5995 | 0.6377 | 0.6900 | 0.2253 | 0.2825 | +4.62 | 0.3139 | +8.11 | 0.4412 | +2.80 |
| Promptriever-8B | 0.5348 | +12.43 | 0.9188 | 0.6271 | 0.5020 | 0.7150 | 0.3180 | 0.3837 | +13.40 | 0.3618 | +15.34 | 0.4974 | +5.89 |
| Promptriever-7B | 0.9039 | 0.5824 | 0.3997 | +11.90 | 0.3736 | +15.12 | 0.5421 | +6.53 | |||||
| Qwen3-Embedding-4B | 0.5490 | +8.10 | 0.8260 | 0.4760 | 0.7000 | 0.7380 | 0.3630 | 0.3800 | +4.22 | 0.3500 | +7.29 | 0.5120 | +1.04 |
| mE5-large | 0.4300 | -2.47 | 0.7210 | 0.7020 | 0.3270 | ||||||||
| BGE-M3 | 0.4813 | -2.45 | 0.7120 | 0.6420 | 0.3170 | ||||||||
| BM25 | 0.4520 | +0.67 | 0.7600 | 0.2690 | 0.3630 | 0.6620 | 0.3060 | -3.10 | -1.10 | -2.10 | |||
| TART-Contriever | 0.8480 | 0.4750 | -9.00 | -3.00 | -3.00 | ||||||||
| INSTRUCTOR-XL | 0.4860 | 0.2150 | -8.10 | +0.70 | -0.90 | ||||||||
| E5-Mistral | 0.8630 | 0.5540 | -9.60 | +0.10 | -0.90 | ||||||||
| RepLLaMA | 0.8570 | 0.5020 | -8.90 | +1.30 | -1.80 |
Results combine paper-reported baselines with saved reruns. Qwen3-Embedding-4B uses the values reported in the paper. Empty cells indicate an unreported score or an incompatible evaluation protocol; legacy FollowIR MAP/nDCG values with the older qrels mapping are omitted. Updated mFollowIR-RU and FollowIR reruns use MTEB 2.10.5 and original-instruction judgments. Evaluation records identify each source.
Standard dense retrieval models score query–passage pairs using a single semantic similarity signal, giving users no control over what "relevant" means beyond keyword choice. Promptriever (Weller et al., 2024) introduced per-instance natural language instructions that dynamically redefine relevance — a capability previously limited to generative LLMs.
ru-Promptriever extends this paradigm to Russian:
| Model | Parameters | Link |
|---|---|---|
| ru-Promptriever-4B | 4B | this model |
| ru-Promptriever-4B-pretrained | 4B | link |
| ru-Promptriever-4B-ru-only | 4B | link |
| ru-Promptriever-1.7B | 1.7B | link |
This is the final, best-performing model in the ru-Promptriever family. Starting from ru-Promptriever-4B-pretrained, it was further fine-tuned on a balanced multilingual mix of:
Under the current harmonized evaluation protocol, this model obtains 17.28 p-MRR on mFollowIR-RU while matching Promptriever-8B's retrieval quality at half the parameter count.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch.nn.functional as F
model_name = "Vladimirlv/ru-promptriever-qwen3-4b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
def encode(texts: list[str], max_length: int = 512) -> torch.Tensor:
"""Encode texts using last-token (EOS) pooling."""
inputs = tokenizer(
texts,
padding=True,
truncation=True,
max_length=max_length,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
# Bypass lm_head to get post-norm hidden states
original_lm_head = model.lm_head
model.lm_head = torch.nn.Identity()
outputs = model(**inputs, use_cache=False, return_dict=True)
model.lm_head = original_lm_head
# EOS pooling: take embedding at last non-padding token
seq_len = inputs["attention_mask"].sum(dim=1) - 1
embeddings = outputs.logits[torch.arange(len(texts)), seq_len]
return F.normalize(embeddings, p=2, dim=1)
query = "Когда была основана Москва?"
passages = [
"Москва была основана в 1147 году князем Юрием Долгоруким.",
"Санкт-Петербург был основан Петром I в 1703 году.",
]
q_emb = encode([query])
p_emb = encode(passages)
scores = (q_emb @ p_emb.T).squeeze()
print(scores) # tensor([0.82, 0.61])
# Append the instruction directly to the query (same format as training)
instruction = "Найди документ, в котором упоминается конкретная дата основания города."
instructed_query = f"{query} {instruction}"
q_emb = encode([instructed_query])
p_emb = encode(passages)
scores = (q_emb @ p_emb.T).squeeze()
# The model adjusts rankings based on the instruction
This model is not compatible with sentence-transformers out of the box due to the custom EOS pooling. Use the snippet above directly with transformers.
| Property | Value |
|---|---|
| Base model | ru-Promptriever-4B-pretrained (continued training) |
| Architecture | CausalLM bi-encoder (EOS pooling) |
| Fine-tuning method | LoRA (rank-32, α=64, all linear layers) |
| Training data | ~65k mixed rows (Russian real + Russian synthetic + English synthetic) |
| Effective batch size | 128 (8 per device × 4 accum × 4 GPUs) |
| Loss | InfoNCE contrastive (temperature=0.01) |
| Learning rate | 5e-5 |
| Epochs | 1 |
| Max query length | 512 tokens |
| Max passage length | 256 tokens |
This model was trained in two stages:
Stage 1 — Pretraining (ru-Promptriever-4B-pretrained): LoRA fine-tuning of Qwen3-4B on ~500k synthetic instruction-augmented Russian retrieval triples from ru-promptriever-dataset, built on top of mMARCO-ru.
Stage 2 — Continued training (this model): further LoRA fine-tuning on a balanced multilingual mix of ~65k rows:
Key properties:
This model is released under CC BY-NC 4.0 (Creative Commons Attribution–NonCommercial 4.0 International).
The non-commercial restriction is inherited from the upstream MS MARCO license (Microsoft Research License — non-commercial use only), which governs the training corpus.
If you use this model, please cite the original Promptriever paper:
@article{weller2024promptriever,
title = {Promptriever: Instruction-Trained Retrievers Can Be Prompted Like Language Models},
author = {Weller, Orion and Van Durme, Benjamin and Lawrie, Dawn and
Paranjape, Ashwin and Zhang, Yuhao and Hessel, Jack},
journal = {arXiv preprint arXiv:2409.11136},
year = {2024}
}