SentenceTransformer based on NeuML/pubmedbert-base-embeddings
This is a sentence-transformers model finetuned from NeuML/pubmedbert-base-embeddings on the mimic10-hard-negatives 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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: NeuML/pubmedbert-base-embeddings
- Maximum Sequence Length: 64 tokens
- Output Dimensionality: 768 tokens
- Similarity Function: Cosine Similarity
- Training Dataset:
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 64, 'do_lower_case': False}) with Transformer model: BertModel
(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("alecocc/icd10-hard-negatives")
# Run inference
sentences = [
'CAD',
'Atherosclerotic heart disease of native coronary artery with unspecified angina pectoris',
'Myopia, bilateral',
]
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]
Training Details
Training Dataset
mimic10-hard-negatives
- Dataset: mimic10-hard-negatives at ef88fe5
- Size: 473,546 training samples
- Columns:
anchor
,positive
,negative_1
,negative_2
,negative_3
,negative_4
,negative_5
,negative_6
,negative_7
,negative_8
,negative_9
, andnegative_10
- Approximate statistics based on the first 1000 samples:
anchor positive negative_1 negative_2 negative_3 negative_4 negative_5 negative_6 negative_7 negative_8 negative_9 negative_10 type string string string string string string string string string string string string details - min: 3 tokens
- mean: 4.53 tokens
- max: 14 tokens
- min: 3 tokens
- mean: 9.67 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 10.19 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 10.49 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 10.8 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 11.1 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 11.64 tokens
- max: 38 tokens
- min: 3 tokens
- mean: 15.14 tokens
- max: 37 tokens
- min: 3 tokens
- mean: 15.58 tokens
- max: 40 tokens
- min: 4 tokens
- mean: 15.1 tokens
- max: 40 tokens
- min: 3 tokens
- mean: 14.96 tokens
- max: 37 tokens
- min: 3 tokens
- mean: 15.35 tokens
- max: 38 tokens
- Samples:
anchor positive negative_1 negative_2 negative_3 negative_4 negative_5 negative_6 negative_7 negative_8 negative_9 negative_10 Anterior exenteration
Malignant neoplasm of bladder neck
Malignant neoplasm of unspecified kidney, except renal pelvis
Malignant neoplasm of unspecified renal pelvis
Malignant neoplasm of left ureter
Malignant neoplasm of paraurethral glands
Malignant neoplasm of left renal pelvis
Unspecified kyphosis, cervical region
Unspecified superficial injuries of left back wall of thorax, initial encounter
Dome fracture of acetabulum
Other fracture of left great toe, initial encounter for open fracture
Unspecified fracture of upper end of unspecified radius, subsequent encounter for open fracture type IIIA, IIIB, or IIIC with malunion
Atorvastatin
Hyperlipidemia, unspecified
Other lactose intolerance
Lipomatosis, not elsewhere classified
Mucopolysaccharidosis, type II
Hyperuricemia without signs of inflammatory arthritis and tophaceous disease
Volume depletion, unspecified
Glaucoma secondary to other eye disorders, unspecified eye
Fracture of one rib, left side, subsequent encounter for fracture with routine healing
Toxic effect of other tobacco and nicotine, accidental (unintentional), sequela
Puncture wound without foreign body of left ring finger with damage to nail
Nondisplaced fracture of epiphysis (separation) (upper) of unspecified femur, subsequent encounter for open fracture type IIIA, IIIB, or IIIC with nonunion
Urostomy
Malignant neoplasm of bladder neck
Malignant neoplasm of urinary organ, unspecified
Malignant neoplasm of overlapping sites of urinary organs
Malignant neoplasm of left ureter
Malignant neoplasm of urethra
Malignant neoplasm of left renal pelvis
Indeterminate leprosy
Poisoning by other viral vaccines, accidental (unintentional)
Fracture of unspecified metatarsal bone(s), right foot, initial encounter for open fracture
Sprain of tarsometatarsal ligament of unspecified foot, subsequent encounter
Burn of first degree of multiple sites of left ankle and foot, initial encounter
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size
: 128per_device_eval_batch_size
: 128learning_rate
: 2e-05num_train_epochs
: 2warmup_ratio
: 0.1fp16
: Truebatch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: noprediction_loss_only
: Trueper_device_train_batch_size
: 128per_device_eval_batch_size
: 128per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_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
: 2max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_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
: Falseuse_ipex
: 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
: Falsedataloader_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}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_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
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_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
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falsebatch_sampler
: no_duplicatesmulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss |
---|---|---|
0.0270 | 100 | 4.1948 |
0.0541 | 200 | 3.5402 |
0.0811 | 300 | 3.2462 |
0.1081 | 400 | 2.9691 |
0.1351 | 500 | 2.788 |
0.1622 | 600 | 2.5922 |
0.1892 | 700 | 2.5648 |
0.2162 | 800 | 2.4821 |
0.2432 | 900 | 2.47 |
0.2703 | 1000 | 2.3774 |
0.2973 | 1100 | 2.3415 |
0.3243 | 1200 | 2.2428 |
0.3514 | 1300 | 2.2794 |
0.3784 | 1400 | 2.2372 |
0.4054 | 1500 | 2.2265 |
0.4324 | 1600 | 2.2186 |
0.4595 | 1700 | 2.2074 |
0.4865 | 1800 | 2.159 |
0.5135 | 1900 | 2.1903 |
0.5405 | 2000 | 2.1328 |
0.5676 | 2100 | 2.0685 |
0.5946 | 2200 | 2.1249 |
0.6216 | 2300 | 2.1321 |
0.6486 | 2400 | 2.0725 |
0.6757 | 2500 | 2.0913 |
0.7027 | 2600 | 2.0192 |
0.7297 | 2700 | 2.036 |
0.7568 | 2800 | 1.9863 |
0.7838 | 2900 | 2.0411 |
0.8108 | 3000 | 1.9796 |
0.8378 | 3100 | 2.0102 |
0.8649 | 3200 | 1.8652 |
0.8919 | 3300 | 1.0192 |
0.9189 | 3400 | 0.9623 |
0.9459 | 3500 | 0.957 |
0.9730 | 3600 | 0.8579 |
1.0 | 3700 | 0.7984 |
1.0270 | 3800 | 0.6359 |
1.0541 | 3900 | 0.7348 |
1.0811 | 4000 | 0.6356 |
1.1081 | 4100 | 0.6252 |
1.1351 | 4200 | 0.6587 |
1.1622 | 4300 | 0.602 |
1.1892 | 4400 | 0.6803 |
1.2162 | 4500 | 0.6204 |
1.2432 | 4600 | 0.667 |
1.2703 | 4700 | 0.6253 |
1.2973 | 4800 | 0.5375 |
1.3243 | 4900 | 0.6054 |
1.3514 | 5000 | 0.4541 |
1.3784 | 5100 | 0.5334 |
1.4054 | 5200 | 0.6075 |
1.4324 | 5300 | 0.5037 |
1.4595 | 5400 | 0.4825 |
1.4865 | 5500 | 0.5442 |
1.5135 | 5600 | 0.4999 |
1.5405 | 5700 | 0.6521 |
1.5676 | 5800 | 0.5769 |
1.5946 | 5900 | 0.5029 |
1.6216 | 6000 | 0.5787 |
1.6486 | 6100 | 0.5235 |
1.6757 | 6200 | 0.5839 |
1.7027 | 6300 | 0.5339 |
1.7297 | 6400 | 0.5339 |
1.7568 | 6500 | 0.4515 |
1.7838 | 6600 | 0.5648 |
1.8108 | 6700 | 0.4355 |
1.8378 | 6800 | 0.5321 |
1.8649 | 6900 | 0.4778 |
1.8919 | 7000 | 0.4884 |
1.9189 | 7100 | 0.5941 |
1.9459 | 7200 | 0.5489 |
1.9730 | 7300 | 0.444 |
2.0 | 7400 | 0.4964 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.2.1
- Transformers: 4.45.2
- PyTorch: 2.1.2+cu121
- Accelerate: 0.29.0.dev0
- Datasets: 2.18.0
- Tokenizers: 0.20.1
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",
}
MultipleNegativesRankingLoss
@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}
}
- Downloads last month
- 20
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for alecocc/icd10-hard-negatives
Base model
NeuML/pubmedbert-base-embeddings