CoolFace
Modelpublic

Master-thesis-NAP/ModernBERT-DAPT-Embed-DAPT-Math

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes101downloads
Model Card

ModernBERT DAPT Embed DAPT Math

This is a sentence-transformers model finetuned from Master-thesis-NAP/ModernBert-DAPT-math. 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: Master-thesis-NAP/ModernBert-DAPT-math <!-- at revision a30384f91d764c272e6b740c256d5581325ea4bb -->
  • Maximum Sequence Length: 8192 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown -->
  • Language: en
  • License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: 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:

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("Master-thesis-NAP/ModernBERT-DAPT-Embed-DAPT-Math")
# Run inference
sentences = [
    "Does Werner-Young's inequality imply that the convolution of two $L^p$ spaces is always $L^r$ for $1 < r < \\infty$?",
    "[Werner-Young's inequality]\\label{Young op-op}\nSuppose $S\\in \\cS^p$ and $T\\in \\cS^q$ with $1+r^{-1}=p^{-1}+q^{-1}$.\nThen $S\\star T\\in L^r(\\R^{2d})$ and\n\\begin{align*}\n    \\|S\\star T\\|_{L^{r}}\\leq \\|S\\|_{\\cS^p}\\|T\\|_{\\cS^q}.\n\\end{align*}",
    '$\\cE^{(0)}_{p,\\alpha}$ satisfies the second Beurling-Deny criterion.  If $1 < p_- \\leq p_+ < \\infty$, it is reflexive and satisfies the $\\Delta_2$-condition.  \n %',
]
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]

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

Evaluation

Metrics

