Instructions to use Vladimirlv/ru-promptriever-qwen3-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vladimirlv/ru-promptriever-qwen3-4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Vladimirlv/ru-promptriever-qwen3-4b")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Vladimirlv/ru-promptriever-qwen3-4b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
ru-Promptriever-Qwen3-4B
Full Benchmark Comparison
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 nDCG@20 |
mFollowIR-RU p-MRR |
InstructIR nDCG@10 |
InstructIR Robustness@10 |
RuBQ nDCG@10 |
SciFact nDCG@10 |
NFCorpus nDCG@10 |
FollowIR Robust04 MAP@1000 |
FollowIR Robust04 p-MRR |
FollowIR Core17 MAP@1000 |
FollowIR Core17 p-MRR |
FollowIR News21 nDCG@5 |
FollowIR News21 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.
Overview
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:
- Architecture: Qwen3-based causal LM fine-tuned as a bi-encoder with LoRA + GradCache
- Pooling: last-token (EOS) pooling
- Key training signal: instruction negatives — passages that are topically relevant to the query but violate the instruction constraint
Model Family
| 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 Model
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:
- Russian real data — MIRACL + MrTyDi (~11k pairs)
- Russian synthetic data — instruction-augmented and standard pairs (~30k)
- English instruction-following data from the original Promptriever / FollowIR dataset (~24k, ~35% of mix)
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.
Usage
Basic Retrieval (no instruction)
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])
Instruction-Following Retrieval
# 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
Using with sentence-transformers
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.
Model Details
| 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 |
Training Data
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:
- Russian real data (~11k) — from MIRACL and MrTyDi retrieval datasets
- Russian synthetic data (~30k) — instruction-augmented and standard pairs from ru-promptriever-dataset
- English synthetic data (~24k, ~35% of total) — from the original Promptriever / FollowIR training data
Key properties:
- Instruction negatives: passages that are topically relevant but violate the instruction (3 per instructed query)
- Paired rows: each source query has both a standard row and an instructed row to prevent catastrophic forgetting
Intended Use
- Instruction-following dense retrieval in Russian: RAG pipelines, search systems, and scenarios requiring fine-grained query control via natural language
- Research on multilingual instruction-following retrieval and bi-encoder training
- Benchmarking alongside mE5, BGE-M3, and Promptriever-style models
Out-of-Scope
- General-purpose text embedding (use mE5-large or BGE-M3 if no instruction-following is needed)
- Commercial applications (see License below)
Limitations
- MS MARCO origin: The training corpus derives from English web passages machine-translated to Russian. A portion of passages retain translation artifacts despite LLM-based rewriting.
- Standard retrieval trade-off: Instruction-following training slightly reduces standard retrieval quality compared to encoder-only models (mE5-large, BGE-M3).
- Synthetic-data quality: Four independent non-author Russian-speaking annotators assessed 64 final instances, with two annotators assigned to the first 32 and two to the remaining 32, giving two independent judgments per instance. Corrected aggregate counts show 95.3% positive-document compliance (122/128 judgments) and 85.2% synthetic-negative rejection (283/332 judgments) under the complete query-instruction condition. This sampled audit characterizes dataset quality; individual synthetic examples may still require filtering for a particular application.
License
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.
Citation
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}
}
Model tree for Vladimirlv/ru-promptriever-qwen3-4b
Base model
Qwen/Qwen3-4B-BaseDataset used to train Vladimirlv/ru-promptriever-qwen3-4b
Papers for Vladimirlv/ru-promptriever-qwen3-4b
Promptriever: Instruction-Trained Retrievers Can Be Prompted Like Language Models
FollowIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions
Evaluation results
- Original-instruction nDCG@20 on mFollowIR-RUtest set self-reported0.535
- p-MRR (percentage points) on mFollowIR-RUtest set self-reported17.280
- nDCG@10 on InstructIRtest set self-reported0.942
- Robustness@10 on InstructIRtest set self-reported0.719