CrossEncoder based on BAAI/bge-reranker-base

This is a Cross Encoder model finetuned from BAAI/bge-reranker-base using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.

Model Details

Model Description

  • Model Type: Cross Encoder
  • Base model: BAAI/bge-reranker-base
  • Maximum Sequence Length: 512 tokens
  • Number of Output Labels: 1 label

Model Sources

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 CrossEncoder

# Download from the ๐Ÿค— Hub
model = CrossEncoder("cross_encoder_model_id")
# Get scores for pairs of texts
pairs = [
    ['user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.', 'SKIN79 Super Plus Beblesh Balm Pink BB 40g All Day Lasting BB Cream - Made In Korea\nBrand: SKIN79 Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: 3 effects functional beblesh balm NEW 2005 PACKAGE whitening, wrinkles improvement Intercept ultraviolet rays UV A and B excellent cover function by composition of make-up base and foundation can correct your irregularly different skin tones naturally excellent for your skin adhesion and sebum control Details: Brand: SKIN79 Scent: Unscented Item Form: Balm Active Ingredients: Damask Rose Water, Niacinamide, Schisandra Extract Unit Count: 1.00 Count Is Discontinued By Manufacturer: No Package Dimensions: 4.02 x 2.05 x 2.01 inches; 1.41 Ounces Item model number: hot pink UPC: 794437141886 784190681859 Manufacturer: SKIN79'],
    ['user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.', "COVERGIRL Clean Matte BB Cream Light 520 For Oily Skin, (packaging may vary) - 1 Fl Oz (1 Count)\nBrand: COVERGIRL Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: Won't clog pores Lasts all day Oil Free BB Cream Suitable BB Cream for sensitive skin Description: Product Description COVERGIRL Clean Matte BB Cream For Light Skin provides the perfect amount of coverage to even skin tone, hide blemishes and keep you shine free all day! Brand Story By CoverGirl Details: Brand: COVERGIRL Item Form: Capsule Active Ingredients: Chloride,silica,sodium benzoate,sodium chloride Unit Count: 1 Fl Oz Number of Items: 1 Is Discontinued By Manufacturer: No Product Dimensions: 1.62 x 0.75 x 4.33 inches; 0.99 Ounces Item model number: 10022700251121 UPC: 022700251124 Manufacturer: Coty Beauty"],
    ['user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.', "Puritan's Pride Arnica Cream-4 oz Cream\nBrand: Puritan's Pride Category: Beauty & Personal Care > Skin Care > Body > Moisturizers > Creams Details: Brand: Puritan's Pride Item Form: Cream Unit Count: 4 Ounce Number of Items: 1 Use for: Whole Body Is Discontinued By Manufacturer: No Package Dimensions: 2.8 x 2.7 x 2.3 inches; 2.4 Ounces Item model number: SG_B00MCJVFF6_US UPC: 766443549277"],
    ['user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.', 'Rimmel London BB Cream, Light\nCategory: Beauty Description: Broad Spectrum SPF 25 Sunscreen 1 Fl oz 30 ml'],
    ['user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.', "L'Oreal Paris Magic Skin Beautifier BB Cream, Fair, 1.0 Ounces\nCategory: Beauty Description: Our first multi-tasking bare skin beautifying cream enhance skinโ€™s 6 dimensions of flawlessness leaving skin perfectly nude and natural."],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.\nassistant: Got it! Are you looking for something with a bit of tint or just moisturizing?\nuser: Just a light BB cream type thing for my body, something simple like my radiance wipes were.\nassistant: Okay, so a gentle body BB cream to even out skin tone?\nuser: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.',
    [
        'SKIN79 Super Plus Beblesh Balm Pink BB 40g All Day Lasting BB Cream - Made In Korea\nBrand: SKIN79 Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: 3 effects functional beblesh balm NEW 2005 PACKAGE whitening, wrinkles improvement Intercept ultraviolet rays UV A and B excellent cover function by composition of make-up base and foundation can correct your irregularly different skin tones naturally excellent for your skin adhesion and sebum control Details: Brand: SKIN79 Scent: Unscented Item Form: Balm Active Ingredients: Damask Rose Water, Niacinamide, Schisandra Extract Unit Count: 1.00 Count Is Discontinued By Manufacturer: No Package Dimensions: 4.02 x 2.05 x 2.01 inches; 1.41 Ounces Item model number: hot pink UPC: 794437141886 784190681859 Manufacturer: SKIN79',
        "COVERGIRL Clean Matte BB Cream Light 520 For Oily Skin, (packaging may vary) - 1 Fl Oz (1 Count)\nBrand: COVERGIRL Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: Won't clog pores Lasts all day Oil Free BB Cream Suitable BB Cream for sensitive skin Description: Product Description COVERGIRL Clean Matte BB Cream For Light Skin provides the perfect amount of coverage to even skin tone, hide blemishes and keep you shine free all day! Brand Story By CoverGirl Details: Brand: COVERGIRL Item Form: Capsule Active Ingredients: Chloride,silica,sodium benzoate,sodium chloride Unit Count: 1 Fl Oz Number of Items: 1 Is Discontinued By Manufacturer: No Product Dimensions: 1.62 x 0.75 x 4.33 inches; 0.99 Ounces Item model number: 10022700251121 UPC: 022700251124 Manufacturer: Coty Beauty",
        "Puritan's Pride Arnica Cream-4 oz Cream\nBrand: Puritan's Pride Category: Beauty & Personal Care > Skin Care > Body > Moisturizers > Creams Details: Brand: Puritan's Pride Item Form: Cream Unit Count: 4 Ounce Number of Items: 1 Use for: Whole Body Is Discontinued By Manufacturer: No Package Dimensions: 2.8 x 2.7 x 2.3 inches; 2.4 Ounces Item model number: SG_B00MCJVFF6_US UPC: 766443549277",
        'Rimmel London BB Cream, Light\nCategory: Beauty Description: Broad Spectrum SPF 25 Sunscreen 1 Fl oz 30 ml',
        "L'Oreal Paris Magic Skin Beautifier BB Cream, Fair, 1.0 Ounces\nCategory: Beauty Description: Our first multi-tasking bare skin beautifying cream enhance skinโ€™s 6 dimensions of flawlessness leaving skin perfectly nude and natural.",
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 4,830 training samples
  • Columns: query, docs, and labels
  • Approximate statistics based on the first 1000 samples:
    query docs labels
    type string list list
    details
    • min: 177 characters
    • mean: 437.5 characters
    • max: 881 characters
    • size: 16 elements
    • size: 16 elements
  • Samples:
    query docs labels
    user: I really liked that sensitive skin concentrate I bought before, but I need a body cream for lighter skin tones now.
    assistant: Got it! Are you looking for something with a bit of tint or just moisturizing?
    user: Just a light BB cream type thing for my body, something simple like my radiance wipes were.
    assistant: Okay, so a gentle body BB cream to even out skin tone?
    user: Yeah exactly, something for lighter skin tones, 7.5 ounce size maybe.
    ['SKIN79 Super Plus Beblesh Balm Pink BB 40g All Day Lasting BB Cream - Made In Korea\nBrand: SKIN79 Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: 3 effects functional beblesh balm NEW 2005 PACKAGE whitening, wrinkles improvement Intercept ultraviolet rays UV A and B excellent cover function by composition of make-up base and foundation can correct your irregularly different skin tones naturally excellent for your skin adhesion and sebum control Details: Brand: SKIN79 Scent: Unscented Item Form: Balm Active Ingredients: Damask Rose Water, Niacinamide, Schisandra Extract Unit Count: 1.00 Count Is Discontinued By Manufacturer: No Package Dimensions: 4.02 x 2.05 x 2.01 inches; 1.41 Ounces Item model number: hot pink UPC: 794437141886 784190681859 Manufacturer: SKIN79', "COVERGIRL Clean Matte BB Cream Light 520 For Oily Skin, (packaging may vary) - 1 Fl Oz (1 Count)\nBrand: COVERGIRL Category: Beauty & Personal Care > Makeup > Face > BB Creams Features: Won't clog ... [0.0, 0.0, 0.0, 0.0, 0.0, ...]
    user: I've been happy with that silk protein hair treatment and my foaming face scrub, but my hair's been feeling kinda weak lately.
    assistant: Got it! Since you liked those, maybe we can find something to boost your scalp health. What have you tried for that?
    user: I'm not convinced another hair product will do muchโ€”most just coat the hair and feel fake.
    assistant: Some intensive lotions actually target the scalp with natural extracts rather than just coating strands.
    user: Yeah but I bet any lotion claims to revive fine hair and never does. Hard to trust that.
    ['Mizani Scalp Care Calming Scalp Lotion |Dandruff Treatment | Nourishes & Soothes Scalp | For Curly Hair | 4 Fl Oz\nBrand: MIZANI Category: Beauty & Personal Care > Salon & Spa > Hair Care > Hair & Scalp Treatments Details: Brand: MIZANI Hair Type: Curly Product Benefits: A nourishing lotion to soothe and treat dry scalp. Primes hair with a healthy no,dandruff shine. Item Form: Lotion,Oil Scent: Eucalyptus Is Discontinued By Manufacturer: No Product Dimensions: 1.25 x 2.19 x 6.06 inches; 4.66 Ounces Item model number: 955600 UPC: 884486493859 884486307361 Manufacturer: Mizani Country of Origin: USA', 'Renpure Plant-Based Beauty Tea Tree Lemon Sage Refreshing Moisture Scalp Serum, 4 Fluid Ounces\nBrand: RENPURE Category: Beauty & Personal Care > Hair Care Features: Scalp Serum: The perfect partner to our scalp scrub, this scalp serum uses plant based conditioning nutrients to give your scalp a fresh finish; Tea tree oil and ginger mint cool and invigorate Invigorating Nutrients: Our Te... [0.0, 0.0, 1.0, 0.0, 0.0, ...]
    user: I want a collectible figure from a movie I like. Something small to put on my shelf would be nice.
    assistant: Which movie or character are you interested in, and do you prefer a stylized look or a realistic one?
    user: Guardians of the Galaxy 2, and I like stylized figures better than realistic ones.
    ["Funko Pop Marvel: Marvel Studios 10 - Gamora (Gold Chrome) Collectible Figure, Multicolor\nBrand: Funko Category: Toys & Games > Toy Figures & Playsets > Action Figures Features: From Marvel Studios 10, Gamora (Gold Chrome), as a stylized POP vinyl from Funko! Stylized collectable stands 3 ยพ inches tall, perfect for any Marvel Studios 10 fan! Collect and display all Marvel Studios 10 figures from Funko! Funko pop! is the 2017 toy of the year and people's choice award winner Description: From Marvel Studios 10, Gamora (gold chrome), as a stylized pop vinyl from Funko! figure stands 3 3/4 inches and comes in a window display box. Check out the other Marvel Studios 10 figures from Funko! collect them all! Details: Product Dimensions: 3.54 x 2.95 x 3.54 inches Item Weight: 3.53 ounces Item model number: 33519 Manufacturer recommended age: 6 years and up Best Sellers Rank: {'Toys & Games': 119252, 'Action Figures': 7062} Is Discontinued By Manufacturer: No Release date: November 27, 2018 ... [0.0, 0.0, 0.0, 0.0, 0.0, ...]
  • Loss: LambdaLoss with these parameters:
    {
        "weighting_scheme": "sentence_transformers.cross_encoder.losses.LambdaLoss.NDCGLoss2PPScheme",
        "k": null,
        "sigma": 1.0,
        "eps": 1e-10,
        "reduction_log": "binary",
        "activation_fn": "torch.nn.modules.linear.Identity",
        "mini_batch_size": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 4
  • gradient_accumulation_steps: 4
  • learning_rate: 2e-05
  • weight_decay: 0.01
  • num_train_epochs: 1.0
  • warmup_ratio: 0.1
  • bf16: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 4
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 1.0
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • 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: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • 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: adamw_torch_fused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • 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: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss
0.0662 20 0.6081
0.1325 40 0.4911
0.1987 60 0.3882
0.2649 80 0.3833
0.3311 100 0.3534
0.3974 120 0.3549
0.4636 140 0.3329
0.5298 160 0.3258
0.5960 180 0.3598
0.6623 200 0.356
0.7285 220 0.3405
0.7947 240 0.3487
0.8609 260 0.3551
0.9272 280 0.3589
0.9934 300 0.3399

Framework Versions

  • Python: 3.12.9
  • Sentence Transformers: 5.1.0
  • Transformers: 4.56.1
  • PyTorch: 2.8.0+cu128
  • Accelerate: 1.15.0
  • Datasets: 5.0.1
  • Tokenizers: 0.22.2

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",
}

LambdaLoss

@inproceedings{wang2018lambdaloss,
  title={The LambdaLoss Framework for Ranking Metric Optimization},
  author={Wang, Xuanhui and Li, Cheng and Golbandi, Nadav and Bendersky, Michael and Najork, Marc},
  booktitle={Proceedings of the 27th ACM international conference on information and knowledge management},
  pages={1313--1322},
  year={2018}
}
Downloads last month
19
Safetensors
Model size
0.3B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for RR52/adl2026-hw2-reranker

Finetuned
(30)
this model

Paper for RR52/adl2026-hw2-reranker