Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 19
How to use GiacomoSignorile/Nomic-v1.5-FineTuned-for-Patent with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("GiacomoSignorile/Nomic-v1.5-FineTuned-for-Patent", trust_remote_code=True)
sentences = [
"Shaped charge warhead and a method for producing the warhead. Title: Shaped charge warhead and a method for producing the warhead\n\nAbstract: Described is a shaped charge warhead comprising an axially symmetric fragmentation casing designed to define a containment space and having in a base portion a casting hole for the explosive, a detonator housed in the casting hole and a conical liner of the shaped charge positioned inside the containment space.The casing and the conical or hemispherical liner, with a variable thickness, if necessary, are made in a single piece.The casing extends along a respective axis of extension in such a way as to also define a standoff of the charged warhead.\n\nBusiness Description: The present invention relates to a shaped charge warhead and to a method for producing the warhead. A shaped charge warhead (known as SCW – Shape Charge Warhead) is a device comprising a fragmentation container (casing) that defines the volume within which a shaped charge liner is positioned. The volume between the liner and the casing is filled with explosive.\n\nTech Features: The technical features include: One-piece shaped charge warhead: the patented warhead is manufactured by additive manufacturing (powder bed fusion), which makes it possible to create, in a single piece, both the axisymmetric container and the conical or hemispherical shell of the shaped charge liner. This eliminates assembly operations, reducing errors and complexity. Warheads currently available on the market are usually assembled from separate components, such as the container and the shell. This process presents the risk of misalignments between the components, which may negatively affect the symmetry of the explosive wave and, consequently, the penetrative capability of the jet. Cellular septa structure: the conical or hemispherical shell of the warhead has a cellular septa structure containing unsintered powder. This feature contributes to increasing the penetrative capability of the jet generated by the explosion, optimizing the mass distribution within the shell and improving performance. Variable thickness: the conical shell may be produced with variable thickness, representing an advantage over conventional constant-thickness warheads. This allows further optimization of explosive jet formation and control of the fragmentation flow. Shells of warheads currently available on the market are generally of constant thickness, which does not allow optimization of fragmentation flow or penetration. Advanced materials: the warhead may be manufactured using advanced metallic materials, such as copper, aluminum, tungsten, bismuth, or zirconium alloys—materials that are difficult to use with traditional technologies. Fragmentation control: the integration of geometric defects within the thickness of the container allows more precise control of the size of fragments generated by the explosion, improving safety and effectiveness.\n\nApplications: The patented shaped charge warhead technology has possible applications in strategic sectors such as defense, controlled demolitions, and the mining industry, where high precision is required in penetrating hard materials or creating controlled fragmentations. In civil and industrial demolitions, the warheads can be employed to bring down structures with maximum precision and safety, minimizing collateral damage. In the mining sector, the warheads could improve the efficiency of explosions for extracting minerals with greater control and reducing risks. The technology solves the limitations by identifying and overcoming the problem of critical assembly (thanks to single-piece additive manufacturing) and improving the performance of the explosive jet through the cellular septa structure and advanced materials. This translates into greater efficiency, reliability, and flexibility of use, creating value for the user thanks to warheads that offer better penetration, fragment control, and reduction of production and maintenance costs.\n\nAdvantages: Elimination of assembly: the warhead is manufactured as a single body through additive manufacturing, reducing alignment errors and production complexity. Improved penetrative capability: thanks to the cellular septa structure containing unsintered powder, the explosive jet has greater effectiveness and precision. Variable shell thickness: allows optimal mass distribution, improving jet efficiency and fragmentation capability. Advanced materials: the technology enables the use of metallic alloys that are difficult to employ with traditional methods, offering greater strength and performance. Fragmentation control: geometric defects in the container make it possible to precisely manage the size of the explosive fragments. These advantages translate into improved performance, reduced production costs, and greater safety.",
"COLLABORATIVE ROBOT FOR WAREHOUSE LOGISTICS. Title: COLLABORATIVE ROBOT FOR WAREHOUSE LOGISTICS\n\nAbstract: \n\nBusiness Description: Highly adaptive and flexible automatic system for the removal of protective film used for pallet wrapping. A prototype has been developed and tested both in the case where the film wraps the pallet only on the side and in the case where it covers the pallet both on the side and on the top surface showing a success rate of 100% and 76.92% respectively.\n\nTech Features: The operation of removing the protective film is typically carried out by operators equipped with cutting tools or automated systems designed specifically for the particular product and not suitable for the use of different types of pallets such as those required in the intra-logistics supply chain. The device consists of a robotic manipulator with 7 degrees of freedom and an end-effector equipped with a blade to cut the protective film. The device is flexible because it allows protective film to be cut on pallets of different nature, shape and size without modification of the equipment, eliminating the need for conversion times. The device has a reduced footprint, even considering a possible mounting on a mobile base to increase the working space. The device can be integrated with a second manipulator equipped with an end-effector that includes a gripper to pick up and manipulate the protective film. A prototype of the device has been made and experimentally validated in the laboratory.\n\nApplications: Intra-logistics sector that consists of the operations to be performed to move packages within a warehouse usually to compose multi-product pallets; Industrial automation and mechanical transport sector for all those industries that in the 4.0 paradigm want to introduce process innovations, in order to increase production while ensuring the integrity of the product on the pallet and safety for the human operator who may find himself working near the cutting device.\n\nAdvantages: Reduced footprint; Flexibility; Versatility.",
"‘TurtHEX’: data contextualization and augmented reality Bluetooth system. Title: ‘TurtHEX’: data contextualization and augmented reality Bluetooth system\n\nAbstract: Disclosed are a communication system (100), for a communication from a user device (102) facing a communication network according to a Bluetooth protocol (104) including a Bluetooth localization infrastructure arranged in a confined environment (A) to a recipient device (106) facing a communication network according to an Internet protocol (108), and a communication system (100), for a communication from a recipient device (106) facing a communication network according to an Internet protocol (112) to a user device (102) facing a communication network according to a Bluetooth protocol (104) including a Blue- tooth localization infrastructure arranged in a confined environment (A). An advanced request communication message and an advanced response communication message are also disclosed.\n\nBusiness Description: TurtHEX technology enables private, personalized and contextualized communication channels to be opened in indoor environments for any user with a Bluetooth or WiFi device. Each communication channel is tied to the user's location in the space: TurtHEX allows any environment to present itself and provide contextualized information to any device connected to the system.\n\nTech Features: TurtHEX technology revolutionizes the concept of Bluetooth and WiFi networks by introducing in a transparent manner information regarding the user's position in space, with centimeter resolution, along with the data stream between network and user. This information is made available to the user without the need for additional devices: any user with a Bluetooth or WiFi device can obtain a personalized and contextualized data stream. TurtHEX system is based on a new type of router based on a set of directional antennas, called Anchor , which can be directly substituted for current WiFi routers. Each TurtHEX Anchor can provide location functionality transparently, combined with normal networking functionality. As with normal WiFi access-points, in the case of larger environments it is possible to install multiple anchors that will be able to automatically cooperate in a \"plug-and-play\" manner in the localization function further improving the accuracy of spatial localization.\nIn particular, TurtHEX is the world's first technology capable of locating general-purpose Bluetooth and WiFi devices with centimeter accuracy in complex environments, without the need for any prior calibration.\nThe TRL of the patented technology is 7.\n\nApplications: Home automation; Augmented reality; Domotics in both private and working environments; Smart industry; Agricolture.\n\nAdvantages: Self-calibrating system; User-friendly; Real-time contextualized and transparent dataflow.",
"Shaped charge warhead and a method for producing the warhead. Title: Shaped charge warhead and a method for producing the warhead\n\nAbstract: Described is a shaped charge warhead comprising an axially symmetric fragmentation casing designed to define a containment space and having in a base portion a casting hole for the explosive, a detonator housed in the casting hole and a conical liner of the shaped charge positioned inside the containment space.The casing and the conical or hemispherical liner, with a variable thickness, if necessary, are made in a single piece.The casing extends along a respective axis of extension in such a way as to also define a standoff of the charged warhead.\n\nBusiness Description: The present invention relates to a shaped charge warhead and to a method for producing the warhead. A shaped charge warhead (known as SCW – Shape Charge Warhead) is a device comprising a fragmentation container (casing) that defines the volume within which a shaped charge liner is positioned. The volume between the liner and the casing is filled with explosive.\n\nTech Features: The technical features include: One-piece shaped charge warhead: the patented warhead is manufactured by additive manufacturing (powder bed fusion), which makes it possible to create, in a single piece, both the axisymmetric container and the conical or hemispherical shell of the shaped charge liner. This eliminates assembly operations, reducing errors and complexity. Warheads currently available on the market are usually assembled from separate components, such as the container and the shell. This process presents the risk of misalignments between the components, which may negatively affect the symmetry of the explosive wave and, consequently, the penetrative capability of the jet. Cellular septa structure: the conical or hemispherical shell of the warhead has a cellular septa structure containing unsintered powder. This feature contributes to increasing the penetrative capability of the jet generated by the explosion, optimizing the mass distribution within the shell and improving performance. Variable thickness: the conical shell may be produced with variable thickness, representing an advantage over conventional constant-thickness warheads. This allows further optimization of explosive jet formation and control of the fragmentation flow. Shells of warheads currently available on the market are generally of constant thickness, which does not allow optimization of fragmentation flow or penetration. Advanced materials: the warhead may be manufactured using advanced metallic materials, such as copper, aluminum, tungsten, bismuth, or zirconium alloys—materials that are difficult to use with traditional technologies. Fragmentation control: the integration of geometric defects within the thickness of the container allows more precise control of the size of fragments generated by the explosion, improving safety and effectiveness.\n\nApplications: The patented shaped charge warhead technology has possible applications in strategic sectors such as defense, controlled demolitions, and the mining industry, where high precision is required in penetrating hard materials or creating controlled fragmentations. In civil and industrial demolitions, the warheads can be employed to bring down structures with maximum precision and safety, minimizing collateral damage. In the mining sector, the warheads could improve the efficiency of explosions for extracting minerals with greater control and reducing risks. The technology solves the limitations by identifying and overcoming the problem of critical assembly (thanks to single-piece additive manufacturing) and improving the performance of the explosive jet through the cellular septa structure and advanced materials. This translates into greater efficiency, reliability, and flexibility of use, creating value for the user thanks to warheads that offer better penetration, fragment control, and reduction of production and maintenance costs.\n\nAdvantages: Elimination of assembly: the warhead is manufactured as a single body through additive manufacturing, reducing alignment errors and production complexity. Improved penetrative capability: thanks to the cellular septa structure containing unsintered powder, the explosive jet has greater effectiveness and precision. Variable shell thickness: allows optimal mass distribution, improving jet efficiency and fragmentation capability. Advanced materials: the technology enables the use of metallic alloys that are difficult to employ with traditional methods, offering greater strength and performance. Fragmentation control: geometric defects in the container make it possible to precisely manage the size of the explosive fragments. These advantages translate into improved performance, reduced production costs, and greater safety."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from nomic-ai/nomic-embed-text-v1.5. 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': 384, 'do_lower_case': False, 'architecture': 'NomicBertModel'})
(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})
)
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 = [
'Procedure for the detection of organic UV filters. Title: Procedure for the detection of organic UV filters\n\nAbstract: \n\nBusiness Description: The invention concerns an optimized analytical procedure for the detection and quantification of organic UV filters, emerging contaminants with potential harmful effects on aquatic ecosystems. The aim is to develop a simple, rapid, portable, and cost-effective voltammetric method, as an alternative to traditional chromatographic techniques, for environmental water monitoring and the characterization of sunscreen products.\n\nTech Features: The technology is based on an innovative method to detect and quantify UV filters such as octocrylene, oxybenzone, and octinoxate, applicable to aqueous matrices and sunscreen products. After a simple sample treatment (concentration for water samples or extraction for creams), the analysis is performed using an electrochemical sensor that measures specific electrical signals: each substance produces a characteristic “peak,” allowing it to be identified and quantified simultaneously. Compared to traditional laboratory methods, such as liquid chromatography or gas chromatography, the proposed solution is more cost-effective, portable, rapid, uses fewer solvents, and enables on-site analysis while maintaining high sensitivity and repeatability.\n\nApplications: Environmental monitoring of marine, lake, and river waters; Control of wastewater and treatment plants; Rapid on-site analysis of emerging contaminants; Characterization of sunscreens and oils; Quality control in the cosmetic sector.\n\nAdvantages: Portable method suitable for field analysis; Lower costs compared to chromatographic techniques; Reduced use of organic solvents; Fast and simple analyses; Simultaneous quantification of multiple UV filters; Good correlation with conventional analytical methods.',
'Procedure for the detection of organic UV filters. Title: Procedure for the detection of organic UV filters\n\nAbstract: \n\nBusiness Description: The invention concerns an optimized analytical procedure for the detection and quantification of organic UV filters, emerging contaminants with potential harmful effects on aquatic ecosystems. The aim is to develop a simple, rapid, portable, and cost-effective voltammetric method, as an alternative to traditional chromatographic techniques, for environmental water monitoring and the characterization of sunscreen products.\n\nTech Features: The technology is based on an innovative method to detect and quantify UV filters such as octocrylene, oxybenzone, and octinoxate, applicable to aqueous matrices and sunscreen products. After a simple sample treatment (concentration for water samples or extraction for creams), the analysis is performed using an electrochemical sensor that measures specific electrical signals: each substance produces a characteristic “peak,” allowing it to be identified and quantified simultaneously. Compared to traditional laboratory methods, such as liquid chromatography or gas chromatography, the proposed solution is more cost-effective, portable, rapid, uses fewer solvents, and enables on-site analysis while maintaining high sensitivity and repeatability.\n\nApplications: Environmental monitoring of marine, lake, and river waters; Control of wastewater and treatment plants; Rapid on-site analysis of emerging contaminants; Characterization of sunscreens and oils; Quality control in the cosmetic sector.\n\nAdvantages: Portable method suitable for field analysis; Lower costs compared to chromatographic techniques; Reduced use of organic solvents; Fast and simple analyses; Simultaneous quantification of multiple UV filters; Good correlation with conventional analytical methods.',
'PRODUCTION OF HIGH ORGANOLEPTIC AND NUTRITIONAL VALUE OLIVE OIL. Title: PRODUCTION OF HIGH ORGANOLEPTIC AND NUTRITIONAL VALUE OLIVE OIL\n\nAbstract: \n\nBusiness Description: The procedure involves the use of a non-toxic and organoleptically inert cryogen in the process of extracting oil from olives. In addition to high yields, it guarantees the production of olive oils, especially extra virgin, enriched in cellular compounds extracted from the fruit and, in particular, in components with aromatic and antioxidant activity, with a consequent significant increase in their organoleptic and nutritional quality. The unmistakable characteristics of the oils most recognizable by the consumer are closely linked to the raw material, the type of olives processed and their production area.\n\nTech Features: The proposed procedure provides the use of "carbonic snow", the carbon dioxide (CO 2 ) in a solid state for the extraction of olive oil. The solid CO 2 causes the formation of ice crystals in the freezing fruit, which in turn determines the collapse of the cellular structure of the pulp. This facilitates the release of substances and their transfer into the oil, which results rich in cellular metabolites with high biological value. The gaseous CO 2 , being heavier than air, tends to remain above the olive paste, creating a gaseous layer able to avoid direct contact with the air oxygen and to preserve the cellular constituents from oxidative degradation. The method makes economically sustainable early harvesting of the olives: the olives less mature will be richer in water and bioactive components (polyphenols, tocopherols); then, the early harvesting limits the damage caused by attacks of Bactrocera oleae (the olive fly), one of the most feared adversities by producers of the sector, able to significantly affect both the yield and the quality of the oil produced.\n\nApplications: Use in mills.\n\nAdvantages: Higher yield, on average 9% more (17.4 kg of product instead of 16 kg per quintal of olives); Better nutritional quality (e.g. 6% more vitamin E); Greater resistance to oxidative processes; Production of oil richer in antioxidants and aromatic components; Longer shelf life than that of oil obtained using conventional technologies.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 1.0000, 0.2489],
# [1.0000, 1.0000, 0.2489],
# [0.2489, 0.2489, 1.0000]])
mnrl-valInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.0433 |
| cosine_accuracy@3 | 0.0967 |
| cosine_accuracy@5 | 0.1412 |
| cosine_accuracy@10 | 0.2087 |
| cosine_precision@1 | 0.0433 |
| cosine_precision@3 | 0.0322 |
| cosine_precision@5 | 0.0282 |
| cosine_precision@10 | 0.0209 |
| cosine_recall@1 | 0.0433 |
| cosine_recall@3 | 0.0967 |
| cosine_recall@5 | 0.1412 |
| cosine_recall@10 | 0.2087 |
| cosine_ndcg@10 | 0.1138 |
| cosine_mrr@10 | 0.0849 |
| cosine_map@100 | 0.0953 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
Epigenetic regulation system for the control of target gene expression |
Applicant/Organization: FONDAZIONE ISTITUTO ITALIANO DI TECNOLOGIA |
System integrating a membrane humidifier and an adsorption-based storage for polymer membrane hydrogen fuel cell applications. |
Technical Classification: H01M |
Superconducting bipolar thermoelectric memory |
Technical Classification: G11C_11 |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false,
"directions": [
"query_to_doc"
],
"partition_mode": "joint",
"hardness_mode": null,
"hardness_strength": 0.0
}
per_device_train_batch_size: 16num_train_epochs: 10eval_strategy: stepsper_device_eval_batch_size: 16multi_dataset_batch_sampler: round_robinper_device_train_batch_size: 16num_train_epochs: 10max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_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: stepsper_device_eval_batch_size: 16prediction_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: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | mnrl-val_cosine_ndcg@10 |
|---|---|---|---|
| 1.0 | 393 | - | 0.0695 |
| 1.0178 | 400 | - | 0.0697 |
| 1.2723 | 500 | 2.2361 | - |
| 2.0 | 786 | - | 0.1032 |
| 2.0356 | 800 | - | 0.1079 |
| 2.5445 | 1000 | 1.5522 | - |
| 3.0 | 1179 | - | 0.1043 |
| 3.0534 | 1200 | - | 0.0946 |
| 3.8168 | 1500 | 1.0458 | - |
| 4.0 | 1572 | - | 0.1138 |
@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{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},
}
Base model
nomic-ai/nomic-embed-text-v1.5