CoolFace
Modelpublic

KatjaK/GND-few-shot-retriever

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes14downloads
Model Card

SentenceTransformer based on BAAI/bge-m3

This is a sentence-transformers model finetuned from BAAI/bge-m3. 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 Type: Sentence Transformer
  • —Base model: BAAI/bge-m3 <!-- at revision 5617a9f61b028005a4858fdac845db406aefb181 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 1024 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'XLMRobertaModel'})
  (1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
  (2): Normalize()
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
    'Umweltgutachten',
    'Zentralblatt der Bauverwaltung Nachrichten d. Reichs- u. Staatsbehörden',
    'Materialfluss Materialfluss <Landsberg> / Portrait einer Branche',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.3120, 0.2367],
#         [0.3120, 1.0000, 0.2667],
#         [0.2367, 0.2667, 1.0000]])

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • —Size: 5,139,569 training samples
  • —Columns: <code>anchor</code> and <code>positive</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 20.6 tokens</li><li>max: 101 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 20.99 tokens</li><li>max: 100 tokens</li></ul> |
  • —Samples: | anchor | positive | |:----------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>The art of Star Wars - das Erwachen der Macht</code> | <code>Harry Potter: magische Orte aus den Filmen</code> | | <code>Fachdidaktik Kunst und Design Lehren und Lernen mit Portfolios</code> | <code>Mit Kindern moderne Kunst entdecken kreative Ideen auch für Fachfremde, 2. - 4. Schuljahr ; [mit Farbabbildungen und Kopiervorlagen auf CD-ROM]</code> | | <code>Der Ditz alles was man über Niederländer wissen sollte</code> | <code>Umgangsformen Protokoll und Etikette, privat und im Beruf</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 3,736 evaluation samples
  • —Columns: <code>anchor</code> and <code>positive</code>
  • —Approximate statistics based on the first 1000 samples: | | anchor | positive | |:--------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 19.09 tokens</li><li>max: 96 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 18.28 tokens</li><li>max: 96 tokens</li></ul> |
  • —Samples: | anchor | positive | |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------| | <code>Bibliotheksstatistik staatliche Allgemeinbibliotheken und Gewerkschaftsbibliotheken der Deutschen Demokratischen Republik in Zahlen ; Bericht und Tabellen zu den Gesamtergebnissen in der Republik und in den Bezirken einschließlich der Wissenschaftlichen Allgemeinbibliotheken der Bezirke</code> | <code>Fortschrittsbericht Bohrtechnik, Erdöl und Erdgasgewinnung und verwandte Gebiete</code> | | <code>Bibliotheksstatistik staatliche Allgemeinbibliotheken und Gewerkschaftsbibliotheken der Deutschen Demokratischen Republik in Zahlen ; Bericht und Tabellen zu den Gesamtergebnissen in der Republik und in den Bezirken einschließlich der Wissenschaftlichen Allgemeinbibliotheken der Bezirke</code> | <code>Zentralkatalog der DDR ZKZ ; Zeitschriften u. Serien d. Auslandes ZKZ</code> | | <code>Zentralkatalog der DDR ZKZ ; Zeitschriften u. Serien d. Auslandes ZKZ</code> | <code>Fortschrittsbericht Bohrtechnik, Erdöl und Erdgasgewinnung und verwandte Gebiete</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 64
  • —per_device_eval_batch_size: 64
  • —learning_rate: 1e-05
  • —num_train_epochs: 2
All Hyperparameters

