SentenceTransformer

This is a sentence-transformers model trained. 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
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 384 tokens
  • Similarity Function: Cosine Similarity

Model Sources

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-transformers

Then you can load this model and run inference.

from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
    'Represent this sentence for searching relevant passages: How does the friction coefficient change under tangential action, and what is the friction coefficient for 90-degree angles?',
    'IS 875 (Part 3):1987 > Tables > Table 9\n( &uw 6.2.2.4 )\n-T i 1 T\nI 1 E 1\nL; G z I__ ---- _____: J I c\n--\n7\n9\n, ----I 1 1 End Surfaces\nD 1 D\nE ) E\' j c j c\' / c; I / j I - -05 / -0.3 1 ! -0\'6 / i I -0.3 / 1 -0.3 1 -0.4 I -0*3 / 0.8 / : I 0\'3\nI I I 0\'6 ! -1\'0\n-I\n0\n0.1 ; -0.3\n45O\n-0\'3 j -C\'4\nj_ I I I-\n9o"\nI\n_-A-\nForj : Cp top = -i\'O; Cp bottom = -0.2\n45"\nTangentially acting friction: ROOo ip 0\'05 pdbd\n90"\nRoof sIope a 0 30\' e - 0\' - 450, D, D\', E, E\' :x1: length 9 = 90", D, D\', E, E\' prr !engzh b\', thereafter Cp = 0\ni\n-7\n.j_ G\'\nI',
    'IS 875 (Part 3):1987 > Tables > Table 11\n( Clause 6.2.2.4)\nb=Sd\nPRESSURE COEFFICIENTS, CD\ne End Surfaces\nD D\' E E\'\n-- -~.\n00 -1.0 03 -0.5 0.2 ,\n45" -0\'3 0.1 -0\'3 0\'1\n90" -0.3 0 -0.3 0 -0\'4 0.8 09 -0.6 -\n0" Forf: Cp top = -11\'0; Cp bottom = 0\'4\n0" - 90° Tangentially acting friction, RIO\' = O"1 pdbd\nf b\'=d\n1\nRoof slope (L = IO" 8 = 0" - 45", D, D\', E, E\' full length 0 = 90°, D, D\', E, E\' par1 length b\', thereafter Cp = 0\nc I C G 1 G\nTABU I2 PRESSURE COEFFICIFiNTS (*OP AND BOTTOM ) FOR PITCRBD FBE ROOFS ir - 10" WITH EFFECTS OF TRAIN OR STORED MATJZItIAL8\nG i\n! 1 I /\n1 -0\'4 0.8 0\'3\n! I\ni I\nI\n0" \' ForJ: I;, top = -15; Cp bottom = 0.9\n0" - I!$" / Tangentially acting friction: R,o" .= 0.1 p&j\ni\n( CIaw 6.2.2.4 )\n-T h\'=O$t h _A_\ni i\n!\nRoof slope m - IO0 EAacts of trains or stored materials: e-o.=- 45\',or 135\' - 180°, D, D\', E, E\' full length 0 = 90*, D, D\', E, E\' part length b\', thereafter CD = 0\nG\'\n-0%',
]
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]

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.6912
cosine_accuracy@3 0.8971
cosine_accuracy@5 0.9265
cosine_accuracy@10 0.9412
cosine_precision@1 0.6912
cosine_precision@3 0.299
cosine_precision@5 0.1853
cosine_precision@10 0.0941
cosine_recall@1 0.6912
cosine_recall@3 0.8971
cosine_recall@5 0.9265
cosine_recall@10 0.9412
cosine_ndcg@10 0.8279
cosine_mrr@10 0.7901
cosine_map@100 0.7924
dot_accuracy@1 0.6912
dot_accuracy@3 0.8971
dot_accuracy@5 0.9265
dot_accuracy@10 0.9412
dot_precision@1 0.6912
dot_precision@3 0.299
dot_precision@5 0.1853
dot_precision@10 0.0941
dot_recall@1 0.6912
dot_recall@3 0.8971
dot_recall@5 0.9265
dot_recall@10 0.9412
dot_ndcg@10 0.8279
dot_mrr@10 0.7901
dot_map@100 0.7924

Training Details

Training Dataset

