Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 12
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. 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.
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, '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): 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("anass1209/resume-job-matcher-all-MiniLM-L6-v2")
# Run inference
sentences = [
'Developed and maintained core backend services using Python and Django, focusing on scalability and efficiency. Implemented RESTful APIs for data retrieval and manipulation. Worked extensively with PostgreSQL for data storage and retrieval. Responsible for optimizing database queries and improving API response times. Experience with model fine-tuning for semantic search and document retrieval using pre-trained embedding models like Sentence Transformers or similar libraries, specifically for improving the relevance of search results and document matching within the web application. Experience using vector databases (e.g., ChromaDB, Weaviate) preferred.',
'## Senior Backend Engineer\n\n* **ABC Corp** | 2020 - Present\n* Led development of a new REST API for user authentication and profile management using Python and Django.\n* Managed a PostgreSQL database, optimizing queries and schema design for improved performance, resulting in a 20% reduction in average API response time.\n* Improved system scalability through efficient code design and load balancing techniques.\n* Experience using pre-trained embedding models (BERT) for natural language processing tasks to improve search accuracy, with focus on keyphrase extraction and content similarity comparison for the recommendations engine. Proficient in Flask.',
"PhD in Computer Science, University of California, Berkeley (2018-2023). Dissertation: 'Adversarial Robustness in NLP for Cybersecurity Applications.' Focused on fine-tuning BERT for malware detection and social engineering attacks. Proficient in Python, TensorFlow, and AWS. Published in top-tier NLP and security conferences. Experienced with large datasets and model evaluation metrics.\n\nMaster of Science in Cybersecurity, Johns Hopkins University (2016-2018). Relevant coursework included Machine Learning, Data Mining, and Network Security. Developed a system for anomaly detection using a recurrent neural network (RNN). Familiar with Python and cloud computing platforms. Good understanding of NLP concepts, but limited experience fine-tuning transformer models. Strong understanding of Information Security Principles.\n\nBachelor of Science in Computer Engineering, Carnegie Mellon University (2012-2016). Relevant coursework: Artificial Intelligence, Database Management, and Software Engineering. Project experience: Developed a web application using Python. No direct experience with fine-tuning NLP models, but a strong foundation in programming and data structures. Familiar with cloud infrastructure concepts. Possess CISSP certification.",
]
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]
dev_evaluation and test_evaluationEmbeddingSimilarityEvaluator| Metric | dev_evaluation | test_evaluation |
|---|---|---|
| pearson_cosine | 0.5379 | 0.5379 |
| spearman_cosine | 0.6213 | 0.6213 |
sentence_0, sentence_1, and label| sentence_0 | sentence_1 | label | |
|---|---|---|---|
| type | string | string | float |
| details |
|
|
|
| sentence_0 | sentence_1 | label |
|---|---|---|
Required skills include experience with embedding models, fine-tuning techniques, Python programming, and knowledge of NLP concepts. Proficiency in libraries like TensorFlow or PyTorch is essential. Familiarity with resume parsing and matching algorithms is a plus. Must be able to analyze performance metrics and iterate on model improvements. |
Skills: Python, TensorFlow, NLP, Embedding Models, Fine-tuning, Resume Matching, Model Evaluation. Experienced in building and deploying machine learning models for text analysis and information retrieval. Proficient in analyzing performance using precision, recall, and F1-score to improve model accuracy. |
0.8882194757461548 |
Experience with embedding models and fine-tuning techniques. Ability to analyze resume data and identify relevant keywords for improved matching. Proficiency in Python and experience with relevant libraries like Transformers, Sentence Transformers, and scikit-learn. Knowledge of A/B testing and evaluation metrics (precision, recall, F1-score). Understanding of product management principles and the product development lifecycle is a plus. |
Skills: |
0.5 |
Senior DevOps Engineer to lead the implementation and optimization of our resume matching system. Responsibilities include: Fine-tuning and evaluating embedding models (e.g., Sentence Transformers, BERT) for improved semantic similarity scoring. Developing and maintaining the infrastructure for model training, evaluation, and deployment. Collaborating with data scientists and software engineers to integrate the matching system into our platform. Monitoring model performance and identifying areas for improvement, including data augmentation strategies. Strong experience with Python, cloud platforms (AWS, GCP, or Azure), containerization (Docker, Kubernetes), and CI/CD pipelines. Must have proficiency in evaluating model performance metrics (precision, recall, F1-score, AUC) and experience with model versioning and A/B testing. |
## Experience |
Acme Corp |
CosineSimilarityLoss with these parameters:{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 50multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 50max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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}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: Nonehub_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: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss | dev_evaluation_spearman_cosine | test_evaluation_spearman_cosine |
|---|---|---|---|---|
| 1.0 | 60 | - | 0.4867 | - |
| 2.0 | 120 | - | 0.5612 | - |
| 3.0 | 180 | - | 0.5929 | - |
| 4.0 | 240 | - | 0.6229 | - |
| 5.0 | 300 | - | 0.6377 | - |
| 6.0 | 360 | - | 0.6434 | - |
| 7.0 | 420 | - | 0.6104 | - |
| 8.0 | 480 | - | 0.6064 | - |
| 8.3333 | 500 | 0.0122 | - | - |
| 9.0 | 540 | - | 0.6005 | - |
| 10.0 | 600 | - | 0.6064 | - |
| 11.0 | 660 | - | 0.5973 | - |
| 12.0 | 720 | - | 0.6097 | - |
| 13.0 | 780 | - | 0.5907 | - |
| 14.0 | 840 | - | 0.5870 | - |
| 15.0 | 900 | - | 0.5989 | - |
| 16.0 | 960 | - | 0.6018 | - |
| 16.6667 | 1000 | 0.0019 | - | - |
| 17.0 | 1020 | - | 0.6208 | - |
| 18.0 | 1080 | - | 0.6133 | - |
| 19.0 | 1140 | - | 0.6200 | - |
| 20.0 | 1200 | - | 0.5960 | - |
| 21.0 | 1260 | - | 0.5999 | - |
| 22.0 | 1320 | - | 0.5995 | - |
| 23.0 | 1380 | - | 0.6177 | - |
| 24.0 | 1440 | - | 0.6201 | - |
| 25.0 | 1500 | 0.0009 | 0.6110 | - |
| 26.0 | 1560 | - | 0.6184 | - |
| 27.0 | 1620 | - | 0.6133 | - |
| 28.0 | 1680 | - | 0.6287 | - |
| 29.0 | 1740 | - | 0.6200 | - |
| 30.0 | 1800 | - | 0.6272 | - |
| 31.0 | 1860 | - | 0.6222 | - |
| 32.0 | 1920 | - | 0.6199 | - |
| 33.0 | 1980 | - | 0.6141 | - |
| 33.3333 | 2000 | 0.0006 | - | - |
| 34.0 | 2040 | - | 0.6228 | - |
| 35.0 | 2100 | - | 0.6275 | - |
| 36.0 | 2160 | - | 0.6167 | - |
| 37.0 | 2220 | - | 0.6140 | - |
| 38.0 | 2280 | - | 0.6217 | - |
| 39.0 | 2340 | - | 0.6280 | - |
| 40.0 | 2400 | - | 0.6254 | - |
| 41.0 | 2460 | - | 0.6186 | - |
| 41.6667 | 2500 | 0.0005 | - | - |
| 42.0 | 2520 | - | 0.6185 | - |
| 43.0 | 2580 | - | 0.6242 | - |
| 44.0 | 2640 | - | 0.6183 | - |
| 45.0 | 2700 | - | 0.6213 | - |
| 46.0 | 2760 | - | 0.6220 | - |
| 47.0 | 2820 | - | 0.6213 | - |
| 48.0 | 2880 | - | 0.6213 | - |
| 49.0 | 2940 | - | 0.6214 | - |
| 50.0 | 3000 | 0.0004 | 0.6213 | - |
| -1 | -1 | - | - | 0.6213 |
@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",
}
Base model
sentence-transformers/all-MiniLM-L6-v2