nreimers commited on
Commit
d87548d
1 Parent(s): 8b151e5
README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cross-Encoder for MS Marco
2
+
3
+ This model uses [BERT-Tiny](https://github.com/google-research/bert), a tiny BERT model with only 2 layers, 2 attention heads and 128 dimension size.
4
+
5
+ It was trained on [MS Marco Passage Ranking](https://github.com/microsoft/MSMARCO-Passage-Ranking) task.
6
+
7
+ The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See [SBERT.net Information Retrieval](https://github.com/UKPLab/sentence-transformers/tree/master/examples/applications/information-retrieval) for more details. The training code is available here: [SBERT.net Training MS Marco](https://github.com/UKPLab/sentence-transformers/tree/master/examples/training/ms_marco)
8
+
9
+ ## Usage and Performance
10
+
11
+ Pre-trained models can be used like this:
12
+ ```
13
+ from sentence_transformers import CrossEncoder
14
+ model = CrossEncoder('model_name', max_length=512)
15
+ scores = model.predict([('Query', 'Paragraph1'), ('Query', 'Paragraph2') , ('Query', 'Paragraph3')])
16
+ ```
17
+
18
+ In the following table, we provide various pre-trained Cross-Encoders together with their performance on the [TREC Deep Learning 2019](https://microsoft.github.io/TREC-2019-Deep-Learning/) and the [MS Marco Passage Reranking](https://github.com/microsoft/MSMARCO-Passage-Ranking/) dataset.
19
+
20
+
21
+ | Model-Name | NDCG@10 (TREC DL 19) | MRR@10 (MS Marco Dev) | Docs / Sec (BertTokenizerFast) | Docs / Sec (Python Tokenizer) |
22
+ | ------------- |:-------------| -----| --- | --- |
23
+ | cross-encoder/ms-marco-TinyBERT-L-2 | 67.43 | 30.15 | 9000 | 780
24
+ | cross-encoder/ms-marco-TinyBERT-L-4 | 68.09 | 34.50 | 2900 | 760
25
+ | cross-encoder/ms-marco-TinyBERT-L-6 | 69.57 | 36.13 | 680 | 660
26
+ | cross-encoder/ms-marco-electra-base | 71.99 | 36.41 | 340 | 340
27
+ | *Other models* | | | |
28
+ | nboost/pt-tinybert-msmarco | 63.63 | 28.80 | 2900 | 760
29
+ | nboost/pt-bert-base-uncased-msmarco | 70.94 | 34.75 | 340 | 340|
30
+ | nboost/pt-bert-large-msmarco | 73.36 | 36.48 | 100 | 100 |
31
+ | Capreolus/electra-base-msmarco | 71.23 | | 340 | 340 |
32
+ | amberoad/bert-multilingual-passage-reranking-msmarco | 68.40 | | 330 | 330
33
+
34
+ Note: Runtime was computed on a V100 GPU. A bottleneck for smaller models is the standard Python tokenizer from Huggingface in version 3. Replacing it with the fast tokenizer based on Rust, the throughput is significantly improved:
35
+
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "nreimers/BERT-Tiny_L-2_H-128_A-2",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 128,
11
+ "id2label": {
12
+ "0": "LABEL_0"
13
+ },
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 512,
16
+ "label2id": {
17
+ "LABEL_0": 0
18
+ },
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 512,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 2,
23
+ "num_hidden_layers": 2,
24
+ "pad_token_id": 0,
25
+ "type_vocab_size": 2,
26
+ "vocab_size": 30522
27
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74cfcb4bad39a47c89f21932bdd6c8061f97cca298d8a4d85cb851c8a90d74ac
3
+ size 17565609
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"do_lower_case": true, "do_basic_tokenize": true, "never_split": null, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": "/home/ukp-reimers/.cache/torch/transformers/448f85f42d7f87f0254da1997bc5cd60cb4607800084132993017232e82432a3.dd8bd9bfd3664b530ea4e645105f557769387b3da9f79bdb55ed556bdd80611d", "tokenizer_file": null, "name_or_path": "nreimers/BERT-Tiny_L-2_H-128_A-2"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff