7j
/

SentenceTransformer based on BAAI/bge-base-en-v1.5

This is a sentence-transformers model finetuned from BAAI/bge-base-en-v1.5 on the msmarco and nq datasets. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-base-en-v1.5
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text
  • Training Datasets:
  • Language: en

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'cls', '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("7j/bge-base-en-v1.5-rag-query-adapter")
# Run inference
queries = [
    'which act requires manufacturers to disclose the origins of their minerals?',
]
documents = [
    'International efforts to reduce trade in conflict resources, tried to reduce incentives to extract and fight over them. For example, in the United States, the 2010 Doddâ\x80\x93Frank Wall Street Reform and Consumer Protection Act required manufacturers to audit their supply chains and report use of conflict minerals. In 2015 a US federal appeals court struck down some aspects of the reporting requirements as a violation of corporationsâ\x80\x99 freedom of speech, but left others in place.',
    'In 2010, Congress passed the Dodd-Frank Act, which directs the Commission to issue rules requiring certain companies to disclose their use of conflict minerals if those minerals are â\x80\x9cnecessary to the functionality or production of a productâ\x80\x9d manufactured by those companies. Under the Act, those minerals include tantalum, tin, gold or tungsten.',
    'Gastric balloon is a reversible, incision free weight loss procedure. There is one such device approved in the U.S.  the ReShape Integrated Dual Balloon System  but gastric balloons have been approved and used for years in some parts of Europe, as well as Canada, Australia, Mexico and South America.dvocates believe that it can still result in lasting and ongoing weight loss after removal because it helps exact behavioral changes; their theory holds that people get used to eating smaller portions of food and are therefore more inclined to continue to eat in this manner long after the balloon is removed.',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.6827, 0.7777, 0.3553]])

Evaluation

Metrics

Information Retrieval

Metric NanoMSMARCO NanoNQ
cosine_accuracy@1 0.46 0.54
cosine_accuracy@3 0.66 0.68
cosine_accuracy@5 0.72 0.7
cosine_accuracy@10 0.82 0.78
cosine_precision@1 0.46 0.54
cosine_precision@3 0.22 0.2267
cosine_precision@5 0.144 0.14
cosine_precision@10 0.082 0.084
cosine_recall@1 0.46 0.52
cosine_recall@3 0.66 0.65
cosine_recall@5 0.72 0.66
cosine_recall@10 0.82 0.75
cosine_ndcg@10 0.6316 0.6444
cosine_mrr@10 0.5724 0.6237
cosine_map@100 0.5825 0.6114

Nano BEIR

  • Dataset: NanoBEIR_mean
  • Evaluated with NanoBEIREvaluator with these parameters:
    {
        "dataset_names": [
            "MSMARCO",
            "NQ"
        ],
        "dataset_id": "sentence-transformers/NanoBEIR-en"
    }
    
Metric Value
cosine_accuracy@1 0.5
cosine_accuracy@3 0.67
cosine_accuracy@5 0.71
cosine_accuracy@10 0.8
cosine_precision@1 0.5
cosine_precision@3 0.2233
cosine_precision@5 0.142
cosine_precision@10 0.083
cosine_recall@1 0.49
cosine_recall@3 0.655
cosine_recall@5 0.69
cosine_recall@10 0.785
cosine_ndcg@10 0.638
cosine_mrr@10 0.5981
cosine_map@100 0.597

Training Details

Training Datasets

msmarco

  • Dataset: msmarco at ce8a493
  • Size: 10,000 training samples
  • Columns: query, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    query positive negative
    type string string string
    details
    • min: 4 tokens
    • mean: 9.05 tokens
    • max: 28 tokens
    • min: 19 tokens
    • mean: 76.85 tokens
    • max: 128 tokens
    • min: 16 tokens
    • mean: 74.76 tokens
    • max: 128 tokens
  • Samples:
    query positive negative
    what are the liberal arts? liberal arts. 1. the academic course of instruction at a college intended to provide general knowledge and comprising the arts, humanities, natural sciences, and social sciences, as opposed to professional or technical subjects. The New York State Education Department requires 60 Liberal Arts credits in a Bachelor of Science program and 90 Liberal Arts credits in a Bachelor of Arts program. In the list of course descriptions, courses which are liberal arts for all students are identified by (Liberal Arts) after the course number.
    what is the mechanism of action of fibrinolytic or thrombolytic drugs? Baillière's Clinical Haematology. 6 Mechanism of action of the thrombolytic agents. 6 Mechanism of action of the thrombolytic agents JEFFREY I. WEITZ Fibrin formed during the haemostatic, inflammatory or tissue repair process serves a temporary role, and must be degraded to restore normal tissue function and structure. Fibrinolytic drug. Fibrinolytic drug, also called thrombolytic drug, any agent that is capable of stimulating the dissolution of a blood clot (thrombus). Fibrinolytic drugs work by activating the so-called fibrinolytic pathway.
    what is normal plat count 78 Followers. A. Platelets are the tiny blood cells that help stop bleeding by binding together to form a clump or plug at sites of injury inside blood vessels. A normal platelet count is between 150,000 and 450,000 platelets per microliter (one-millionth of a liter, abbreviated mcL).The average platelet count is 237,000 per mcL in men and 266,000 per mcL in women.8 Followers. A. Platelets are the tiny blood cells that help stop bleeding by binding together to form a clump or plug at sites of injury inside blood vessels. A normal platelet count is between 150,000 and 450,000 platelets per microliter (one-millionth of a liter, abbreviated mcL). Your blood test results should be written in your maternity notes. Your platelet count will look something like Plat. 160x10.9/L, which means you have a platelet count of 160, which is in the normal range.If your platelet count is low, the blood test should be done again.This will keep track of whether or not your count is dropping.our platelet count will look something like Plat. 160x10.9/L, which means you have a platelet count of 160, which is in the normal range. If your platelet count is low, the blood test should be done again. This will keep track of whether or not your count is dropping.
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

