Feature Extraction
sentence-transformers
Safetensors
bert
text-embeddings
information-retrieval
contrastive-learning
research
text-embeddings-inference
Instructions to use PrithviAI9998/CustomLossBGE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use PrithviAI9998/CustomLossBGE with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("PrithviAI9998/CustomLossBGE") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,419 +1,68 @@
|
|
| 1 |
---
|
| 2 |
-
tags:
|
| 3 |
-
- sentence-transformers
|
| 4 |
-
- sentence-similarity
|
| 5 |
-
- feature-extraction
|
| 6 |
-
- generated_from_trainer
|
| 7 |
-
- dataset_size:90000
|
| 8 |
-
- loss:DifficultyHardNegativeMNRL
|
| 9 |
-
widget:
|
| 10 |
-
- source_sentence: 'TyDi QA: A Large Question-Answer Dataset in 11 Very Different
|
| 11 |
-
Languages'
|
| 12 |
-
sentences:
|
| 13 |
-
- 'TyDi QA: A Benchmark for Information-Seeking Question Answering in Typologically
|
| 14 |
-
Diverse Languages'
|
| 15 |
-
- On the Interplay Between Fine-tuning and Sentence-level Probing for Linguistic
|
| 16 |
-
Knowledge in Pre-trained Transformers
|
| 17 |
-
- Domain Adaptation for Ear Recognition Using Deep Convolutional Neural Networks
|
| 18 |
-
- source_sentence: Using Artificial Intelligence and Chinese Calligraphy to Create
|
| 19 |
-
Meaningful Abstract Art
|
| 20 |
-
sentences:
|
| 21 |
-
- An Ontological Architecture for Orbital Debris Data
|
| 22 |
-
- Statistical Estimation of Ergodic Markov Chain Kernel over Discrete State Space
|
| 23 |
-
- A Framework and Dataset for Abstract Art Generation via CalligraphyGAN
|
| 24 |
-
- source_sentence: Breaking a Hard Two-Stage Optimization Problem into Pieces with
|
| 25 |
-
Primal-Dual Splitting and Deep Unrolling
|
| 26 |
-
sentences:
|
| 27 |
-
- 'RWNE: A Scalable Random-Walk-Based Network Embedding Framework with Personalized
|
| 28 |
-
Higher-Order Proximity Preserved'
|
| 29 |
-
- Two-Stage Stochastic Optimization via Primal-Dual Decomposition and Deep Unrolling
|
| 30 |
-
- Low-dimensional Embodied Semantics for Music and Language
|
| 31 |
-
- source_sentence: 'EPIC-KITCHENS: A Massive Video Dataset of Real People Cooking
|
| 32 |
-
in Their Own Kitchens'
|
| 33 |
-
sentences:
|
| 34 |
-
- On the Equivalence Between Abstract Dialectical Frameworks and Logic Programs
|
| 35 |
-
- 'FlowControl: Optical Flow Based Visual Servoing'
|
| 36 |
-
- 'Scaling Egocentric Vision: The EPIC-KITCHENS Dataset'
|
| 37 |
-
- source_sentence: 'Teaching AI to Paint: A Review of Neural Style Transfer'
|
| 38 |
-
sentences:
|
| 39 |
-
- Isointense infant brain MRI segmentation with a dilated convolutional neural
|
| 40 |
-
network
|
| 41 |
-
- Localizing Open-Ontology QA Semantic Parsers in a Day Using Machine Translation
|
| 42 |
-
- 'Neural Style Transfer: A Review'
|
| 43 |
-
pipeline_tag: sentence-similarity
|
| 44 |
library_name: sentence-transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
---
|
| 46 |
|
| 47 |
-
#
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
-
|
| 54 |
-
- **Model Type:** Sentence Transformer
|
| 55 |
-
<!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
|
| 56 |
-
- **Maximum Sequence Length:** 512 tokens
|
| 57 |
-
- **Output Dimensionality:** 768 dimensions
|
| 58 |
-
- **Similarity Function:** Cosine Similarity
|
| 59 |
-
- **Supported Modality:** Text
|
| 60 |
-
<!-- - **Training Dataset:** Unknown -->
|
| 61 |
-
<!-- - **Language:** Unknown -->
|
| 62 |
-
<!-- - **License:** Unknown -->
|
| 63 |
|
| 64 |
-
##
|
| 65 |
|
| 66 |
-
- **
|
| 67 |
-
- **
|
| 68 |
-
- **
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
##
|
| 71 |
|
| 72 |
-
|
| 73 |
-
SentenceTransformer(
|
| 74 |
-
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
|
| 75 |
-
(1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'cls', 'include_prompt': True})
|
| 76 |
-
(2): Normalize({})
|
| 77 |
-
)
|
| 78 |
-
```
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
##
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
```bash
|
| 87 |
-
pip install -U sentence-transformers
|
| 88 |
-
```
|
| 89 |
-
Then you can load this model and run inference.
|
| 90 |
```python
|
| 91 |
from sentence_transformers import SentenceTransformer
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
# Run inference
|
| 96 |
sentences = [
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
'Isointense infant brain MRI segmentation with a dilated convolutional neural network',
|
| 100 |
]
|
| 101 |
-
embeddings = model.encode(sentences)
|
| 102 |
-
print(embeddings.shape)
|
| 103 |
-
# [3, 768]
|
| 104 |
-
|
| 105 |
-
# Get the similarity scores for the embeddings
|
| 106 |
-
similarities = model.similarity(embeddings, embeddings)
|
| 107 |
-
print(similarities)
|
| 108 |
-
# tensor([[ 1.0000, 0.8865, -0.1032],
|
| 109 |
-
# [ 0.8865, 1.0000, -0.1180],
|
| 110 |
-
# [-0.1032, -0.1180, 1.0000]])
|
| 111 |
-
```
|
| 112 |
-
<!--
|
| 113 |
-
### Direct Usage (Transformers)
|
| 114 |
-
|
| 115 |
-
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 116 |
-
|
| 117 |
-
</details>
|
| 118 |
-
-->
|
| 119 |
-
|
| 120 |
-
<!--
|
| 121 |
-
### Downstream Usage (Sentence Transformers)
|
| 122 |
-
|
| 123 |
-
You can finetune this model on your own dataset.
|
| 124 |
-
|
| 125 |
-
<details><summary>Click to expand</summary>
|
| 126 |
-
|
| 127 |
-
</details>
|
| 128 |
-
-->
|
| 129 |
-
|
| 130 |
-
<!--
|
| 131 |
-
### Out-of-Scope Use
|
| 132 |
-
|
| 133 |
-
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 134 |
-
-->
|
| 135 |
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
-->
|
| 141 |
-
|
| 142 |
-
<!--
|
| 143 |
-
### Recommendations
|
| 144 |
-
|
| 145 |
-
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 146 |
-
-->
|
| 147 |
-
|
| 148 |
-
## Training Details
|
| 149 |
-
|
| 150 |
-
### Training Dataset
|
| 151 |
-
|
| 152 |
-
#### Unnamed Dataset
|
| 153 |
-
|
| 154 |
-
* Size: 90,000 training samples
|
| 155 |
-
* Columns: <code>anchor</code>, <code>positive</code>, and <code>difficulty</code>
|
| 156 |
-
* Approximate statistics based on the first 100 samples:
|
| 157 |
-
| | anchor | positive | difficulty |
|
| 158 |
-
|:---------|:-----------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------|
|
| 159 |
-
| type | string | string | float |
|
| 160 |
-
| modality | text | text | |
|
| 161 |
-
| details | <ul><li>min: 13 tokens</li><li>mean: 18.43 tokens</li><li>max: 33 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 14.8 tokens</li><li>max: 32 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.62</li><li>max: 1.0</li></ul> |
|
| 162 |
-
* Samples:
|
| 163 |
-
| anchor | positive | difficulty |
|
| 164 |
-
|:-------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------|
|
| 165 |
-
| <code>Optimizing Class-Specific Complex Network Generation for High-Level Classification Using Genetic Algorithms</code> | <code>Improve High Level Classification with a More Sensitive metric and Optimization approach for Complex Network Building</code> | <code>0.6605389916629563</code> |
|
| 166 |
-
| <code>Monte Carlo Self-Supervised Proposal-Based Object Segmentation via Background Reconstruction</code> | <code>Self-supervised Training of Proposal-based Segmentation via Background Prediction</code> | <code>0.2350132138874433</code> |
|
| 167 |
-
| <code>Task-Level Planning and Simulation for Robotic Assembly of Spiral Brick Columns</code> | <code>Towards Spiral Brick Column Building Robots</code> | <code>0.5583512859833102</code> |
|
| 168 |
-
* Loss: <code>__main__.DifficultyHardNegativeMNRL</code>
|
| 169 |
-
|
| 170 |
-
### Training Hyperparameters
|
| 171 |
-
#### Non-Default Hyperparameters
|
| 172 |
-
|
| 173 |
-
- `per_device_train_batch_size`: 64
|
| 174 |
-
- `learning_rate`: 2e-05
|
| 175 |
-
- `lr_scheduler_type`: cosine
|
| 176 |
-
- `warmup_steps`: 0.1
|
| 177 |
-
- `weight_decay`: 0.01
|
| 178 |
-
- `fp16`: True
|
| 179 |
-
|
| 180 |
-
#### All Hyperparameters
|
| 181 |
-
<details><summary>Click to expand</summary>
|
| 182 |
-
|
| 183 |
-
- `per_device_train_batch_size`: 64
|
| 184 |
-
- `num_train_epochs`: 3
|
| 185 |
-
- `max_steps`: -1
|
| 186 |
-
- `learning_rate`: 2e-05
|
| 187 |
-
- `lr_scheduler_type`: cosine
|
| 188 |
-
- `lr_scheduler_kwargs`: None
|
| 189 |
-
- `warmup_steps`: 0.1
|
| 190 |
-
- `optim`: adamw_torch_fused
|
| 191 |
-
- `optim_args`: None
|
| 192 |
-
- `weight_decay`: 0.01
|
| 193 |
-
- `adam_beta1`: 0.9
|
| 194 |
-
- `adam_beta2`: 0.999
|
| 195 |
-
- `adam_epsilon`: 1e-08
|
| 196 |
-
- `optim_target_modules`: None
|
| 197 |
-
- `gradient_accumulation_steps`: 1
|
| 198 |
-
- `average_tokens_across_devices`: True
|
| 199 |
-
- `max_grad_norm`: 1.0
|
| 200 |
-
- `label_smoothing_factor`: 0.0
|
| 201 |
-
- `bf16`: False
|
| 202 |
-
- `fp16`: True
|
| 203 |
-
- `bf16_full_eval`: False
|
| 204 |
-
- `fp16_full_eval`: False
|
| 205 |
-
- `tf32`: None
|
| 206 |
-
- `gradient_checkpointing`: False
|
| 207 |
-
- `gradient_checkpointing_kwargs`: None
|
| 208 |
-
- `torch_compile`: False
|
| 209 |
-
- `torch_compile_backend`: None
|
| 210 |
-
- `torch_compile_mode`: None
|
| 211 |
-
- `use_liger_kernel`: False
|
| 212 |
-
- `liger_kernel_config`: None
|
| 213 |
-
- `use_cache`: False
|
| 214 |
-
- `neftune_noise_alpha`: None
|
| 215 |
-
- `torch_empty_cache_steps`: None
|
| 216 |
-
- `auto_find_batch_size`: False
|
| 217 |
-
- `log_on_each_node`: True
|
| 218 |
-
- `logging_nan_inf_filter`: True
|
| 219 |
-
- `include_num_input_tokens_seen`: no
|
| 220 |
-
- `log_level`: passive
|
| 221 |
-
- `log_level_replica`: warning
|
| 222 |
-
- `disable_tqdm`: False
|
| 223 |
-
- `project`: huggingface
|
| 224 |
-
- `trackio_space_id`: None
|
| 225 |
-
- `trackio_bucket_id`: None
|
| 226 |
-
- `trackio_static_space_id`: None
|
| 227 |
-
- `per_device_eval_batch_size`: 8
|
| 228 |
-
- `prediction_loss_only`: True
|
| 229 |
-
- `eval_on_start`: False
|
| 230 |
-
- `eval_do_concat_batches`: True
|
| 231 |
-
- `eval_use_gather_object`: False
|
| 232 |
-
- `eval_accumulation_steps`: None
|
| 233 |
-
- `include_for_metrics`: []
|
| 234 |
-
- `batch_eval_metrics`: False
|
| 235 |
-
- `save_only_model`: False
|
| 236 |
-
- `save_on_each_node`: False
|
| 237 |
-
- `enable_jit_checkpoint`: False
|
| 238 |
-
- `push_to_hub`: False
|
| 239 |
-
- `hub_private_repo`: None
|
| 240 |
-
- `hub_model_id`: None
|
| 241 |
-
- `hub_strategy`: every_save
|
| 242 |
-
- `hub_always_push`: False
|
| 243 |
-
- `hub_revision`: None
|
| 244 |
-
- `load_best_model_at_end`: False
|
| 245 |
-
- `ignore_data_skip`: False
|
| 246 |
-
- `restore_callback_states_from_checkpoint`: False
|
| 247 |
-
- `full_determinism`: False
|
| 248 |
-
- `seed`: 42
|
| 249 |
-
- `data_seed`: None
|
| 250 |
-
- `use_cpu`: False
|
| 251 |
-
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
| 252 |
-
- `parallelism_config`: None
|
| 253 |
-
- `dataloader_drop_last`: False
|
| 254 |
-
- `dataloader_num_workers`: 0
|
| 255 |
-
- `dataloader_pin_memory`: True
|
| 256 |
-
- `dataloader_persistent_workers`: False
|
| 257 |
-
- `dataloader_prefetch_factor`: None
|
| 258 |
-
- `remove_unused_columns`: True
|
| 259 |
-
- `label_names`: None
|
| 260 |
-
- `train_sampling_strategy`: random
|
| 261 |
-
- `length_column_name`: length
|
| 262 |
-
- `ddp_find_unused_parameters`: None
|
| 263 |
-
- `ddp_bucket_cap_mb`: None
|
| 264 |
-
- `ddp_broadcast_buffers`: False
|
| 265 |
-
- `ddp_static_graph`: None
|
| 266 |
-
- `ddp_backend`: None
|
| 267 |
-
- `ddp_timeout`: 1800
|
| 268 |
-
- `fsdp`: None
|
| 269 |
-
- `fsdp_config`: None
|
| 270 |
-
- `deepspeed`: None
|
| 271 |
-
- `debug`: []
|
| 272 |
-
- `skip_memory_metrics`: True
|
| 273 |
-
- `do_predict`: False
|
| 274 |
-
- `resume_from_checkpoint`: None
|
| 275 |
-
- `warmup_ratio`: None
|
| 276 |
-
- `local_rank`: -1
|
| 277 |
-
- `prompts`: None
|
| 278 |
-
- `batch_sampler`: batch_sampler
|
| 279 |
-
- `multi_dataset_batch_sampler`: proportional
|
| 280 |
-
- `router_mapping`: {}
|
| 281 |
-
- `learning_rate_mapping`: {}
|
| 282 |
-
|
| 283 |
-
</details>
|
| 284 |
-
|
| 285 |
-
### Training Logs
|
| 286 |
-
| Epoch | Step | Training Loss |
|
| 287 |
-
|:------:|:----:|:-------------:|
|
| 288 |
-
| 0.0355 | 50 | 0.4145 |
|
| 289 |
-
| 0.0711 | 100 | 0.3501 |
|
| 290 |
-
| 0.1066 | 150 | 0.3438 |
|
| 291 |
-
| 0.1421 | 200 | 0.3303 |
|
| 292 |
-
| 0.1777 | 250 | 0.3097 |
|
| 293 |
-
| 0.2132 | 300 | 0.3408 |
|
| 294 |
-
| 0.2488 | 350 | 0.3330 |
|
| 295 |
-
| 0.2843 | 400 | 0.3043 |
|
| 296 |
-
| 0.3198 | 450 | 0.2819 |
|
| 297 |
-
| 0.3554 | 500 | 0.3188 |
|
| 298 |
-
| 0.3909 | 550 | 0.2908 |
|
| 299 |
-
| 0.4264 | 600 | 0.2752 |
|
| 300 |
-
| 0.4620 | 650 | 0.2821 |
|
| 301 |
-
| 0.4975 | 700 | 0.2914 |
|
| 302 |
-
| 0.5330 | 750 | 0.2819 |
|
| 303 |
-
| 0.5686 | 800 | 0.2641 |
|
| 304 |
-
| 0.6041 | 850 | 0.2505 |
|
| 305 |
-
| 0.6397 | 900 | 0.2366 |
|
| 306 |
-
| 0.6752 | 950 | 0.2548 |
|
| 307 |
-
| 0.7107 | 1000 | 0.2703 |
|
| 308 |
-
| 0.7463 | 1050 | 0.2538 |
|
| 309 |
-
| 0.7818 | 1100 | 0.2773 |
|
| 310 |
-
| 0.8173 | 1150 | 0.2314 |
|
| 311 |
-
| 0.8529 | 1200 | 0.2504 |
|
| 312 |
-
| 0.8884 | 1250 | 0.2327 |
|
| 313 |
-
| 0.9240 | 1300 | 0.2181 |
|
| 314 |
-
| 0.9595 | 1350 | 0.2357 |
|
| 315 |
-
| 0.9950 | 1400 | 0.2425 |
|
| 316 |
-
| 1.0306 | 1450 | 0.1656 |
|
| 317 |
-
| 1.0661 | 1500 | 0.1822 |
|
| 318 |
-
| 1.1016 | 1550 | 0.1690 |
|
| 319 |
-
| 1.1372 | 1600 | 0.1816 |
|
| 320 |
-
| 1.1727 | 1650 | 0.1538 |
|
| 321 |
-
| 1.2082 | 1700 | 0.1697 |
|
| 322 |
-
| 1.2438 | 1750 | 0.1674 |
|
| 323 |
-
| 1.2793 | 1800 | 0.1721 |
|
| 324 |
-
| 1.3149 | 1850 | 0.1702 |
|
| 325 |
-
| 1.3504 | 1900 | 0.1511 |
|
| 326 |
-
| 1.3859 | 1950 | 0.1752 |
|
| 327 |
-
| 1.4215 | 2000 | 0.1533 |
|
| 328 |
-
| 1.4570 | 2050 | 0.1593 |
|
| 329 |
-
| 1.4925 | 2100 | 0.1645 |
|
| 330 |
-
| 1.5281 | 2150 | 0.1574 |
|
| 331 |
-
| 1.5636 | 2200 | 0.1626 |
|
| 332 |
-
| 1.5991 | 2250 | 0.1694 |
|
| 333 |
-
| 1.6347 | 2300 | 0.1672 |
|
| 334 |
-
| 1.6702 | 2350 | 0.1717 |
|
| 335 |
-
| 1.7058 | 2400 | 0.1524 |
|
| 336 |
-
| 1.7413 | 2450 | 0.1197 |
|
| 337 |
-
| 1.7768 | 2500 | 0.1553 |
|
| 338 |
-
| 1.8124 | 2550 | 0.1674 |
|
| 339 |
-
| 1.8479 | 2600 | 0.1482 |
|
| 340 |
-
| 1.8834 | 2650 | 0.1463 |
|
| 341 |
-
| 1.9190 | 2700 | 0.1441 |
|
| 342 |
-
| 1.9545 | 2750 | 0.1422 |
|
| 343 |
-
| 1.9900 | 2800 | 0.1492 |
|
| 344 |
-
| 2.0256 | 2850 | 0.1162 |
|
| 345 |
-
| 2.0611 | 2900 | 0.1023 |
|
| 346 |
-
| 2.0967 | 2950 | 0.1114 |
|
| 347 |
-
| 2.1322 | 3000 | 0.1257 |
|
| 348 |
-
| 2.1677 | 3050 | 0.1266 |
|
| 349 |
-
| 2.2033 | 3100 | 0.1169 |
|
| 350 |
-
| 2.2388 | 3150 | 0.1274 |
|
| 351 |
-
| 2.2743 | 3200 | 0.1109 |
|
| 352 |
-
| 2.3099 | 3250 | 0.1158 |
|
| 353 |
-
| 2.3454 | 3300 | 0.1076 |
|
| 354 |
-
| 2.3810 | 3350 | 0.1130 |
|
| 355 |
-
| 2.4165 | 3400 | 0.1092 |
|
| 356 |
-
| 2.4520 | 3450 | 0.1124 |
|
| 357 |
-
| 2.4876 | 3500 | 0.1122 |
|
| 358 |
-
| 2.5231 | 3550 | 0.0988 |
|
| 359 |
-
| 2.5586 | 3600 | 0.1190 |
|
| 360 |
-
| 2.5942 | 3650 | 0.1136 |
|
| 361 |
-
| 2.6297 | 3700 | 0.1084 |
|
| 362 |
-
| 2.6652 | 3750 | 0.1250 |
|
| 363 |
-
| 2.7008 | 3800 | 0.1238 |
|
| 364 |
-
| 2.7363 | 3850 | 0.1163 |
|
| 365 |
-
| 2.7719 | 3900 | 0.1173 |
|
| 366 |
-
| 2.8074 | 3950 | 0.1039 |
|
| 367 |
-
| 2.8429 | 4000 | 0.1087 |
|
| 368 |
-
| 2.8785 | 4050 | 0.1255 |
|
| 369 |
-
| 2.9140 | 4100 | 0.1133 |
|
| 370 |
-
| 2.9495 | 4150 | 0.1085 |
|
| 371 |
-
| 2.9851 | 4200 | 0.1293 |
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
### Training Time
|
| 375 |
-
- **Training**: 17.1 minutes
|
| 376 |
-
|
| 377 |
-
### Framework Versions
|
| 378 |
-
- Python: 3.12.13
|
| 379 |
-
- Sentence Transformers: 5.6.0
|
| 380 |
-
- Transformers: 5.13.1
|
| 381 |
-
- PyTorch: 2.11.0+cu128
|
| 382 |
-
- Accelerate: 1.14.0
|
| 383 |
-
- Datasets: 4.0.0
|
| 384 |
-
- Tokenizers: 0.22.2
|
| 385 |
-
|
| 386 |
-
## Citation
|
| 387 |
-
|
| 388 |
-
### BibTeX
|
| 389 |
|
| 390 |
-
|
| 391 |
-
```bibtex
|
| 392 |
-
@inproceedings{reimers-2019-sentence-bert,
|
| 393 |
-
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 394 |
-
author = "Reimers, Nils and Gurevych, Iryna",
|
| 395 |
-
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
| 396 |
-
month = "11",
|
| 397 |
-
year = "2019",
|
| 398 |
-
publisher = "Association for Computational Linguistics",
|
| 399 |
-
url = "https://arxiv.org/abs/1908.10084",
|
| 400 |
-
}
|
| 401 |
```
|
| 402 |
|
| 403 |
-
|
| 404 |
-
## Glossary
|
| 405 |
-
|
| 406 |
-
*Clearly define terms in order to be accessible across audiences.*
|
| 407 |
-
-->
|
| 408 |
-
|
| 409 |
-
<!--
|
| 410 |
-
## Model Card Authors
|
| 411 |
|
| 412 |
-
|
| 413 |
-
-->
|
| 414 |
|
| 415 |
-
|
| 416 |
-
## Model Card Contact
|
| 417 |
|
| 418 |
-
|
| 419 |
-
-->
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: sentence-transformers
|
| 3 |
+
base_model: BAAI/bge-base-en-v1.5
|
| 4 |
+
tags:
|
| 5 |
+
- sentence-transformers
|
| 6 |
+
- feature-extraction
|
| 7 |
+
- text-embeddings
|
| 8 |
+
- information-retrieval
|
| 9 |
+
- contrastive-learning
|
| 10 |
+
- research
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# CustomLossBGE
|
| 14 |
|
| 15 |
+
## Overview
|
| 16 |
|
| 17 |
+
CustomLossBGE is a fine-tuned BGE-based sentence embedding model developed for semantic representation learning and research paper title retrieval.
|
| 18 |
|
| 19 |
+
The model explores difficulty-aware contrastive learning to improve semantic alignment between text representations, with particular emphasis on challenging negative examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
## Model Details
|
| 22 |
|
| 23 |
+
- **Architecture:** BGE
|
| 24 |
+
- **Base model:** BAAI/bge-base-en-v1.5
|
| 25 |
+
- **Training framework:** Sentence Transformers
|
| 26 |
+
- **Training objective:** Custom difficulty-aware contrastive loss
|
| 27 |
+
- **Embedding dimension:** 768 (verify against the uploaded model)
|
| 28 |
|
| 29 |
+
## Training Methodology
|
| 30 |
|
| 31 |
+
The model was fine-tuned using a custom loss formulation combining Multiple Negatives Ranking Loss with a difficulty-aware hard-negative margin objective.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
The objective incorporates sample difficulty to adapt the separation margin between positive and hard-negative representations.
|
| 34 |
|
| 35 |
+
## Intended Use
|
| 36 |
|
| 37 |
+
- Semantic similarity
|
| 38 |
+
- Dense text retrieval
|
| 39 |
+
- Research paper title matching
|
| 40 |
+
- Sentence embedding research
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
```python
|
| 45 |
from sentence_transformers import SentenceTransformer
|
| 46 |
|
| 47 |
+
model = SentenceTransformer("PrithviAI9998/CustomLossBGE")
|
| 48 |
+
|
|
|
|
| 49 |
sentences = [
|
| 50 |
+
"Deep learning for network anomaly detection",
|
| 51 |
+
"Neural approaches to intrusion detection"
|
|
|
|
| 52 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
+
embeddings = model.encode(
|
| 55 |
+
sentences,
|
| 56 |
+
normalize_embeddings=True
|
| 57 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
print(embeddings.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
```
|
| 61 |
|
| 62 |
+
## Limitations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
The model is primarily developed and evaluated in the context of research-oriented semantic retrieval. Performance may vary across domains and text types.
|
|
|
|
| 65 |
|
| 66 |
+
## Acknowledgements
|
|
|
|
| 67 |
|
| 68 |
+
Developed as part of research on semantic retrieval and original research title recovery.
|
|
|