Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
•
1908.10084
•
Published
•
9
This is a sentence-transformers model finetuned from Qwen/Qwen3-Embedding-0.6B on the massive_triplet_v3 dataset. It maps sentences & paragraphs to a 1024-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': 32768, 'do_lower_case': False}) with Transformer model: Qwen3Model
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, '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': True, '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("CocoRoF/POLAR-Qwen3-0.6b-linq-gist")
# Run inference
sentences = [
'create list of spiders that obeys the visible projects list, through use of the spider selection menu',
"def create_spiders_list():\n spiders_lst = [obj for obj in globals().values() if\n inspect.isclass(obj) and str(obj).split('.')[2] == 'spiders' and 'BaseSpider' not in str(obj)]\n visible_projects = find_visible_projects()\n spiders_dict = {i.split('.')[0]: [obj for obj in spiders_lst if i.split('.')[0] in str(obj)] for i in\n os.listdir('HousingPriceScraper/HousingPriceScraper/spiders/SpiderGroups')[:-1] if i.split('.')[0] in visible_projects}\n if len(list(spiders_dict.keys())) > 0:\n spiders_lst = select_spiders(spiders_dict)\n else:\n print('There are no visible projects, got to set_visible_projects to set defaults')\n return False\n return spiders_lst",
'def instantiate_pipelines(settings, simulator_settings):\n pipelines = []\n # lock to manage race parallel processes race conditions \n lock = Lock()\n\n logger.info("\\nVALIDATING PIPELINES\\n")\n for p_idx, pipeline_settings in enumerate(settings.runs):\n\n # turn a pipeline off by specifying num_runs as 0\n num_runs = pipeline_settings.get("num_runs", 0)\n\n # start_idx determines the first dataset name\'s starting idx\n start_idx = pipeline_settings.get("start_idx", 0)\n\n if num_runs:\n logger.info("Validating run: {}\\n".format(p_idx))\n else:\n logger.info("Skipping run: {}\\n".format(p_idx))\n \n for idx in range(start_idx, start_idx + num_runs): \n logger.info("Pipeline sub index: {}\\n".format(idx))\n # class factory and instantiate pipeline object\n Pipeline = pipeline_factory(pipeline_settings["pipeline_name"])\n p = Pipeline(pipeline_settings, idx, simulator_settings)\n \n # give each pipeline an idependent logger\n log_name = "dSim_{}".format(p.pipeline_settings["dataset_name"])\n log_path = os.path.join(p.pipeline_settings["outdir"],\n p.pipeline_settings["dataset_name"]+\'.log\')\n fh = logging.FileHandler(log_path, mode=\'w\')\n fh.setLevel(logging.DEBUG)\n format = "%(asctime)-6s: %(name)s - %(levelname)s - %(message)s"\n fmt = logging.Formatter(format)\n fh.setFormatter(fmt)\n local_logger = logging.getLogger(log_name)\n local_logger.addHandler(fh)\n logger.info("Init local logging: {}".format(log_path))\n p.logger = local_logger\n\n # pipeline/ dataset directory\n p.pipeline_settings["lock"] = lock\n\n # validate all submodules for each pipeline is ready (use local logger) \n p.instantiate_modules()\n\n # append to list of instantiated pipelines\n pipelines.append(p)\n return pipelines',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
query, positive, and negative| query | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| query | positive | negative |
|---|---|---|
방학기간에 소외지역의 청소년을 대상으로 청춘누리 봉사단이 할 수 있는 캠프의 이름은 뭐야 |
주요 수상기관 교육기부프로그램 개요 |
개도국에 IT나눔을 실천한 청년들과 아름다운 동행 |
Loads sensor filters from an Excel file. Both new style XLSX and oldstyle XLS formats are supported. |
def load_sensor_filters_excel(filename, normalise=False, sheet_names=None): |
def convert_csv(fname): |
Create an additional feature to metadata by counting number of occurrences in data, for a specific element_type |
def create_count_features(metadata, element_type, data, grp_feat, res_feat, feature_suffix): |
def test(self): |
CachedGISTEmbedLoss with these parameters:{'guide': SentenceTransformer(
(0): Transformer({'max_seq_length': 40960, 'do_lower_case': False}) with Transformer model: Qwen3Model
(1): Pooling({'word_embedding_dimension': 4096, 'pooling_mode_cls_token': False, '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': True, 'include_prompt': True})
(2): Normalize()
), 'temperature': 0.01}
overwrite_output_dir: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32gradient_accumulation_steps: 16learning_rate: 2e-06weight_decay: 0.01adam_beta2: 0.99adam_epsilon: 1e-07max_grad_norm: 0.3num_train_epochs: 1.0warmup_ratio: 0.1dataloader_num_workers: 16hub_model_id: CocoRoF/POLAR-Qwen3-0.6b-linq-gistprompts: ({'query': 'Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery:', 'document': ''},)batch_sampler: no_duplicatesoverwrite_output_dir: Truedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 32per_device_eval_batch_size: 32per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 16eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-06weight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.99adam_epsilon: 1e-07max_grad_norm: 0.3num_train_epochs: 1.0max_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: Truedataloader_num_workers: 16dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}tp_size: 0fsdp_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: CocoRoF/POLAR-Qwen3-0.6b-linq-gisthub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: 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: Falseaverage_tokens_across_devices: Falseprompts: ({'query': 'Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery:', 'document': ''},)batch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss |
|---|---|---|
| 0.0082 | 1 | 2.0699 |
| 0.0164 | 2 | 1.7826 |
| 0.0246 | 3 | 1.9799 |
| 0.0328 | 4 | 8.1569 |
| 0.0410 | 5 | 4.641 |
| 0.0492 | 6 | 4.847 |
| 0.0573 | 7 | 8.2247 |
| 0.0655 | 8 | 8.9525 |
| 0.0737 | 9 | 4.2975 |
| 0.0819 | 10 | 6.3088 |
| 0.0901 | 11 | 5.6983 |
| 0.0983 | 12 | 4.3867 |
| 0.1065 | 13 | 6.1817 |
| 0.1147 | 14 | 6.0226 |
| 0.1229 | 15 | 15.2869 |
| 0.1311 | 16 | 11.8965 |
| 0.1393 | 17 | 9.4219 |
| 0.1475 | 18 | 5.9216 |
| 0.1557 | 19 | 6.5436 |
| 0.1639 | 20 | 5.4599 |
| 0.1720 | 21 | 4.6468 |
| 0.1802 | 22 | 4.9366 |
| 0.1884 | 23 | 4.5267 |
| 0.1966 | 24 | 4.9044 |
| 0.2048 | 25 | 4.9682 |
| 0.2130 | 26 | 4.1537 |
| 0.2212 | 27 | 4.0729 |
| 0.2294 | 28 | 3.9093 |
| 0.2376 | 29 | 3.3863 |
| 0.2458 | 30 | 3.9228 |
| 0.2540 | 31 | 2.8689 |
| 0.2622 | 32 | 3.3243 |
| 0.2704 | 33 | 2.7494 |
| 0.2785 | 34 | 3.108 |
| 0.2867 | 35 | 3.1585 |
| 0.2949 | 36 | 3.2985 |
| 0.3031 | 37 | 2.7137 |
| 0.3113 | 38 | 2.8327 |
| 0.3195 | 39 | 2.7932 |
| 0.3277 | 40 | 3.038 |
| 0.3359 | 41 | 2.769 |
| 0.3441 | 42 | 2.7036 |
| 0.3523 | 43 | 3.1873 |
| 0.3605 | 44 | 2.5984 |
| 0.3687 | 45 | 2.6836 |
| 0.3769 | 46 | 3.0616 |
| 0.3850 | 47 | 2.87 |
| 0.3932 | 48 | 2.5225 |
| 0.4014 | 49 | 2.3775 |
| 0.4096 | 50 | 2.3407 |
| 0.4178 | 51 | 2.6313 |
| 0.4260 | 52 | 2.6966 |
| 0.4342 | 53 | 2.3673 |
| 0.4424 | 54 | 2.4391 |
| 0.4506 | 55 | 2.5654 |
| 0.4588 | 56 | 2.2967 |
| 0.4670 | 57 | 2.4656 |
| 0.4752 | 58 | 2.2497 |
| 0.4834 | 59 | 2.3793 |
| 0.4916 | 60 | 2.4427 |
| 0.4997 | 61 | 2.2327 |
| 0.5079 | 62 | 2.04 |
| 0.5161 | 63 | 2.2881 |
| 0.5243 | 64 | 2.0218 |
| 0.5325 | 65 | 2.3258 |
| 0.5407 | 66 | 2.1217 |
| 0.5489 | 67 | 1.9639 |
| 0.5571 | 68 | 2.1681 |
| 0.5653 | 69 | 2.1941 |
| 0.5735 | 70 | 2.1217 |
| 0.5817 | 71 | 2.1097 |
| 0.5899 | 72 | 2.1242 |
| 0.5981 | 73 | 1.9071 |
| 0.6062 | 74 | 1.8552 |
| 0.6144 | 75 | 1.8398 |
| 0.6226 | 76 | 1.9429 |
| 0.6308 | 77 | 1.6457 |
| 0.6390 | 78 | 1.656 |
| 0.6472 | 79 | 1.6597 |
| 0.6554 | 80 | 1.8188 |
| 0.6636 | 81 | 2.0348 |
| 0.6718 | 82 | 1.9511 |
| 0.6800 | 83 | 1.8009 |
| 0.6882 | 84 | 1.8279 |
| 0.6964 | 85 | 1.7993 |
| 0.7046 | 86 | 1.782 |
| 0.7127 | 87 | 1.6168 |
| 0.7209 | 88 | 1.7357 |
| 0.7291 | 89 | 1.5588 |
| 0.7373 | 90 | 1.6574 |
| 0.7455 | 91 | 1.7124 |
| 0.7537 | 92 | 1.7205 |
| 0.7619 | 93 | 1.7439 |
| 0.7701 | 94 | 1.4042 |
| 0.7783 | 95 | 1.547 |
| 0.7865 | 96 | 1.5815 |
| 0.7947 | 97 | 1.4141 |
| 0.8029 | 98 | 1.3568 |
| 0.8111 | 99 | 1.5084 |
| 0.8193 | 100 | 1.4027 |
| 0.8274 | 101 | 1.4902 |
| 0.8356 | 102 | 1.317 |
| 0.8438 | 103 | 1.8041 |
| 0.8520 | 104 | 1.4397 |
| 0.8602 | 105 | 1.3406 |
| 0.8684 | 106 | 1.5127 |
| 0.8766 | 107 | 1.2449 |
| 0.8848 | 108 | 1.4508 |
| 0.8930 | 109 | 1.4171 |
| 0.9012 | 110 | 1.626 |
| 0.9094 | 111 | 1.285 |
| 0.9176 | 112 | 1.2682 |
| 0.9258 | 113 | 1.5178 |
| 0.9339 | 114 | 1.3686 |
| 0.9421 | 115 | 1.227 |
| 0.9503 | 116 | 1.3685 |
| 0.9585 | 117 | 1.3253 |
| 0.9667 | 118 | 1.0893 |
| 0.9749 | 119 | 1.1753 |
| 0.9831 | 120 | 1.252 |
| 0.9913 | 121 | 1.2304 |
| 0.9995 | 122 | 1.1111 |
@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",
}