HAV precision-optimised classifier v1
Browse files- README.md +57 -2
- config.json +86 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +21 -0
- training_args.bin +3 -0
README.md
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
base_model: "answerdotai/ModernBERT-base"
|
| 2 |
---
|
| 3 |
+
# HAV classifier (modernbert-base)
|
| 4 |
+
Binary: High Analytical Value (HAV) vs Low (LAV) for social posts. Precision-optimised (F0.5).
|
| 5 |
+
|
| 6 |
+
## Data preparation
|
| 7 |
+
Model has been trained on data with spam removed, spam posts could be classified as HAV. Not trained on tiktok data.
|
| 8 |
+
|
| 9 |
+
## Operating point
|
| 10 |
+
Apply a **decision threshold of 0.909** on `softmax(logits)[:, 1]`.
|
| 11 |
+
Do NOT use argmax@0.5 — this model is precision-tuned and 0.5 gives far lower precision.
|
| 12 |
+
|
| 13 |
+
## Metrics
|
| 14 |
+
"objective": {
|
| 15 |
+
"metric": "F0.5 (HAV)",
|
| 16 |
+
"beta": 0.5,
|
| 17 |
+
"min_hav_recall": 0.3,
|
| 18 |
+
"decision_threshold": 0.9099,
|
| 19 |
+
"val_selection": {
|
| 20 |
+
"threshold": 0.9099,
|
| 21 |
+
"hav_precision": 0.8238,
|
| 22 |
+
"hav_recall": 0.5035,
|
| 23 |
+
"nonhav_recall": 0.9753,
|
| 24 |
+
"fbeta": 0.7308,
|
| 25 |
+
"beta": 0.5
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"data": {
|
| 29 |
+
"train_rows": 10866,
|
| 30 |
+
"train_hav": 2033,
|
| 31 |
+
"eval_rows": 2366,
|
| 32 |
+
"eval_hav": 440
|
| 33 |
+
},
|
| 34 |
+
"test_overall": {
|
| 35 |
+
"accuracy": 0.8762,
|
| 36 |
+
"hav_f05": 0.6841,
|
| 37 |
+
"hav_f1": 0.5936,
|
| 38 |
+
"macro_f1": 0.7603,
|
| 39 |
+
"weighted_f1": 0.865,
|
| 40 |
+
"average_precision": 0.7163
|
| 41 |
+
},
|
| 42 |
+
"test_per_class": {
|
| 43 |
+
"non_HAV": {
|
| 44 |
+
"precision": 0.8916,
|
| 45 |
+
"recall": 0.9652,
|
| 46 |
+
"f1-score": 0.927,
|
| 47 |
+
"support": 1926.0
|
| 48 |
+
},
|
| 49 |
+
"HAV": {
|
| 50 |
+
"precision": 0.7616,
|
| 51 |
+
"recall": 0.4864,
|
| 52 |
+
"f1-score": 0.5936,
|
| 53 |
+
"support": 440.0
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
## Caveats
|
| 58 |
+
Misclassfied negative class still an issue. pos_weight=4.9, max_length=256.
|
config.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"ModernBertForSequenceClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 50281,
|
| 8 |
+
"classifier_activation": "gelu",
|
| 9 |
+
"classifier_bias": false,
|
| 10 |
+
"classifier_dropout": 0.2,
|
| 11 |
+
"classifier_pooling": "mean",
|
| 12 |
+
"cls_token_id": 50281,
|
| 13 |
+
"decoder_bias": true,
|
| 14 |
+
"deterministic_flash_attn": false,
|
| 15 |
+
"dtype": "float32",
|
| 16 |
+
"embedding_dropout": 0.0,
|
| 17 |
+
"eos_token_id": 50282,
|
| 18 |
+
"global_attn_every_n_layers": 3,
|
| 19 |
+
"gradient_checkpointing": false,
|
| 20 |
+
"hav_decision_threshold": 0.9099,
|
| 21 |
+
"hidden_activation": "gelu",
|
| 22 |
+
"hidden_size": 768,
|
| 23 |
+
"id2label": {
|
| 24 |
+
"0": "LAV",
|
| 25 |
+
"1": "HAV"
|
| 26 |
+
},
|
| 27 |
+
"initializer_cutoff_factor": 2.0,
|
| 28 |
+
"initializer_range": 0.02,
|
| 29 |
+
"intermediate_size": 1152,
|
| 30 |
+
"label2id": {
|
| 31 |
+
"HAV": 1,
|
| 32 |
+
"LAV": 0
|
| 33 |
+
},
|
| 34 |
+
"layer_norm_eps": 1e-05,
|
| 35 |
+
"layer_types": [
|
| 36 |
+
"full_attention",
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"full_attention"
|
| 58 |
+
],
|
| 59 |
+
"local_attention": 128,
|
| 60 |
+
"max_position_embeddings": 8192,
|
| 61 |
+
"mlp_bias": false,
|
| 62 |
+
"mlp_dropout": 0.0,
|
| 63 |
+
"model_type": "modernbert",
|
| 64 |
+
"norm_bias": false,
|
| 65 |
+
"norm_eps": 1e-05,
|
| 66 |
+
"num_attention_heads": 12,
|
| 67 |
+
"num_hidden_layers": 22,
|
| 68 |
+
"pad_token_id": 50283,
|
| 69 |
+
"position_embedding_type": "absolute",
|
| 70 |
+
"rope_parameters": {
|
| 71 |
+
"full_attention": {
|
| 72 |
+
"rope_theta": 160000.0,
|
| 73 |
+
"rope_type": "default"
|
| 74 |
+
},
|
| 75 |
+
"sliding_attention": {
|
| 76 |
+
"rope_theta": 10000.0,
|
| 77 |
+
"rope_type": "default"
|
| 78 |
+
}
|
| 79 |
+
},
|
| 80 |
+
"sep_token_id": 50282,
|
| 81 |
+
"sparse_pred_ignore_index": -100,
|
| 82 |
+
"sparse_prediction": false,
|
| 83 |
+
"tie_word_embeddings": true,
|
| 84 |
+
"transformers_version": "5.13.1",
|
| 85 |
+
"vocab_size": 50368
|
| 86 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc4da324431561cc7bcaf989c69cd4c47b4c57b1facc3edd36b6bffa7a4afdc3
|
| 3 |
+
size 598439784
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": true,
|
| 4 |
+
"cls_token": "[CLS]",
|
| 5 |
+
"is_local": true,
|
| 6 |
+
"local_files_only": false,
|
| 7 |
+
"mask_token": "[MASK]",
|
| 8 |
+
"max_length": 256,
|
| 9 |
+
"model_input_names": [
|
| 10 |
+
"input_ids",
|
| 11 |
+
"attention_mask"
|
| 12 |
+
],
|
| 13 |
+
"model_max_length": 8192,
|
| 14 |
+
"pad_token": "[PAD]",
|
| 15 |
+
"sep_token": "[SEP]",
|
| 16 |
+
"stride": 0,
|
| 17 |
+
"tokenizer_class": "TokenizersBackend",
|
| 18 |
+
"truncation_side": "right",
|
| 19 |
+
"truncation_strategy": "longest_first",
|
| 20 |
+
"unk_token": "[UNK]"
|
| 21 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:416ae22124784f4f272d80d9da6ff23451ec0a2f97ad3a2deb5093ddd3c6a7d4
|
| 3 |
+
size 5201
|