This model is finetuned starting from the well-known
ms-marco-MiniLM-L-6-v2 using KL distillation techniques as described
here,
using
bge-reranker-v2-m3 as teacher
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3model = AutoModelForSequenceClassification.from_pretrained("juanluisdb/MiniLM-L-6-rerank-m3")
4tokenizer = AutoTokenizer.from_pretrained("juanluisdb/MiniLM-L-6-rerank-m3")
5features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'], padding=True, truncation=True, return_tensors="pt")
6model.eval()
7with torch.no_grad():
8 scores = model(**features).logits
9 print(scores)
1from sentence_transformers import CrossEncoder
2model = CrossEncoder("juanluisdb/MiniLM-L-6-rerank-m3", max_length=512)
3scores = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])
I've run tests on different BEIR datasets. Cross Encoders rerank top100 BM25 results.
* Training splits of NQ and Fever were used as part of the training data.