SQAI/bge-embedding-model2
BGE base Financial Matryoshka
This is a sentence-transformers model finetuned from SQAI/bge-embedding-model. It maps sentences & paragraphs to a 384-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: SQAI/bge-embedding-model <!-- at revision 9a9bc3f795ddfc56610a621b37aa077ae0653fa4 -->
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 384 tokens
- Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown -->
- Language: en
- License: apache-2.0
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}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, '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-transformersThen you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("SQAI/bge-embedding-model2")
# Run inference
sentences = [
'errors.controllerFault.lowLoadCurrent',
'"Can you provide me with the current status of the streetlight on \'street name\', specifically in relation to its voltage under load, whether it\'s lower than expected and how that might be indicating potential electrical issues? Could you also give me insight into the current drawn by the streetlight, whether or not the relay is currently on or off, and if there are any faults in the lux module that may affect light level sensing and control? Moreover, could you tell me the type of dimming schedule applied, the ambient light level detected in lux, the total energy consumed so far recorded in kilowatt-hours, and the lower voltage threshold for this streetlight\'s efficient operation?"',
'"Can you show me the current status of the relay in the streetlights located at the X-coordinate grid, highlighting any faults in the lux module that might be affecting light level sensing and control? Also, could you provide information on the current dimming level of these streetlights in operation, the type of dimming schedule applied, and whether the voltage is within the upper limit considered safe and efficient for their operation?"',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]<!--
Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details> -->
<!--
Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details> -->
<!--
Out-of-Scope Use
List how the model may foreseeably be misused and address what users ought not to do with the model. -->
Evaluation
Metrics
Information Retrieval
- Dataset:
dim_768 - Evaluated with <code>InformationRetrievalEvaluator</code>
Information Retrieval
- Dataset:
dim_512 - Evaluated with <code>InformationRetrievalEvaluator</code>
Information Retrieval
- Dataset:
dim_256 - Evaluated with <code>InformationRetrievalEvaluator</code>
Information Retrieval
- Dataset:
dim_128 - Evaluated with <code>InformationRetrievalEvaluator</code>
Information Retrieval
- Dataset:
dim_64 - Evaluated with <code>InformationRetrievalEvaluator</code>
<!--
Bias, Risks and Limitations
What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->
<!--
Recommendations
What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->
Training Details
Training Dataset
Unnamed Dataset
- Size: 1,865 training samples
- Columns: <code>positive</code> and <code>anchor</code>
- Approximate statistics based on the first 1000 samples: | | positive | anchor | |:--------|:---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 5 tokens</li><li>mean: 7.68 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>min: 17 tokens</li><li>mean: 89.79 tokens</li><li>max: 187 tokens</li></ul> |
- Samples: | positive | anchor | |:----------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>threshold.lowLoadVoltage</code> | <code>"What is the maximum current level above which it is considered unsafe for a specific streetlight in my area, what is the minimum longitude of the geographic area this streetlight covers, is this streetlight's control mode automated or manually controlled, also, can you provide the delta or width of the grid area occupied by this group of streetlights, what is the level of AC voltage supply to this streetlight, what's the lower voltage threshold below which this streetlight may not operate efficiently, how many times has this streetlight been switched on, what is the minimum operational voltage under load conditions, and finally, what is the latitude of this streetlight?"</code> | | <code>asset.id</code> | <code>"Could you please tell me the scheduled dimming settings for the string stored streetlights, troubleshoot why these streetlights remain on during daylight hours, and confirm if this could be due to sensor faults? Also, I'd like to know the identifier for the parent group to which this group of streetlights belongs, and the IMEI number of the streetlight device."</code> | | <code>errors.controllerFault.highPower</code> | <code>"Can you provide an analysis of the efficiency of power usage by examining the power factor of the streetlights, especially in areas of the grid with high Y-coordinates, highlight instances where power consumption is significantly higher than expected which may indicate faults, identify situations where voltage under load is above safe levels, and assess if there are any problems with our central control system's ability to manage streetlight groups?"</code> |
- Loss: <code>MatryoshkaLoss</code> with these parameters:
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
384,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1
],
"n_dims_per_step": -1
}Evaluation Dataset
Unnamed Dataset
- Size: 208 evaluation samples
- Columns: <code>positive</code> and <code>anchor</code>
- Approximate statistics based on the first 1000 samples: | | positive | anchor | |:--------|:---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | | details | <ul><li>min: 5 tokens</li><li>mean: 7.55 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>min: 19 tokens</li><li>mean: 90.69 tokens</li><li>max: 187 tokens</li></ul> |
- Samples: | positive | anchor | |:---------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>log.controlModeSwitch</code> | <code>"Can you provide the control mode switch identifier used for changing the default dimming level set for a specific group of streetlights, identified by their unique identifier, considering the time taken for the streetlight to activate or light up from the command, and possibly troubleshoot why the power consumption is lower than expected which could be due to hardware issues, quite possibly due to the relay responsible for turning the streetlight on and off sticking?"</code> | | <code>errors.controllerFault.luxModuleFault</code> | <code>"Can you provide the timestamp of the last update to the threshold settings, and detail any faults in the lux module related to light level sensing and control for the streetlight on this specific street name? I also want to know the longitude of the streetlight. And also, can you tell me what type of dimming schedule is applied to the streetlight, the type of port used for its dimming controls, and the total energy it has consumed, recorded in kilowatt-hours. Lastly, could you also provide the timestamp of the recorded streetlighting error, and confirm the status of the relay responsible for turning this streetlight on and off, as I am suspecting it might be sticking?"</code> | | <code>threshold.lowLoadCurrent</code> | <code>"What is the maximum safe voltage under load conditions for the city's streetlights, and do we possess the necessary rights to link these streetlights for synchronized control? Could you provide me with the timestamp of the latest data or action performed by our streetlights, and tell me the lower lux level threshold at which we would need to consider additional lighting? How often does each streetlight send a data report in normal operation, and what is the minimum load current level where we might start seeing suboptimal functioning? Have we been experiencing any problems with managing groups of streetlights via the central control system? Also, has there been any instances where the current under load was excessively high, indicating possible overloads, or situations where the operation temperature was belo normal limits due to environmental conditions? Lastly, have there been any noted communication issues between the streetlight's driver and the control system?"</code> |
- Loss: <code>MatryoshkaLoss</code> with these parameters:
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
384,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1
],
"n_dims_per_step": -1
}Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: epochper_device_train_batch_size: 32per_device_eval_batch_size: 16gradient_accumulation_steps: 16learning_rate: 2e-06weight_decay: 0.03num_train_epochs: 200lr_scheduler_type: cosinewarmup_ratio: 0.2bf16: Truetf32: Trueload_best_model_at_end: Trueoptim: adamwtorchfusedbatch_sampler: no_duplicates
All Hyperparameters
<details><summary>Click to expand</summary>
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 16eval_accumulation_steps: Nonelearning_rate: 2e-06weight_decay: 0.03adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 200max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.2warmup_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: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Truelocal_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: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamwtorchfusedoptim_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: Falsebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional
</details>
Training Logs
<details><summary>Click to expand</summary>
- The bold row denotes the saved checkpoint. </details>
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.0.1
- Transformers: 4.41.2
- PyTorch: 2.1.2+cu121
- Accelerate: 0.31.0
- Datasets: 2.19.1
- Tokenizers: 0.19.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",
}MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}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}
}<!--
Glossary
Clearly define terms in order to be accessible across audiences. -->
<!--
Model Card Authors
Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->
<!--
Model Card Contact
Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->
