SentenceTransformer based on google-bert/bert-base-uncased
This is a sentence-transformers model finetuned from google-bert/bert-base-uncased. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: google-bert/bert-base-uncased
- Maximum Sequence Length: 75 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
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': 'cls', '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("kwondw/bert-base-uncased-trec-covid-tsdae")
# Run inference
sentences = [
'Of, cyclization using CF (3 CO))) ·Et (2) show that the, and enamidones trifluoromethyl residue were.',
'Of particular interest, the Friedel–Crafts cyclization using (CF(3)CO)(2)O/BF(3)·Et(2)O show that near the expected keto-lactams, enamides and enamidones containing trifluoromethyl residue were isolated.',
'FINDINGS: Initial clinical presentation included fever, chills, and myalgia in both patients, and for patient 1, diarrhoea.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.7967, 0.4642],
# [0.7967, 1.0000, 0.3914],
# [0.4642, 0.3914, 1.0000]])
Evaluation
Metrics
Information Retrieval
- Dataset:
trec-covid - Evaluated with InformationRetrievalEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.3 |
| cosine_accuracy@3 | 0.48 |
| cosine_accuracy@5 | 0.62 |
| cosine_accuracy@10 | 0.72 |
| cosine_precision@1 | 0.3 |
| cosine_precision@3 | 0.2467 |
| cosine_precision@5 | 0.24 |
| cosine_precision@10 | 0.202 |
| cosine_recall@1 | 0.0008 |
| cosine_recall@3 | 0.0018 |
| cosine_recall@5 | 0.0029 |
| cosine_recall@10 | 0.0049 |
| cosine_ndcg@10 | 0.2191 |
| cosine_mrr@10 | 0.4139 |
| cosine_map@100 | 0.0331 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 1,204,106 training samples
- Columns: noisy and text
- Approximate statistics based on the first 1000 samples:
noisy text type string string details min: 3 tokensmean: 22.09 tokensmax: 75 tokens min: 6 tokensmean: 34.99 tokensmax: 75 tokens - Samples:
noisy text of the mobile apps can potentially help mobile app developers improve or modify their mobile app achieve optimal outcomes The results of the mobile apps assessment can potentially help mobile app developers improve or modify their existing mobile app designs to achieve optimal outcomes. In model such specialty of covid-19 virus as the presence of "super-spreaders" by a on a hierarchic landscape of social spreads infection In particular, our model describes such a specialty of spread of covid-19 virus as the presence of "super-spreaders" who by performing a kind of random walk on a hierarchic landscape of social clusters spreads infection. The SARS-CoV-2 result The primary outcome was SARS-CoV-2 test result. - Loss: DenoisingAutoEncoderLoss with these parameters:
{ "decoder_name_or_path": "google-bert/bert-base-uncased", "need_retokenization": false }
Evaluation Dataset
Unnamed Dataset
- Size: 10,000 evaluation samples
- Columns: noisy and text
- Approximate statistics based on the first 1000 samples:
noisy text type string string details min: 3 tokensmean: 21.7 tokensmax: 75 tokens min: 4 tokensmean: 33.89 tokensmax: 75 tokens - Samples:
noisy text The intraoperative hypertension and hypotension not the PHE non-PHE cohorts. The frequency of intraoperative hypertension and hypotension did not differ between the PHE and non-PHE cohorts. , existing variants suffer problems: () large-scale optimization; (2) hyperparameter problem; high computational cost of the operations However, the existing BSO variants can suffer from three problems: (1) large-scale optimization problem; (2) hyperparameter optimization problem; (3) high computational cost of the clustering operations. neurological impact of coronaviruses implications the novel SARS-CoV-2 Potential neurological impact of coronaviruses: implications for the novel SARS-CoV-2. - Loss: DenoisingAutoEncoderLoss with these parameters:
{ "decoder_name_or_path": "google-bert/bert-base-uncased", "need_retokenization": false }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 32per_device_eval_batch_size: 32learning_rate: 3e-05num_train_epochs: 1warmup_ratio: 0.1fp16: True
All Hyperparameters
overwrite_output_dir: Falsedo_predict: Falseprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 3e-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: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Truedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_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: Noneadafactor: Falsegroup_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: Trueuse_legacy_prediction_loop: Falsepush_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_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_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: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss | trec-covid_cosine_ndcg@10 |
|---|---|---|---|---|
| -1 | -1 | - | - | 0.0426 |
| 0.0053 | 100 | 8.8093 | - | - |
| 0.0106 | 200 | 7.0291 | - | - |
| 0.0159 | 300 | 6.0361 | - | - |
| 0.0213 | 400 | 5.3162 | - | - |
| 0.0266 | 500 | 4.948 | - | - |
| 0.0319 | 600 | 4.7147 | - | - |
| 0.0372 | 700 | 4.5298 | - | - |
| 0.0425 | 800 | 4.3886 | - | - |
| 0.0478 | 900 | 4.2642 | - | - |
| 0.0532 | 1000 | 4.1818 | - | - |
| 0.0585 | 1100 | 4.066 | - | - |
| 0.0638 | 1200 | 4.0063 | - | - |
| 0.0691 | 1300 | 3.9134 | - | - |
| 0.0744 | 1400 | 3.84 | - | - |
| 0.0797 | 1500 | 3.7689 | - | - |
| 0.0850 | 1600 | 3.6951 | - | - |
| 0.0904 | 1700 | 3.6394 | - | - |
| 0.0957 | 1800 | 3.5781 | - | - |
| 0.1000 | 1882 | - | 3.4684 | 0.3187 |
| 0.1010 | 1900 | 3.5428 | - | - |
| 0.1063 | 2000 | 3.4823 | - | - |
| 0.1116 | 2100 | 3.4376 | - | - |
| 0.1169 | 2200 | 3.3825 | - | - |
| 0.1222 | 2300 | 3.3455 | - | - |
| 0.1276 | 2400 | 3.3159 | - | - |
| 0.1329 | 2500 | 3.2707 | - | - |
| 0.1382 | 2600 | 3.2369 | - | - |
| 0.1435 | 2700 | 3.2121 | - | - |
| 0.1488 | 2800 | 3.2047 | - | - |
| 0.1541 | 2900 | 3.1562 | - | - |
| 0.1595 | 3000 | 3.1153 | - | - |
| 0.1648 | 3100 | 3.1192 | - | - |
| 0.1701 | 3200 | 3.0879 | - | - |
| 0.1754 | 3300 | 3.0675 | - | - |
| 0.1807 | 3400 | 3.0677 | - | - |
| 0.1860 | 3500 | 3.0446 | - | - |
| 0.1913 | 3600 | 3.0262 | - | - |
| 0.1967 | 3700 | 2.9887 | - | - |
| 0.2001 | 3764 | - | 2.9182 | 0.2884 |
| 0.2020 | 3800 | 2.9773 | - | - |
| 0.2073 | 3900 | 2.9757 | - | - |
| 0.2126 | 4000 | 2.9605 | - | - |
| 0.2179 | 4100 | 2.9488 | - | - |
| 0.2232 | 4200 | 2.9405 | - | - |
| 0.2286 | 4300 | 2.9177 | - | - |
| 0.2339 | 4400 | 2.9198 | - | - |
| 0.2392 | 4500 | 2.9111 | - | - |
| 0.2445 | 4600 | 2.8871 | - | - |
| 0.2498 | 4700 | 2.8818 | - | - |
| 0.2551 | 4800 | 2.8733 | - | - |
| 0.2604 | 4900 | 2.8406 | - | - |
| 0.2658 | 5000 | 2.8417 | - | - |
| 0.2711 | 5100 | 2.8224 | - | - |
| 0.2764 | 5200 | 2.8358 | - | - |
| 0.2817 | 5300 | 2.8043 | - | - |
| 0.2870 | 5400 | 2.818 | - | - |
| 0.2923 | 5500 | 2.7969 | - | - |
| 0.2977 | 5600 | 2.7889 | - | - |
| 0.3001 | 5646 | - | 2.7185 | 0.2657 |
| 0.3030 | 5700 | 2.7777 | - | - |
| 0.3083 | 5800 | 2.7812 | - | - |
| 0.3136 | 5900 | 2.7592 | - | - |
| 0.3189 | 6000 | 2.7795 | - | - |
| 0.3242 | 6100 | 2.7619 | - | - |
| 0.3295 | 6200 | 2.7494 | - | - |
| 0.3349 | 6300 | 2.7261 | - | - |
| 0.3402 | 6400 | 2.7353 | - | - |
| 0.3455 | 6500 | 2.7374 | - | - |
| 0.3508 | 6600 | 2.7191 | - | - |
| 0.3561 | 6700 | 2.695 | - | - |
| 0.3614 | 6800 | 2.7202 | - | - |
| 0.3667 | 6900 | 2.6993 | - | - |
| 0.3721 | 7000 | 2.6927 | - | - |
| 0.3774 | 7100 | 2.6739 | - | - |
| 0.3827 | 7200 | 2.6903 | - | - |
| 0.3880 | 7300 | 2.6657 | - | - |
| 0.3933 | 7400 | 2.6901 | - | - |
| 0.3986 | 7500 | 2.6457 | - | - |
| 0.4001 | 7528 | - | 2.5967 | 0.2250 |
| 0.4040 | 7600 | 2.6521 | - | - |
| 0.4093 | 7700 | 2.6469 | - | - |
| 0.4146 | 7800 | 2.66 | - | - |
| 0.4199 | 7900 | 2.6402 | - | - |
| 0.4252 | 8000 | 2.641 | - | - |
| 0.4305 | 8100 | 2.6278 | - | - |
| 0.4358 | 8200 | 2.6179 | - | - |
| 0.4412 | 8300 | 2.6184 | - | - |
| 0.4465 | 8400 | 2.6266 | - | - |
| 0.4518 | 8500 | 2.6196 | - | - |
| 0.4571 | 8600 | 2.6184 | - | - |
| 0.4624 | 8700 | 2.6039 | - | - |
| 0.4677 | 8800 | 2.5929 | - | - |
| 0.4731 | 8900 | 2.6021 | - | - |
| 0.4784 | 9000 | 2.575 | - | - |
| 0.4837 | 9100 | 2.5908 | - | - |
| 0.4890 | 9200 | 2.5854 | - | - |
| 0.4943 | 9300 | 2.5934 | - | - |
| 0.4996 | 9400 | 2.5838 | - | - |
| 0.5002 | 9410 | - | 2.5046 | 0.2278 |
| 0.5049 | 9500 | 2.5755 | - | - |
| 0.5103 | 9600 | 2.5851 | - | - |
| 0.5156 | 9700 | 2.5843 | - | - |
| 0.5209 | 9800 | 2.5622 | - | - |
| 0.5262 | 9900 | 2.5568 | - | - |
| 0.5315 | 10000 | 2.5473 | - | - |
| 0.5368 | 10100 | 2.5527 | - | - |
| 0.5421 | 10200 | 2.5696 | - | - |
| 0.5475 | 10300 | 2.529 | - | - |
| 0.5528 | 10400 | 2.5312 | - | - |
| 0.5581 | 10500 | 2.5354 | - | - |
| 0.5634 | 10600 | 2.5293 | - | - |
| 0.5687 | 10700 | 2.5307 | - | - |
| 0.5740 | 10800 | 2.5202 | - | - |
| 0.5794 | 10900 | 2.5353 | - | - |
| 0.5847 | 11000 | 2.5128 | - | - |
| 0.5900 | 11100 | 2.5097 | - | - |
| 0.5953 | 11200 | 2.4985 | - | - |
| 0.6002 | 11292 | - | 2.4444 | 0.2278 |
| 0.6006 | 11300 | 2.4931 | - | - |
| 0.6059 | 11400 | 2.5152 | - | - |
| 0.6112 | 11500 | 2.5082 | - | - |
| 0.6166 | 11600 | 2.5133 | - | - |
| 0.6219 | 11700 | 2.4898 | - | - |
| 0.6272 | 11800 | 2.4835 | - | - |
| 0.6325 | 11900 | 2.4962 | - | - |
| 0.6378 | 12000 | 2.4959 | - | - |
| 0.6431 | 12100 | 2.4912 | - | - |
| 0.6485 | 12200 | 2.4951 | - | - |
| 0.6538 | 12300 | 2.4988 | - | - |
| 0.6591 | 12400 | 2.4688 | - | - |
| 0.6644 | 12500 | 2.4879 | - | - |
| 0.6697 | 12600 | 2.446 | - | - |
| 0.6750 | 12700 | 2.4813 | - | - |
| 0.6803 | 12800 | 2.4651 | - | - |
| 0.6857 | 12900 | 2.4745 | - | - |
| 0.6910 | 13000 | 2.4683 | - | - |
| 0.6963 | 13100 | 2.4602 | - | - |
| 0.7002 | 13174 | - | 2.3960 | 0.2213 |
| 0.7016 | 13200 | 2.455 | - | - |
| 0.7069 | 13300 | 2.4537 | - | - |
| 0.7122 | 13400 | 2.4559 | - | - |
| 0.7176 | 13500 | 2.4847 | - | - |
| 0.7229 | 13600 | 2.4559 | - | - |
| 0.7282 | 13700 | 2.4427 | - | - |
| 0.7335 | 13800 | 2.4544 | - | - |
| 0.7388 | 13900 | 2.4579 | - | - |
| 0.7441 | 14000 | 2.4354 | - | - |
| 0.7494 | 14100 | 2.4515 | - | - |
| 0.7548 | 14200 | 2.4542 | - | - |
| 0.7601 | 14300 | 2.4387 | - | - |
| 0.7654 | 14400 | 2.4286 | - | - |
| 0.7707 | 14500 | 2.4113 | - | - |
| 0.7760 | 14600 | 2.4242 | - | - |
| 0.7813 | 14700 | 2.4239 | - | - |
| 0.7866 | 14800 | 2.4353 | - | - |
| 0.7920 | 14900 | 2.4352 | - | - |
| 0.7973 | 15000 | 2.4214 | - | - |
| 0.8003 | 15056 | - | 2.3577 | 0.2162 |
| 0.8026 | 15100 | 2.426 | - | - |
| 0.8079 | 15200 | 2.4113 | - | - |
| 0.8132 | 15300 | 2.4309 | - | - |
| 0.8185 | 15400 | 2.4175 | - | - |
| 0.8239 | 15500 | 2.4168 | - | - |
| 0.8292 | 15600 | 2.4352 | - | - |
| 0.8345 | 15700 | 2.4225 | - | - |
| 0.8398 | 15800 | 2.4063 | - | - |
| 0.8451 | 15900 | 2.4151 | - | - |
| 0.8504 | 16000 | 2.4027 | - | - |
| 0.8557 | 16100 | 2.3933 | - | - |
| 0.8611 | 16200 | 2.4156 | - | - |
| 0.8664 | 16300 | 2.4136 | - | - |
| 0.8717 | 16400 | 2.3916 | - | - |
| 0.8770 | 16500 | 2.4114 | - | - |
| 0.8823 | 16600 | 2.3812 | - | - |
| 0.8876 | 16700 | 2.411 | - | - |
| 0.8930 | 16800 | 2.4001 | - | - |
| 0.8983 | 16900 | 2.4018 | - | - |
| 0.9003 | 16938 | - | 2.3311 | 0.2182 |
| 0.9036 | 17000 | 2.395 | - | - |
| 0.9089 | 17100 | 2.4117 | - | - |
| 0.9142 | 17200 | 2.4186 | - | - |
| 0.9195 | 17300 | 2.3813 | - | - |
| 0.9248 | 17400 | 2.4138 | - | - |
| 0.9302 | 17500 | 2.3926 | - | - |
| 0.9355 | 17600 | 2.3758 | - | - |
| 0.9408 | 17700 | 2.3898 | - | - |
| 0.9461 | 17800 | 2.3859 | - | - |
| 0.9514 | 17900 | 2.3853 | - | - |
| 0.9567 | 18000 | 2.3903 | - | - |
| 0.9620 | 18100 | 2.3833 | - | - |
| 0.9674 | 18200 | 2.3949 | - | - |
| 0.9727 | 18300 | 2.3944 | - | - |
| 0.9780 | 18400 | 2.3831 | - | - |
| 0.9833 | 18500 | 2.3798 | - | - |
| 0.9886 | 18600 | 2.3609 | - | - |
| 0.9939 | 18700 | 2.3829 | - | - |
| 0.9993 | 18800 | 2.3793 | - | - |
| -1 | -1 | - | - | 0.2191 |
Training Time
- Training: 3.9 hours
- Evaluation: 33.6 minutes
- Total: 4.5 hours
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.4.1
- Transformers: 4.57.6
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0
- Datasets: 5.0.0
- Tokenizers: 0.22.2
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",
}
DenoisingAutoEncoderLoss
@inproceedings{wang-2021-TSDAE,
title = "TSDAE: Using Transformer-based Sequential Denoising Auto-Encoderfor Unsupervised Sentence Embedding Learning",
author = "Wang, Kexin and Reimers, Nils and Gurevych, Iryna",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2021",
month = nov,
year = "2021",
address = "Punta Cana, Dominican Republic",
publisher = "Association for Computational Linguistics",
pages = "671--688",
url = "https://arxiv.org/abs/2104.06979",
}