NQ-open MiniLM reranker
A 22.7M-parameter cross-encoder that reranks Wikipedia passages for open-domain questions.
It is cross-encoder/ms-marco-MiniLM-L6-v2
fine-tuned on Natural Questions (NQ) training questions, as the second stage of a retrieve-then-rerank
pipeline built over a 100k-question NQ Wikipedia corpus.
Result: on 5,712 held-out questions, an answer appears in the top 10 reranked passages for 91.0% (95% CI 90.2–91.7) of questions, up from 84.2% for the first-stage retriever alone.
Usage
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
name = "NezarIn/nq-open-minilm-reranker"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForSequenceClassification.from_pretrained(name).eval()
query = "who wrote the declaration of independence"
passages = ["Declaration of Independence | The Declaration was drafted by Thomas Jefferson in 1776.",
"France | Paris is the capital of France."]
enc = tok([query] * len(passages), passages, truncation="only_second", max_length=512,
padding=True, return_tensors="pt")
with torch.no_grad():
scores = model(**enc).logits[:, 0] # higher = more relevant; sort passages by score
Passages were formatted as "<title> > <section path> | <passage text>" during training and
evaluation; the model also works on plain text.
Results
The candidates are the top 50 passages from a hybrid first stage (contriever-msmarco dense + BM25, reciprocal-rank fusion), with exact-duplicate passages removed. Every reranker below scores the same candidate lists.
Metric: answer-hit@k. The share of questions where a gold short answer appears (normalised, word-bounded string match) in at least one of the top k passages. This is the standard DPR-style retrieval accuracy for NQ-open; it is a retrieval metric, not answer exact match.
| Stage (top-50 candidates) | test hit@1 | test hit@10 (95% CI) | test hit@20 | val hit@10 (95% CI) |
|---|---|---|---|---|
| Hybrid retriever, duplicates removed | 47.3 | 84.2 (83.2–85.1) | 90.6 | 85.6 (84.5–86.7) |
| ColBERTv2, off the shelf | 57.9 | 88.4 (87.5–89.2) | 92.6 | 89.6 (88.6–90.6) |
| MiniLM base model, off the shelf | 57.7 | 88.4 (87.6–89.2) | 92.9 | 89.1 (88.0–90.1) |
| This model | 67.3 | 91.0 (90.2–91.7) | 94.1 | 91.7 (90.7–92.5) |
- test: 5,712 NQ-open questions from NQ train rows 80,000–99,999, never used for training or for any choice.
- val: 3,608 NQ-open questions from the official NQ validation split.
- Ceiling: the answer is in the 50 candidates for 95.5% (test) and 96.1% (val) of questions; no reranker can exceed that.
- Exploratory, not the headline: with 100 candidates instead of 50, test hit@10 is 92.1. That depth was compared on the test set, so it is not a held-out result.
- Latency: 13 ms median (20 ms p99) to rerank 50 passages for one question on an RTX PRO 6000 GPU.
Training
- Data: NQ-open questions (short answer of 5 tokens or fewer) from the first 80,000 rows of NQ train: 21,963 questions after holding out 1,000 for epoch selection, of which 19,198 formed usable training groups. 2,399 were skipped because no answer-bearing passage from the gold page was in the top 50; 366 because fewer than 7 negatives were available.
- Positive: the highest-ranked candidate that contains a gold answer and comes from the question's gold Wikipedia page (or is an identical copy of a gold-page passage).
- Negatives: the 7 highest-ranked candidates with no answer string and not from the gold page.
- Loss: softmax cross-entropy over each group of 1 positive + 7 negatives.
- Setup: 3 epochs, learning rate 1e-5 with linear warmup and decay, 16 questions (128 pairs) per step, max 512 tokens, bf16. Epoch 3 was kept; held-out dev hit@10 went 88.4 (base model) → 90.9 → 91.8 → 92.0.
- Compute: about 6 minutes of training on one RTX PRO 6000.
Data hygiene
- The base model was fine-tuned on MS MARCO. Its training README uses NQ only as an evaluation set. Every retriever and reranker in this pipeline was chosen to have no documented NQ training data, so that the only NQ data the system has seen is the training split described above.
- Test and validation questions were not used for training, epoch choice or depth choice.
Limitations
- String-match labels. Positives come from answer-string matches, so a few are coincidental mentions. The answer-hit metric has the same bias.
- Corpus scope. The passage corpus is the Wikipedia pages behind the first 100k NQ train questions plus the validation pages (3.2M passages, 2.0M distinct), not full Wikipedia. Results on full Wikipedia will be lower.
- Page versions. NQ pages are keyed by URL, which includes a revision id; 2.8% of questions point to a stored revision other than their own. A direct check found the answer missing from the stored page for 8 of the 5,712 test questions, only 1 of them because of the revision mismatch.
- English Wikipedia only, and questions in NQ's style (real Google search queries).