<details><summary>Click to expand</summary>

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 64
  • —per_device_eval_batch_size: 64
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_steps: None
  • —torch_empty_cache_steps: None
  • —learning_rate: 1e-05
  • —weight_decay: 0.0
  • —adam_beta1: 0.9
  • —adam_beta2: 0.999
  • —adam_epsilon: 1e-08
  • —max_grad_norm: 1.0
  • —num_train_epochs: 2
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.0
  • —warmup_steps: 0
  • —log_level: passive
  • —log_level_replica: warning
  • —log_on_each_node: True
  • —logging_nan_inf_filter: True
  • —save_safetensors: True
  • —save_on_each_node: False
  • —save_only_model: False
  • —restore_callback_states_from_checkpoint: False
  • —no_cuda: False
  • —use_cpu: False
  • —use_mps_device: False
  • —seed: 42
  • —data_seed: None
  • —jit_mode_eval: False
  • —use_ipex: False
  • —bf16: False
  • —fp16: False
  • —fp16_opt_level: O1
  • —half_precision_backend: auto
  • —bf16_full_eval: False
  • —fp16_full_eval: False
  • —tf32: None
  • —local_rank: 0
  • —ddp_backend: None
  • —tpu_num_cores: None
  • —tpu_metrics_debug: False
  • —debug: []
  • —dataloader_drop_last: False
  • —dataloader_num_workers: 0
  • —dataloader_prefetch_factor: None
  • —past_index: -1
  • —disable_tqdm: False
  • —remove_unused_columns: True
  • —label_names: None
  • —load_best_model_at_end: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —tp_size: 0
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • —deepspeed: None
  • —label_smoothing_factor: 0.0
  • —optim: adamw_torch
  • —optim_args: None
  • —adafactor: False
  • —group_by_length: False
  • —length_column_name: length
  • —ddp_find_unused_parameters: None
  • —ddp_bucket_cap_mb: None
  • —ddp_broadcast_buffers: False
  • —dataloader_pin_memory: True
  • —dataloader_persistent_workers: False
  • —skip_memory_metrics: True
  • —use_legacy_prediction_loop: False
  • —push_to_hub: False
  • —resume_from_checkpoint: None
  • —hub_model_id: None
  • —hub_strategy: every_save
  • —hub_private_repo: None
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —include_for_metrics: []
  • —eval_do_concat_batches: True
  • —fp16_backend: auto
  • —push_to_hub_model_id: None
  • —push_to_hub_organization: None
  • —mp_parameters:
  • —auto_find_batch_size: False
  • —full_determinism: False
  • —torchdynamo: None
  • —ray_scope: last
  • —ddp_timeout: 1800
  • —torch_compile: False
  • —torch_compile_backend: None
  • —torch_compile_mode: None
  • —include_tokens_per_second: False
  • —include_num_input_tokens_seen: False
  • —neftune_noise_alpha: None
  • —optim_target_modules: None
  • —batch_eval_metrics: False
  • —eval_on_start: False
  • —use_liger_kernel: False
  • —eval_use_gather_object: False
  • —average_tokens_across_devices: False
  • —prompts: None
  • —batch_sampler: batch_sampler
  • —multi_dataset_batch_sampler: proportional
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining LossValidation Loss
0.00625002.1697-
0.012510002.08692.2847
0.018715002.0643-
0.024920002.03582.2490
0.031125002.0275-
0.037430002.01912.2716
0.043635002.0037-
0.049840001.99982.2407
0.056045001.976-
0.062350001.97762.2088
0.068555001.9705-
0.074760001.97962.2011
0.080965001.952-
0.087270001.94622.2119
0.093475001.9466-
0.099680001.91622.1985
0.105885001.9171-
0.112190001.92072.1956
0.118395001.9041-
0.1245100001.9082.2035
0.1307105001.9105-
0.1370110001.88172.1951
0.1432115001.9109-
0.1494120001.90332.1413
0.1557125001.8991-
0.1619130001.88752.1770
0.1681135001.8777-
0.1743140001.88222.1892
0.1806145001.8696-
0.1868150001.86282.1856
0.1930155001.8828-
0.1992160001.85972.1755
0.2055165001.8762-
0.2117170001.87242.1548
0.2179175001.8685-
0.2241180001.87332.1681
0.2304185001.852-
0.2366190001.84122.1868
0.2428195001.859-
0.2490200001.84332.1439
0.2553205001.852-
0.2615210001.85372.1446
0.2677215001.803-
0.2740220001.82332.1722
0.2802225001.8294-
0.2864230001.82972.1857
0.2926235001.8306-
0.2989240001.83362.1519
0.3051245001.8203-
0.3113250001.82472.1728
0.3175255001.8077-
0.3238260001.79152.1985
0.3300265001.8087-
0.3362270001.81282.1808
0.3424275001.8139-
0.3487280001.81182.1518
0.3549285001.8113-
0.3611290001.80772.1721
0.3673295001.8193-
0.3736300001.79862.1783
0.3798305001.8002-
0.3860310001.8072.1628
0.3922315001.7917-
0.3985320001.77572.1827
0.4047325001.8038-
0.4109330001.78382.1703
0.4172335001.7748-
0.4234340001.80392.1684
0.4296345001.7674-
0.4358350001.75972.1902
0.4421355001.7828-
0.4483360001.77472.1980
0.4545365001.776-
0.4607370001.80782.1805
0.4670375001.7814-
0.4732380001.77412.1616
0.4794385001.7755-
0.4856390001.75762.1644
0.4919395001.7562-
0.4981400001.76022.1709
0.5043405001.757-
0.5105410001.76932.1938
0.5168415001.7655-
0.5230420001.76172.1970
0.5292425001.7687-
0.5355430001.75652.1630
0.5417435001.7492-
0.5479440001.75792.1694
0.5541445001.7629-
0.5604450001.73642.1836
0.5666455001.7444-
0.5728460001.73082.1785
0.5790465001.7351-
0.5853470001.75882.1523
0.5915475001.7235-
0.5977480001.73172.1694
0.6039485001.7415-
0.6102490001.75882.1867
0.6164495001.7103-
0.6226500001.72692.1812
0.6288505001.7254-
0.6351510001.73982.1663
0.6413515001.7178-
0.6475520001.74542.1856
0.6537525001.7188-
0.6600530001.72042.1688
0.6662535001.72-
0.6724540001.73562.1861
0.6787545001.7338-
0.6849550001.72542.1700
0.6911555001.7243-
0.6973560001.73082.1781
0.7036565001.7215-
0.7098570001.71152.1784
0.7160575001.7071-
0.7222580001.71552.1884
0.7285585001.7236-
0.7347590001.70782.1825
0.7409595001.7056-
0.7471600001.7242.1695
0.7534605001.7077-
0.7596610001.69482.1562
0.7658615001.6858-
0.7720620001.72072.1835
0.7783625001.7086-
0.7845630001.71732.1645
0.7907635001.717-
0.7970640001.70322.1732
0.8032645001.6992-
0.8094650001.70612.1841
0.8156655001.6926-
0.8219660001.68812.1970
0.8281665001.6905-
0.8343670001.69242.1774
0.8405675001.6926-
0.8468680001.68882.1826
0.8530685001.6975-
0.8592690001.68842.1740
0.8654695001.6843-
0.8717700001.67662.1717
0.8779705001.6887-
0.8841710001.68272.1788
0.8903715001.6922-
0.8966720001.67962.2068
0.9028725001.6682-
0.9090730001.67312.1866
0.9152735001.6747-
0.9215740001.67512.1737
0.9277745001.6545-
0.9339750001.68282.1894
0.9402755001.6649-
0.9464760001.66922.1638
0.9526765001.6596-
0.9588770001.66492.1874
0.9651775001.6731-
0.9713780001.68452.1805
0.9775785001.69-
0.9837790001.66222.1604
0.9900795001.6581-
0.9962800001.67632.1873
1.0024805001.6351-
1.0086810001.59692.2085
1.0149815001.598-
1.0211820001.58772.2237
1.0273825001.6039-
1.0335830001.60652.2369
1.0398835001.5922-
1.0460840001.58962.2240
1.0522845001.5905-
1.0585850001.57252.2057
1.0647855001.5865-
1.0709860001.59122.2256
1.0771865001.5947-
1.0834870001.57342.2342
1.0896875001.5942-
1.0958880001.58722.2254
1.1020885001.5838-
1.1083890001.56812.2428
1.1145895001.5838-
1.1207900001.56682.2431
1.1269905001.5891-
1.1332910001.60292.2416
1.1394915001.579-
1.1456920001.57972.2316
1.1518925001.5944-
1.1581930001.5812.2542
1.1643935001.5601-
1.1705940001.56532.2278
1.1767945001.562-
1.1830950001.59852.2356
1.1892955001.5599-
1.1954960001.57382.2325
1.2017965001.5809-
1.2079970001.58162.2242
1.2141975001.5852-
1.2203980001.56112.2319
1.2266985001.567-
1.2328990001.56152.2454
1.2390995001.5696-
1.24521000001.58122.2469
1.25151005001.566-
1.25771010001.57512.2255
1.26391015001.5864-
1.27011020001.57962.2340
1.27641025001.5646-
1.28261030001.5732.2555
1.28881035001.5824-
1.29501040001.55312.2520
1.30131045001.5672-
1.30751050001.56192.2355
1.31371055001.576-
1.32001060001.57672.2266
1.32621065001.563-
1.33241070001.56272.2367
1.33861075001.5589-
1.34491080001.55122.2533
1.35111085001.5725-
1.35731090001.54542.2460
1.36351095001.5609-
1.36981100001.5492.2515
1.37601105001.5587-
1.38221110001.58392.2551
1.38841115001.5547-
1.39471120001.54332.2389
1.40091125001.558-
1.40711130001.55422.2350
1.41331135001.5641-
1.41961140001.55672.2444
1.42581145001.5537-
1.43201150001.55372.2395
1.43821155001.5501-
1.44451160001.54882.2517
1.45071165001.5518-
1.45691170001.56312.2351
1.46321175001.5626-
1.46941180001.55682.2289
1.47561185001.5591-
1.48181190001.54482.2264
1.48811195001.5463-
1.49431200001.53452.2319
1.50051205001.5645-
1.50671210001.54572.2289
1.51301215001.5509-
1.51921220001.55622.2302
1.52541225001.5469-
1.53161230001.55142.2322
1.53791235001.5686-
1.54411240001.54372.2453
1.55031245001.5304-
1.55651250001.56092.2427
1.56281255001.5416-
1.56901260001.54182.2385
1.57521265001.5458-
1.58151270001.57352.2241
1.58771275001.5601-
1.59391280001.5462.2267
1.60011285001.5419-
1.60641290001.55792.2396
1.61261295001.5383-
1.61881300001.54512.2371
1.62501305001.5505-
1.63131310001.53742.2264
1.63751315001.5357-
1.64371320001.52232.2416
1.64991325001.5312-
1.65621330001.54382.2300
1.66241335001.5366-
1.66861340001.53542.2329
1.67481345001.5316-
1.68111350001.54522.2388
1.68731355001.5548-
1.69351360001.54482.2342
1.69971365001.5281-
1.70601370001.5292.2372
1.71221375001.5254-
1.71841380001.51632.2371
1.72471385001.537-
1.73091390001.55312.2455
1.73711395001.5269-
1.74331400001.52992.2372
1.74961405001.5331-
1.75581410001.54942.2293
1.76201415001.5337-
1.76821420001.52682.2365
1.77451425001.5331-
1.78071430001.53142.2318
1.78691435001.5375-
1.79311440001.53752.2257
1.79941445001.5386-
1.80561450001.53142.2387
1.81181455001.5446-
1.81801460001.52572.2421
1.82431465001.5275-
1.83051470001.53292.2389
1.83671475001.5362-
1.84301480001.55562.2322
1.84921485001.5214-
1.85541490001.51782.2337
1.86161495001.5156-
1.86791500001.52442.2318
1.87411505001.5283-
1.88031510001.53862.2400
1.88651515001.5326-
1.89281520001.53392.2408
1.89901525001.5201-
1.90521530001.52972.2402
1.91141535001.5325-
1.91771540001.55032.2428
1.92391545001.5382-
1.93011550001.5342.2397
1.93631555001.5245-
1.94261560001.51982.2380
1.94881565001.5301-
1.95501570001.53242.2399
1.96121575001.5171-
1.96751580001.52982.2399
1.97371585001.5309-
1.97991590001.50532.2406
1.98621595001.5237-
1.99241600001.52282.2414
1.99861605001.539-

</details>

Framework Versions

  • —Python: 3.9.18
  • —Sentence Transformers: 5.1.0
  • —Transformers: 4.51.3
  • —PyTorch: 2.6.0+cu124
  • —Accelerate: 1.10.1
  • —Datasets: 4.0.0
  • —Tokenizers: 0.21.4

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}
MultipleNegativesRankingLoss
bibtex
@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}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->