juanluisdb
commited on
Commit
•
dfd64c8
1
Parent(s):
6ea9a53
Update README.md
Browse files
README.md
CHANGED
@@ -2,16 +2,48 @@
|
|
2 |
library_name: transformers
|
3 |
tags:
|
4 |
- cross-encoder
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
---
|
6 |
|
7 |
# Model Card for Model ID
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Evaluation
|
12 |
|
13 |
### BEIR (NDCG@10)
|
14 |
-
Cross Encoders rerank top100 BM25 results
|
15 |
|
16 |
| | nq* | fever* | fiqa | trec-covid | scidocs | scifact | nfcorpus | hotpotqa | dbpedia-entity | quora | climate-fever |
|
17 |
|:--------------------------|:----------|:----------|:----------|:-------------|:----------|:----------|:-----------|:-----------|:-----------------|:----------|:----------------|
|
@@ -22,4 +54,21 @@ Cross Encoders rerank top100 BM25 results
|
|
22 |
| ms-marco-MiniLM-L-6-v2 | 0.523 | 0.801 | 0.349 | 0.741 | 0.164 | 0.688 | 0.349 | 0.724 | 0.445 | 0.825 | 0.244 |
|
23 |
| MiniLM-L-6-rerank-reborn | 0.580 | **0.867** | 0.364 | 0.738 | 0.165 | **0.750** | 0.350 | 0.775 | 0.444 | **0.871** | 0.309 |
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
tags:
|
4 |
- cross-encoder
|
5 |
+
datasets:
|
6 |
+
- lightonai/ms-marco-en-bge
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
base_model:
|
10 |
+
- cross-encoder/ms-marco-MiniLM-L-6-v2
|
11 |
---
|
12 |
|
13 |
# Model Card for Model ID
|
14 |
|
15 |
+
This model is finetuned starting from the well-known [ms-marco-MiniLM-L-6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2) using KL distillation techniques as described [here](https://www.answer.ai/posts/2024-08-13-small-but-mighty-colbert.html),
|
16 |
+
using [bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) as teacher
|
17 |
+
|
18 |
+
# Usage
|
19 |
+
|
20 |
+
## Usage with Transformers
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
24 |
+
import torch
|
25 |
+
model = AutoModelForSequenceClassification.from_pretrained("juanluisdb/MiniLM-L-6-rerank-reborn")
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained("juanluisdb/MiniLM-L-6-rerank-reborn")
|
27 |
+
features = 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")
|
28 |
+
model.eval()
|
29 |
+
with torch.no_grad():
|
30 |
+
scores = model(**features).logits
|
31 |
+
print(scores)
|
32 |
+
```
|
33 |
+
|
34 |
+
|
35 |
+
## Usage with SentenceTransformers
|
36 |
+
|
37 |
+
```python
|
38 |
+
from sentence_transformers import CrossEncoder
|
39 |
+
model = CrossEncoder("juanluisdb/MiniLM-L-6-rerank-reborn", max_length=512)
|
40 |
+
scores = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])
|
41 |
+
```
|
42 |
|
43 |
# Evaluation
|
44 |
|
45 |
### BEIR (NDCG@10)
|
46 |
+
I've run tests on different BEIR datasets. Cross Encoders rerank top100 BM25 results.
|
47 |
|
48 |
| | nq* | fever* | fiqa | trec-covid | scidocs | scifact | nfcorpus | hotpotqa | dbpedia-entity | quora | climate-fever |
|
49 |
|:--------------------------|:----------|:----------|:----------|:-------------|:----------|:----------|:-----------|:-----------|:-----------------|:----------|:----------------|
|
|
|
54 |
| ms-marco-MiniLM-L-6-v2 | 0.523 | 0.801 | 0.349 | 0.741 | 0.164 | 0.688 | 0.349 | 0.724 | 0.445 | 0.825 | 0.244 |
|
55 |
| MiniLM-L-6-rerank-reborn | 0.580 | **0.867** | 0.364 | 0.738 | 0.165 | **0.750** | 0.350 | 0.775 | 0.444 | **0.871** | 0.309 |
|
56 |
|
57 |
+
\* Training splits of NQ and Fever were used as part of the training data.
|
58 |
+
|
59 |
+
Comparison with [ablated model](https://huggingface.co/juanluisdb/MiniLM-L-6-rerank-reborn-ablated/settings) trained only on MSMarco:
|
60 |
+
| | nq | fever | fiqa | trec-covid | scidocs | scifact | nfcorpus | hotpotqa | dbpedia-entity | quora | climate-fever |
|
61 |
+
|:------------------------------------|-------:|--------:|-------:|-------------:|----------:|----------:|-----------:|-----------:|-----------------:|--------:|----------------:|
|
62 |
+
| ms-marco-MiniLM-L-6-v2 | 0.5234 | 0.8007 | 0.349 | 0.741 | 0.1638 | 0.688 | 0.3493 | 0.7235 | 0.4445 | 0.8251 | 0.2438 |
|
63 |
+
| MiniLM-L-6-rerank-refreshed-ablated | 0.5412 | 0.8221 | 0.3598 | 0.7331 | 0.163 | 0.7376 | 0.3495 | 0.7583 | 0.4382 | 0.8619 | 0.2449 |
|
64 |
+
| improvement (%) | **3.40** | **2.67** | **3.08** | -1.07 | -0.47 | **7.22** | 0.08 | **4.80** | -1.41 | **4.45** | **0.47** |
|
65 |
+
|
66 |
+
|
67 |
+
# Datasets Used
|
68 |
+
|
69 |
+
~900k queries with 32-way triplets were used from these datasets:
|
70 |
+
|
71 |
+
* MSMarco
|
72 |
+
* TriviaQA
|
73 |
+
* Natural Questions
|
74 |
+
* FEVER
|