SentenceTransformer

This is a sentence-transformers model trained on the train_set dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

  • Learning other languages ​​besides Chinese and English is insufficient, so additional learning is needed to optimize use of other languages.
  • This model is additionally trained on the Korean dataset.

Model Description

  • Model Type: Sentence Transformer Transformer Encoder
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 1024 tokens
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: XLMRobertaModel 
  (1): Pooling({'word_embedding_dimension': 1024, '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})
  (2): Normalize()
)

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("dragonkue/bge-m3-ko")
# Run inference
sentences = [
    '수급권자 중 근로 능력이 없는 임산부는 몇 종에 해당하니?',
    '내년부터 저소득층 1세 미만 아동의 \n의료비 부담이 더 낮아진다!\n의료급여제도 개요\n□ (목적) 생활유지 능력이 없거나 생활이 어려운 국민들에게 발생하는 질병, 부상, 출산 등에 대해 국가가 의료서비스 제공\n□ (지원대상) 국민기초생활보장 수급권자, 타 법에 의한 수급권자 등\n\n| 구분 | 국민기초생활보장법에 의한 수급권자 | 국민기초생활보장법 이외의 타 법에 의한 수급권자 |\n| --- | --- | --- |\n| 1종 | ○ 국민기초생활보장 수급권자 중 근로능력이 없는 자만으로 구성된 가구 - 18세 미만, 65세 이상 - 4급 이내 장애인 - 임산부, 병역의무이행자 등 | ○ 이재민(재해구호법) ○ 의상자 및 의사자의 유족○ 국내 입양된 18세 미만 아동○ 국가유공자 및 그 유족․가족○ 국가무형문화재 보유자 및 그 가족○ 새터민(북한이탈주민)과 그 가족○ 5․18 민주화운동 관련자 및 그 유가족○ 노숙인 ※ 행려환자 (의료급여법 시행령) |\n| 2종 | ○ 국민기초생활보장 수급권자 중 근로능력이 있는 가구 | - |\n',
    '이어 이날 오후 1시30분부터 열릴 예정이던 스노보드 여자 슬로프스타일 예선 경기는 연기를 거듭하다 취소됐다. 조직위는 예선 없이 다음 날 결선에서 참가자 27명이 한번에 경기해 순위를 가리기로 했다.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Evaluation

Metrics

  • ndcg, mrr, map metrics are metrics that consider ranking, while accuracy, precision, and recall are metrics that do not consider ranking. (Example: When considering ranking for retrieval top 10, different scores are given when the correct document is in 1st place and when it is in 10th place. However, accuracy, precision, and recall scores are the same if they are in the top 10.)

Information Retrieval

  • Korean Embedding Benchmark is a benchmark with a relatively long 3/4 quantile of string length of 1024
Korean Embedding Benchmark with AutoRAG

This is a benchmark of Korean embedding models. (https://github.com/Marker-Inc-Korea/AutoRAG-example-korean-embedding-benchmark)

  • Top-k 1
Model name F1 Recall Precision mAP mRR NDCG
paraphrase-multilingual-mpnet-base-v2 0.3596 0.3596 0.3596 0.3596 0.3596 0.3596
KoSimCSE-roberta 0.4298 0.4298 0.4298 0.4298 0.4298 0.4298
Cohere embed-multilingual-v3.0 0.3596 0.3596 0.3596 0.3596 0.3596 0.3596
openai ada 002 0.4737 0.4737 0.4737 0.4737 0.4737 0.4737
multilingual-e5-large-instruct 0.4649 0.4649 0.4649 0.4649 0.4649 0.4649
Upstage Embedding 0.6579 0.6579 0.6579 0.6579 0.6579 0.6579
paraphrase-multilingual-MiniLM-L12-v2 0.2982 0.2982 0.2982 0.2982 0.2982 0.2982
openai_embed_3_small 0.5439 0.5439 0.5439 0.5439 0.5439 0.5439
ko-sroberta-multitask 0.4211 0.4211 0.4211 0.4211 0.4211 0.4211
openai_embed_3_large 0.6053 0.6053 0.6053 0.6053 0.6053 0.6053
KU-HIAI-ONTHEIT-large-v1 0.7105 0.7105 0.7105 0.7105 0.7105 0.7105
KU-HIAI-ONTHEIT-large-v1.1 0.7193 0.7193 0.7193 0.7193 0.7193 0.7193
kf-deberta-multitask 0.4561 0.4561 0.4561 0.4561 0.4561 0.4561
gte-multilingual-base 0.5877 0.5877 0.5877 0.5877 0.5877 0.5877
KoE5 0.7018 0.7018 0.7018 0.7018 0.7018 0.7018
BGE-m3 0.6578 0.6578 0.6578 0.6578 0.6578 0.6578
bge-m3-korean 0.5351 0.5351 0.5351 0.5351 0.5351 0.5351
BGE-m3-ko 0.7456 0.7456 0.7456 0.7456 0.7456 0.7456
  • Top-k 3
Model name F1 Recall Precision mAP mRR NDCG
paraphrase-multilingual-mpnet-base-v2 0.2368 0.4737 0.1579 0.2032 0.2032 0.2712
KoSimCSE-roberta 0.3026 0.6053 0.2018 0.2661 0.2661 0.3515
Cohere embed-multilingual-v3.0 0.2851 0.5702 0.1901 0.2515 0.2515 0.3321
openai ada 002 0.3553 0.7105 0.2368 0.3202 0.3202 0.4186
multilingual-e5-large-instruct 0.3333 0.6667 0.2222 0.2909 0.2909 0.3856
Upstage Embedding 0.4211 0.8421 0.2807 0.3509 0.3509 0.4743
paraphrase-multilingual-MiniLM-L12-v2 0.2061 0.4123 0.1374 0.1740 0.1740 0.2340
openai_embed_3_small 0.3640 0.7281 0.2427 0.3026 0.3026 0.4097
ko-sroberta-multitask 0.2939 0.5877 0.1959 0.2500 0.2500 0.3351
openai_embed_3_large 0.3947 0.7895 0.2632 0.3348 0.3348 0.4491
KU-HIAI-ONTHEIT-large-v1 0.4386 0.8772 0.2924 0.3421 0.3421 0.4766
KU-HIAI-ONTHEIT-large-v1.1 0.4430 0.8860 0.2953 0.3406 0.3406 0.4778
kf-deberta-multitask 0.3158 0.6316 0.2105 0.2792 0.2792 0.3679
gte-multilingual-base 0.4035 0.8070 0.2690 0.3450 0.3450 0.4614
KoE5 0.4254 0.8509 0.2836 0.3173 0.3173 0.4514
BGE-m3 0.4254 0.8508 0.2836 0.3421 0.3421 0.4701
bge-m3-korean 0.3684 0.7368 0.2456 0.3143 0.3143 0.4207
BGE-m3-ko 0.4517 0.9035 0.3011 0.3494 0.3494 0.4886
  • Top-k 5
Model name F1 Recall Precision mAP mRR NDCG
paraphrase-multilingual-mpnet-base-v2 0.1813 0.5439 0.1088 0.1575 0.1575 0.2491
KoSimCSE-roberta 0.2164 0.6491 0.1298 0.1751 0.1751 0.2873
Cohere embed-multilingual-v3.0 0.2076 0.6228 0.1246 0.1640 0.1640 0.2731
openai ada 002 0.2602 0.7807 0.1561 0.2139 0.2139 0.3486
multilingual-e5-large-instruct 0.2544 0.7632 0.1526 0.2194 0.2194 0.3487
Upstage Embedding 0.2982 0.8947 0.1789 0.2237 0.2237 0.3822
paraphrase-multilingual-MiniLM-L12-v2 0.1637 0.4912 0.0982 0.1437 0.1437 0.2264
openai_embed_3_small 0.2690 0.8070 0.1614 0.2148 0.2148 0.3553
ko-sroberta-multitask 0.2164 0.6491 0.1298 0.1697 0.1697 0.2835
openai_embed_3_large 0.2807 0.8421 0.1684 0.2088 0.2088 0.3586
KU-HIAI-ONTHEIT-large-v1 0.3041 0.9123 0.1825 0.2137 0.2137 0.3783
KU-HIAI-ONTHEIT-large-v1.1 0.3099 0.9298 0.1860 0.2148 0.2148 0.3834
kf-deberta-multitask 0.2281 0.6842 0.1368 0.1724 0.1724 0.2939
gte-multilingual-base 0.2865 0.8596 0.1719 0.2096 0.2096 0.3637
KoE5 0.2982 0.8947 0.1789 0.2054 0.2054 0.3678
BGE-m3 0.3041 0.9123 0.1825 0.2193 0.2193 0.3832
bge-m3-korean 0.2661 0.7982 0.1596 0.2116 0.2116 0.3504
BGE-m3-ko 0.3099 0.9298 0.1860 0.2098 0.2098 0.3793
  • Top-k 10
Model name F1 Recall Precision mAP mRR NDCG
paraphrase-multilingual-mpnet-base-v2 0.1212 0.6667 0.0667 0.1197 0.1197 0.2382
KoSimCSE-roberta 0.1324 0.7281 0.0728 0.1080 0.1080 0.2411
Cohere embed-multilingual-v3.0 0.1324 0.7281 0.0728 0.1150 0.1150 0.2473
openai ada 002 0.1563 0.8596 0.0860 0.1051 0.1051 0.2673
multilingual-e5-large-instruct 0.1483 0.8158 0.0816 0.0980 0.0980 0.2520
Upstage Embedding 0.1707 0.9386 0.0939 0.1078 0.1078 0.2848
paraphrase-multilingual-MiniLM-L12-v2 0.1053 0.5789 0.0579 0.0961 0.0961 0.2006
openai_embed_3_small 0.1547 0.8509 0.0851 0.0984 0.0984 0.2593
ko-sroberta-multitask 0.1276 0.7018 0.0702 0.0986 0.0986 0.2275
openai_embed_3_large 0.1643 0.9035 0.0904 0.1180 0.1180 0.2855
KU-HIAI-ONTHEIT-large-v1 0.1707 0.9386 0.0939 0.1105 0.1105 0.2860
KU-HIAI-ONTHEIT-large-v1.1 0.1722 0.9474 0.0947 0.1033 0.1033 0.2822
kf-deberta-multitask 0.1388 0.7632 0.0763 0.1 0.1 0.2422
gte-multilingual-base 0.1675 0.9211 0.0921 0.1066 0.1066 0.2805
KoE5 0.1675 0.9211 0.0921 0.1011 0.1011 0.2750
BGE-m3 0.1707 0.9386 0.0939 0.1130 0.1130 0.2884
bge-m3-korean 0.1579 0.8684 0.0868 0.1093 0.1093 0.2721
BGE-m3-ko 0.1770 0.9736 0.0974 0.1097 0.1097 0.2932

Information Retrieval

Metric Value
cosine_accuracy@1 0.6103
cosine_accuracy@3 0.8169
cosine_accuracy@5 0.8732
cosine_accuracy@10 0.9202
cosine_precision@1 0.6103
cosine_precision@3 0.3787
cosine_precision@5 0.2761
cosine_precision@10 0.1728
cosine_recall@1 0.3847
cosine_recall@3 0.5902
cosine_recall@5 0.6794
cosine_recall@10 0.7695
cosine_ndcg@10 0.6723
cosine_mrr@10 0.7262
cosine_map@100 0.6074
dot_accuracy@1 0.6103
dot_accuracy@3 0.8169
dot_accuracy@5 0.8732
dot_accuracy@10 0.9202
dot_precision@1 0.6103
dot_precision@3 0.3787
dot_precision@5 0.2761
dot_precision@10 0.1728
dot_recall@1 0.3847
dot_recall@3 0.5902
dot_recall@5 0.6794
dot_recall@10 0.7695
dot_ndcg@10 0.6723
dot_mrr@10 0.7262
dot_map@100 0.6074

Bias, Risks and Limitations

  • Since the evaluation results are different for each domain, it is necessary to compare and evaluate the model in your own domain. In the Miracl benchmark, the evaluation was conducted using the Korean Wikipedia as a corpus, and in this case, the cosine_ndcg@10 score dropped by 0.02 points after learning. However, in the Auto-RAG benchmark, which is a financial domain, the ndcg score increased by 0.09 when it was top 1. This model may be advantageous for use in a specific domain.
  • Also, since the miracl benchmark consists of a corpus of relatively short strings, while the Korean Embedding Benchmark consists of a corpus of longer strings, this model may be more advantageous if the length of the corpus you want to use is long.

Training Hyperparameters

Non-Default Hyperparameters

The batch size was referenced from the following paper: Text Embeddings by Weakly-Supervised Contrastive Pre-training (https://arxiv.org/pdf/2212.03533)

  • eval_strategy: steps
  • per_device_train_batch_size: 32768
  • per_device_eval_batch_size: 32768
  • learning_rate: 3e-05
  • warmup_ratio: 0.03333333333333333
  • fp16: True
  • 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: 32768
  • per_device_eval_batch_size: 32768
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • learning_rate: 3e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 3
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.03333333333333333
  • 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: False
  • fp16: True
  • 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: True
  • 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}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • 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: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • 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
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

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",
}
@misc{bge-m3,
      title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation}, 
      author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
      year={2024},
      eprint={2402.03216},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
@article{wang2022text,
  title={Text Embeddings by Weakly-Supervised Contrastive Pre-training},
  author={Wang, Liang and Yang, Nan and Huang, Xiaolong and Jiao, Binxing and Yang, Linjun and Jiang, Daxin and Majumder, Rangan and Wei, Furu},
  journal={arXiv preprint arXiv:2212.03533},
  year={2022}
}
Downloads last month
14,544
Safetensors
Model size
568M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for dragonkue/BGE-m3-ko

Base model

BAAI/bge-m3
Finetuned
(130)
this model
Quantizations
1 model

Evaluation results