metadata
			language:
  - en
license: apache-2.0
tags:
  - biencoder
  - sentence-transformers
  - text-classification
  - sentence-pair-classification
  - semantic-similarity
  - semantic-search
  - retrieval
  - reranking
  - generated_from_trainer
  - dataset_size:13675
  - loss:ArcFaceInBatchLoss
base_model: Alibaba-NLP/gte-modernbert-base
widget:
  - source_sentence: >-
      Bathurst Street has been the heart of the Jewish community of Toronto for
      decades .
    sentences:
      - >-
        Baron portrayed actress Violet Carson who played Ena Sharples in the
        soap .
      - >-
        Bathurst Street has been the heart of the Jewish community of Toronto
        for many decades .
      - >-
        It stretches approximately 20 miles from Manasquan Inlet in Point
        Pleasant Beach in the north to Island Beach State Park in the south .
  - source_sentence: >-
      All tracks produced by Zack Shada , Jeremy Shada , Logan Charles , John
      Spicer and Seth Renken . All tracks are written by Zack Odom and Kenneth
      Mount .
    sentences:
      - >-
        All tracks produced by Zack Shada , Jeremy Shada , Logan Charles , John
        Spicer and Seth Renken . All tracks are written by Zack Odom and Kenneth
        Mount .
      - >-
        All tracks by Zack Shada , Jeremy Shada , John Spicer , Logan Charles
        and Seth Renken are produced by Zack Odom and Kenneth Mount .
      - Jimmy Connors defeated Eddie Dibbs 7 -- 5 , 7 -- 5
  - source_sentence: >-
      Arque Municipality is situated in the eastern part of the province and
      Tacopaya Municipality is located in the west .
    sentences:
      - >-
        Arque Municipality is situated in the eastern part of the province and
        Tacopaya Municipality is located in the west .
      - >-
        Bangkok International Preparatory and Secondary School , or Bangkok Prep
        , is an independent international school located on the National
        Curriculum of England based in Bangkok , Thailand .
      - >-
        The municipality of Tacopaya is situated in the eastern part of the
        province and municipality of Arque located in the west .
  - source_sentence: Browning is identified as married , but no wife or child is captured .
    sentences:
      - >-
        Alexander Alexander is the grandson of the Sarawak - leader Tun Jugah
        Barieng and the son of former politician Tan Sri Datuk Amar Leonard
        Linggi .
      - Browning is identified as married , but no wife or child is recorded .
      - It was formerly known also as ' Crotto ' .
  - source_sentence: >-
      Actor Charlie Chan , who portrayed Warner Oland when `` The Black Camel ``
      was filmed in Hawaii , he met .
    sentences:
      - >-
        Chang met actor Warner Oland , who portrayed Charlie Chan , when `` The
        Black Camel `` was filmed in Hawaii .
      - >-
        As an actor , he joined the Royal Shakespeare Company of Peter Hall ,
        working with Peggy Ashcroft and Dame Edith Evans .
      - >-
        Actor Charlie Chan , who portrayed Warner Oland when `` The Black Camel
        `` was filmed in Hawaii , he met .
datasets:
  - redis/langcache-sentencepairs-v2
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Redis fine-tuned BiEncoder model for semantic caching on LangCache
This is a sentence-transformers model finetuned from Alibaba-NLP/gte-modernbert-base on the LangCache Sentence Pairs (all) dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for sentence pair similarity.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: Alibaba-NLP/gte-modernbert-base
- Maximum Sequence Length: 100 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
- Language: en
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
  (0): Transformer({'max_seq_length': 100, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
  (mlp_hidden): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.ReLU'})
  (mlp_out): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.linear.Identity'})
)
Usage
Direct Usage (Sentence Transformers)
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("redis/langcache-embed-v3")
# Run inference
sentences = [
    'Actor Charlie Chan , who portrayed Warner Oland when `` The Black Camel `` was filmed in Hawaii , he met .',
    'Actor Charlie Chan , who portrayed Warner Oland when `` The Black Camel `` was filmed in Hawaii , he met .',
    'Chang met actor Warner Oland , who portrayed Charlie Chan , when `` The Black Camel `` was filmed in Hawaii .',
]
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.7693],
#         [1.0000, 1.0000, 0.7693],
#         [0.7693, 0.7693, 1.0000]])
Training Details
Training Dataset
LangCache Sentence Pairs (all)
- Dataset: LangCache Sentence Pairs (all)
- Size: 6,786 training samples
- Columns: anchor,positive, andnegative
- Approximate statistics based on the first 1000 samples:anchor positive negative type string string string details - min: 9 tokens
- mean: 27.96 tokens
- max: 50 tokens
 - min: 9 tokens
- mean: 27.98 tokens
- max: 51 tokens
 - min: 9 tokens
- mean: 27.56 tokens
- max: 49 tokens
 
