SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': True, 'architecture': 'BertModel'})
(1): Pooling({'word_embedding_dimension': 1024, '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()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("rshn-krn/bge-large-legal-billing")
5# Run inference
6sentences = [
7 'Carrier: Coaction Global, Inc.\nAttorney: Senior Counsel | Rate: $245/hr | Units: 0.1\nTask: L120 - Analysis/Strategy | Activity: A103 - Draft/revise\nNarrative: Draft Litigation Status Report regarding the deposition testimony of California Highway Patrol Officer A.S. Johnson with attention to Section I. Testimony, subsection G. Witness Statements, subsection 3. Tuna Taleni ',
8 'Carrier: Coaction Global, Inc.\nAttorney: Senior Counsel | Rate: $245/hr | Units: 0.3\nTask: L120 - Analysis/Strategy | Activity: A103 - Draft/revise\nNarrative: Draft Litigation Status Report regarding the deposition testimony of California Highway Patrol Officer A.S. Johnson with attention to Section I. Testimony, subsection G. Witness Statements, subsection 4. Lumafale Oti ',
9 'Carrier: Mitsui Sumitomo Marine Management, Inc.\nAttorney: Senior Counsel | Rate: $325/hr | Units: 0.1\nTask: L110 - Fact Investigation/Development | Activity: A107 - Communicat/OUT\nNarrative: Email to current counsel for Google defendants regarding status of dismissal of non-related entities in our to evaluate the case for insured.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.9998, 0.4579],
19# [0.9998, 1.0000, 0.4567],
20# [0.4579, 0.4567, 1.0000]])anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
Carrier: Golden Bear Insurance Company[object Object]Attorney: Partner | Rate: $210/hr | Units: 0.3[object Object]Task: L120 - Analysis/Strategy | Activity: A104 - Review/analyze[object Object]Narrative: Review and analysis of asserted claims with particular attention to elements necessary to establish and likely defenses available to rebut claims and related initial pleadings, investigation, and discovery to leverage same so as to strategically implement ideal defense strategy | Carrier: Golden Bear Insurance Company[object Object]Attorney: Partner | Rate: $250/hr | Units: 0.1[object Object]Task: L440 - Other Trial Preparation and Support | Activity: A104 - Review/analyze[object Object]Narrative: Analyze the notice from the civil division manager for Monmouth County ordering a trial in this matter in April of 2025 |
Carrier: Aspen Specialty Insurance Company[object Object]Attorney: Associate | Rate: $240/hr | Units: 0.1[object Object]Task: L110 - Fact Investigation/Development | Activity: A103 - Draft/revise[object Object]Narrative: Draft and evaluate electronic correspondence to Ross McKissick, Plaintiff's counsel, discussing the nature and scope of Plaintiff's meet and confer issues for purposes of defense of same. | Carrier: Aspen Specialty Insurance Company[object Object]Attorney: Associate | Rate: $240/hr | Units: 1.4[object Object]Task: L310 - Written Discovery | Activity: A103 - Draft/revise[object Object]Narrative: Prepare Defendant's First Request for Production to Plaintiff. |
Carrier: Argo Group U.S.[object Object]Attorney: Paralegal | Rate: $135/hr | Units: 0.2[object Object]Task: L110 - Fact Investigation/Development | Activity: A103 - Draft/revise[object Object]Narrative: Draft r letter to American Pacific Concrete LLC to be in compliance with order issued by Arbitrator and to advise possible default can be entered if failure to respond. | Carrier: Argo Group U.S.[object Object]Attorney: Paralegal | Rate: $135/hr | Units: 0.2[object Object]Task: L130 - Experts/Consultants | Activity: A108 - Communicat/MISC[object Object]Narrative: Emails (4) to and from retained expert Jeff Ambrosia regarding meeting of experts of all parties to discuss landscaping issues in compliance with Arbitrator's order. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 32warmup_steps: 0.1gradient_accumulation_steps: 4fp16: Truegradient_checkpointing: Trueper_device_train_batch_size: 32num_train_epochs: 3max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 4average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Truegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: trackioeval_strategy: noper_device_eval_batch_size: 8prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_backend: Noneddp_timeout: 1800fsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}deepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0447 | 10 | 1.5338 |
| 0.0894 | 20 | 0.4740 |
| 0.1341 | 30 | 0.4362 |
| 0.1788 | 40 | 0.3799 |
| 0.2235 | 50 | 0.4078 |
| 0.2682 | 60 | 0.3891 |
| 0.3128 | 70 | 0.4182 |
| 0.3575 | 80 | 0.3938 |
| 0.4022 | 90 | 0.4459 |
| 0.4469 | 100 | 0.4123 |
| 0.4916 | 110 | 0.3640 |
| 0.5363 | 120 | 0.4194 |
| 0.5810 | 130 | 0.3928 |
| 0.6257 | 140 | 0.4267 |
| 0.6704 | 150 | 0.4228 |
| 0.7151 | 160 | 0.4358 |
| 0.7598 | 170 | 0.4309 |
| 0.8045 | 180 | 0.4161 |
| 0.8492 | 190 | 0.4289 |
| 0.8939 | 200 | 0.4091 |
| 0.9385 | 210 | 0.3994 |
| 0.9832 | 220 | 0.4184 |
| 1.0268 | 230 | 0.4119 |
| 1.0715 | 240 | 0.4279 |
| 1.1162 | 250 | 0.3907 |
| 1.1609 | 260 | 0.4242 |
| 1.2056 | 270 | 0.4049 |
| 1.2503 | 280 | 0.3787 |
| 1.2950 | 290 | 0.4150 |
| 1.3397 | 300 | 0.4472 |
| 1.3844 | 310 | 0.3944 |
| 1.4291 | 320 | 0.4288 |
| 1.4737 | 330 | 0.3718 |
| 1.5184 | 340 | 0.4148 |
| 1.5631 | 350 | 0.4160 |
| 1.6078 | 360 | 0.3907 |
| 1.6525 | 370 | 0.3918 |
| 1.6972 | 380 | 0.3777 |
| 1.7419 | 390 | 0.4300 |
| 1.7866 | 400 | 0.3913 |
| 1.8313 | 410 | 0.4205 |
| 1.8760 | 420 | 0.3863 |
| 1.9207 | 430 | 0.4370 |
| 1.9654 | 440 | 0.4225 |
| 2.0089 | 450 | 0.4057 |
| 2.0536 | 460 | 0.3843 |
| 2.0983 | 470 | 0.4034 |
| 2.1430 | 480 | 0.4115 |
| 2.1877 | 490 | 0.4128 |
| 2.2324 | 500 | 0.4028 |
| 2.2771 | 510 | 0.4198 |
| 2.3218 | 520 | 0.3613 |
| 2.3665 | 530 | 0.4017 |
| 2.4112 | 540 | 0.3639 |
| 2.4559 | 550 | 0.3978 |
| 2.5006 | 560 | 0.3982 |
| 2.5453 | 570 | 0.4059 |
| 2.5899 | 580 | 0.4175 |
| 2.6346 | 590 | 0.4510 |
| 2.6793 | 600 | 0.4210 |
| 2.7240 | 610 | 0.4098 |
| 2.7687 | 620 | 0.4082 |
| 2.8134 | 630 | 0.3970 |
| 2.8581 | 640 | 0.3846 |
| 2.9028 | 650 | 0.4155 |
| 2.9475 | 660 | 0.4071 |
| 2.9922 | 670 | 0.4293 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}