SentenceTransformer based on intfloat/multilingual-e5-base

This is a sentence-transformers model finetuned from intfloat/multilingual-e5-base. It maps sentences & paragraphs to a 768-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: intfloat/multilingual-e5-base
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: XLMRobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, '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})
  (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("ThanhLe0125/e5-math-ebd-01")
# Run inference
sentences = [
    "query: Ý nghĩa của việc tìm nghiệm của phương trình f'(x) = 0?",
    "passage: # Phương pháp tìm cực trị của hàm số\n\n## Quy trình tìm cực trị\n**Bước 1:** Tìm tập xác định của hàm số\n**Bước 2:** Tính đạo hàm $f'(x)$\n**Bước 3:** Tìm nghiệm của phương trình $f'(x) = 0$ và các điểm mà $f'(x)$ không xác định\n**Bước 4:** Lập bảng xét dấu $f'(x)$\n**Bước 5:** Kết luận về cực trị\n\n## Ví dụ minh họa\nTìm cực trị của hàm số $f(x) = x^4 - 2x^2 + 1$.\n\n**Lời giải:**\nTập xác định: $D = \\mathbb{R}$\n$f'(x) = 4x^3 - 4x = 4x(x^2 - 1) = 4x(x-1)(x+1)$\n$f'(x) = 0 \\Leftrightarrow x = -1, x = 0, x = 1$\n\nBảng xét dấu:\n- $x \\in (-\\infty; -1)$: $f'(x) < 0$\n- $x \\in (-1; 0)$: $f'(x) > 0$  \n- $x \\in (0; 1)$: $f'(x) < 0$\n- $x \\in (1; +\\infty)$: $f'(x) > 0$\n\n**Kết luận:**\n- $x = -1$: cực tiểu, $f(-1) = 0$\n- $x = 0$: cực đại, $f(0) = 1$\n- $x = 1$: cực tiểu, $f(1) = 0$",
    'passage: # Tổ hợp\n\n## Định nghĩa\n**Tổ hợp chập $k$ của $n$ phần tử** là cách chọn $k$ phần tử từ $n$ phần tử mà không quan tâm đến thứ tự.\n\n**Ký hiệu:** $C_n^k$ hoặc $\\binom{n}{k}$\n\n**Điều kiện:** $0 \\leq k \\leq n$\n\n## Công thức\n$$C_n^k = \\frac{A_n^k}{k!} = \\frac{n!}{k!(n-k)!}$$\n\n**Công thức Pascal:** $C_n^k = C_{n-1}^{k-1} + C_{n-1}^k$\n\n## Tính chất cơ bản\n1. $C_n^0 = C_n^n = 1$\n2. $C_n^k = C_n^{n-k}$\n3. $C_n^1 = n$\n4. $C_n^2 = \\frac{n(n-1)}{2}$\n\n## Ví dụ tính toán\n**Ví dụ 1:** Từ 10 học sinh, chọn 3 học sinh tham gia đội tuyển. Có bao nhiêu cách?\n\n**Lời giải:** $C_{10}^3 = \\frac{10!}{3! \\times 7!} = \\frac{10 \\times 9 \\times 8}{3 \\times 2 \\times 1} = 120$ cách.\n\n**Ví dụ 2:** Trong một lớp có 15 nam và 10 nữ. Chọn 5 người sao cho có đúng 3 nam và 2 nữ.\n\n**Lời giải:** \n- Chọn 3 nam từ 15 nam: $C_{15}^3 = 455$ cách\n- Chọn 2 nữ từ 10 nữ: $C_{10}^2 = 45$ cách\n- Tổng cộng: $455 \\times 45 = 20,475$ cách\n\n## Nhị thức Newton\n$$(a + b)^n = \\sum_{k=0}^{n} C_n^k a^{n-k} b^k$$\n\n**Ví dụ:** $(x + 2)^4 = C_4^0 x^4 + C_4^1 x^3 \\cdot 2 + C_4^2 x^2 \\cdot 2^2 + C_4^3 x \\cdot 2^3 + C_4^4 \\cdot 2^4$\n$= x^4 + 8x^3 + 24x^2 + 32x + 16$\n\n## Phân biệt chỉnh hợp và tổ hợp\n- **Chỉnh hợp:** Quan tâm thứ tự (Ví dụ: Chọn và xếp hạng)\n- **Tổ hợp:** Không quan tâm thứ tự (Ví dụ: Chọn thành viên nhóm)\n\n**Mối quan hệ:** $A_n^k = k! \\times C_n^k$',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

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

Evaluation

Metrics

Binary Classification

Metric Value
cosine_accuracy 0.95
cosine_accuracy_threshold 0.3498
cosine_f1 0.9231
cosine_f1_threshold 0.2493
cosine_precision 0.8684
cosine_recall 0.9851
cosine_ap 0.9737
cosine_mcc 0.8848

Training Details

Training Dataset

Unnamed Dataset

  • Size: 1,924 training samples
  • Columns: sentence_0, sentence_1, and sentence_2
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 sentence_2
    type string string string
    details
    • min: 10 tokens
    • mean: 24.47 tokens
    • max: 56 tokens
    • min: 228 tokens
    • mean: 254.6 tokens
    • max: 256 tokens
    • min: 228 tokens
    • mean: 254.43 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1 sentence_2
    query: Giải thích ý nghĩa của ký hiệu C(n, k) và A(n, k) trong toán tổ hợp. passage: # Bài toán tổ hợp - chỉnh hợp thực tế

    ## Dạng bài thường gặp
    1. Sắp xếp người ngồi
    2. Chọn đội tuyển, ủy ban
    3. Phân chia nhóm
    4. Xếp lịch, phân công
    5. Mật khẩu, biển số xe

    ## Ví dụ tổng hợp
    Ví dụ 1: Một bàn dài có 10 ghế. Có 6 nam và 4 nữ. Hỏi có bao nhiêu cách xếp sao cho:
    a) Các nữ ngồi cạnh nhau
    b) Nam và nữ ngồi xen kẽ

    Lời giải:
    a) Coi 4 nữ như 1 khối, ta có 7 đối tượng (6 nam + 1 khối nữ)
    - Xếp 7 đối tượng: $7!$ cách
    - Xếp 4 nữ trong khối: $4!$ cách
    - Tổng: $7! \times 4! = 120,960$ cách

    b) Vì có 6 nam và 4 nữ, xếp theo kiểu: N-Nam-N-Nam-...
    - Xếp 6 nam: $6!$ cách
    - Chọn 4 vị trí từ 7 vị trí giữa các nam: $C_7^4$ cách
    - Xếp 4 nữ vào 4 vị trí đã chọn: $4!$ cách
    - Tổng: $6! \times C_7^4 \times 4! = 1,209,600$ cách

    Ví dụ 2: Chia 12 học sinh thành 3 nhóm có 4 người mỗi nhóm.

    Lời giải:
    - Chọn 4 người cho nhóm 1: $C_{12}^4$
    - Chọn 4 người cho nhóm 2 từ 8 người còn lại: $C_8^4$
    - 4 người còn lại tự động vào nhóm 3...
    passage: # Tiệm cận đứng của đồ thị hàm số

    ## Định nghĩa
    Đường thẳng $x = a$ được gọi là tiệm cận đứng của đồ thị hàm số $y = f(x)$ nếu ít nhất một trong các điều kiện sau được thỏa mãn:
    - $\lim_{x \to a^+} f(x) = +\infty$ hoặc $\lim_{x \to a^+} f(x) = -\infty$
    - $\lim_{x \to a^-} f(x) = +\infty$ hoặc $\lim_{x \to a^-} f(x) = -\infty$

    ## Phương pháp tìm tiệm cận đứng
    Đối với hàm phân thức $f(x) = \frac{P(x)}{Q(x)}$:
    1. Tìm nghiệm của $Q(x) = 0$ mà không phải nghiệm của $P(x) = 0$
    2. Với mỗi nghiệm $x = a$, tính giới hạn một phía
    3. Nếu có giới hạn vô cực thì $x = a$ là tiệm cận đứng

    ## Ví dụ
    Tìm tiệm cận đứng của $f(x) = \frac{x+1}{x^2-4}$.

    Lời giải:
    $x^2 - 4 = 0 \Leftrightarrow x = \pm 2$

    Tại $x = 2$:
    - $\lim_{x \to 2^+} \frac{x+1}{x^2-4} = \lim_{x \to 2^+} \frac{3}{(x-2)(x+2)} = +\infty$
    - $\lim_{x \to 2^-} \frac{x+1}{x^2-4} = -\infty$

    Tại $x = -2$:
    - $\lim_{x \to (-2)^+} \frac{x+1}{x^2-4} = -\infty$
    - $\lim_{x \to (-2)^-} \frac{x+1}{x^2-4} = +\infty$

    *Kết luận:...
    query: Trong một hộp có 7 viên bi khác nhau. Lấy ngẫu nhiên ra 2 viên. Hỏi có bao nhiêu cách lấy? passage: # Bài toán tổ hợp - chỉnh hợp thực tế

    ## Dạng bài thường gặp
    1. Sắp xếp người ngồi
    2. Chọn đội tuyển, ủy ban
    3. Phân chia nhóm
    4. Xếp lịch, phân công
    5. Mật khẩu, biển số xe

    ## Ví dụ tổng hợp
    Ví dụ 1: Một bàn dài có 10 ghế. Có 6 nam và 4 nữ. Hỏi có bao nhiêu cách xếp sao cho:
    a) Các nữ ngồi cạnh nhau
    b) Nam và nữ ngồi xen kẽ

    Lời giải:
    a) Coi 4 nữ như 1 khối, ta có 7 đối tượng (6 nam + 1 khối nữ)
    - Xếp 7 đối tượng: $7!$ cách
    - Xếp 4 nữ trong khối: $4!$ cách
    - Tổng: $7! \times 4! = 120,960$ cách

    b) Vì có 6 nam và 4 nữ, xếp theo kiểu: N-Nam-N-Nam-...
    - Xếp 6 nam: $6!$ cách
    - Chọn 4 vị trí từ 7 vị trí giữa các nam: $C_7^4$ cách
    - Xếp 4 nữ vào 4 vị trí đã chọn: $4!$ cách
    - Tổng: $6! \times C_7^4 \times 4! = 1,209,600$ cách

    Ví dụ 2: Chia 12 học sinh thành 3 nhóm có 4 người mỗi nhóm.

    Lời giải:
    - Chọn 4 người cho nhóm 1: $C_{12}^4$
    - Chọn 4 người cho nhóm 2 từ 8 người còn lại: $C_8^4$
    - 4 người còn lại tự động vào nhóm 3...
    passage: # Tính toán phương sai và độ lệch chuẩn

    ## Ví dụ 1: Dữ liệu rời rạc
    Điểm số: 6, 7, 8, 9, 10

    Bước 1: Tính trung bình
    $\bar{x} = \frac{6 + 7 + 8 + 9 + 10}{5} = 8$

    Bước 2: Tính phương sai
    query: So sánh sự khác biệt giữa khảo sát hàm phân thức bậc nhất trên bậc nhất với khảo sát hàm số bậc hai. passage: # Khảo sát hàm phân thức bậc nhất trên bậc nhất: $f(x) = \frac{ax + b}{cx + d}$

    ## Điều kiện
    $c \neq 0$ và $ad - bc \neq 0$

    ## Đặc điểm chung
    - Tập xác định: $D = \mathbb{R} \setminus {-\frac{d}{c}}$
    - Tiệm cận đứng: $x = -\frac{d}{c}$
    - Tiệm cận ngang: $y = \frac{a}{c}$
    - Hàm số đơn điệu trên mỗi khoảng xác định

    ## Tính đơn điệu
    $f'(x) = \frac{ad - bc}{(cx + d)^2}$

    - Nếu $ad - bc > 0$: hàm đồng biến trên mỗi khoảng xác định
    - Nếu $ad - bc < 0$: hàm nghịch biến trên mỗi khoảng xác định

    ## Tâm đối xứng
    Đồ thị có tâm đối xứng là giao điểm của hai tiệm cận: $I(-\frac{d}{c}; \frac{a}{c})$

    ## Ví dụ
    Khảo sát $f(x) = \frac{2x + 1}{x - 1}$.

    Lời giải:
    - TXĐ: $D = \mathbb{R} \setminus {1}$
    - $f'(x) = \frac{2(x-1) - (2x+1)}{(x-1)^2} = \frac{-3}{(x-1)^2} < 0$
    - Hàm nghịch biến trên $(-\infty; 1)$ và $(1; +\infty)$
    - Tiệm cận đứng: $x = 1$
    - Tiệm cận ngang: $y = 2$
    - Tâm đối xứng: $I(1; 2)$
    - Giao trục tung: $(0; -1)$
    - Giao trục hoành: $(-\frac{1}{2}; 0)$
    passage: # Giá trị lớn nhất và nhỏ nhất của hàm số

    ## Định nghĩa
    Cho hàm số $y = f(x)$ xác định trên tập $D$.

    Giá trị lớn nhất: Số $M$ được gọi là giá trị lớn nhất của hàm số $f(x)$ trên $D$ nếu:
    - $f(x) \leq M$ với mọi $x \in D$
    - Tồn tại $x_0 \in D$ sao cho $f(x_0) = M$

    Giá trị nhỏ nhất: Số $m$ được gọi là giá trị nhỏ nhất của hàm số $f(x)$ trên $D$ nếu:
    - $f(x) \geq m$ với mọi $x \in D$
    - Tồn tại $x_0 \in D$ sao cho $f(x_0) = m$

    ## Định lý Weierstrass
    Nếu hàm số $f(x)$ liên tục trên đoạn $[a; b]$ thì $f(x)$ đạt giá trị lớn nhất và giá trị nhỏ nhất trên đoạn đó.

    ## Sự khác biệt với cực trị
    - Cực trị: khái niệm địa phương (so sánh trong lân cận)
    - Giá trị lớn nhất, nhỏ nhất: khái niệm toàn cục (so sánh trên toàn bộ tập xác định)
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 4
  • per_device_eval_batch_size: 4
  • num_train_epochs: 20
  • 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: 4
  • per_device_eval_batch_size: 4
  • 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: 20
  • 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}
  • tp_size: 0
  • 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
  • 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 ranking_evaluator_cosine_ap
0.8299 200 - 0.9308
1.0 241 - 0.9113
1.6598 400 - 0.9397
2.0 482 - 0.9254
2.0747 500 0.7221 -
2.4896 600 - 0.9335
3.0 723 - 0.9318
3.3195 800 - 0.9493
4.0 964 - 0.9419
4.1494 1000 0.4382 0.9440
4.9793 1200 - 0.9523
5.0 1205 - 0.9505
5.8091 1400 - 0.9629
6.0 1446 - 0.9639
6.2241 1500 0.402 -
6.6390 1600 - 0.9537
7.0 1687 - 0.9532
7.4689 1800 - 0.9737

Framework Versions

  • Python: 3.11.11
  • Sentence Transformers: 3.4.1
  • Transformers: 4.51.3
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.5.2
  • Datasets: 3.6.0
  • Tokenizers: 0.21.1

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{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
Downloads last month
-
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 ThanhLe0125/e5-math-ebd-01

Finetuned
(107)
this model

Papers for ThanhLe0125/e5-math-ebd-01

Evaluation results