Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use Netizine/icis_commodity_embedding with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Netizine/icis_commodity_embedding")
sentences = [
"How is demand from blown film converters trending for natural-colour rLDPE pellets sourced from production scrap in Germany?",
"For a tender closing Friday, market participants indicated post-industrial, food-grade HDPE bales could be workable around €1,030-1,110/t DAP Valencia for prompt-to-March delivery, depending on lot size and delivery flexibility.",
"Demand from German blown-film converters for natural rLDPE pellets sourced from production scrap was steady to slightly firmer week on week, though buyers continued to push back on offers above the low-to-mid €1,200s/t FCA level.",
"Europe recycled high-density polyethylene (R-HDPE) blow-moulding natural pellet demand continues to increase on the back of new packaging projects and increased recycled content use from the packaging sector."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from google/embeddinggemma-300m. It maps sentences & paragraphs to a 768-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': 2048, 'do_lower_case': False, 'architecture': 'Gemma3TextModel'})
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, '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): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
(4): 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("Netizine/icis_commodity_embedding")
# Run inference
queries = [
"Any new import inspections, permits, or customs delays affecting inbound post-consumer black HDPE bales into Vietnam this quarter?",
]
documents = [
'Market sources said Vietnam has maintained tighter inspection rates and documentation checks on inbound post-consumer black HDPE bales this quarter, extending customs clearance to roughly 10-15 working days in some cases, but without a major new permit requirement.',
'Deals and discussions for spot imports of HDPE have taken place at $960-970/tonne CFR (cost & freight) Vietnam, compared with the $1,030-1,050/tonne CFR Vietnam assessment range in the week ended 15 September.',
'Container freight indications from Ningbo to Hamburg were heard at roughly $2,000-2,300 per 40ft this week (about $80-100/t), adding to CIF Europe ideas for imported white rHDPE blow moulding pellets even as netbacks stayed steady.',
]
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.9667, 0.0020, 0.0885]])
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| anchor | positive | negative |
|---|---|---|
Can you give the latest ICIS range for rLDPE pellets, post-consumer, colourless, FCA Rotterdam/Antwerp? |
ICIS assessed post-consumer colourless rLDPE pellets at €1,070-1,170/t FCA Rotterdam/Antwerp in the week to 21 February 2026. |
ICIS began pricing R-HDPE natural blow-moulding pellets in May 2020. |
What are traders paying this week for PCR LDPE colourless pellets (post-consumer) delivered to Lombardy, Italy (DDP)? |
This week, post-consumer colourless PCR LDPE pellet business was heard around €1,180-1,280/t DDP Lombardy, with better-filtered, low-odour lots at the top of the range. |
Colourless (C) polyethylene terephthalate (PET) post-consumer bottle bale prices have increased in Italy in the latest monthly auction, adding upwards pressure to both recycled PET (R-PET) C flake and food-grade pellet (FGP) prices in the country, which reflects a common theme for January being felt across the wider European market. |
How did the weekly assessment for post-consumer colourless rLDPE pellets in NWE change versus last week? |
The ICIS weekly assessment for post-consumer colourless rLDPE pellets FCA Rotterdam/Antwerp fell by €20/t week on week to €1,070-1,170/t as buyers resisted higher offers. |
Consumption of flexible R-LDPE pellets has increased in April in NWE, although this remains counterbalanced by high stock levels. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false
}
per_device_train_batch_size: 16learning_rate: 2e-05num_train_epochs: 5warmup_ratio: 0.1prompts: {'anchor': 'task: search result | query: ', 'positive': 'title: none | text: ', 'negative': 'title: none | text: '}overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_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: 5max_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: 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}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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_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: Nonehub_always_push: Falsehub_revision: Nonegradient_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: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: {'anchor': 'task: search result | query: ', 'positive': 'title: none | text: ', 'negative': 'title: none | text: '}batch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0378 | 100 | 0.0336 |
| 0.0757 | 200 | 0.0013 |
| 0.1135 | 300 | 0.0009 |
| 0.1513 | 400 | 0.0015 |
| 0.1892 | 500 | 0.0019 |
| 0.2270 | 600 | 0.0013 |
| 0.2649 | 700 | 0.0034 |
| 0.3027 | 800 | 0.0046 |
| 0.3405 | 900 | 0.0007 |
| 0.3784 | 1000 | 0.0009 |
| 0.4162 | 1100 | 0.0022 |
| 0.4540 | 1200 | 0.0107 |
| 0.4919 | 1300 | 0.0081 |
| 0.5297 | 1400 | 0.0111 |
| 0.5675 | 1500 | 0.0052 |
| 0.6054 | 1600 | 0.0013 |
| 0.6432 | 1700 | 0.0108 |
| 0.6810 | 1800 | 0.0055 |
| 0.7189 | 1900 | 0.0042 |
| 0.7567 | 2000 | 0.0056 |
| 0.7946 | 2100 | 0.0034 |
| 0.8324 | 2200 | 0.0051 |
| 0.8702 | 2300 | 0.0021 |
| 0.9081 | 2400 | 0.0022 |
| 0.9459 | 2500 | 0.0089 |
| 0.9837 | 2600 | 0.0036 |
| 1.0216 | 2700 | 0.0013 |
| 1.0594 | 2800 | 0.0019 |
| 1.0972 | 2900 | 0.0015 |
| 1.1351 | 3000 | 0.0008 |
| 1.1729 | 3100 | 0.001 |
| 1.2107 | 3200 | 0.003 |
| 1.2486 | 3300 | 0.0013 |
| 1.2864 | 3400 | 0.0017 |
| 1.3243 | 3500 | 0.0008 |
| 1.3621 | 3600 | 0.0004 |
| 1.3999 | 3700 | 0.0012 |
| 1.4378 | 3800 | 0.0022 |
| 1.4756 | 3900 | 0.0032 |
| 1.5134 | 4000 | 0.0011 |
| 1.5513 | 4100 | 0.0016 |
| 1.5891 | 4200 | 0.0014 |
| 1.6269 | 4300 | 0.0024 |
| 1.6648 | 4400 | 0.0038 |
| 1.7026 | 4500 | 0.0015 |
| 1.7404 | 4600 | 0.0008 |
| 1.7783 | 4700 | 0.001 |
| 1.8161 | 4800 | 0.0006 |
| 1.8540 | 4900 | 0.0011 |
| 1.8918 | 5000 | 0.001 |
| 1.9296 | 5100 | 0.001 |
| 1.9675 | 5200 | 0.0013 |
| 2.0053 | 5300 | 0.0011 |
| 2.0431 | 5400 | 0.0005 |
| 2.0810 | 5500 | 0.0004 |
| 2.1188 | 5600 | 0.0009 |
| 2.1566 | 5700 | 0.001 |
| 2.1945 | 5800 | 0.0005 |
| 2.2323 | 5900 | 0.0012 |
| 2.2701 | 6000 | 0.0024 |
| 2.3080 | 6100 | 0.0006 |
| 2.3458 | 6200 | 0.0002 |
| 2.3837 | 6300 | 0.0005 |
| 2.4215 | 6400 | 0.0003 |
| 2.4593 | 6500 | 0.0004 |
| 2.4972 | 6600 | 0.0003 |
| 2.5350 | 6700 | 0.0006 |
| 2.5728 | 6800 | 0.0005 |
| 2.6107 | 6900 | 0.0005 |
| 2.6485 | 7000 | 0.0004 |
| 2.6863 | 7100 | 0.0007 |
| 2.7242 | 7200 | 0.0005 |
| 2.7620 | 7300 | 0.0003 |
| 2.7998 | 7400 | 0.0005 |
| 2.8377 | 7500 | 0.0007 |
| 2.8755 | 7600 | 0.0009 |
| 2.9134 | 7700 | 0.0002 |
| 2.9512 | 7800 | 0.0001 |
| 2.9890 | 7900 | 0.0012 |
| 3.0269 | 8000 | 0.0004 |
| 3.0647 | 8100 | 0.0014 |
| 3.1025 | 8200 | 0.0003 |
| 3.1404 | 8300 | 0.0004 |
| 3.1782 | 8400 | 0.0003 |
| 3.2160 | 8500 | 0.0002 |
| 3.2539 | 8600 | 0.0003 |
| 3.2917 | 8700 | 0.0002 |
| 3.3295 | 8800 | 0.0001 |
| 3.3674 | 8900 | 0.0003 |
| 3.4052 | 9000 | 0.0002 |
| 3.4431 | 9100 | 0.0001 |
| 3.4809 | 9200 | 0.0001 |
| 3.5187 | 9300 | 0.0003 |
| 3.5566 | 9400 | 0.0006 |
| 3.5944 | 9500 | 0.0002 |
| 3.6322 | 9600 | 0.0001 |
| 3.6701 | 9700 | 0.0002 |
| 3.7079 | 9800 | 0.0007 |
| 3.7457 | 9900 | 0.0001 |
| 3.7836 | 10000 | 0.0001 |
| 3.8214 | 10100 | 0.0002 |
| 3.8593 | 10200 | 0.0003 |
| 3.8971 | 10300 | 0.0001 |
| 3.9349 | 10400 | 0.0002 |
| 3.9728 | 10500 | 0.0001 |
| 4.0106 | 10600 | 0.0002 |
| 4.0484 | 10700 | 0.0002 |
| 4.0863 | 10800 | 0.0001 |
| 4.1241 | 10900 | 0.0003 |
| 4.1619 | 11000 | 0.0001 |
| 4.1998 | 11100 | 0.0001 |
| 4.2376 | 11200 | 0.0002 |
| 4.2754 | 11300 | 0.0004 |
| 4.3133 | 11400 | 0.0003 |
| 4.3511 | 11500 | 0.0001 |
| 4.3890 | 11600 | 0.0001 |
| 4.4268 | 11700 | 0.0001 |
| 4.4646 | 11800 | 0.0001 |
| 4.5025 | 11900 | 0.0005 |
| 4.5403 | 12000 | 0.0004 |
| 4.5781 | 12100 | 0.0001 |
| 4.6160 | 12200 | 0.0002 |
| 4.6538 | 12300 | 0.0001 |
| 4.6916 | 12400 | 0.0001 |
| 4.7295 | 12500 | 0.0001 |
| 4.7673 | 12600 | 0.0001 |
| 4.8051 | 12700 | 0.0 |
| 4.8430 | 12800 | 0.0001 |
| 4.8808 | 12900 | 0.0007 |
| 4.9187 | 13000 | 0.0001 |
| 4.9565 | 13100 | 0.0008 |
| 4.9943 | 13200 | 0.0001 |
@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",
}
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Base model
google/embeddinggemma-300m