Downloads · 30 days
0
kwondw/bert-base-uncased-gooaq-peft
bert-base-uncased-gooaq-peft is a sentence similarity model from kwondw. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
This is a sentence-transformers model finetuned from google-bert/bert-base-uncased on the gooaq dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.
Downloads · 30 days
0
Access
Public
Updated Aug 20, 2026
Repo size
9.4 MB
Likes
0
Public
Click a slice to open those files.
.safetensors9.4 MB · 92%
From the Hugging Face model README
This is a sentence-transformers model finetuned from google-bert/bert-base-uncased on the gooaq dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
(1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)
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("kwondw/bert-base-uncased-gooaq-peft")
# Run inference
queries = [
"how to reverse a video on tiktok that's not yours?",
]
documents = [
'[\'Tap "Effects" at the bottom of your screen — it\\\'s an icon that looks like a clock. Open the Effects menu. ... \', \'At the end of the new list that appears, tap "Time." Select "Time" at the end. ... \', \'Select "Reverse" — you\\\'ll then see a preview of your new, reversed video appear on the screen.\']',
'Relative age is the age of a rock layer (or the fossils it contains) compared to other layers. It can be determined by looking at the position of rock layers. Absolute age is the numeric age of a layer of rocks or fossils. Absolute age can be determined by using radiometric dating.',
'Franchise Facts Poke Bar has a franchise fee of up to $30,000, with a total initial investment range of $157,800 to $438,000. The initial cost of a franchise includes several fees -- Unlock this franchise to better understand the costs such as training and territory fees.',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.6499, 0.2407, 0.4209]])
<!--
### 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.*
-->
NanoClimateFEVER, NanoDBPedia, NanoFEVER, NanoFiQA2018, NanoHotpotQA, NanoMSMARCO, NanoNFCorpus, NanoNQ, NanoQuoraRetrieval, NanoSCIDOCS, NanoArguAna, NanoSciFact and NanoTouche2020| Metric | NanoClimateFEVER | NanoDBPedia | NanoFEVER | NanoFiQA2018 | NanoHotpotQA | NanoMSMARCO | NanoNFCorpus | NanoNQ | NanoQuoraRetrieval | NanoSCIDOCS | NanoArguAna | NanoSciFact | NanoTouche2020 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cosine_accuracy@1 | 0.1 | 0.32 | 0.06 | 0.08 | 0.24 | 0.0 | 0.12 | 0.04 | 0.68 | 0.22 | 0.08 | 0.18 | 0.1837 |
| cosine_accuracy@3 | 0.28 | 0.52 | 0.18 | 0.14 | 0.44 | 0.12 | 0.24 | 0.1 | 0.76 | 0.26 | 0.28 | 0.24 | 0.5918 |
| cosine_accuracy@5 | 0.3 | 0.58 | 0.26 | 0.24 | 0.5 | 0.28 | 0.3 | 0.14 | 0.8 | 0.4 | 0.4 | 0.26 | 0.6939 |
| cosine_accuracy@10 | 0.44 | 0.74 | 0.38 | 0.3 | 0.58 | 0.4 | 0.4 | 0.34 | 0.94 | 0.5 | 0.52 | 0.3 | 0.9184 |
| cosine_precision@1 | 0.1 | 0.32 | 0.06 | 0.08 | 0.24 | 0.0 | 0.12 | 0.04 | 0.68 | 0.22 | 0.08 | 0.18 | 0.1837 |
| cosine_precision@3 | 0.1 | 0.3 | 0.06 | 0.0667 | 0.1467 | 0.04 | 0.1 | 0.0333 | 0.3133 | 0.12 | 0.0933 | 0.08 | 0.2449 |
| cosine_precision@5 | 0.076 | 0.288 | 0.052 | 0.068 | 0.116 | 0.056 | 0.088 | 0.028 | 0.2 | 0.128 | 0.08 | 0.052 | 0.2286 |
| cosine_precision@10 | 0.054 | 0.27 | 0.042 | 0.048 | 0.076 | 0.04 | 0.076 | 0.034 | 0.116 | 0.102 | 0.052 | 0.032 | 0.2265 |
| cosine_recall@1 | 0.0317 | 0.0205 | 0.06 | 0.0202 | 0.12 | 0.0 | 0.0026 | 0.04 | 0.5973 | 0.0467 | 0.08 | 0.145 | 0.0117 |
| cosine_recall@3 | 0.1117 | 0.0514 | 0.17 | 0.0467 | 0.22 | 0.12 | 0.02 | 0.1 | 0.7253 | 0.0747 | 0.28 | 0.205 | 0.049 |
| cosine_recall@5 | 0.1333 | 0.0824 | 0.24 | 0.1134 | 0.29 | 0.28 | 0.0221 | 0.13 | 0.756 | 0.1307 | 0.4 | 0.225 | 0.0758 |
| cosine_recall@10 | 0.2083 | 0.1416 | 0.38 | 0.1644 | 0.38 | 0.4 | 0.0501 | 0.33 | 0.8893 | 0.2087 | 0.52 | 0.27 | 0.1459 |
| cosine_ndcg@10 | 0.1515 | 0.2926 | 0.1948 | 0.1104 | 0.2913 | 0.1779 | 0.0929 | 0.1532 | 0.76 | 0.1842 | 0.2907 | 0.2084 | 0.2313 |
| cosine_mrr@10 | 0.2069 | 0.4482 | 0.1391 | 0.1365 | 0.3582 | 0.1093 | 0.1967 | 0.1021 | 0.7396 | 0.2786 | 0.2185 | 0.213 | 0.4017 |
| cosine_map@100 | 0.1188 | 0.206 | 0.1523 | 0.0827 | 0.2335 | 0.1258 | 0.0274 | 0.1245 | 0.7242 | 0.1455 | 0.232 | 0.1919 | 0.1588 |
NanoBEIR_mean{
"dataset_names": [
"climatefever",
"dbpedia",
"fever",
"fiqa2018",
"hotpotqa",
"msmarco",
"nfcorpus",
"nq",
"quoraretrieval",
"scidocs",
"arguana",
"scifact",
"touche2020"
],
"dataset_id": "sentence-transformers/NanoBEIR-en"
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.1772 |
| cosine_accuracy@3 | 0.3194 |
| cosine_accuracy@5 | 0.3965 |
| cosine_accuracy@10 | 0.5199 |
| cosine_precision@1 | 0.1772 |
| cosine_precision@3 | 0.1306 |
| cosine_precision@5 | 0.1124 |
| cosine_precision@10 | 0.0899 |
| cosine_recall@1 | 0.0904 |
| cosine_recall@3 | 0.1672 |
| cosine_recall@5 | 0.2214 |
| cosine_recall@10 | 0.3145 |
| cosine_ndcg@10 | 0.2415 |
| cosine_mrr@10 | 0.273 |
| cosine_map@100 | 0.1941 |
| question | answer | |
|---|---|---|
| type | string | string |
| details | <ul><li>min: 8 tokens</li><li>mean: 11.86 tokens</li><li>max: 21 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 60.48 tokens</li><li>max: 138 tokens</li></ul> |
| question | answer |
|---|---|
| <code>what is the difference between broilers and layers?</code> | <code>An egg laying poultry is called egger or layer whereas broilers are reared for obtaining meat. So a layer should be able to produce more number of large sized eggs, without growing too much. On the other hand, a broiler should yield more meat and hence should be able to grow well.</code> |
| <code>what is the difference between chronological order and spatial order?</code> | <code>As a writer, you should always remember that unlike chronological order and the other organizational methods for data, spatial order does not take into account the time. Spatial order is primarily focused on the location. All it does is take into account the location of objects and not the time.</code> |
| <code>is kamagra same as viagra?</code> | <code>Kamagra is thought to contain the same active ingredient as Viagra, sildenafil citrate. In theory, it should work in much the same way as Viagra, taking about 45 minutes to take effect, and lasting for around 4-6 hours. However, this will vary from person to person.</code> |
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 64,
"gather_across_devices": true,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
| 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> |
| 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> |
{
"scale": 20.0,
"similarity_fct": "cos_sim",
"mini_batch_size": 64,
"gather_across_devices": true,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
per_device_train_batch_size: 1024per_device_eval_batch_size: 1024learning_rate: 2e-05num_train_epochs: 1warmup_steps: 0.1fp16: Truebatch_sampler: no_duplicatesdo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 1024per_device_eval_batch_size: 1024gradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0.1log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Truedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | NanoClimateFEVER_cosine_ndcg@10 | NanoDBPedia_cosine_ndcg@10 | NanoFEVER_cosine_ndcg@10 | NanoFiQA2018_cosine_ndcg@10 | NanoHotpotQA_cosine_ndcg@10 | NanoMSMARCO_cosine_ndcg@10 | NanoNFCorpus_cosine_ndcg@10 | NanoNQ_cosine_ndcg@10 | NanoQuoraRetrieval_cosine_ndcg@10 | NanoSCIDOCS_cosine_ndcg@10 | NanoArguAna_cosine_ndcg@10 | NanoSciFact_cosine_ndcg@10 | NanoTouche2020_cosine_ndcg@10 | NanoBEIR_mean_cosine_ndcg@10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.0082 | 1 | 5.2273 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| 0.2049 | 25 | 5.0022 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| 0.2541 | 31 | - | 4.1730 | 0.1359 | 0.2292 | 0.1912 | 0.0939 | 0.2781 | 0.1820 | 0.0665 | 0.0769 | 0.7343 | 0.1322 | 0.2587 | 0.1597 | 0.1314 | 0.2054 |
| 0.4098 | 50 | 4.1202 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| 0.5082 | 62 | - | 3.1421 | 0.1315 | 0.2757 | 0.1906 | 0.0897 | 0.2795 | 0.1788 | 0.0779 | 0.1234 | 0.7298 | 0.1654 | 0.2745 | 0.1836 | 0.1940 | 0.2226 |
| 0.6148 | 75 | 3.3739 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| 0.7623 | 93 | - | 2.6714 | 0.1515 | 0.2926 | 0.1948 | 0.1104 | 0.2913 | 0.1779 | 0.0929 | 0.1532 | 0.7600 | 0.1842 | 0.2907 | 0.2084 | 0.2313 | 0.2415 |
| 0.8197 | 100 | 2.9527 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
@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",
}
@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.*
-->