SentenceTransformer based on BAAI/bge-base-en
This is a sentence-transformers model finetuned from BAAI/bge-base-en. 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: BAAI/bge-base-en
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
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': 512, 'do_lower_case': True, 'architecture': 'BertModel'})
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
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("aaa961/finetuned-bge-base-en-firefox")
# Run inference
sentences = [
"Loss of bookmarks state after OS hibernation User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0\n\nSteps to reproduce:\n\nKept Firefox 88.0 open for several days, using hibernate on Windows inbetween.\nCreated several bookmarks using Ctrl-D and Shift-Ctrl-D both for private as well as non-private sites.\nAlso created some bookmarks by dragging from address bar into subfolders of bookmark window.\nI was wondering, that on some windows star icon an address bar did not become blue.\nVerified, that i already had bookmarked this site by pressing Ctrl-D. The appropriate bookmarks subfolder was shown. Star still did not become true.\nAnything else seem ok.\nDid quit Firefox using File->Quit menu command, saving session with all open tabs.\nDid start Firefox with restoring previous session using menu command.\n\n\nActual results:\n\nSome of the bookmarks created above are lost. Can't remember most of them.\nHowever i remember a few sites, which i definitely had created a bookmark for.\nNo bookmark exists.\nAlso there is no entry in history for these sites. Missing entry in history might be due to using private window. (Can't remember if i was using a private window for opening this site.)\n\nI repeatedly had lost both bookmarks and history entries some month ago and then created a new profile. Did not import anything from previous profiles. \n\n\nExpected results:\n\nBookmarks should have been saved as expected.",
'Messages with triggers cause trigger listeners to initialize multiple times [Currently](https://searchfox.org/mozilla-central/rev/07342ce09126c513540c1c343476e026cfa907bf/browser/components/newtab/lib/ASRouter.jsm#827) we call the `.init` function of every trigger (when defined).\nThis makes sense for `openURL` where we accumulate more URLs but for others it is a bug\n* moments trigger will add multiple setIntervals\n* whatsNew will evaluate multiple times which is wasteful).',
'Urlbar docs: In index.rst, the Architecture Overview link in the Where to Start section is broken In index.rst, the Architecture Overview link in the Where to Start section links to an unrelated page in the devtools docs.',
]
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, 1.0000, 1.0000],
# [1.0000, 1.0000, 1.0000],
# [1.0000, 1.0000, 1.0000]])
Evaluation
Metrics
Triplet
- Dataset:
bge-base-en-train - Evaluated with
TripletEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy | 0.4904 |
Triplet
- Dataset:
bge-base-en-train - Evaluated with
TripletEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy | 0.5142 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 5,424 training samples
- Columns:
textsandlabel - Approximate statistics based on the first 1000 samples:
texts label type string int details - min: 17 tokens
- mean: 211.84 tokens
- max: 511 tokens
- 1: ~26.20%
- 2: ~21.70%
- 3: ~42.90%
- 4: ~0.80%
- 5: ~8.40%
- Samples:
texts label The "X" button of the opt-in modal is only read as "button" using a screen reader [Affected Versions]:
- Firefox Beta 97.0b2 (Build ID: 20220111185943)
- Firefox Nightly 98.a1 (Build ID: 20220111093827)
[Affected Platforms]:
- Windows 10 x64
- Ubuntu 20.04 x64
- macOS 10.15.7
[Prerequisites]:
- Have Firefox Beta 97.0b2 downloaded on your computer.
- Have the "browser.search.region" set to "US".
- Have one of the treatment user.js on your computer.
- Make sure there is no other modal displayed when starting the browser (browser default window, onboarding for new users etc).
- Have a screen reader application opened.
[Steps to reproduce]:
1. Open Firefox Beta 97.0b2.
2. Navigate to the “about:support” page and paste the user.js file into the Profile folder.
3. Restart the browser.
4. Focus on the "X" button of the modal.
5. Listen to what the screen reader application reads.
**[Exp...1Text and radio buttons are overlapping on PDF Tested with:
Nightly 91.0a1 (2021-06-23)
Tested on:
Win 10
Preconditions:
In about:config, set pdfjs.enableXfa = true
Steps:
1. Launch Firefox
2. Open the attached pdf.
3. Go to "Taille de l'entreprise"
Actual result:
Radio buttons and text are overlapping.
Expected result:
Text and radio buttons should be properly displayed1opening a new private window shows the old private window start page for a moment with browser.privatebrowsing.felt-privacy-v1, causing a bad perceived performance STR:
1. Set browser.privatebrowsing.felt-privacy-v1 to true
2. Open a private window
Actual:
The content of the old private window start page is visible during the window creation. This causes a very visible jump of the content and the window creation feels slow. Please see the following screencast:
https://www.youtube.com/watch?v=Fax2VqefuuY
You can change the speed to 0,25 on YouTube to see it even better.
Expected:
No felt performance issue.3 - Loss:
BatchSemiHardTripletLoss
Evaluation Dataset
Unnamed Dataset
- Size: 1,162 evaluation samples
- Columns:
textsandlabel - Approximate statistics based on the first 1000 samples:
texts label type string int details - min: 16 tokens
- mean: 209.86 tokens
- max: 508 tokens
- 1: ~26.30%
- 2: ~21.00%
- 3: ~42.50%
- 4: ~0.70%
- 5: ~9.50%
- Samples:
texts label (Proton) (a11y) Selected tabs almost not to see STR:
1. select multiple tabs
Expected:
You have no difficulties to see your selected tabs.
Actual:
It's almost not possible (at least to me) to see the selected tabs due to a insufficient contrast between the tab bar color and the tab color.
Marking as regression since it has a11y implications compared to pre Proton.2The Not Now button from the Fakespot Onboarding sidebar is missing the Clicked State Found in
* Nightly 118.0a1 (2023-08-18)
Affected versions
* Nightly 118.0a1 (2023-08-18)
Affected platforms
* ALL
Preconditions:
Set the browser.shopping.experience2023.enabled - TRUE
Set the toolkit.shopping.useOHTTP - TRUE
Steps to reproduce
1. Reach about:preferences and turn off feature recommendations.
2. Reach the Amazon https://www.amazon.com/dp/B09B6ZXD2V/ref=sbl_dpx_office-desks_B0B4CYW8FB_0 link
3. Click and Hold the Not Now button from the Onboarding Shopping sidebar.
Expected result
* The Not now button from the Onboarding Shopping sidebar should change its state when Clicked.
Actual result
* The Not now button from the Onboarding Shopping sidebar is missing the Clicked state.
Regression range
Not Applicable1Missing data from table Tested with:
Nightly 91.0a1 (2021-06-22)
Tested on:
Win 10
Preconditions:
In about:config, set pdfjs.enableXfa = true
Steps:
1. Launch firefox
2. Open the attached PDF
Actual result:
No data in table is displayed
Expected result:
A table with data should be displayed1 - Loss:
BatchSemiHardTripletLoss
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 2per_device_eval_batch_size: 2gradient_accumulation_steps: 8learning_rate: 2e-05num_train_epochs: 5warmup_ratio: 0.1fp16: Truebatch_sampler: group_by_label
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 2per_device_eval_batch_size: 2per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 8eval_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: 5max_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: 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: Falseneftune_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: Falseprompts: Nonebatch_sampler: group_by_labelmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss | bge-base-en-train_cosine_accuracy |
|---|---|---|---|---|
| 0.2950 | 100 | 5.4327 | 5.0655 | 0.5050 |
| 0.5900 | 200 | 5.2042 | 5.0281 | 0.4919 |
| 0.8850 | 300 | 5.1393 | 5.0186 | 0.5009 |
| 1.1829 | 400 | 5.1552 | 5.0137 | 0.5004 |
| 1.4779 | 500 | 5.0807 | 5.0111 | 0.4989 |
| 1.7729 | 600 | 5.0634 | 5.0092 | 0.4982 |
| 2.0708 | 700 | 5.1017 | 5.0079 | 0.4985 |
| 2.3658 | 800 | 5.0431 | 5.0067 | 0.4913 |
| 2.6608 | 900 | 5.0378 | 5.0058 | 0.4888 |
| 2.9558 | 1000 | 5.0332 | 5.0051 | 0.4904 |
| 3.2537 | 1100 | 5.08 | 5.0048 | 0.4897 |
| 3.5487 | 1200 | 5.0277 | 5.0043 | 0.4899 |
| 3.8437 | 1300 | 5.0257 | 5.0041 | 0.4888 |
| 4.1416 | 1400 | 5.075 | 5.0039 | 0.4924 |
| 4.4366 | 1500 | 5.0235 | 5.0038 | 0.4937 |
| 4.7316 | 1600 | 5.0224 | 5.0038 | 0.4904 |
| -1 | -1 | - | - | 0.5142 |
Framework Versions
- Python: 3.10.10
- Sentence Transformers: 5.1.0
- Transformers: 4.55.3
- PyTorch: 2.7.1+cu128
- Accelerate: 1.10.0
- Datasets: 4.0.0
- Tokenizers: 0.21.4
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",
}
BatchSemiHardTripletLoss
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
- Downloads last month
- 3
Model tree for aaa961/finetuned-bge-base-en-firefox
Base model
BAAI/bge-base-enEvaluation results
- Cosine Accuracy on bge base en trainself-reported0.490
- Cosine Accuracy on bge base en trainself-reported0.514