MoritzLaurer/ModernBERT-base-zeroshot-v2.0

Model

ModernBERT-base-zeroshot-v2.0

19

9 commits

1 linked in READMEs

updated Jan 24, 2025

See the code
endpoints_compatible
generated_from_trainer
modernbert
onnx
safetensors
text-classification
text-embeddings-inference
transformers

README

ModernBERT-base-zeroshot-v2.0

Model description

This model is answerdotai/ModernBERT-base fine-tuned on the same dataset mix as the zeroshot-v2.0 models in the Zeroshot Classifiers Collection.

General takeaways:

  • The model is very fast and memory efficient. It's multiple times faster and consumes multiple times less memory than DeBERTav3. The memory efficiency enables larger batch sizes. I got a ~2x speed increase by enabling bf16 (instead of fp16).
  • It performs slightly worse then DeBERTav3 on average on the tasks tested below.
  • I'm in the process of preparing a newer version trained on better synthetic data to make full use of the 8k context window and to update the training mix of the older zeroshot-v2.0 models.

Training results

Per-dataset breakdown:

DatasetsMeanMean w/o NLImnli_mmnli_mmfevernlianli_r1anli_r2anli_r3wanlilingnliwellformedqueryrottentomatoesamazonpolarityimdbyelpreviewshatexplainmassivebanking77emotiondairemocontextempatheticagnewsyahootopicsbiasframes_sexbiasframes_offensivebiasframes_intentfinancialphrasebankappreviewshateoffensivetrueteacherspamwikitoxic_toxicaggregatedwikitoxic_obscenewikitoxic_identityhatewikitoxic_threatwikitoxic_insultmanifestocapsotu
Accuracy0.8310.8350.9320.9360.8840.7630.6470.6570.8230.8890.7530.8640.9490.9350.9740.7980.7880.7270.7890.7930.4890.8930.7170.9270.8510.8590.9070.9520.9260.7260.9780.9120.9140.930.9510.9060.4760.708
F1 macro0.8130.8180.9250.930.8720.740.610.6110.810.8740.7510.8640.9490.9350.9740.7510.7380.7460.7330.7980.4750.8930.7120.9190.8510.8590.8920.9520.8470.7210.9660.9120.9140.930.9420.9060.3290.637
Inference text/sec (A100 40GB GPU, batch=128)3472.03474.02338.04416.02993.02959.02904.03003.04647.04486.05032.04354.02466.01140.01582.04392.05446.05296.04904.04787.02251.04042.01884.04048.04032.04121.04275.03746.04485.01114.04322.02260.02274.02189.02085.02410.03933.04388.0

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 32
  • eval_batch_size: 128
  • seed: 42
  • optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_ratio: 0.06
  • num_epochs: 2

Framework versions

  • Transformers 4.48.0.dev0
  • Pytorch 2.5.1+cu124
  • Datasets 3.2.0
  • Tokenizers 0.21.0

Contributors

MoritzLaurer

7 commits

tomaarsen

1 commits

Xenova

1 commits

MoritzLaurer/ModernBERT-base-zeroshot-v2.0

Model

ModernBERT-base-zeroshot-v2.0

19

9 commits

1 linked in READMEs

updated Jan 24, 2025

See the code
endpoints_compatible
generated_from_trainer
modernbert
onnx
safetensors
text-classification
text-embeddings-inference
transformers

README

ModernBERT-base-zeroshot-v2.0

Model description

This model is answerdotai/ModernBERT-base fine-tuned on the same dataset mix as the zeroshot-v2.0 models in the Zeroshot Classifiers Collection.

General takeaways:

  • The model is very fast and memory efficient. It's multiple times faster and consumes multiple times less memory than DeBERTav3. The memory efficiency enables larger batch sizes. I got a ~2x speed increase by enabling bf16 (instead of fp16).
  • It performs slightly worse then DeBERTav3 on average on the tasks tested below.
  • I'm in the process of preparing a newer version trained on better synthetic data to make full use of the 8k context window and to update the training mix of the older zeroshot-v2.0 models.

Training results

Per-dataset breakdown:

DatasetsMeanMean w/o NLImnli_mmnli_mmfevernlianli_r1anli_r2anli_r3wanlilingnliwellformedqueryrottentomatoesamazonpolarityimdbyelpreviewshatexplainmassivebanking77emotiondairemocontextempatheticagnewsyahootopicsbiasframes_sexbiasframes_offensivebiasframes_intentfinancialphrasebankappreviewshateoffensivetrueteacherspamwikitoxic_toxicaggregatedwikitoxic_obscenewikitoxic_identityhatewikitoxic_threatwikitoxic_insultmanifestocapsotu
Accuracy0.8310.8350.9320.9360.8840.7630.6470.6570.8230.8890.7530.8640.9490.9350.9740.7980.7880.7270.7890.7930.4890.8930.7170.9270.8510.8590.9070.9520.9260.7260.9780.9120.9140.930.9510.9060.4760.708
F1 macro0.8130.8180.9250.930.8720.740.610.6110.810.8740.7510.8640.9490.9350.9740.7510.7380.7460.7330.7980.4750.8930.7120.9190.8510.8590.8920.9520.8470.7210.9660.9120.9140.930.9420.9060.3290.637
Inference text/sec (A100 40GB GPU, batch=128)3472.03474.02338.04416.02993.02959.02904.03003.04647.04486.05032.04354.02466.01140.01582.04392.05446.05296.04904.04787.02251.04042.01884.04048.04032.04121.04275.03746.04485.01114.04322.02260.02274.02189.02085.02410.03933.04388.0

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 32
  • eval_batch_size: 128
  • seed: 42
  • optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_ratio: 0.06
  • num_epochs: 2

Framework versions

  • Transformers 4.48.0.dev0
  • Pytorch 2.5.1+cu124
  • Datasets 3.2.0
  • Tokenizers 0.21.0

Contributors

MoritzLaurer

7 commits

tomaarsen

1 commits

Xenova

1 commits