VOOZH about

URL: https://huggingface.co/tomaarsen/asym-static-retrieval-mrl-en-v1

⇱ tomaarsen/asym-static-retrieval-mrl-en-v1 · Hugging Face


Asymmetric Static Embeddings with BERT uncased tokenizer finetuned on various datasets

This is a sentence-transformers model trained on the gooaq, msmarco, squad, s2orc, allnli, paq, trivia_qa, msmarco_10m, swim_ir, pubmedqa, miracl, mldr and mr_tydi datasets. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

Model Sources

Full Model Architecture

SentenceTransformer(
 (0): Router(
 (sub_modules): ModuleDict(
 (query): Sequential(
 (0): StaticEmbedding(
 (embedding): EmbeddingBag(30522, 1024, mode='mean')
 )
 )
 (document): Sequential(
 (0): StaticEmbedding(
 (embedding): EmbeddingBag(30522, 1024, mode='mean')
 )
 )
 )
 )
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

pip install -U sentence-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("tomaarsen/asym-static-retrieval-mrl-en-v1")
# Run inference
queries = [
 "What is the name of Nan\u0027s primary teacher?",
]
documents = [
 "While still young, Nan left his military career so that he could commit himself fully to his study of Buddhism and to meditation. In 1942 at age 24, he went on a three-year meditation retreat in the Emei Mountains. It is said that it was there that he verified his experiences against the Chinese Buddhist canon. During this time, Nan's primary teacher was Yuan Huanxian (袁煥仙; 1887\xa0– 1966).",
 'Among other schemes that have been considered is a rapid transport link between Heathrow and Gatwick Airports, known as "Heathwick", which would allow the airports to operate jointly as an airline hub; In 2018, the Department for Transport began to invite proposals for privately funded rail links to Heathrow Airport. Projects being considered under this initiative include:The Mayor of London\'s office and Transport for London commissioned plans in the event of Heathrow\'s closure—to replace it by a large built-up area. Some of the plans seem to show terminal 5, or part of it, kept as a shopping centre.',
 'Formally, we represent each event in a distributed flow as a quadruple of the form (x,t,k,v), where "x" is the location (e.g., the network address of a physical node) at which the event occurs, "t" is the time at which this happens, "k" is a version, or a sequence number identifying the particular event, and "v" is a value that represents the event payload (e.g., all the arguments passed in a method call). Each distributed flow is a (possibly infinite) set of such quadruples that satisfies the following three formal properties. In addition to the above, flows can have a number of additional properties.',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.4520, -0.0703, -0.0320]])

Evaluation

Metrics

Information Retrieval

  • Datasets: NanoClimateFEVER, NanoDBPedia, NanoFEVER, NanoFiQA2018, NanoHotpotQA, NanoMSMARCO, NanoNFCorpus, NanoNQ, NanoQuoraRetrieval, NanoSCIDOCS, NanoArguAna, NanoSciFact and NanoTouche2020
  • Evaluated with InformationRetrievalEvaluator
Metric NanoClimateFEVER NanoDBPedia NanoFEVER NanoFiQA2018 NanoHotpotQA NanoMSMARCO NanoNFCorpus NanoNQ NanoQuoraRetrieval NanoSCIDOCS NanoArguAna NanoSciFact NanoTouche2020
cosine_accuracy@1 0.28 0.68 0.54 0.36 0.66 0.16 0.42 0.28 0.82 0.36 0.1 0.48 0.6531
cosine_accuracy@3 0.52 0.84 0.84 0.5 0.8 0.44 0.58 0.48 0.94 0.52 0.38 0.56 0.9388
cosine_accuracy@5 0.64 0.94 0.88 0.58 0.84 0.58 0.64 0.68 1.0 0.56 0.5 0.62 1.0
cosine_accuracy@10 0.74 0.94 0.98 0.68 0.94 0.62 0.76 0.74 1.0 0.74 0.62 0.74 1.0
cosine_precision@1 0.28 0.68 0.54 0.36 0.66 0.16 0.42 0.28 0.82 0.36 0.1 0.48 0.6531
cosine_precision@3 0.2 0.5933 0.28 0.2267 0.38 0.1467 0.3533 0.16 0.3667 0.24 0.1267 0.1933 0.6259
cosine_precision@5 0.16 0.544 0.188 0.172 0.256 0.116 0.312 0.14 0.252 0.192 0.1 0.132 0.6449
cosine_precision@10 0.11 0.464 0.104 0.11 0.146 0.062 0.24 0.078 0.134 0.138 0.062 0.082 0.5612
cosine_recall@1 0.13 0.0785 0.5167 0.1801 0.33 0.16 0.0465 0.27 0.7307 0.0767 0.1 0.445 0.0419
cosine_recall@3 0.2423 0.1643 0.7867 0.3516 0.57 0.44 0.095 0.46 0.8653 0.1497 0.38 0.53 0.1245
cosine_recall@5 0.309 0.2226 0.8433 0.4359 0.64 0.58 0.1186 0.66 0.966 0.1987 0.5 0.595 0.2132
cosine_recall@10 0.4147 0.323 0.9433 0.5142 0.73 0.62 0.1383 0.71 0.9893 0.2827 0.62 0.73 0.3493
cosine_ndcg@10 0.3362 0.5786 0.7429 0.4093 0.6567 0.398 0.3205 0.4854 0.903 0.2746 0.3542 0.5806 0.6057
cosine_mrr@10 0.4314 0.782 0.6964 0.4538 0.752 0.3259 0.5189 0.4182 0.8917 0.4599 0.2693 0.5492 0.801
cosine_map@100 0.2645 0.4402 0.6704 0.3417 0.5927 0.3435 0.1459 0.4202 0.863 0.2092 0.2847 0.5343 0.4628