nq

  • Dataset: nq at f9e894e
  • Size: 10,000 training samples
  • Columns: query and answer
  • Approximate statistics based on the first 1000 samples:
    query answer
    type string string
    details
    • min: 10 tokens
    • mean: 11.74 tokens
    • max: 21 tokens
    • min: 17 tokens
    • mean: 105.83 tokens
    • max: 128 tokens
  • Samples:
    query answer
    when did richmond last play in a preliminary final Richmond Football Club Richmond began 2017 with 5 straight wins, a feat it had not achieved since 1995. A series of close losses hampered the Tigers throughout the middle of the season, including a 5-point loss to the Western Bulldogs, 2-point loss to Fremantle, and a 3-point loss to the Giants. Richmond ended the season strongly with convincing victories over Fremantle and St Kilda in the final two rounds, elevating the club to 3rd on the ladder. Richmond's first final of the season against the Cats at the MCG attracted a record qualifying final crowd of 95,028; the Tigers won by 51 points. Having advanced to the first preliminary finals for the first time since 2001, Richmond defeated Greater Western Sydney by 36 points in front of a crowd of 94,258 to progress to the Grand Final against Adelaide, their first Grand Final appearance since 1982. The attendance was 100,021, the largest crowd to a grand final since 1986. The Crows led at quarter time and led by as many as 13, but the Tig...
    who sang what in the world's come over you Jack Scott (singer) At the beginning of 1960, Scott again changed record labels, this time to Top Rank Records.[1] He then recorded four Billboard Hot 100 hits – "What in the World's Come Over You" (#5), "Burning Bridges" (#3) b/w "Oh Little One" (#34), and "It Only Happened Yesterday" (#38).[1] "What in the World's Come Over You" was Scott's second gold disc winner.[6] Scott continued to record and perform during the 1960s and 1970s.[1] His song "You're Just Gettin' Better" reached the country charts in 1974.[1] In May 1977, Scott recorded a Peel session for BBC Radio 1 disc jockey, John Peel.
    who produces the most wool in the world Wool Global wool production is about 2 million tonnes per year, of which 60% goes into apparel. Wool comprises ca 3% of the global textile market, but its value is higher owing to dying and other modifications of the material.[1] Australia is a leading producer of wool which is mostly from Merino sheep but has been eclipsed by China in terms of total weight.[30] New Zealand (2016) is the third-largest producer of wool, and the largest producer of crossbred wool. Breeds such as Lincoln, Romney, Drysdale, and Elliotdale produce coarser fibers, and wool from these sheep is usually used for making carpets.
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 16
  • num_train_epochs: 1
  • learning_rate: 2e-05
  • warmup_steps: 0.1
  • weight_decay: 0.01
  • gradient_accumulation_steps: 4
  • disable_tqdm: True
  • per_device_eval_batch_size: 32
  • push_to_hub: True
  • hub_model_id: 7j/bge-base-en-v1.5-rag-query-adapter
  • dataloader_num_workers: 2
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 16
  • num_train_epochs: 1
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 4
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: False
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: True
  • project: huggingface
  • trackio_space_id: trackio
  • per_device_eval_batch_size: 32
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: True
  • hub_private_repo: None
  • hub_model_id: 7j/bge-base-en-v1.5-rag-query-adapter
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 2
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: []
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss NanoMSMARCO_cosine_ndcg@10 NanoNQ_cosine_ndcg@10 NanoBEIR_mean_cosine_ndcg@10
0.0032 1 3.7036 - - -
0.032 10 1.8804 - - -
0.064 20 2.3442 - - -
0.096 30 2.0224 - - -
0.128 40 2.1542 - - -
0.16 50 1.9589 - - -
0.192 60 2.0630 - - -
0.224 70 2.2774 - - -
0.256 80 1.7651 - - -
0.288 90 2.0196 - - -
0.32 100 1.8836 - - -
0.352 110 2.2037 - - -
0.384 120 2.3894 - - -
0.416 130 1.7873 - - -
0.448 140 1.9101 - - -
0.48 150 1.9055 - - -
0.512 160 1.7553 - - -
0.544 170 2.1702 - - -
0.576 180 1.9363 - - -
0.608 190 2.0139 - - -
0.64 200 1.6861 - - -
0.672 210 1.7386 - - -
0.704 220 2.0747 - - -
0.736 230 2.1088 - - -
0.768 240 1.7917 - - -
0.8 250 1.6875 - - -
0.832 260 2.2581 - - -
0.864 270 1.7539 - - -
0.896 280 1.6714 - - -
0.928 290 1.5976 - - -
0.96 300 1.7032 - - -
0.992 310 1.6623 - - -
-1 -1 - 0.6316 0.6444 0.6380

Training Time

  • Training: 10.4 hours

Framework Versions

  • Python: 3.12.12
  • Sentence Transformers: 5.4.1
  • Transformers: 5.5.4
  • PyTorch: 2.11.0+cu130
  • Accelerate: 1.13.0
  • Datasets: 4.8.4
  • Tokenizers: 0.22.2

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{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}
Downloads last month
4
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for 7j/bge-base-en-v1.5-rag-query-adapter

Finetuned
(467)
this model

Datasets used to train 7j/bge-base-en-v1.5-rag-query-adapter

Papers for 7j/bge-base-en-v1.5-rag-query-adapter

Evaluation results