Information Retrieval
MetricValue
cosine_accuracy@10.568
cosine_accuracy@30.6324
cosine_accuracy@50.6586
cosine_accuracy@100.6938
cosine_precision@10.568
cosine_precision@30.3649
cosine_precision@50.2774
cosine_precision@100.1819
cosine_recall@10.0265
cosine_recall@30.0487
cosine_recall@50.0599
cosine_recall@100.0752
cosine_ndcg@100.2532
cosine_mrr@100.607
cosine_map@1000.0742

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • Size: 79,876 training samples
  • Columns: <code>anchor</code>, <code>positive</code>, and <code>negative</code>
  • Approximate statistics based on the first 1000 samples: | | anchor | positive | negative | |:--------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 9 tokens</li><li>mean: 38.48 tokens</li><li>max: 142 tokens</li></ul> | <ul><li>min: 5 tokens</li><li>mean: 210.43 tokens</li><li>max: 924 tokens</li></ul> | <ul><li>min: 14 tokens</li><li>mean: 91.02 tokens</li><li>max: 481 tokens</li></ul> |
  • Samples: | anchor | positive | negative | |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>What is the limit of the proportion of 1's in the sequence $an$ as $n$ approaches infinity, given that $0 \leq 3gn -2n \leq 4$?</code> | <code>Let $gn$ be the number of $1$'s in the sequence $a1 a2 \cdots an$.<br>Then <br>\begin{equation}<br>0 \leq 3gn -2n \leq 4<br>\label{star}<br>\end{equation}<br>for all $n$, and hence<br>$\lim{n \rightarrow \infty} gn/n = 2/3$.<br>\label{thm1}</code> | <code>\label{thm:boundsinitial}<br> Let $\seqq{s}$ be a sequence of rank $r$ for which the roots of the characteristic polynomial are all different. Then, for any positive integer $M$, the rank of $\seq{s^M}$ is at most<br> \begin{align}<br> \rank s^M \leq \binom{M+r-1}{M}.<br> \end{align}</code> | | <code>Does the statement of \textbf{ThmConjAreTrue} imply that the maximum genus of a locally Cohen-Macaulay curve in $\mathbb{P}^3{\mathbb{C}}$ of degree $d$ that does not lie on a surface of degree $s-1$ is always equal to $g(d,s)$?</code> | <code>\label{ThmConjAreTrue}<br>Conjectures \ref{Conj1} and \ref{Conj2} are true.<br>As a consequence, <br>if either $d=s \geq 1$ or $d \geq 2s+1 \geq 3$, <br>the maximum genus of a locally Cohen-Macaulay curve in $\mathbb{P}^3{\mathbb{C}}$ of degree $d$ that does not lie on a surface of degree $s-1$ is equal to $g(d,s)$.</code> | <code>[{\cite[Corollary 2.2.2 with $p=3$]{BSY}}]<br> Let $S$ be a non-trivial Severi-Brauer surface over a perfect field $\textbf{k}$. Then $S$ does not contain points of degree $d$, where $d$ is not divisible by $3$. On the other hand $S$ contains a point of degree $3$.</code> | | <code>\\emph{Is the statement \emph{If $X$ is a compact Hausdorff space, then $X$ is normal}, proven in the first isomorphism theorem for topological groups, or is it a well-known result in topology?}</code> | <code>}<br>\newcommand{\ep}{</code> | <code>\label{prop:coherence}<br> If $X$ is a qcqs scheme, then $RX$ is coherent in the sense that the set of quasi-compact open subsets of $RX$ is closed under finite intersections and forms a basis for the topology of $RX$.</code> |
  • Loss: <code>TripletLoss</code> with these parameters:
json
  {
      "distance_metric": "TripletDistanceMetric.COSINE",
      "triplet_margin": 0.1
  }

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: epoch
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 16
  • gradient_accumulation_steps: 8
  • 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: adamwtorchfused
  • batch_sampler: no_duplicates
All Hyperparameters

<details><summary>Click to expand</summary>

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • 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: 8
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-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: 4
  • max_steps: -1
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • 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: True
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: True
  • 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: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • tp_size: 0
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamwtorchfused
  • 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: no_duplicates
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

<details><summary>Click to expand</summary>

EpochStepTraining LossTESTING_cosine_ndcg@10
0.0160101.1162-
0.0320201.0465-
0.0481300.9663-
0.0641400.8758-
0.0801500.8215-
0.0961600.7492-
0.1122700.6356-
0.1282800.3573-
0.1442900.166-
0.16021000.0797-
0.17621100.046-
0.19231200.0419-
0.20831300.025-
0.22431400.0233-
0.24031500.0205-
0.25641600.0142-
0.27241700.017-
0.28841800.0157-
0.30441900.0104-
0.32042000.0126-
0.33652100.019-
0.35252200.0153-
0.36852300.0171-
0.38452400.0124-
0.40062500.01-
0.41662600.0071-
0.43262700.0125-
0.44862800.0096-
0.46472900.0092-
0.48073000.0067-
0.49673100.0069-
0.51273200.0054-
0.52873300.0107-
0.54483400.0115-
0.56083500.0083-
0.57683600.0175-
0.59283700.0162-
0.60893800.0094-
0.62493900.0124-
0.64094000.0078-
0.65694100.014-
0.67294200.0117-
0.68904300.0097-
0.70504400.0094-
0.72104500.0077-
0.73704600.0103-
0.75314700.0099-
0.76914800.0123-
0.78514900.0103-
0.80115000.0098-
0.81715100.0059-
0.83325200.0031-
0.84925300.0075-
0.86525400.0101-
0.88125500.0099-
0.89735600.0098-
0.91335700.0072-
0.92935800.0057-
0.94535900.0074-
0.96136000.0038-
0.97746100.0127-
0.99346200.0098-
1.0625-0.2532
1.00806300.0064-
1.02406400.0066-
1.04016500.0056-
1.05616600.0031-
1.07216700.0023-
1.08816800.0032-
1.10416900.0021-
1.12027000.0011-
1.13627100.006-
1.15227200.0045-
1.16827300.0041-
1.18437400.0026-
1.20037500.0019-
1.21637600.0058-
1.23237700.0054-
1.24837800.0066-
1.26447900.0033-
1.28048000.004-
1.29648100.0028-
1.31248200.0027-
1.32858300.0017-
1.34458400.0009-
1.36058500.0048-
1.37658600.0037-
1.39258700.0045-
1.40868800.0043-
1.42468900.0046-
1.44069000.0023-
1.45669100.0031-
1.47279200.0027-
1.48879300.0022-
1.50479400.0042-
1.52079500.0026-
1.53689600.0049-
1.55289700.0024-
1.56889800.0019-
1.58489900.0038-
1.600810000.0036-
1.616910100.0023-
1.632910200.0021-
1.648910300.0011-
1.664910400.0025-
1.681010500.0026-
1.697010600.0034-
1.713010700.0024-
1.729010800.0038-
1.745010900.002-
1.761111000.0046-
1.777111100.0003-
1.793111200.0062-
1.809111300.0057-
1.825211400.0012-
1.841211500.0021-
1.857211600.0038-
1.873211700.0024-
1.889211800.0026-
1.905311900.0034-
1.921312000.0064-
1.937312100.0041-
1.953312200.0032-
1.969412300.0028-
1.985412400.0009-
2.012500.00420.2488
2.016012600.0005-
2.032012700.0018-
2.048112800.0009-
2.064112900.001-
2.080113000.0024-
2.096113100.0011-
2.112213200.0008-
2.128213300.0001-
2.144213400.0006-
2.160213500.0005-
2.176213600.0003-
2.192313700.0-
2.208313800.0-
2.224313900.0001-
2.240314000.0001-
2.256414100.0027-
2.272414200.0005-
2.288414300.0007-
2.304414400.0001-
2.320414500.0002-
2.336514600.001-
2.352514700.0003-
2.368514800.001-
2.384514900.0-
2.400615000.0006-
2.416615100.0007-
2.432615200.0007-
2.448615300.0004-
2.464715400.0007-
2.480715500.0012-
2.496715600.0015-
2.512715700.0014-
2.528715800.0005-
2.544815900.0005-
2.560816000.0014-
2.576816100.0016-
2.592816200.0-
2.608916300.0002-
2.624916400.0006-
2.640916500.0002-
2.656916600.0003-
2.672916700.0007-
2.689016800.0005-
2.705016900.0007-
2.721017000.0-
2.737017100.0008-
2.753117200.0019-
2.769117300.0017-
2.785117400.0002-
2.801117500.0002-
2.817117600.0002-
2.833217700.0014-
2.849217800.0005-
2.865217900.0021-
2.881218000.002-
2.897318100.0021-
2.913318200.0007-
2.929318300.0-
2.945318400.0011-
2.961318500.0006-
2.977418600.0008-
2.993418700.0001-
3.01875-0.2516
3.008018800.0033-
3.024018900.0-
3.040119000.0-
3.056119100.0009-
3.072119200.0001-
3.088119300.001-
3.104119400.0001-
3.120219500.0001-
3.136219600.0-
3.152219700.0003-
3.168219800.0001-
3.184319900.0005-
3.200320000.0-
3.216320100.0-
3.232320200.0-
3.248320300.0-
3.264420400.0-
3.280420500.0-
3.296420600.0001-
3.312420700.0001-
3.328520800.0-
3.344520900.0001-
3.360521000.0-
3.376521100.0005-
3.392521200.0001-
3.408621300.0-
3.424621400.0-
3.440621500.0004-
3.456621600.0005-
3.472721700.0-
3.488721800.0006-
3.504721900.0002-
3.520722000.0007-
3.536822100.0-
3.552822200.0-
3.568822300.0008-
3.584822400.0001-
3.600822500.0013-
3.616922600.0004-
3.632922700.0006-
3.648922800.0001-
3.664922900.0-
3.681023000.0011-
3.697023100.0005-
3.713023200.0-
3.729023300.0-
3.745023400.0006-
3.761123500.0-
3.777123600.0002-
3.793123700.0006-
3.809123800.0002-
3.825223900.0004-
3.841224000.0-
3.857224100.0007-
3.873224200.0006-
3.889224300.0002-
3.905324400.0009-
3.921324500.0009-
3.937324600.0-
3.953324700.0001-
3.969424800.0012-
3.985424900.0003-
3.99502496-0.2524
-1-1-0.2532
  • The bold row denotes the saved checkpoint. </details>

Framework Versions

  • Python: 3.11.12
  • Sentence Transformers: 4.1.0
  • Transformers: 4.51.3
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.6.0
  • Datasets: 2.14.4
  • Tokenizers: 0.21.1

Citation

BibTeX

Sentence Transformers
bibtex
@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",
}
TripletLoss
bibtex
@misc{hermans2017defense,
    title={In Defense of the Triplet Loss for Person Re-Identification},
    author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
    year={2017},
    eprint={1703.07737},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->