Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use jebish7/bge_MNSR with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("jebish7/bge_MNSR")
sentences = [
"Could you clarify the process for determining whether an entity is subject to FATCA and the ADGM Common Reporting Standard Regulations 2017?",
"If Rule 7.5.3(b) or 7.5.3(c) applies, the Insurance Intermediary must, if requested by the Retail Client, provide to that Client a list of insurers with whom it deals or may deal in relation to the relevant Contracts of Insurance.",
"REGULATORY REQUIREMENTS FOR AUTHORISED PERSONS ENGAGED IN REGULATED ACTIVITIES IN RELATION TO VIRTUAL ASSETS\nInternational Tax Reporting Obligations\nCOBS Rule 17.4 requires Authorised Persons to consider and, if applicable, adhere to their tax reporting obligations including, as applicable, under the Foreign Account Tax Compliance Act (“FATCA”) and the ADGM Common Reporting Standard Regulations 2017.\n",
"The following lists some of the items that an Authorised Person should consider including in its internal reporting of Operational Risks:\na.\tthe results of monitoring activities;\nb.\tassessments of the Operational Risk framework performed by control functions such as internal audit, compliance, risk management and/or external audit;\nc.\treports generated by (and/or for) supervisory authorities;\nd.\tmaterial breaches of the Authorised Person's risk appetite and tolerance with respect to Operational Risk;\ne.\tdetails of recent significant internal Operational Risk events and losses, including near misses or events that resulted in a positive return; and\nf.\trelevant external events and any potential impact on the Authorised Person and its Operational Risk framework, including Operational Risk capital."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from BAAI/bge-small-en-v1.5 on the csv dataset. 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.
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()
)
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("jebish7/bge_MNSR")
# Run inference
sentences = [
'How does ADGM ensure that FinTech Participants remain compliant with evolving regulatory standards, particularly in the context of new and developing technologies?',
'The Guidance is applicable to the following Persons:\n(a)\tan applicant for a Financial Services Permission to carry on the Regulated Activity of Developing Financial Technology Services within the RegLab in or from ADGM; and/or\n(b)\ta FinTech Participant.',
'DIGITAL SECURITIES – INTERMEDIARIES\nConventional Intermediaries – Digital Securities\nIntermediaries intending to operate solely, in the context of Digital Securities, as a broker or dealer for Clients (including the operation of an OTC broking or dealing desk) are not permitted to structure their broking / dealing service or platform in such a way that would have it be considered as operating a RIE or MTF. The FSRA would consider features such as allowing for price discovery, displaying a public trading order book (accessible to any member of the public, regardless of whether they are Clients), and allowing trades to automatically be matched using an exchange-type matching engine as characteristic of a RIE or MTF, and not activities acceptable for an Digital Securities intermediary to undertake.\n',
]
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]
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
In the case of a cross-border transaction involving jurisdictions with differing sanctions regimes, how should a Relevant Person prioritize and reconcile these requirements? |
Sanctions. UNSC Sanctions and Sanctions issued or administered by the U.A.E., including Targeted Financial Sanctions, apply in the ADGM. Relevant Persons must comply with Targeted Financial Sanctions. Sanctions compliance is emphasised by specific obligations contained in the AML Rulebook requiring Relevant Persons to establish and maintain effective systems and controls to comply with applicable Sanctions, including in particular Targeted Financial Sanctions, as set out in Chapter 11. |
How does the FSRA monitor and assess the deployment scalability of a FinTech proposal within the UAE and ADGM beyond the RegLab validity period? |
Evaluation Criteria. To qualify for authorisation under the RegLab framework, the applicant must demonstrate how it satisfies the following evaluation criteria: |
How does the ADGM define "distinct risks" that arise from conducting business entirely in an NFTF manner compared to a mix of face-to-face and NFTF interactions, and what specific risk mitigation strategies should be employed in these scenarios? |
The risk assessment under Rule 6.2.1(c) should identify actions to mitigate risks associated with undertaking NFTF business generally, and the use of eKYC specifically. This is because distinct risks are often likely to arise where business is conducted entirely in an NFTF manner, compared to when the business relationship includes a mix of face-to-face and NFTF interactions. The assessment should make reference to risk mitigation measures recommended by the Regulator, a competent authority of the U.A.E., FATF, and other relevant bodies. |
MultipleNegativesSymmetricRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
How should our firm approach the development and implementation of a risk management system that addresses the full spectrum of risks listed, including technology, compliance, and legal risks? |
Management of particular risks |
What measures could an Authorised Person take to ensure non-repudiation and accountability, so that individuals or systems processing information cannot deny their actions? |
|
What authority does the Regulator have over the terms and conditions applied to the escrow account holding funds from a Prospectus Offer? |
The Regulator may, during the Offer Period or such other longer period as specified, impose a requirement that the monies held by a Person making a Prospectus Offer or his agent pursuant to the Prospectus Offer or issuance are held in an escrow account for a specified period and on specified terms. |
MultipleNegativesSymmetricRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: epochper_device_train_batch_size: 64learning_rate: 2e-05num_train_epochs: 10warmup_ratio: 0.1load_best_model_at_end: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 8per_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: 10max_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: Falsefp16_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: Trueignore_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| Epoch | Step | Training Loss | loss |
|---|---|---|---|
| 0.8658 | 200 | 1.6059 | - |
| 1.2684 | 293 | - | 0.4773 |
| 1.4632 | 400 | 0.8247 | - |
| 2.2684 | 586 | - | 0.4313 |
| 2.0606 | 600 | 0.7352 | - |
| 2.9264 | 800 | 1.0011 | - |
| 3.2684 | 879 | - | 0.4038 |
| 3.5238 | 1000 | 0.646 | - |
| 4.2684 | 1172 | - | 0.3926 |
| 4.1212 | 1200 | 0.6207 | - |
| 4.9870 | 1400 | 0.8652 | - |
| 5.2684 | 1465 | - | 0.3769 |
| 5.5844 | 1600 | 0.5708 | - |
| 6.2684 | 1758 | - | 0.3691 |
| 6.1818 | 1800 | 0.5588 | - |
| 7.0476 | 2000 | 0.7551 | - |
| 7.2684 | 2051 | - | 0.3608 |
| 7.6450 | 2200 | 0.5758 | - |
| 8.1212 | 2310 | - | 0.3561 |
@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",
}
Base model
BAAI/bge-small-en-v1.5