CoolFace
Modelpublic

tomaarsen/NeoBERT-gooaq-8e-05

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes25downloads
Model Card

SentenceTransformer based on chandar-lab/NeoBERT

This is a sentence-transformers model finetuned from chandar-lab/NeoBERT on the gooaq dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

This model has been finetuned using train_st_gooaq.py using an RTX 3090. It used the same training script as tomaarsen/ModernBERT-base-gooaq.

Model Details

Model Description

  • —Model Type: Sentence Transformer
  • —Base model: chandar-lab/NeoBERT <!-- at revision d97a4acdc851efed665d0550ea5704f00ad3ef76 -->
  • —Maximum Sequence Length: 8192 tokens
  • —Output Dimensionality: 768 dimensions
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —gooaq
  • —Language: en <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NeoBERT 
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)

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("tomaarsen/NeoBERT-gooaq-8e-05")
# Run inference
sentences = [
    'what is the difference between 18 and 20 inch tires?',
    'The only real difference is a 20" rim would be more likely to be damaged, as you pointed out. Beyond looks, there is zero benefit for the 20" rim. Also, just the availability of tires will likely be much more limited for the larger rim. ... Tire selection is better for 18" wheels than 20" wheels.',
    'So extracurricular activities are just activities that you do outside of class. The Common App says that extracurricular activities "include arts, athletics, clubs, employment, personal commitments, and other pursuits."',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

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. -->

Evaluation

Metrics

Information Retrieval
MetricNanoNQNanoMSMARCO
cosine_accuracy@10.460.32
cosine_accuracy@30.640.58
cosine_accuracy@50.70.68
cosine_accuracy@100.760.74
cosine_precision@10.460.32
cosine_precision@30.220.1933
cosine_precision@50.1440.136
cosine_precision@100.080.074
cosine_recall@10.430.32
cosine_recall@30.620.58
cosine_recall@50.680.68
cosine_recall@100.730.74
cosine_ndcg@100.59210.5415
cosine_mrr@100.56070.4768
cosine_map@1000.55010.4902
Nano BEIR
MetricValue
cosine_accuracy@10.39
cosine_accuracy@30.61
cosine_accuracy@50.69
cosine_accuracy@100.75
cosine_precision@10.39
cosine_precision@30.2067
cosine_precision@50.14
cosine_precision@100.077
cosine_recall@10.375
cosine_recall@30.6
cosine_recall@50.68
cosine_recall@100.735
cosine_ndcg@100.5668
cosine_mrr@100.5188
cosine_map@1000.5202

<!--

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

gooaq
  • —Dataset: gooaq at b089f72
  • —Size: 3,011,496 training samples
  • —Columns: <code>question</code> and <code>answer</code>
  • —Approximate statistics based on the first 1000 samples: | | question | answer | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 11.87 tokens</li><li>max: 23 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 60.09 tokens</li><li>max: 201 tokens</li></ul> |
  • —Samples: | question | answer | |:-----------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>what is the difference between clay and mud mask?</code> | <code>The main difference between the two is that mud is a skin-healing agent, while clay is a cosmetic, drying agent. Clay masks are most useful for someone who has oily skin and is prone to breakouts of acne and blemishes.</code> | | <code>myki how much on card?</code> | <code>A full fare myki card costs $6 and a concession, seniors or child myki costs $3. For more information about how to use your myki, visit ptv.vic.gov.au or call 1800 800 007.</code> | | <code>how to find out if someone blocked your phone number on iphone?</code> | <code>If you get a notification like "Message Not Delivered" or you get no notification at all, that's a sign of a potential block. Next, you could try calling the person. If the call goes right to voicemail or rings once (or a half ring) then goes to voicemail, that's further evidence you may have been blocked.</code> |
  • —Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

gooaq
  • —Dataset: gooaq at b089f72
  • —Size: 1,000 evaluation samples
  • —Columns: <code>question</code> and <code>answer</code>
  • —Approximate statistics based on the first 1000 samples: | | question | answer | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 8 tokens</li><li>mean: 11.88 tokens</li><li>max: 22 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 61.03 tokens</li><li>max: 127 tokens</li></ul> |
  • —Samples: | question | answer | |:-----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>how do i program my directv remote with my tv?</code> | <code>['Press MENU on your remote.', 'Select Settings & Help > Settings > Remote Control > Program Remote.', 'Choose the device (TV, audio, DVD) you wish to program. ... ', 'Follow the on-screen prompts to complete programming.']</code> | | <code>are rodrigues fruit bats nocturnal?</code> | <code>Before its numbers were threatened by habitat destruction, storms, and hunting, some of those groups could number 500 or more members. Sunrise, sunset. Rodrigues fruit bats are most active at dawn, at dusk, and at night.</code> | | <code>why does your heart rate increase during exercise bbc bitesize?</code> | <code>During exercise there is an increase in physical activity and muscle cells respire more than they do when the body is at rest. The heart rate increases during exercise. The rate and depth of breathing increases - this makes sure that more oxygen is absorbed into the blood, and more carbon dioxide is removed from it.</code> |
  • —Loss: <code>CachedMultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 2048
  • —per_device_eval_batch_size: 2048
  • —learning_rate: 8e-05
  • —num_train_epochs: 1
  • —warmup_ratio: 0.05
  • —bf16: True
  • —batch_sampler: no_duplicates
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: 2048
  • —per_device_eval_batch_size: 2048
  • —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: 8e-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: 1
  • —max_steps: -1
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: {}
  • —warmup_ratio: 0.05
  • —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: True
  • —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}
  • —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
  • —dispatch_batches: None
  • —split_batches: 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: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining LossValidation LossNanoNQ_cosine_ndcg@10NanoMSMARCO_cosine_ndcg@10NanoBEIR_mean_cosine_ndcg@10