- Samples:anchor positive negative ( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs :Los Angeles Lakers win series 4-0( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs :Los Angeles Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0The study included 752 universities in Pennsylvania , including public schools , public charter schools and traditional public magnet schools .( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0
- Loss: losses.ArcFaceInBatchLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false }
Evaluation Dataset
LangCache Sentence Pairs (all)
- Dataset: LangCache Sentence Pairs (all)
- Size: 6,786 evaluation samples
- Columns: anchor,positive, andnegative
- Approximate statistics based on the first 1000 samples:anchor positive negative type string string string details - min: 9 tokens
- mean: 27.96 tokens
- max: 50 tokens
 - min: 9 tokens
- mean: 27.98 tokens
- max: 51 tokens
 - min: 9 tokens
- mean: 27.56 tokens
- max: 49 tokens
 
- Samples:anchor positive negative ( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs :Los Angeles Lakers win series 4-0( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs :Los Angeles Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0The study included 752 universities in Pennsylvania , including public schools , public charter schools and traditional public magnet schools .( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Los Angeles Lakers vs. ( 2 ) San Antonio Spurs :Lakers win series 4-0( 1 ) Lakers vs. ( 2 ) San Antonio Spurs : `` Los Angeles Lakers Win 4-0
- Loss: losses.ArcFaceInBatchLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false }
Training Hyperparameters
Non-Default Hyperparameters
- eval_strategy: steps
- per_device_train_batch_size: 300
- per_device_eval_batch_size: 300
- gradient_accumulation_steps: 2
- weight_decay: 0.001
- adam_beta2: 0.98
- adam_epsilon: 1e-06
- num_train_epochs: 1
- warmup_ratio: 0.05
- bf16: True
- dataloader_num_workers: 4
- dataloader_prefetch_factor: 4
- load_best_model_at_end: True
- optim: stable_adamw
- ddp_find_unused_parameters: False
- dataloader_persistent_workers: True
- push_to_hub: True
- hub_model_id: redis/langcache-embed-v3
- batch_sampler: no_duplicates
All Hyperparameters
Click to expand
- overwrite_output_dir: False
- do_predict: False
- eval_strategy: steps
- prediction_loss_only: True
- per_device_train_batch_size: 300
- per_device_eval_batch_size: 300
- per_gpu_train_batch_size: None
- per_gpu_eval_batch_size: None
- gradient_accumulation_steps: 2
- eval_accumulation_steps: None
- torch_empty_cache_steps: None
- learning_rate: 5e-05
- weight_decay: 0.001
- adam_beta1: 0.9
- adam_beta2: 0.98
- adam_epsilon: 1e-06
- max_grad_norm: 1.0
- num_train_epochs: 1
- max_steps: -1
- lr_scheduler_type: linear
- lr_scheduler_kwargs: {}
- warmup_ratio: 0.05
- warmup_steps: 0
- log_level: passive
- log_level_replica: warning
- log_on_each_node: True
- logging_nan_inf_filter: True
- save_safetensors: True
- save_on_each_node: False
- save_only_model: False
- restore_callback_states_from_checkpoint: False
- no_cuda: False
- use_cpu: False
- use_mps_device: False
- seed: 42
- data_seed: None
- jit_mode_eval: False
- use_ipex: False
- bf16: True
- fp16: False
- fp16_opt_level: O1
- half_precision_backend: auto
- bf16_full_eval: False
- fp16_full_eval: False
- tf32: None
- local_rank: 0
- ddp_backend: None
- tpu_num_cores: None
- tpu_metrics_debug: False
- debug: []
- dataloader_drop_last: False
- dataloader_num_workers: 4
- dataloader_prefetch_factor: 4
- past_index: -1
- disable_tqdm: False
- remove_unused_columns: True
- label_names: None
- load_best_model_at_end: True
- ignore_data_skip: False
- fsdp: []
- fsdp_min_num_params: 0
- fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- fsdp_transformer_layer_cls_to_wrap: None
- accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- parallelism_config: None
- deepspeed: None
- label_smoothing_factor: 0.0
- optim: stable_adamw
- optim_args: None
- adafactor: False
- group_by_length: False
- length_column_name: length
- ddp_find_unused_parameters: False
- ddp_bucket_cap_mb: None
- ddp_broadcast_buffers: False
- dataloader_pin_memory: True
- dataloader_persistent_workers: True
- skip_memory_metrics: True
- use_legacy_prediction_loop: False
- push_to_hub: True
- resume_from_checkpoint: None
- hub_model_id: redis/langcache-embed-v3
- hub_strategy: every_save
- hub_private_repo: None
- hub_always_push: False
- hub_revision: None
- gradient_checkpointing: False
- gradient_checkpointing_kwargs: None
- include_inputs_for_metrics: False
- include_for_metrics: []
- eval_do_concat_batches: True
- fp16_backend: auto
- push_to_hub_model_id: None
- push_to_hub_organization: None
- mp_parameters:
- auto_find_batch_size: False
- full_determinism: False
- torchdynamo: None
- ray_scope: last
- ddp_timeout: 1800
- torch_compile: False
- torch_compile_backend: None
- torch_compile_mode: None
- include_tokens_per_second: False
- include_num_input_tokens_seen: False
- neftune_noise_alpha: None
- optim_target_modules: None
- batch_eval_metrics: False
- eval_on_start: False
- use_liger_kernel: False
- liger_kernel_config: None
- eval_use_gather_object: False
- average_tokens_across_devices: False
- prompts: None
- batch_sampler: no_duplicates
- multi_dataset_batch_sampler: proportional
- router_mapping: {}
- learning_rate_mapping: {}
Framework Versions
- Python: 3.12.3
- Sentence Transformers: 5.1.0
- Transformers: 4.56.0
- PyTorch: 2.8.0+cu128
- Accelerate: 1.10.1
- Datasets: 4.0.0
- Tokenizers: 0.22.0
Citation
BibTeX
Sentence Transformers
@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",
}

