---
language:
- en
license: apache-2.0
library_name: sentence-transformers
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:282883
- loss:MatryoshkaLoss
- loss:MultipleNegativesRankingLoss
base_model: BAAI/bge-base-en-v1.5
datasets: []
metrics:
- cosine_accuracy@1
- cosine_accuracy@3
- cosine_accuracy@5
- cosine_accuracy@10
- cosine_precision@1
- cosine_precision@3
- cosine_precision@5
- cosine_precision@10
- cosine_recall@1
- cosine_recall@3
- cosine_recall@5
- cosine_recall@10
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@100
widget:
- source_sentence: Mwanamke anashona.
sentences:
- Mwanamke akishona blanketi pamoja.
- Lakini Sir James alimkatiza.
- Kwa kuongezea, wabunifu mashuhuri sasa wana maduka ya rejareja katika hoteli kadhaa
za ununuzi.
- source_sentence: Mtandao huwawezesha watu kununua vitu.
sentences:
- Mwanamke fulani anakata kipande cha jibini.
- Hakuna hata mmoja wa wafadhili hawa anayeweza kuruhusu kuacha sasa, haswa na uchumi
unaoteseka ndani na kitaifa.
- Kwa vyovyote vile, kama ningekuwa na nia ya kununua kitabu hicho, ningekuwa na
nafasi nzuri zaidi ya kujadili bei nzuri.
- source_sentence: Je, kweli wewe ni hivyo gullible, Dave Hanson?
sentences:
- Mwanamume amesimama katika mashua paddling kuelekea pwani lined na fanicha na
vitu vingine kubwa.
- Dave Hanson, je, unaamini kila kitu wanachosema?
- Wasichana watatu wakifanya mchezo wa kuigiza jukwaani.
- source_sentence: Wanandoa wakitembea pamoja.
sentences:
- Mwanamume aliyevalia koti la manjano anatembea kando ya gari la kubebea watu.
- Wenzi wa ndoa wazee wanatembea barabarani wakishikamana mikono.
- Msichana mdogo anapanda kwenye kifaa cha kamba.
- source_sentence: Kuna masuala ya sera.
sentences:
- Mwanamke mwenye makunyanzi sana akishikilia miwani yake na kutembea kwenye barabara
ya jiji.
- Mwanamume anayeigiza kwa ajili ya umati wa watu.
- Masuala ya sera ya mbinu nyingi na maombi.
pipeline_tag: sentence-similarity
model-index:
- name: BGE base Financial Matryoshka
results:
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: dim 768
type: dim_768
metrics:
- type: cosine_accuracy@1
value: 0.26803894120641386
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.3499618223466531
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.3858806312038687
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.43318910664291166
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.26803894120641386
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.11665394078221768
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.07717612624077373
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.043318910664291166
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.26803894120641386
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.3499618223466531
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.3858806312038687
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.43318910664291166
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.34611891078942064
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.3188061049905684
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.3251959746415499
name: Cosine Map@100
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: dim 512
type: dim_512
metrics:
- type: cosine_accuracy@1
value: 0.26552557902774243
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.34601679816747266
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.3810766098243828
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.4290850089081191
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.26552557902774243
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.11533893272249085
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.07621532196487656
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.04290850089081191
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.26552557902774243
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.34601679816747266
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.3810766098243828
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.4290850089081191
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.3425120728009226
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.31538232445349546
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.32174207802147353
name: Cosine Map@100
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: dim 256
type: dim_256
metrics:
- type: cosine_accuracy@1
value: 0.2576355306693815
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.33790404683125475
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.37165945533214556
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.41950878086026977
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.2576355306693815
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.1126346822770849
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.07433189106642912
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.041950878086026974
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.2576355306693815
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.33790404683125475
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.37165945533214556
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.41950878086026977
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.3338740008089949
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.30705069547968683
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.3134101334652913
name: Cosine Map@100
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: dim 128
type: dim_128
metrics:
- type: cosine_accuracy@1
value: 0.24494146093153474
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.3218694324255536
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.3557202850598117
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.402901501654365
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.24494146093153474
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.10728981080851785
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.07114405701196233
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.0402901501654365
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.24494146093153474
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.3218694324255536
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.3557202850598117
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.402901501654365
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.3191027723891013
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.2928823673781056
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.299205934269314
name: Cosine Map@100
- task:
type: information-retrieval
name: Information Retrieval
dataset:
name: dim 64
type: dim_64
metrics:
- type: cosine_accuracy@1
value: 0.21936243318910664
name: Cosine Accuracy@1
- type: cosine_accuracy@3
value: 0.2918045304148638
name: Cosine Accuracy@3
- type: cosine_accuracy@5
value: 0.3234601679816747
name: Cosine Accuracy@5
- type: cosine_accuracy@10
value: 0.3698778315092899
name: Cosine Accuracy@10
- type: cosine_precision@1
value: 0.21936243318910664
name: Cosine Precision@1
- type: cosine_precision@3
value: 0.0972681768049546
name: Cosine Precision@3
- type: cosine_precision@5
value: 0.06469203359633495
name: Cosine Precision@5
- type: cosine_precision@10
value: 0.03698778315092899
name: Cosine Precision@10
- type: cosine_recall@1
value: 0.21936243318910664
name: Cosine Recall@1
- type: cosine_recall@3
value: 0.2918045304148638
name: Cosine Recall@3
- type: cosine_recall@5
value: 0.3234601679816747
name: Cosine Recall@5
- type: cosine_recall@10
value: 0.3698778315092899
name: Cosine Recall@10
- type: cosine_ndcg@10
value: 0.2897472677253453
name: Cosine Ndcg@10
- type: cosine_mrr@10
value: 0.26472963050495346
name: Cosine Mrr@10
- type: cosine_map@100
value: 0.2710377326397304
name: Cosine Map@100
---
# BGE base Financial Matryoshka
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5). 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:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 768 tokens
- **Similarity Function:** Cosine Similarity
- **Language:** en
- **License:** apache-2.0
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
### Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, '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:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("sartifyllc/bge-base-swahili-matryoshka")
# Run inference
sentences = [
'Kuna masuala ya sera.',
'Masuala ya sera ya mbinu nyingi na maombi.',
'Mwanamke mwenye makunyanzi sana akishikilia miwani yake na kutembea kwenye barabara ya jiji.',
]
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
#### Information Retrieval
* Dataset: `dim_768`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@1 | 0.268 |
| cosine_accuracy@3 | 0.35 |
| cosine_accuracy@5 | 0.3859 |
| cosine_accuracy@10 | 0.4332 |
| cosine_precision@1 | 0.268 |
| cosine_precision@3 | 0.1167 |
| cosine_precision@5 | 0.0772 |
| cosine_precision@10 | 0.0433 |
| cosine_recall@1 | 0.268 |
| cosine_recall@3 | 0.35 |
| cosine_recall@5 | 0.3859 |
| cosine_recall@10 | 0.4332 |
| cosine_ndcg@10 | 0.3461 |
| cosine_mrr@10 | 0.3188 |
| **cosine_map@100** | **0.3252** |
#### Information Retrieval
* Dataset: `dim_512`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@1 | 0.2655 |
| cosine_accuracy@3 | 0.346 |
| cosine_accuracy@5 | 0.3811 |
| cosine_accuracy@10 | 0.4291 |
| cosine_precision@1 | 0.2655 |
| cosine_precision@3 | 0.1153 |
| cosine_precision@5 | 0.0762 |
| cosine_precision@10 | 0.0429 |
| cosine_recall@1 | 0.2655 |
| cosine_recall@3 | 0.346 |
| cosine_recall@5 | 0.3811 |
| cosine_recall@10 | 0.4291 |
| cosine_ndcg@10 | 0.3425 |
| cosine_mrr@10 | 0.3154 |
| **cosine_map@100** | **0.3217** |
#### Information Retrieval
* Dataset: `dim_256`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@1 | 0.2576 |
| cosine_accuracy@3 | 0.3379 |
| cosine_accuracy@5 | 0.3717 |
| cosine_accuracy@10 | 0.4195 |
| cosine_precision@1 | 0.2576 |
| cosine_precision@3 | 0.1126 |
| cosine_precision@5 | 0.0743 |
| cosine_precision@10 | 0.042 |
| cosine_recall@1 | 0.2576 |
| cosine_recall@3 | 0.3379 |
| cosine_recall@5 | 0.3717 |
| cosine_recall@10 | 0.4195 |
| cosine_ndcg@10 | 0.3339 |
| cosine_mrr@10 | 0.3071 |
| **cosine_map@100** | **0.3134** |
#### Information Retrieval
* Dataset: `dim_128`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:-----------|
| cosine_accuracy@1 | 0.2449 |
| cosine_accuracy@3 | 0.3219 |
| cosine_accuracy@5 | 0.3557 |
| cosine_accuracy@10 | 0.4029 |
| cosine_precision@1 | 0.2449 |
| cosine_precision@3 | 0.1073 |
| cosine_precision@5 | 0.0711 |
| cosine_precision@10 | 0.0403 |
| cosine_recall@1 | 0.2449 |
| cosine_recall@3 | 0.3219 |
| cosine_recall@5 | 0.3557 |
| cosine_recall@10 | 0.4029 |
| cosine_ndcg@10 | 0.3191 |
| cosine_mrr@10 | 0.2929 |
| **cosine_map@100** | **0.2992** |
#### Information Retrieval
* Dataset: `dim_64`
* Evaluated with [InformationRetrievalEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
| Metric | Value |
|:--------------------|:----------|
| cosine_accuracy@1 | 0.2194 |
| cosine_accuracy@3 | 0.2918 |
| cosine_accuracy@5 | 0.3235 |
| cosine_accuracy@10 | 0.3699 |
| cosine_precision@1 | 0.2194 |
| cosine_precision@3 | 0.0973 |
| cosine_precision@5 | 0.0647 |
| cosine_precision@10 | 0.037 |
| cosine_recall@1 | 0.2194 |
| cosine_recall@3 | 0.2918 |
| cosine_recall@5 | 0.3235 |
| cosine_recall@10 | 0.3699 |
| cosine_ndcg@10 | 0.2897 |
| cosine_mrr@10 | 0.2647 |
| **cosine_map@100** | **0.271** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 282,883 training samples
* Columns: positive
and anchor
* Approximate statistics based on the first 1000 samples:
| | positive | anchor |
|:--------|:---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
| type | string | string |
| details |
Alingoja mtu huyo mwingine arudi.
| Ca'daan alingoja hadi alasiri yote mtu huyo atoke tena.
|
| Sheria hiyo huanzisha mfululizo wa ukaguzi wa majaribio.
| Sheria hiyo pia inatoa sheria ya kudhibiti kwa ajili ya mashirika fulani ambayo yanahitaji kuandaa taarifa za kifedha za mashirika yote na kuzisimamisha kwa wakaguzi wa jumla.
|
| Mbwa anakimbia na kuruka nje.
| Mbwa mwenye rangi ya kahawia anaruka na kukimbia shambani.
|
* Loss: [MatryoshkaLoss
](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
```json
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: epoch
- `per_device_train_batch_size`: 32
- `per_device_eval_batch_size`: 16
- `gradient_accumulation_steps`: 16
- `learning_rate`: 2e-05
- `num_train_epochs`: 4
- `lr_scheduler_type`: cosine
- `warmup_ratio`: 0.1
- `bf16`: True
- `tf32`: True
- `load_best_model_at_end`: True
- `optim`: adamw_torch_fused
- `batch_sampler`: no_duplicates
#### All Hyperparameters