SentenceTransformer based on indobenchmark/indobert-base-p2

This is a sentence-transformers model finetuned from indobenchmark/indobert-base-p2. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: indobenchmark/indobert-base-p2
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)

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("Folma/IndoBERT-Retail-Search-Model")
# Run inference
sentences = [
    'KATALOG PRODUK ASEPSO SABUN BADAN BATANG',
    'ASEPSO BAR SOAP FRESH 80 GR',
    'JOHNSONS BABY OIL 125 ML',
]
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,  0.8572, -0.1430],
#         [ 0.8572,  1.0000, -0.1383],
#         [-0.1430, -0.1383,  1.0000]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.3367
cosine_accuracy@3 0.5963
cosine_accuracy@5 0.7027
cosine_accuracy@10 0.8207
cosine_precision@1 0.3367
cosine_precision@3 0.1988
cosine_precision@5 0.1405
cosine_precision@10 0.0821
cosine_recall@1 0.3367
cosine_recall@3 0.5963
cosine_recall@5 0.7027
cosine_recall@10 0.8207
cosine_ndcg@10 0.5704
cosine_mrr@10 0.4912
cosine_map@100 0.4988

Training Details

Training Dataset

Unnamed Dataset

  • Size: 54,541 training samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 4 tokens
    • mean: 8.5 tokens
    • max: 20 tokens
    • min: 5 tokens
    • mean: 11.18 tokens
    • max: 21 tokens
    • min: 4 tokens
    • mean: 11.17 tokens
    • max: 21 tokens
  • Samples:
    anchor positive negative
    IKAN LAUT MERK SEAFOOD IKAN FRESH KEMBUNG COMO KG MABELL SOSIS KEJU 60GR
    KATALOG PRODUK BU SANDRA SAUS SAMBAL BU SANDRA SAMBAL UDANG 150g CADBURY LICKABLE DAIRY MILK 20GR
    PILIHAN BUMBU KOREA DARI O FOOD O'FOOD KIMCHI JJIGAE SAUCE 120g MAMASUKA RUMPUT LAUT RENDANG 4.5X2
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 64
  • num_train_epochs: 50
  • learning_rate: 2e-05
  • warmup_steps: 0.1
  • weight_decay: 0.01
  • fp16: True
  • eval_strategy: steps
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 64
  • num_train_epochs: 50
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 1
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: False
  • fp16: True
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: trackio
  • eval_strategy: steps
  • per_device_eval_batch_size: 8
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • 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
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: []
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss retail-production-eval_cosine_ndcg@10
0.5862 500 1.6535 0.4757
1.1723 1000 0.8146 0.5074
1.7585 1500 0.5929 0.5271
2.3447 2000 0.4561 0.5407
2.9308 2500 0.4064 0.5501
3.5170 3000 0.3404 0.5539
4.1032 3500 0.3302 0.5593
4.6893 4000 0.2986 0.5644
5.2755 4500 0.2868 0.5641
5.8617 5000 0.2767 0.5644
6.4478 5500 0.2532 0.571
7.0340 6000 0.2495 0.5684
7.6202 6500 0.2346 0.5676
8.2063 7000 0.2286 0.5704
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 19.3 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.4.0
  • Transformers: 5.5.4
  • PyTorch: 2.10.0+cu128
  • Accelerate: 1.13.0
  • Datasets: 4.0.0
  • 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",
}

MultipleNegativesRankingLoss

@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},
}
Downloads last month
85
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Folma/IndoBERT-Retail-Search-Model

Finetuned
(97)
this model

Space using Folma/IndoBERT-Retail-Search-Model 1

Papers for Folma/IndoBERT-Retail-Search-Model

Evaluation results