VOOZH about

URL: https://huggingface.co/tomaarsen/ModernBERT-base-gooaq

⇱ tomaarsen/ModernBERT-base-gooaq Β· Hugging Face


SentenceTransformer based on answerdotai/ModernBERT-base

This is a sentence-transformers model finetuned from answerdotai/ModernBERT-base 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, although only 10GB of VRAM was used.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: answerdotai/ModernBERT-base
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
  • Language: en

Model Sources

Full Model Architecture

SentenceTransformer(
 (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: ModernBertModel 
 (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:

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/ModernBERT-base-gooaq")
# Run inference
sentences = [
 'are you human korean novela?',
 "Are You Human? (Korean: λ„ˆλ„ μΈκ°„μ΄λ‹ˆ; RR: Neodo Inganini; lit. Are You Human Too?) is a 2018 South Korean television series starring Seo Kang-jun and Gong Seung-yeon. It aired on KBS2's Mondays and Tuesdays at 22:00 (KST) time slot, from June 4 to August 7, 2018.",
 'A relative of European pear varieties like Bartlett and Anjou, the Asian pear is great used in recipes or simply eaten out of hand. It retains a crispness that works well in slaws and salads, and it holds its shape better than European pears when baked and cooked.',
]
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]

Evaluation

Metrics

Information Retrieval

Metric NanoNQ NanoMSMARCO
cosine_accuracy@1 0.38 0.32
cosine_accuracy@3 0.64 0.56
cosine_accuracy@5 0.7 0.66
cosine_accuracy@10 0.8 0.82
cosine_precision@1 0.38 0.32
cosine_precision@3 0.22 0.1867
cosine_precision@5 0.144 0.132
cosine_precision@10 0.082 0.082
cosine_recall@1 0.36 0.32
cosine_recall@3 0.62 0.56
cosine_recall@5 0.67 0.66
cosine_recall@10 0.74 0.82
cosine_ndcg@10 0.5674 0.5554
cosine_mrr@10 0.5237 0.4725
cosine_map@100 0.5117 0.4798

Nano BEIR

Metric Value
cosine_accuracy@1 0.35
cosine_accuracy@3 0.6
cosine_accuracy@5 0.68
cosine_accuracy@10 0.81
cosine_precision@1 0.35
cosine_precision@3 0.2033
cosine_precision@5 0.138
cosine_precision@10 0.082
cosine_recall@1 0.34
cosine_recall@3 0.59
cosine_recall@5 0.665
cosine_recall@10 0.78
cosine_ndcg@10 0.5614
cosine_mrr@10 0.4981
cosine_map@100 0.4957

Training Details

Training Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 3,012,496 training samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 12.0 tokens
    • max: 21 tokens
    • min: 15 tokens
    • mean: 58.17 tokens
    • max: 190 tokens
  • Samples:
    question answer
    what is the difference between clay and mud mask? 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.
    myki how much on card? 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.
    how to find out if someone blocked your phone number on iphone? 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.
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
     "scale": 20.0,
     "similarity_fct": "cos_sim"
    }
    

Evaluation Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 3,012,496 evaluation samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 12.05 tokens
    • max: 21 tokens
    • min: 13 tokens
    • mean: 59.08 tokens
    • max: 116 tokens
  • Samples:
    question answer
    how do i program my directv remote with my tv? ['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.']
    are rodrigues fruit bats nocturnal? 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.
    why does your heart rate increase during exercise bbc bitesize? 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.
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
     "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

Training Logs

Framework Versions

  • Python: 3.11.10
  • Sentence Transformers: 3.3.1
  • Transformers: 4.48.0.dev0
  • PyTorch: 2.6.0.dev20241112+cu121
  • Accelerate: 1.2.0
  • Datasets: 3.2.0
  • Tokenizers: 0.21.0

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",
}

CachedMultipleNegativesRankingLoss

@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}
}
Downloads last month
1,280
Safetensors
Model size
0.1B params
Tensor type
F32
Β·

Model tree for tomaarsen/ModernBERT-base-gooaq

Finetuned
(1334)
this model

Dataset used to train tomaarsen/ModernBERT-base-gooaq

Papers for tomaarsen/ModernBERT-base-gooaq

Evaluation results