Unnamed Dataset

  • Size: 615 training samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 615 samples:
    anchor positive negative
    type string string string
    details
    • min: 18 tokens
    • mean: 32.74 tokens
    • max: 66 tokens
    • min: 30 tokens
    • mean: 300.54 tokens
    • max: 504 tokens
    • min: 71 tokens
    • mean: 340.02 tokens
    • max: 504 tokens
  • Samples:
    anchor positive negative
    Represent this sentence for searching relevant passages: Is ignoring a superior court's judgment on interest recovery considered a breach of Indian law's fundamental principles? Ssangyong v NHAI (SC 2019) > Judgment (R.F. Nariman, J.) > ¶ 13 (part 2/2) - Changes made by the Amendment Act, 2015
    would be set aside on the ground that it would be contrary to the public policy of India. It went on further to hold that a contravention of the provisions of the Foreign Exchange Regulation Act would be contrary to the public policy of India in that the statute is enacted for the national economic interest to ensure that the nation does not lose foreign exchange which is essential for the economic survival of the nation (see SCC p. 685, para 75). Equally, disregarding orders passed by the superior courts in India could also be a contravention of the fundamental policy of Indian law, but the recovery of compound interest on interest, being contrary to statute only, would not contravene any fundamental policy of Indian law (see SCC pp. 689 & 693, paras 85 & 95)."
    To this statement of the law, this Court added that the binding effect of the judgment of a superior court being disregarded would be equally violative of the fundamental policy of Indian Law [see paragraph 27].
    Ssangyong v NHAI (SC 2019) > Judgment (R.F. Nariman, J.) > ¶ 17 (part 1/7) - Changes made by the Amendment Act, 2015
    Yet another expansion of the phrase "public policy of India" contained in Section 34 of the 1996 Act was by another judgment of this Court in Western Geco (supra), which was explained in Associate Builders (supra) as follows:
    "28. In a recent judgment, ONGC Ltd. v. Western Geco International Ltd. [(2014) 9 SCC 263 : (2014) 5 SCC (Civ) 12], this Court added three other distinct and fundamental juristic principles which must be understood as a part and parcel of the fundamental policy of Indian law. The Court held: (SCC pp. 278-80, paras 35 & 38-40)
    "35. What then would constitute the
    'fundamental policy of Indian law' is the question. The decision in ONGC [(2003) 5 SCC 705 : AIR 2003 SC 2629] does not elaborate that aspect. Even so, the expression must, in our opinion, include all such fundamental principles as providing a basis for administration of justice and enforcement of law in this country. Without meaning to exhaustively enumerate the purport of the expression 'fundamental policy of Indian law', we may refer to three distinct and fundamental juristic principles that must necessarily be understood as a part and parcel of the fundamental policy of Indian law. The first and foremost is the principle that in every determination whether by a court or other authority that affects the rights of a citizen or leads to any civil consequences, the court or
    Represent this sentence for searching relevant passages: What are the procedures for submitting a corrected measurement book if errors are found in the initial one? CPWD GCC 2020 > Clauses of Contract > Clause 6 - Computerized Measurement Book
    The final, fair, computerized measurement book given by the contractor, duly bound, with its pages machine numbered, should be 100% correct, and no cutting or over-writing in the measurements would thereafter be allowed. If at all any error is noticed, the contractor shall have to submit a fresh computerized MB with its pages duly machine numbered and bound, after getting the earlier MB cancelled by the department. Thereafter, the MB shall be taken in the Divisional Office records, and allotted a number as per the Register of Computerized MBs. This should be done before the corresponding bill is submitted to the Division Office for payment. The contractor shall submit two spare copies of such computerized MB's for the purpose of reference and record by the various officers of the department.
    The contractor shall also submit to the department separately his computerized Abstract of Cost and the bill based on these measurements, duly bound, and its pages machine numbered along with two spare copies of the "bill. Thereafter, this bill will be processed by the Division Office and allotted a number as per the computerized record in the same way as done for the measurement book meant for measurements.
    The contractor shall, without extra charge, provide all assistance with every appliance, labour and other things necessary for checking of measurements/levels by the Engineer-in- Charge or his representative.
    Except where any general or detailed description of the work expressly shows to the contrary, measurements shall be taken in accordance with the procedure set forth in the specifications notwithstanding any provision in the relevant Standard Method of measurement or any general or local custom. In the case of items which are not covered by specifications, measurements shall be taken in accordance with the relevant standard method of measurement issued by the Bureau of Indian Standards and if for any item no such standard is available then a mutually agreed method shall be followed.
    Ssangyong v NHAI (SC 2019) > Judgment (R.F. Nariman, J.) > ¶ 17 (part 6/7) - Changes made by the Amendment Act, 2015
    33. It must clearly be understood that when a court is applying the "public policy" test to an arbitration award, it does not act as a court of appeal and consequently errors of fact cannot be corrected. A possible view by the arbitrator on facts has necessarily to pass muster as the arbitrator is the ultimate master of the quantity and quality of evidence to be relied upon when he delivers his arbitral award. Thus, an award based on little evidence or on evidence which does not measure up in quality to a trained legal mind would not be held to be invalid on this score. Once it is found that the arbitrator's approach is not arbitrary or capricious, then he is the last word on facts. In P.R. Shah, Shares & Stock Brokers (P) Ltd. v. B.H.H. Securities (P) Ltd. [(2012) 1 SCC 594 : (2012) 1 SCC (Civ) 342], this Court held: (SCC pp. 601-02, para 21)
    "21. A court does not sit in appeal over the
    Represent this sentence for searching relevant passages: What instruments are recommended for tall structures to measure wind data and how can this data be utilized? IS 875 (Part 3):1987 > Foreword > Cl. 0.3.3-0.4
    The Committee responsible for the revision of wind maps while reviewing available
    meteorological wind data and response of struc- tures to wind, felt the paucity of data on which to base wind maps for Indian conditions on statisti- cal analysis. The Committee, therefore, recomm- ends to all individuals and organizations responsible for putting-up of tall structures to ,provide instrumentation in. their existing and new structures ( transmission towers, chimneys, cooling towers, buildings, etc ) at different eleva- tions ( at least at two levels ) to continuously measure and monitor wind data. The instruments are required to collect data on wind direction, wind speed and structural response of the struc- ture due to wind ( with the help of accelerometer, strain gauges, etc ). It is also the opinion of the committee that such instrumentation in tall struc- tures will not in any way affect or alter the functional behaviour of such structures. The data so collected will be very valuable in evolving more accurate wind loading of structures.
    The Sectional Committee responsible for the preparation of this standard has taken into account the prevailing practice in regard to load- ing standards followed in this country by the various authorities and has also taken note of the developments in a number of other countries. In the preparation of this code, the following overseas standards have also been examined:
    a) BSCP 3 : 1973 Code of basic data for design of buildings: Chapter V Loading, Part 2 Wind loads.
    b) AS 1170, Part 2-1983 SAA Loading code Part 2 - Wind forces.
    c) NZS 4203-1976 Code of practice for general structural design loading for buildings.
    d) ANSI A58.1-1972 American Standard Building code requirements for minimum design loads in buildings and other structures.
    e) Wind resistant design regulations, A World List. Association for Science Documents Information, Tokyo.
    IS 875 (Part 3):1987 > 7. Dynamic Effects > Cl. 7-7.1 (part 1/4) - DYNAMIC EFFECTS
    DYNAMIC EFFECTS
    General - Flexible slender structures and structural elements shall be investigated to ascer- tain the importance of wind induized oscillations or excitations along and across the direction of wind.
    In general, the following guidelines may be 'used for examining the problems of wind induced oscillations:
    a) Buildings and closed structures with a height to minimum lateral dimension ratio of more than about 5.0. and
    IS : 875 ( Part 3 ) - 1987
    b) Buildings and closed structures whose natural frequency in the first mode -is less than 1-O Hz. Any building or structure which does not satisfy either of the above two criteria shall be examined for dynamic effects of wind.
    NOTE 1 - The fundamental time period (I) may either be established by experimental observations on similar buildings or calculated by any rational method of analysis. In the absence of such data, T may be determined as follows for multi-storeyed buildings: 4
    For moment .resisting frames without bracing or shear walls for resisting the lateral loads
    z-=0*1 n where n = number of storeys including basement sto- reys; and
    b)
    For all others
    == 0'09 H
    d/d where H - total height of the main structure of the building in metres, and
    d = maximum base dimension of building in metrcs in a direction parallel to the applied wind force.
    NOTE 2 - If preliminary studies indicate that wind-induced oscillations are likely to be rignificant, investigations should be persuade with the aid of analy- tical methods or, if necessary, by means oi wind tunnel tests on models. NOTE 3 - CrossLwind motions may by due to lateral gustiness of the wind, unsteady wake flow (for example, vortex shedding ), negative aerodynamic damping or to a combination of these effects. These cross-wind motions, can become critical in the design of tall buildings/structures.
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: epoch
  • per_device_train_batch_size: 32
  • learning_rate: 2e-05
  • warmup_ratio: 0.1
  • data_seed: 42
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: 42
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss val_cosine_map@100
0 0 - 0.7059
0.25 5 1.67 -
0.5 10 1.321 -
0.75 15 1.0658 -
1.0 20 0.7881 -
1.05 21 - 0.7916
1.2 25 0.8238 -
1.45 30 0.7223 -
1.7 35 0.7229 -
1.95 40 0.6751 -
2.05 42 - 0.7912
2.15 45 0.4682 -
2.4 50 0.5694 -
2.65 55 0.6663 -
2.9 60 0.6347 0.7924
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.12.7
  • Sentence Transformers: 3.2.1
  • Transformers: 4.45.2
  • PyTorch: 2.4.1+cu121
  • Accelerate: 1.0.1
  • Datasets: 3.0.1
  • Tokenizers: 0.20.3

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",
}

CachedMultipleNegativesRankingLoss

@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}
Downloads last month
23
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Papers for shawnriju/bge-small-construction-rag

Evaluation results