ModernBERT Embed base Akryl Matryoshka
This is a sentence-transformers model finetuned from nomic-ai/modernbert-embed-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: nomic-ai/modernbert-embed-base
- Maximum Sequence Length: 8192 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Language: en
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'ModernBertModel'})
(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("Akryl/modernbert-embed-base-akryl-matryoshka")
# Run inference
queries = [
"\u003c1-hop\u003e\n\n4.2.6 PDM SACCO Operations\n\uf0b7 A loan applicant must be a member of a registered subsistence household on the PDMIS, be a member of a PDM Enterprise Group that is a member of the PDM SACCO.\n\uf0b7 All beneficiaries should be members of a registered subsistence household on the Parish Development Management Information System (applies before 5th June 2023).\n\uf0b7 Subsistence households applying to access PRF should be determined and selected at village level through a vetting meeting convened by the enterprise groups and attended by LC1 Chairpersons (applies after 5th June 2023).\n\uf0b7 For farming enterprises, the borrower must obtain an agriculture insurance policy under the Uganda Agriculture Insurance Scheme (UAIS).\nI made the following observations;\n1., Activity = Selection and Implementation of Prioritized/Flagship Projects. 1., Observations = \uf0b7 All the 10 parishes did not flagship contrary to guidelines. \uf0b7 All the 10 parishes selected projects that were inconsistent the LG priority commodities. \uf0b7 11 out of farmer enterprises/house holds implemented projects that are. 1., Management Response = select projects the flagship with selected 20 that sensitizations utilization of projects by various fora Beneficiaries advised to experiences Frequent beneficiaries encouraged operate.. 1., Management Response = The Accounting Officer explained on proper PRF on prioritized all stakeholders at is ongoing. of PRF have been conduct monthly meetings for members to share and challenges. visits among of PRF are also like the way VSL. 2., Activity = Insurance Policy for Farming Enterprises.. 2., Observations = Appendix 5 (g) I noted that all the 11 PRF beneficiaries who carried out farming enterprises in 8 PDM SACCOs did not obtain agricultural insurance policies from UAIS. Refer to Appendix. 2., Management Response = The Accounting Officer explained that since the selected households have received enterprises will obtain agricultural policies from guidelines put in place.. 2., Management Response = PRF, farming be mobilised to insurance UAIS per the",
]
documents = [
'What are the requirements for subsistence households to access PRF, and how does the insurance policy requirement for farming enterprises relate to these conditions?',
'How do the financial figures for net assets and cash balances compare between the years ending 30 June 2017 and 30 June 2021, and what trends can be observed in the financial statements during this period?',
'What is the management responsibility and role of the Accounting Officer in preparing financial statements for Kalungu District Local Government?',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.7440, 0.3670, 0.5151]])
Evaluation
Metrics
Information Retrieval
- Dataset:
dim_768 - Evaluated with
InformationRetrievalEvaluatorwith these parameters:{ "truncate_dim": 768 }
| Metric | Value |
|---|---|
| cosine_accuracy@3 | 0.6585 |
| cosine_accuracy@5 | 0.7317 |
| cosine_accuracy@7 | 0.8537 |
| cosine_precision@3 | 0.2195 |
| cosine_precision@5 | 0.1463 |
| cosine_precision@7 | 0.122 |
| cosine_recall@3 | 0.6098 |
| cosine_recall@5 | 0.6829 |
| cosine_recall@7 | 0.8049 |
| cosine_ndcg@3 | 0.4949 |
| cosine_ndcg@5 | 0.5254 |
| cosine_ndcg@7 | 0.5671 |
| cosine_mrr@10 | 0.5102 |
| cosine_map@100 | 0.4906 |
Information Retrieval
- Dataset:
dim_512 - Evaluated with
InformationRetrievalEvaluatorwith these parameters:{ "truncate_dim": 512 }
| Metric | Value |
|---|---|
| cosine_accuracy@3 | 0.6341 |
| cosine_accuracy@5 | 0.7805 |
| cosine_accuracy@7 | 0.8537 |
| cosine_precision@3 | 0.2114 |
| cosine_precision@5 | 0.1561 |
| cosine_precision@7 | 0.122 |
| cosine_recall@3 | 0.5854 |
| cosine_recall@5 | 0.7317 |
| cosine_recall@7 | 0.8049 |
| cosine_ndcg@3 | 0.5047 |
| cosine_ndcg@5 | 0.5645 |
| cosine_ndcg@7 | 0.5889 |
| cosine_mrr@10 | 0.5474 |
| cosine_map@100 | 0.5138 |
Information Retrieval
- Dataset:
dim_256 - Evaluated with
InformationRetrievalEvaluatorwith these parameters:{ "truncate_dim": 256 }
| Metric | Value |
|---|---|
| cosine_accuracy@3 | 0.6829 |
| cosine_accuracy@5 | 0.7805 |
| cosine_accuracy@7 | 0.8537 |
| cosine_precision@3 | 0.2276 |
| cosine_precision@5 | 0.1561 |
| cosine_precision@7 | 0.122 |
| cosine_recall@3 | 0.6341 |
| cosine_recall@5 | 0.7317 |
| cosine_recall@7 | 0.8049 |
| cosine_ndcg@3 | 0.4859 |
| cosine_ndcg@5 | 0.5279 |
| cosine_ndcg@7 | 0.5529 |
| cosine_mrr@10 | 0.4897 |
| cosine_map@100 | 0.4687 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 402 training samples
- Columns:
textandquestion - Approximate statistics based on the first 402 samples:
text question type string string details - min: 39 tokens
- mean: 279.24 tokens
- max: 698 tokens
- min: 8 tokens
- mean: 28.59 tokens
- max: 76 tokens
- Samples:
text question <2-hop>
4.1.1 Positive observations
I noted the following areas where management had commendable performance;
The water grant was incorporated into the entity's budget which was approved by Parliament/Council for release and implementation.
I noted that 6 out of 6 (100%) of the budgeted projects were provided for in the approved five-year development plan.
All the projects implemented were eligible.
There was an agreement between the land owners and the community members to protect government's rights to ownership of the land where the project is being constructed.
11How were fund management and budget approval handled in the Education Development grant projects?Auditor's Responsibilities for the audit of the Financial Statements
From the matters communicated with the Accounting Officer, I determine those matters that were of most significance in the audit of the financial statements of the current period and are therefore the key audit matters. I describe these matters in my auditor's report unless law or regulation precludes public disclosure about the matter or when, in extremely rare circumstances, I determine that a matter should not be communicated in my report because the adverse consequences of doing so would reasonably be expected to outweigh the public interest benefits of such communication.What are the auditor's responsibilities regarding financial statements?<1-hop>
Auditor's Responsibilities for the audit of the Financial Statements
My objectives are to obtain reasonable assurance about whether the financial statements as a whole are free from material misstatement, whether due to fraud or error, and to issue an auditor's report that includes my opinion. Reasonable assurance is a high level of assurance but is not a guarantee that an audit conducted in accordance with ISSAIs will always detect a material misstatement, when it exists. Misstatements can arise from fraud or error and are considered material if, individually or in aggregate, they could reasonably be expected to influence the economic decisions of users, taken on the basis of these financial statements.
As part of an audit in accordance with ISSAIs, I exercise professional judgment and maintain professional skepticism throughout the audit. I also:
Identify and assess the risks of material misstatement of the financial statements, whether due to fraud ...What are the key responsibilities of an auditor in ensuring financial statements are free from material misstatement? - Loss:
MatryoshkaLosswith these parameters:{ "loss": "MultipleNegativesRankingLoss", "matryoshka_dims": [ 768, 512, 256 ], "matryoshka_weights": [ 1, 1, 1 ], "n_dims_per_step": -1 }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: epochper_device_eval_batch_size: 16gradient_accumulation_steps: 64learning_rate: 2e-05num_train_epochs: 4lr_scheduler_type: cosinewarmup_ratio: 0.1bf16: Trueload_best_model_at_end: Truebatch_sampler: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 8per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 64eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 4max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Trueignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | dim_768_cosine_ndcg@7 | dim_512_cosine_ndcg@7 | dim_256_cosine_ndcg@7 |
|---|---|---|---|---|
| 1.0 | 1 | 0.5313 | 0.4963 | 0.5033 |
| 2.0 | 2 | 0.5533 | 0.5192 | 0.5376 |
| 3.0 | 3 | 0.5721 | 0.5729 | 0.5536 |
| 4.0 | 4 | 0.5671 | 0.5889 | 0.5529 |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.12.11
- Sentence Transformers: 5.1.0
- Transformers: 4.56.1
- PyTorch: 2.8.0+cu126
- Accelerate: 1.10.1
- Datasets: 4.1.0
- Tokenizers: 0.22.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",
}
MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
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
- 6
Model tree for Akryl/modernbert-embed-base-akryl-matryoshka
Base model
answerdotai/ModernBERT-base
Finetuned
nomic-ai/modernbert-embed-base
Space using Akryl/modernbert-embed-base-akryl-matryoshka 1
Evaluation results
- Cosine Accuracy@3 on dim 768self-reported0.659
- Cosine Accuracy@5 on dim 768self-reported0.732
- Cosine Accuracy@7 on dim 768self-reported0.854
- Cosine Precision@3 on dim 768self-reported0.220
- Cosine Precision@5 on dim 768self-reported0.146
- Cosine Precision@7 on dim 768self-reported0.122
- Cosine Recall@3 on dim 768self-reported0.610
- Cosine Recall@5 on dim 768self-reported0.683
- Cosine Recall@7 on dim 768self-reported0.805
- Cosine Ndcg@3 on dim 768self-reported0.495