Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup
Paper • 2101.06983 • Published • 3
How to use Ehsanl/cncpt_e5 with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Ehsanl/cncpt_e5")
sentences = [
"That is a happy person",
"That is a happy dog",
"That is a very happy person",
"Today is a sunny day"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large-instruct on the json dataset. It maps inputs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
)
concept-devtrain_retriever_bidirlm.RankZeroIREvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.223 |
| cosine_accuracy@5 | 0.505 |
| cosine_accuracy@10 | 0.615 |
| cosine_precision@1 | 0.223 |
| cosine_precision@10 | 0.0838 |
| cosine_precision@25 | 0.0479 |
| cosine_recall@1 | 0.0525 |
| cosine_recall@10 | 0.1952 |
| cosine_recall@25 | 0.2725 |
| cosine_ndcg@10 | 0.1847 |
| cosine_mrr@10 | 0.3442 |
| cosine_map@100 | 0.1199 |
per_device_train_batch_size: 512num_train_epochs: 1.0learning_rate: 2e-05lr_scheduler_type: cosinewarmup_steps: 58weight_decay: 0.01bf16: Truetf32: Trueper_device_eval_batch_size: 512hub_private_repo: Truehub_strategy: checkpointload_best_model_at_end: Truedataloader_num_workers: 2dataloader_pin_memory: Falseddp_find_unused_parameters: Falseper_device_train_batch_size: 512num_train_epochs: 1.0max_steps: -1learning_rate: 2e-05lr_scheduler_type: cosinelr_scheduler_kwargs: Nonewarmup_steps: 58optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Truegradient_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: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 512prediction_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: Truehub_model_id: Nonehub_strategy: checkpointhub_always_push: Falsehub_revision: Noneload_best_model_at_end: Trueignore_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: 2dataloader_pin_memory: Falsedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Falseddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None| Epoch | Step | Training Loss | concept-dev_cosine_ndcg@10 |
|---|---|---|---|
| 0.0017 | 1 | 8.2978 | - |
| 0.0173 | 10 | 8.1293 | - |
| 0.0347 | 20 | 7.7957 | - |
| 0.0520 | 30 | 7.3246 | - |
| 0.0693 | 40 | 6.9759 | - |
| 0.0867 | 50 | 6.7088 | - |
| 0.1040 | 60 | 6.5911 | - |
| 0.1213 | 70 | 6.4329 | - |
| 0.1386 | 80 | 6.3659 | - |
| 0.1560 | 90 | 6.2806 | - |
| 0.1733 | 100 | 6.2206 | - |
| 0.1906 | 110 | 6.1548 | - |
| 0.2080 | 120 | 6.1161 | - |
| 0.2253 | 130 | 6.0303 | - |
| 0.2426 | 140 | 6.0143 | - |
| 0.2600 | 150 | 5.9863 | - |
| 0.2773 | 160 | 5.9285 | - |
| 0.2946 | 170 | 5.9333 | - |
| 0.3120 | 180 | 5.8504 | - |
| 0.3293 | 190 | 5.8392 | - |
| 0.3466 | 200 | 5.7718 | 0.1746 |
| 0.3640 | 210 | 5.7754 | - |
| 0.3813 | 220 | 5.7743 | - |
| 0.3986 | 230 | 5.7048 | - |
| 0.4159 | 240 | 5.6923 | - |
| 0.4333 | 250 | 5.6670 | - |
| 0.4506 | 260 | 5.7028 | - |
| 0.4679 | 270 | 5.6281 | - |
| 0.4853 | 280 | 5.6590 | - |
| 0.5026 | 290 | 5.6350 | - |
| 0.5199 | 300 | 5.6218 | - |
| 0.5373 | 310 | 5.6122 | - |
| 0.5546 | 320 | 5.5454 | - |
| 0.5719 | 330 | 5.5093 | - |
| 0.5893 | 340 | 5.5001 | - |
| 0.6066 | 350 | 5.5197 | - |
| 0.6239 | 360 | 5.5142 | - |
| 0.6412 | 370 | 5.5230 | - |
| 0.6586 | 380 | 5.4936 | - |
| 0.6759 | 390 | 5.4790 | - |
| 0.6932 | 400 | 5.5171 | 0.1827 |
| 0.7106 | 410 | 5.4625 | - |
| 0.7279 | 420 | 5.4563 | - |
| 0.7452 | 430 | 5.4652 | - |
| 0.7626 | 440 | 5.4686 | - |
| 0.7799 | 450 | 5.4186 | - |
| 0.7972 | 460 | 5.4356 | - |
| 0.8146 | 470 | 5.4426 | - |
| 0.8319 | 480 | 5.4641 | - |
| 0.8492 | 490 | 5.4589 | - |
| 0.8666 | 500 | 5.4399 | - |
| 0.8839 | 510 | 5.4501 | - |
| 0.9012 | 520 | 5.4281 | - |
| 0.9185 | 530 | 5.4175 | - |
| 0.9359 | 540 | 5.4407 | - |
| 0.9532 | 550 | 5.4569 | - |
| 0.9705 | 560 | 5.4252 | - |
| 0.9879 | 570 | 5.4485 | - |
| 1.0 | 577 | - | 0.1847 |
@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{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@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
intfloat/multilingual-e5-large-instruct