--- tags: - sentence-transformers - sentence-similarity - feature-extraction - generated_from_trainer - dataset_size:180794 - loss:ContrastiveLoss base_model: michiyasunaga/BioLinkBERT-large widget: - source_sentence: Phgdh sentences: - Ps10 - ENSRNOG00000054310 - phosphoglycerate dehydrogenase - source_sentence: Ct55 sentences: - ENSRNOG00000066640 - LOC120100252 - ENSRNOG00000003203 - source_sentence: ENSRNOG00000056416 sentences: - U6 spliceosomal RNA - LOC120101297 - Tex15 - source_sentence: ENSRNOG00000024661 sentences: - osteoglycin - ENSRNOG00000042201 - Jpt2 - source_sentence: coactivator-associated arginine methyltransferase 1 sentences: - small nucleolar RNA SNORA17 - tRNA methyltransferase 13 homolog - solute carrier family 22, member 23 pipeline_tag: sentence-similarity library_name: sentence-transformers metrics: - pearson_cosine - spearman_cosine model-index: - name: SentenceTransformer based on michiyasunaga/BioLinkBERT-large results: - task: type: semantic-similarity name: Semantic Similarity dataset: name: val eval type: val-eval metrics: - type: pearson_cosine value: 0.7654387722246483 name: Pearson Cosine - type: spearman_cosine value: 0.7407893174141362 name: Spearman Cosine --- # SentenceTransformer based on michiyasunaga/BioLinkBERT-large This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [michiyasunaga/BioLinkBERT-large](https://huggingface.co/michiyasunaga/BioLinkBERT-large). It maps sentences & paragraphs to a 1024-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:** [michiyasunaga/BioLinkBERT-large](https://huggingface.co/michiyasunaga/BioLinkBERT-large) - **Maximum Sequence Length:** 128 tokens - **Output Dimensionality:** 1024 dimensions - **Similarity Function:** Cosine Similarity ### Model Sources - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### Full Model Architecture ``` SentenceTransformer( (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: BertModel (1): Pooling({'word_embedding_dimension': 1024, '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("sentence_transformers_model_id") # Run inference sentences = [ 'coactivator-associated arginine methyltransferase 1', 'tRNA methyltransferase 13 homolog', 'small nucleolar RNA SNORA17', ] embeddings = model.encode(sentences) print(embeddings.shape) # [3, 1024] # Get the similarity scores for the embeddings similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] ``` ## Evaluation ### Metrics #### Semantic Similarity * Dataset: `val-eval` * Evaluated with [EmbeddingSimilarityEvaluator](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.EmbeddingSimilarityEvaluator) | Metric | Value | |:--------------------|:-----------| | pearson_cosine | 0.7654 | | **spearman_cosine** | **0.7408** | ## Training Details ### Training Dataset #### Unnamed Dataset * Size: 180,794 training samples * Columns: text1, text2, and label * Approximate statistics based on the first 1000 samples: | | text1 | text2 | label | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | | | | * Samples: | text1 | text2 | label | |:--------------------------------|:-----------------------------------------|:---------------| | ENSRNOG00000007053 | mediator complex subunit 7 | 1 | | ENSRNOG00000060932 | small nucleolar RNA SNORA55 | 1 | | ENSRNOG00000015213 | ENSRNOG00000024039 | 0 | * Loss: [ContrastiveLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#contrastiveloss) with these parameters: ```json { "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 1.0, "size_average": true } ``` ### Evaluation Dataset #### Unnamed Dataset * Size: 22,599 evaluation samples * Columns: text1, text2, and label * Approximate statistics based on the first 1000 samples: | | text1 | text2 | label | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------| | type | string | string | int | | details | | | | * Samples: | text1 | text2 | label | |:--------------------------------|:--------------------------------|:---------------| | ENSRNOG00000001350 | Naa25 | 1 | | ENSRNOG00000019570 | Gng3 | 1 | | AABR07040892.1 | ENSRNOG00000039203 | 1 | * Loss: [ContrastiveLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#contrastiveloss) with these parameters: ```json { "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 1.0, "size_average": true } ``` ### Training Hyperparameters #### Non-Default Hyperparameters - `eval_strategy`: steps - `per_device_train_batch_size`: 256 - `per_device_eval_batch_size`: 256 - `learning_rate`: 3e-05 - `num_train_epochs`: 100 - `warmup_ratio`: 0.1 - `fp16`: True - `load_best_model_at_end`: True - `ddp_find_unused_parameters`: False #### All Hyperparameters
Click to expand - `overwrite_output_dir`: False - `do_predict`: False - `eval_strategy`: steps - `prediction_loss_only`: True - `per_device_train_batch_size`: 256 - `per_device_eval_batch_size`: 256 - `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`: 3e-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`: 100 - `max_steps`: -1 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: {} - `warmup_ratio`: 0.1 - `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`: False - `fp16`: True - `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`: True - `ignore_data_skip`: False - `fsdp`: [] - `fsdp_min_num_params`: 0 - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} - `tp_size`: 0 - `fsdp_transformer_layer_cls_to_wrap`: None - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': 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`: False - `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 - `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`: batch_sampler - `multi_dataset_batch_sampler`: proportional
### Training Logs | Epoch | Step | Training Loss | Validation Loss | val-eval_spearman_cosine | |:-----------:|:---------:|:-------------:|:---------------:|:------------------------:| | 0.7072 | 500 | 0.1291 | - | - | | 0.9986 | 706 | - | 0.1366 | -0.0396 | | 1.4144 | 1000 | 0.1134 | - | - | | 1.9972 | 1412 | - | 0.1040 | 0.3382 | | 2.1216 | 1500 | 0.1066 | - | - | | 2.8289 | 2000 | 0.0943 | - | - | | 2.9958 | 2118 | - | 0.0867 | 0.5349 | | 3.5361 | 2500 | 0.0863 | - | - | | 3.9943 | 2824 | - | 0.0825 | 0.5669 | | 4.2433 | 3000 | 0.0827 | - | - | | 4.9505 | 3500 | 0.0806 | - | - | | 4.9929 | 3530 | - | 0.0810 | 0.5764 | | 5.6577 | 4000 | 0.0782 | - | - | | 5.9915 | 4236 | - | 0.0785 | 0.5923 | | 6.3649 | 4500 | 0.0774 | - | - | | 6.9901 | 4942 | - | 0.0774 | 0.6017 | | 7.0721 | 5000 | 0.0758 | - | - | | 7.7793 | 5500 | 0.0735 | - | - | | 7.9887 | 5648 | - | 0.0773 | 0.6034 | | 8.4866 | 6000 | 0.0719 | - | - | | 8.9873 | 6354 | - | 0.0765 | 0.6052 | | 9.1938 | 6500 | 0.0701 | - | - | | 9.9010 | 7000 | 0.0685 | - | - | | 9.9859 | 7060 | - | 0.0753 | 0.6165 | | 10.6082 | 7500 | 0.0651 | - | - | | 10.9844 | 7766 | - | 0.0742 | 0.6215 | | 11.3154 | 8000 | 0.0634 | - | - | | 11.9830 | 8472 | - | 0.0730 | 0.6345 | | 12.0226 | 8500 | 0.0612 | - | - | | 12.7298 | 9000 | 0.0567 | - | - | | 12.9816 | 9178 | - | 0.0720 | 0.6401 | | 13.4371 | 9500 | 0.0538 | - | - | | 13.9802 | 9884 | - | 0.0708 | 0.6514 | | 14.1443 | 10000 | 0.0517 | - | - | | 14.8515 | 10500 | 0.048 | - | - | | 14.9788 | 10590 | - | 0.0691 | 0.6616 | | 15.5587 | 11000 | 0.0436 | - | - | | 15.9774 | 11296 | - | 0.0681 | 0.6692 | | 16.2659 | 11500 | 0.0417 | - | - | | 16.9731 | 12000 | 0.0394 | - | - | | 16.9760 | 12002 | - | 0.0659 | 0.6819 | | 17.6803 | 12500 | 0.0345 | - | - | | 17.9745 | 12708 | - | 0.0636 | 0.6954 | | 18.3876 | 13000 | 0.033 | - | - | | 18.9731 | 13414 | - | 0.0621 | 0.7027 | | 19.0948 | 13500 | 0.0313 | - | - | | 19.8020 | 14000 | 0.028 | - | - | | 19.9717 | 14120 | - | 0.0615 | 0.7066 | | 20.5092 | 14500 | 0.0258 | - | - | | 20.9703 | 14826 | - | 0.0598 | 0.7144 | | 21.2164 | 15000 | 0.0249 | - | - | | 21.9236 | 15500 | 0.0231 | - | - | | 21.9689 | 15532 | - | 0.0587 | 0.7191 | | 22.6308 | 16000 | 0.0207 | - | - | | 22.9675 | 16238 | - | 0.0582 | 0.7215 | | 23.3380 | 16500 | 0.0199 | - | - | | 23.9661 | 16944 | - | 0.0575 | 0.7245 | | 24.0453 | 17000 | 0.0194 | - | - | | 24.7525 | 17500 | 0.0169 | - | - | | 24.9646 | 17650 | - | 0.0562 | 0.7293 | | 25.4597 | 18000 | 0.0161 | - | - | | 25.9632 | 18356 | - | 0.0557 | 0.7327 | | 26.1669 | 18500 | 0.0159 | - | - | | 26.8741 | 19000 | 0.0146 | - | - | | 26.9618 | 19062 | - | 0.0550 | 0.7342 | | 27.5813 | 19500 | 0.0134 | - | - | | 27.9604 | 19768 | - | 0.0551 | 0.7340 | | 28.2885 | 20000 | 0.0132 | - | - | | 28.9590 | 20474 | - | 0.0544 | 0.7373 | | 28.9958 | 20500 | 0.0127 | - | - | | 29.7030 | 21000 | 0.0112 | - | - | | 29.9576 | 21180 | - | 0.0538 | 0.7387 | | 30.4102 | 21500 | 0.011 | - | - | | 30.9562 | 21886 | - | 0.0534 | 0.7403 | | 31.1174 | 22000 | 0.0109 | - | - | | 31.8246 | 22500 | 0.0099 | - | - | | 31.9547 | 22592 | - | 0.0536 | 0.7402 | | 32.5318 | 23000 | 0.0094 | - | - | | 32.9533 | 23298 | - | 0.0530 | 0.7421 | | 33.2390 | 23500 | 0.0093 | - | - | | 33.9463 | 24000 | 0.0091 | - | - | | 33.9519 | 24004 | - | 0.0528 | 0.7425 | | 34.6535 | 24500 | 0.0081 | - | - | | 34.9505 | 24710 | - | 0.0524 | 0.7435 | | 35.3607 | 25000 | 0.0081 | - | - | | 35.9491 | 25416 | - | 0.0529 | 0.7421 | | 36.0679 | 25500 | 0.008 | - | - | | 36.7751 | 26000 | 0.0072 | - | - | | 36.9477 | 26122 | - | 0.0526 | 0.7426 | | 37.4823 | 26500 | 0.007 | - | - | | **37.9463** | **26828** | **-** | **0.0522** | **0.7439** | | 38.1895 | 27000 | 0.007 | - | - | | 38.8967 | 27500 | 0.0067 | - | - | | 38.9448 | 27534 | - | 0.0529 | 0.7416 | | 39.6040 | 28000 | 0.0062 | - | - | | 39.9434 | 28240 | - | 0.0523 | 0.7425 | | 40.3112 | 28500 | 0.0062 | - | - | | 40.9420 | 28946 | - | 0.0529 | 0.7408 | * The bold row denotes the saved checkpoint. ### Framework Versions - Python: 3.10.12 - Sentence Transformers: 4.1.0 - Transformers: 4.51.3 - PyTorch: 2.6.0+cu124 - Accelerate: 1.6.0 - Datasets: 3.5.1 - Tokenizers: 0.21.1 ## 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", } ``` #### ContrastiveLoss ```bibtex @inproceedings{hadsell2006dimensionality, author={Hadsell, R. and Chopra, S. and LeCun, Y.}, booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)}, title={Dimensionality Reduction by Learning an Invariant Mapping}, year={2006}, volume={2}, number={}, pages={1735-1742}, doi={10.1109/CVPR.2006.100} } ```