-1-1--0.04280.11270.0777
0.0068104.2332----
0.0136201.5303----
0.0204300.887----
0.0272400.6286----
0.0340500.51930.20910.44340.44540.4444
0.0408600.4423----
0.0476700.3842----
0.0544800.3576----
0.0612900.3301----
0.06801000.31350.12520.46060.51500.4878
0.07481100.302----
0.08161200.277----
0.08841300.2694----
0.09521400.2628----
0.10201500.24710.09490.51350.51330.5134
0.10881600.2343----
0.11561700.2386----
0.12241800.219----
0.12921900.217----
0.13602000.20730.08700.52810.48240.5052
0.14282100.2208----
0.14962200.2046----
0.15642300.2045----
0.16322400.1987----
0.17002500.19490.07340.57810.49760.5378
0.17682600.1888----
0.18352700.187----
0.19032800.1834----
0.19712900.1747----
0.20393000.18050.06630.55800.54530.5516
0.21073100.1738----
0.21753200.1707----
0.22433300.1758----
0.23113400.1762----
0.23793500.16490.06240.57610.53100.5535
0.24473600.1682----
0.25153700.1629----
0.25833800.1595----
0.26513900.1571----
0.27194000.16170.05920.58650.51930.5529
0.27874100.1521----
0.28554200.1518----
0.29234300.1583----
0.29914400.1516----
0.30594500.14730.05700.58440.51810.5512
0.31274600.1491----
0.31954700.1487----
0.32634800.1457----
0.33314900.1463----
0.33995000.1410.05710.56520.50270.5340
0.34675100.1438----
0.35355200.148----
0.36035300.136----
0.36715400.1359----
0.37395500.13880.05070.54570.46600.5058
0.38075600.1358----
0.38755700.1365----
0.39435800.1328----
0.40115900.1404----
0.40796000.13040.05240.54770.52590.5368
0.41476100.1321----
0.42156200.1322----
0.42836300.1262----
0.43516400.1339----
0.44196500.12570.04940.55640.49200.5242
0.44876600.1247----
0.45556700.1316----
0.46236800.124----
0.46916900.1247----
0.47597000.12120.04800.56630.50400.5351
0.48277100.1194----
0.48957200.1224----
0.49637300.1225----
0.50317400.1209----
0.50997500.11970.04470.55350.51270.5331
0.51677600.1196----
0.52357700.1129----
0.53037800.1223----
0.53707900.1159----
0.54388000.11780.04120.55580.52750.5416
0.55068100.1186----
0.55748200.1153----
0.56428300.1178----
0.57108400.1155----
0.57788500.11520.04320.57380.52430.5490
0.58468600.1101----
0.59148700.1057----
0.59828800.1141----
0.60508900.1172----
0.61189000.11460.04140.56410.48050.5223
0.61869100.1094----
0.62549200.1116----
0.63229300.111----
0.63909400.1078----
0.64589500.10410.04240.58830.54120.5647
0.65269600.1068----
0.65949700.1076----
0.66629800.1068----
0.67309900.1038----
0.679810000.10170.04090.58500.51170.5483
0.686610100.1079----
0.693410200.1067----
0.700210300.1079----
0.707010400.1039----
0.713810500.10160.03560.59270.53440.5636
0.720610600.1017----
0.727410700.1029----
0.734210800.1038----
0.741010900.0994----
0.747811000.09840.03760.56180.53210.5470
0.754611100.0966----
0.761411200.1024----
0.768211300.099----
0.775011400.1017----
0.781811500.09510.03680.58320.50730.5453
0.788611600.1008----
0.795411700.096----
0.802211800.0962----
0.809011900.1004----
0.815812000.09860.03210.58950.52420.5568
0.822612100.0966----
0.829412200.096----
0.836212300.0962----
0.843012400.0987----
0.849812500.0960.03160.58010.54340.5617
0.856612600.097----
0.863412700.0929----
0.870212800.0973----
0.877012900.0973----
0.883813000.09390.03300.59160.54780.5697
0.890613100.0968----
0.897313200.0969----
0.904113300.0931----
0.910913400.0919----
0.917713500.09160.03240.59080.53080.5608
0.924513600.0903----
0.931313700.0957----
0.938113800.0891----
0.944913900.0909----
0.951714000.09240.03180.58230.53880.5605
0.958514100.0932----
0.965314200.0916----
0.972114300.0966----
0.978914400.0864----
0.985714500.08720.03110.58950.54420.5668
0.992514600.0897----
0.999314700.086----
-1-1--0.59210.54150.5668

</details>

Framework Versions

  • —Python: 3.11.10
  • —Sentence Transformers: 3.5.0.dev0
  • —Transformers: 4.49.0
  • —PyTorch: 2.5.1+cu124
  • —Accelerate: 1.2.0
  • —Datasets: 2.21.0
  • —Tokenizers: 0.21.0

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",
}
CachedMultipleNegativesRankingLoss
bibtex
@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

<!--

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. -->