redis/langcache-embed-v3-mini-experimental
199
1---2language:3- en4license: apache-2.05tags:6- biencoder7- sentence-transformers8- text-classification9- sentence-pair-classification10- semantic-similarity11- semantic-search12- retrieval13- reranking14- generated_from_trainer15- loss:ArcFaceInBatchLoss16base_model: sentence-transformers/all-MiniLM-L6-v217pipeline_tag: sentence-similarity18library_name: sentence-transformers19metrics:20- cosine_accuracy@121- cosine_precision@122- cosine_recall@123- cosine_ndcg@1024- cosine_mrr@125- cosine_map@10026- cosine_auc_precision_cache_hit_ratio27- cosine_auc_similarity_distribution28model-index:29- name: Redis fine-tuned BiEncoder model for semantic caching on LangCache30 results:31 - task:32 type: custom-information-retrieval33 name: Custom Information Retrieval34 dataset:35 name: test36 type: test37 metrics:38 - type: cosine_accuracy@139 value: 0.547439460103215540 name: Cosine Accuracy@141 - type: cosine_precision@142 value: 0.547439460103215543 name: Cosine Precision@144 - type: cosine_recall@145 value: 0.528489458947974346 name: Cosine Recall@147 - type: cosine_ndcg@1048 value: 0.746423286618459949 name: Cosine Ndcg@1050 - type: cosine_mrr@151 value: 0.547439460103215552 name: Cosine Mrr@153 - type: cosine_map@10054 value: 0.690519996337716355 name: Cosine Map@10056 - type: cosine_auc_precision_cache_hit_ratio57 value: 0.3152425404388599658 name: Cosine Auc Precision Cache Hit Ratio59 - type: cosine_auc_similarity_distribution60 value: 0.1608948803049254461 name: Cosine Auc Similarity Distribution62---63 64# Redis fine-tuned BiEncoder model for semantic caching on LangCache65 66This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2). It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for sentence pair similarity.67 68## Model Details69 70### Model Description71- **Model Type:** Sentence Transformer72- **Base model:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->73- **Maximum Sequence Length:** 128 tokens74- **Output Dimensionality:** 384 dimensions75- **Similarity Function:** Cosine Similarity76<!-- - **Training Dataset:** Unknown -->77- **Language:** en78- **License:** apache-2.079 80### Model Sources81 82- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)83- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)84- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)85 86### Full Model Architecture87 88```89SentenceTransformer(90 (0): Transformer({'max_seq_length': 128, 'do_lower_case': False, 'architecture': 'BertModel'})91 (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})92 (2): Normalize()93)94```95 96## Usage97 98### Direct Usage (Sentence Transformers)99 100First install the Sentence Transformers library:101 102```bash103pip install -U sentence-transformers104```105 106Then you can load this model and run inference.107```python108from sentence_transformers import SentenceTransformer109 110# Download from the ๐ค Hub111model = SentenceTransformer("redis/langcache-embed-v3-mini")112# Run inference113sentences = [114 'The weather is lovely today.',115 "It's so sunny outside!",116 'He drove to the stadium.',117]118embeddings = model.encode(sentences)119print(embeddings.shape)120# [3, 384]121 122# Get the similarity scores for the embeddings123similarities = model.similarity(embeddings, embeddings)124print(similarities)125# tensor([[1.0000, 0.6650, 0.1040],126# [0.6650, 1.0000, 0.1401],127# [0.1040, 0.1401, 0.9999]])128```129 130<!--131### Direct Usage (Transformers)132 133<details><summary>Click to see the direct usage in Transformers</summary>134 135</details>136-->137 138<!--139### Downstream Usage (Sentence Transformers)140 141You can finetune this model on your own dataset.142 143<details><summary>Click to expand</summary>144 145</details>146-->147 148<!--149### Out-of-Scope Use150 151*List how the model may foreseeably be misused and address what users ought not to do with the model.*152-->153 154## Evaluation155 156### Metrics157 158#### Custom Information Retrieval159 160* Dataset: `test`161* Evaluated with <code>ir_evaluator.CustomInformationRetrievalEvaluator</code> with these parameters:162 ```json163 {164 "query_prompt": "query:",165 "corpus_prompt": "query:"166 }167 ```168 169| Metric | Value |170|:-------------------------------------|:-----------|171| cosine_accuracy@1 | 0.5474 |172| cosine_precision@1 | 0.5474 |173| cosine_recall@1 | 0.5285 |174| **cosine_ndcg@10** | **0.7464** |175| cosine_mrr@1 | 0.5474 |176| cosine_map@100 | 0.6905 |177| cosine_auc_precision_cache_hit_ratio | 0.3152 |178| cosine_auc_similarity_distribution | 0.1609 |179 180<!--181## Bias, Risks and Limitations182 183*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*184-->185 186<!--187### Recommendations188 189*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*190-->191 192## Training Details193 194### Training Hyperparameters195#### Non-Default Hyperparameters196 197- `eval_strategy`: steps198- `per_device_train_batch_size`: 64199- `per_device_eval_batch_size`: 64200- `weight_decay`: 0.001201- `adam_beta2`: 0.98202- `adam_epsilon`: 1e-06203- `max_steps`: 100000204- `warmup_ratio`: 0.15205- `bf16`: True206- `load_best_model_at_end`: True207- `ddp_find_unused_parameters`: False208- `push_to_hub`: True209- `hub_model_id`: redis/langcache-embed-v3-mini210- `eval_on_start`: True211- `batch_sampler`: no_duplicates212 213#### All Hyperparameters214<details><summary>Click to expand</summary>215 216- `overwrite_output_dir`: False217- `do_predict`: False218- `eval_strategy`: steps219- `prediction_loss_only`: True220- `per_device_train_batch_size`: 64221- `per_device_eval_batch_size`: 64222- `per_gpu_train_batch_size`: None223- `per_gpu_eval_batch_size`: None224- `gradient_accumulation_steps`: 1225- `eval_accumulation_steps`: None226- `torch_empty_cache_steps`: None227- `learning_rate`: 5e-05228- `weight_decay`: 0.001229- `adam_beta1`: 0.9230- `adam_beta2`: 0.98231- `adam_epsilon`: 1e-06232- `max_grad_norm`: 1.0233- `num_train_epochs`: 3.0234- `max_steps`: 100000235- `lr_scheduler_type`: linear236- `lr_scheduler_kwargs`: {}237- `warmup_ratio`: 0.15238- `warmup_steps`: 0239- `log_level`: passive240- `log_level_replica`: warning241- `log_on_each_node`: True242- `logging_nan_inf_filter`: True243- `save_safetensors`: True244- `save_on_each_node`: False245- `save_only_model`: False246- `restore_callback_states_from_checkpoint`: False247- `no_cuda`: False248- `use_cpu`: False249- `use_mps_device`: False250- `seed`: 42251- `data_seed`: None252- `jit_mode_eval`: False253- `bf16`: True254- `fp16`: False255- `fp16_opt_level`: O1256- `half_precision_backend`: auto257- `bf16_full_eval`: False258- `fp16_full_eval`: False259- `tf32`: None260- `local_rank`: 0261- `ddp_backend`: None262- `tpu_num_cores`: None263- `tpu_metrics_debug`: False264- `debug`: []265- `dataloader_drop_last`: False266- `dataloader_num_workers`: 0267- `dataloader_prefetch_factor`: None268- `past_index`: -1269- `disable_tqdm`: False270- `remove_unused_columns`: True271- `label_names`: None272- `load_best_model_at_end`: True273- `ignore_data_skip`: False274- `fsdp`: []275- `fsdp_min_num_params`: 0276- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}277- `fsdp_transformer_layer_cls_to_wrap`: None278- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}279- `parallelism_config`: None280- `deepspeed`: None281- `label_smoothing_factor`: 0.0282- `optim`: adamw_torch_fused283- `optim_args`: None284- `adafactor`: False285- `group_by_length`: False286- `length_column_name`: length287- `project`: huggingface288- `trackio_space_id`: trackio289- `ddp_find_unused_parameters`: False290- `ddp_bucket_cap_mb`: None291- `ddp_broadcast_buffers`: False292- `dataloader_pin_memory`: True293- `dataloader_persistent_workers`: False294- `skip_memory_metrics`: True295- `use_legacy_prediction_loop`: False296- `push_to_hub`: True297- `resume_from_checkpoint`: None298- `hub_model_id`: redis/langcache-embed-v3-mini299- `hub_strategy`: every_save300- `hub_private_repo`: None301- `hub_always_push`: False302- `hub_revision`: None303- `gradient_checkpointing`: False304- `gradient_checkpointing_kwargs`: None305- `include_inputs_for_metrics`: False306- `include_for_metrics`: []307- `eval_do_concat_batches`: True308- `fp16_backend`: auto309- `push_to_hub_model_id`: None310- `push_to_hub_organization`: None311- `mp_parameters`: 312- `auto_find_batch_size`: False313- `full_determinism`: False314- `torchdynamo`: None315- `ray_scope`: last316- `ddp_timeout`: 1800317- `torch_compile`: False318- `torch_compile_backend`: None319- `torch_compile_mode`: None320- `include_tokens_per_second`: False321- `include_num_input_tokens_seen`: no322- `neftune_noise_alpha`: None323- `optim_target_modules`: None324- `batch_eval_metrics`: False325- `eval_on_start`: True326- `use_liger_kernel`: False327- `liger_kernel_config`: None328- `eval_use_gather_object`: False329- `average_tokens_across_devices`: True330- `prompts`: None331- `batch_sampler`: no_duplicates332- `multi_dataset_batch_sampler`: proportional333- `router_mapping`: {}334- `learning_rate_mapping`: {}335 336</details>337 338### Training Logs339| Epoch | Step | test_cosine_ndcg@10 |340|:-----:|:----:|:-------------------:|341| 0 | 0 | 0.7464 |342 343 344### Framework Versions345- Python: 3.12.3346- Sentence Transformers: 5.1.1347- Transformers: 4.57.0348- PyTorch: 2.8.0+cu128349- Accelerate: 1.10.1350- Datasets: 4.1.1351- Tokenizers: 0.22.1352 353## Citation354 355### BibTeX356 357#### Sentence Transformers358```bibtex359@inproceedings{reimers-2019-sentence-bert,360 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",361 author = "Reimers, Nils and Gurevych, Iryna",362 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",363 month = "11",364 year = "2019",365 publisher = "Association for Computational Linguistics",366 url = "https://arxiv.org/abs/1908.10084",367}368```369 370<!--371## Glossary372 373*Clearly define terms in order to be accessible across audiences.*374-->375 376<!--377## Model Card Authors378 379*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*380-->381 382<!--383## Model Card Contact384 385*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*386-->