Nano BEIR

  • Dataset: NanoBEIR_mean
  • Evaluated with NanoBEIREvaluator with these parameters:
    {
     "dataset_names": [
     "climatefever",
     "dbpedia",
     "fever",
     "fiqa2018",
     "hotpotqa",
     "msmarco",
     "nfcorpus",
     "nq",
     "quoraretrieval",
     "scidocs",
     "arguana",
     "scifact",
     "touche2020"
     ]
    }
    
Metric Value
cosine_accuracy@1 0.4456
cosine_accuracy@3 0.6414
cosine_accuracy@5 0.7277
cosine_accuracy@10 0.8077
cosine_precision@1 0.4456
cosine_precision@3 0.2994
cosine_precision@5 0.2468
cosine_precision@10 0.1762
cosine_recall@1 0.2389
cosine_recall@3 0.3969
cosine_recall@5 0.4833
cosine_recall@10 0.5665
cosine_ndcg@10 0.5112
cosine_mrr@10 0.5654
cosine_map@100 0.4287

Training Details

Training Datasets

Evaluation Datasets

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 2048
  • per_device_eval_batch_size: 2048
  • learning_rate: 0.2
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • bf16: True
  • batch_sampler: no_duplicates
  • router_mapping: {'question': 'query', 'query': 'query', 'title': 'query', 'anchor': 'query', 'answer': 'document', 'positive': 'document', 'negative': 'document', 'negative1': 'document', 'negative2': 'document', 'negative3': 'document', 'negative4': 'document', 'negative5': 'document', 'negative6': 'document', 'negative7': 'document', 'negative8': 'document', 'negative9': 'document', 'negative10': 'document', 'negative11': 'document', 'negative12': 'document', 'negative13': 'document', 'negative14': 'document', 'negative15': 'document', 'negative16': 'document', 'negative17': 'document', 'negative18': 'document', 'negative19': 'document', 'negative20': 'document', 'abstract': 'document', 'text': 'document'}

All Hyperparameters

Training Logs

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • Energy Consumed: 2.353 kWh
  • Carbon Emitted: 0.630 kg of CO2
  • Hours Used: 14.787 hours

Training Hardware

  • On Cloud: No
  • GPU Model: 1 x NVIDIA GeForce RTX 3090
  • CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
  • RAM Size: 31.78 GB

Framework Versions

  • Python: 3.11.6
  • Sentence Transformers: 5.2.0.dev0
  • Transformers: 4.55.4
  • PyTorch: 2.7.1+cu126
  • Accelerate: 1.6.0
  • Datasets: 3.6.0
  • Tokenizers: 0.21.4

Citation

BibTeX

Sentence Transformers

@inproceedings{reimers-2019-sentence-bert,
 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
 author = "Reimers, Nils and Gurevych, Iryna",
 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
 month = "11",
 year = "2019",
 publisher = "Association for Computational Linguistics",
 url = "https://arxiv.org/abs/1908.10084",
}

MatryoshkaLoss

@misc{kusupati2024matryoshka,
 title={Matryoshka Representation Learning},
 author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
 year={2024},
 eprint={2205.13147},
 archivePrefix={arXiv},
 primaryClass={cs.LG}
}

MultipleNegativesRankingLoss

@misc{henderson2017efficient,
 title={Efficient Natural Language Response Suggestion for Smart Reply},
 author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
 year={2017},
 eprint={1705.00652},
 archivePrefix={arXiv},
 primaryClass={cs.CL}
}
Downloads last month

-

Downloads are not tracked for this model. How to track

Datasets used to train tomaarsen/asym-static-retrieval-mrl-en-v1

Papers for tomaarsen/asym-static-retrieval-mrl-en-v1

Evaluation results