bge-m3-klue-sts / README.md
shinqhwa's picture
Upload folder using huggingface_hub
bd657e0 verified
|
Raw
History Blame Contribute Delete
15.7 kB
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - generated_from_trainer
  - dataset_size:10501
  - loss:CosineSimilarityLoss
base_model: BAAI/bge-m3
widget:
  - source_sentence: 삼촌이  시간대에 보고싶은 티비 프로그램이 뭐여요?
    sentences:
      - 외출  방범 모드 변환하는 방법  알려줘
      - >-
        제2차 전략회의에서 대전, 경기, 강원, 전남, 제주, 경남 등 6개 시·도지사가 지역에서 추진 중인 뉴딜 관련 사례를
        소개했습니다.
      - 학교가 보낸 메일은 차단하면 안돼
  - source_sentence: 재산세율 인하 대상을 공시가격 6억원 이하 1주택자로 한정하고 세율 인하 폭을 0.05%p로 정한 이유는?
    sentences:
      - 무엇보다 호스트의 빠른 응답과 세심함, 친절함이 좋았어요
      - 날짜  언제 아버지가 시간이 되시는지요?
      - 재산세율 인하가 공시가격 6억원 이하 1주택자로 제한되고 세율 인하가 0.05%p로 정해진 이유는 무엇입니까?
  - source_sentence: 집안 조명 개수 늘리는  삼가주시기 바랍니다.
    sentences:
      - 숙소의 위치는 버스와 지하철을 이용하기에 좋았습니다.
      - 회원님의 한달  가스레인지 비용이 얼마인지   있을까요?
      - 앞으로 서울 서계동 복합문화시설(현 국립극단) 부지와 부천영상지구 부지에 문화예술인 지원주택이 조성될 예정입니다.
  - source_sentence:  겨울이 우기인 프랑스의 을씨년스런 분위기와  곳곳에 위치한  조명, 연식있는 건물이  어울렸습니다
    sentences:
      - 저의 여행일정에 위치나 가격대 시설등이 만족스러웠습니다.
      - 정부가 22일부터 내달 5일까지 종교시설, 실내 체육시설, 유흥시설 등에 대한 운영 중단을 권고했다.
      - 학회 홍보메일이랑 저널 홍보메일을 비교했을  뭐가  자주 와?
  - source_sentence: 호시우역과 가까워 신트라에 가기 편합니다.
    sentences:
      - 신트라는 호시우역에서 가까워서 가는 것이 편리합니다.
      - 첫날에 지도와 함께 친절한 설명과 건물 옥상 야경팁도 좋았습니다.
      - 제가 갔던 에어비엔비중에서 제일 좋았어요!
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
  - pearson_cosine
  - spearman_cosine
model-index:
  - name: SentenceTransformer based on BAAI/bge-m3
    results:
      - task:
          type: semantic-similarity
          name: Semantic Similarity
        dataset:
          name: Unknown
          type: unknown
        metrics:
          - type: pearson_cosine
            value: 0.8721708944763191
            name: Pearson Cosine
          - type: spearman_cosine
            value: 0.8828376070833523
            name: Spearman Cosine
          - type: pearson_cosine
            value: 0.9622964526170126
            name: Pearson Cosine
          - type: spearman_cosine
            value: 0.9247125520705015
            name: Spearman Cosine

SentenceTransformer based on BAAI/bge-m3

This is a sentence-transformers model finetuned from BAAI/bge-m3. 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

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-m3
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 1024 dimensions
  • 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': 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})
)

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("sentence_transformers_model_id")
# Run inference
sentences = [
    '호시우역과 가까워 신트라에 가기 편합니다.',
    '신트라는 호시우역에서 가까워서 가는 것이 편리합니다.',
    '첫날에 지도와 함께 친절한 설명과 건물 옥상 야경팁도 좋았습니다.',
]
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

Semantic Similarity

Metric Value
pearson_cosine 0.8722
spearman_cosine 0.8828

Semantic Similarity

Metric Value
pearson_cosine 0.9623
spearman_cosine 0.9247

Training Details

Training Dataset

Unnamed Dataset

  • Size: 10,501 training samples
  • Columns: sentence_0, sentence_1, and label
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 label
    type string string float
    details
    • min: 7 tokens
    • mean: 20.97 tokens
    • max: 70 tokens
    • min: 8 tokens
    • mean: 20.15 tokens
    • max: 63 tokens
    • min: 0.0
    • mean: 0.44
    • max: 1.0
  • Samples:
    sentence_0 sentence_1 label
    앞으로 다른 사람의 토지에 정당한 사유 없이 자동차를 두 달 넘게 무단 방치하는 경우 강제 견인한다. 문체부는 범정부 협업으로 한류를 지속 확산하고 연관 산업의 성장을 견인한다. 0.1
    인공지능, 보안(시큐리티), 사물인터넷(IoT), 스마트 헬스케어 등의 제품·서비스가 중점적으로 선보일 예정이다. 인공지능, 보안(Security), 사물 인터넷(IoT), 스마트 헬스케어 등의 제품과 서비스가 주로 도입될 예정입니다. 0.86
    오늘 중에 혹시 일정 아직 안 잡힌 시간 있음 궁금해. 학교 다닐 때도 같이 오래 놀았던 대학 후배인데 결혼식에 늦는 몰염치한 짓은 하지 맙시다. 0.0
  • Loss: CosineSimilarityLoss with these parameters:
    {
        "loss_fct": "torch.nn.modules.loss.MSELoss"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • num_train_epochs: 4
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 4
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • 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: 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}
  • 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: None
  • hub_always_push: False
  • 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
  • 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
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Epoch Step Training Loss spearman_cosine
-1 -1 - 0.8828
0.7610 500 0.0239 -
1.0 657 - 0.9175
1.5221 1000 0.0068 0.9192
2.0 1314 - 0.9235
2.2831 1500 0.0043 -
3.0 1971 - 0.9243
3.0441 2000 0.0027 0.9245
3.8052 2500 0.0021 -
4.0 2628 - 0.9247

Framework Versions

  • Python: 3.12.7
  • Sentence Transformers: 3.4.1
  • Transformers: 4.49.0
  • PyTorch: 2.6.0+cu118
  • Accelerate: 1.4.0
  • Datasets: 3.3.2
  • Tokenizers: 0.21.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",
}