pveugen commited on
Commit
b926950
·
0 Parent(s):

toxic v0.1.0

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: desert-ant-labs-source-available-1.0
4
+ license_link: https://license.desertant.com/1.0
5
+ language:
6
+ - de
7
+ - en
8
+ - es
9
+ - fr
10
+ - it
11
+ - nl
12
+ - pl
13
+ - pt
14
+ tags:
15
+ - hate-speech
16
+ - content-moderation
17
+ - text-classification
18
+ - on-device
19
+ - litert
20
+ - tflite
21
+ - core-ml
22
+ - multilingual
23
+ pipeline_tag: text-classification
24
+ ---
25
+
26
+ # toxic: on-device multilingual hate-speech and abuse triage
27
+
28
+ An on-device multilingual hate-speech / abuse triage classifier: five content
29
+ heads (`HATEFUL`, `HARASSMENT`, `THREAT`, `SEXUAL`, `SELF_HARM`) plus
30
+ protected-group target heads, measured on eight EU languages (en, de, fr, nl,
31
+ pt, es, it, pl). The deployable model is **~66.7 MB** (4-bit Core ML on Apple,
32
+ 2.8 ms on an M3 Ultra Neural Engine) or **~75.5 MB** (int4 LiteRT `.tflite` on
33
+ Android, Linux and the web). Inference is 100% on-device: no network call,
34
+ ever.
35
+
36
+ **Triage, not verdict.** Outputs are escalation signals for human review or a
37
+ heavier local tier, not autonomous removal decisions. `SELF_HARM` and `THREAT`
38
+ are high-precision heads intended for resource routing with a human in the
39
+ loop. The failure modes below are published on purpose: read them before
40
+ wiring the model into any enforcement path.
41
+
42
+ ## Files
43
+
44
+ | File | Format | Size | Contents |
45
+ |---|---|---:|---|
46
+ | `toxic.tflite` | LiteRT / TFLite (int4 blockwise-32) | ~75.5 MB | Dynamic-range int4 (block-32 groups) + int8, fixed `[1, 128]` window; runs on Android, Linux and the web |
47
+ | `toxic.mlmodelc` | Compiled Core ML (4-bit) | ~66.7 MB | Palettized (grouped-channel encoder + per-tensor embedding), fp16 compute, ANE-resident; ready to load on Apple platforms |
48
+ | `toxic.mlpackage` | Core ML package (4-bit) | ~66.7 MB | Same model before `coremlcompiler`; recompile or inspect |
49
+ | `toxic.pt` | PyTorch state dict | ~531 MB | Full-precision reference weights (encoder + both heads) |
50
+ | `config.json` | JSON | tiny | Encoder + head config (base, labels, `max_len`, vocab size) |
51
+ | `tokenizer.json`, `tokenizer_config.json` | JSON | ~2.4 MB | EU-trimmed (60,728-piece) SentencePiece-Unigram tokenizer (XLM-R lineage) |
52
+ | `toxic_tokenizer.bin` | Binary | ~0.7 MB | Compact `RDTK` vocab (scores + pieces) for the portable SDK tokenizers |
53
+ | `labels.json` | JSON | tiny | `id2label` / `label2id` for both heads |
54
+ | `toxic_meta.json` | JSON | tiny | Version, languages, labels, default threshold and the per-language threshold menu |
55
+
56
+ ## Taxonomy
57
+
58
+ Two multi-label heads over one shared encoder. Text can fire several labels at
59
+ once; thresholds apply per label.
60
+
61
+ - **Content heads (5):** `HATEFUL` (scoped to the EU notion of illegal hate
62
+ speech: public incitement to violence or hatred against a protected group,
63
+ Framework Decision 2008/913/JHA), `HARASSMENT` (targeted insult / bullying
64
+ of an individual), `THREAT` (threat of violence), `SEXUAL` (sexual
65
+ harassment / unsolicited sexual aggression), `SELF_HARM` (self-harm /
66
+ suicide content, for resource routing).
67
+ - **Target heads (10):** the 2008/913/JHA protected grounds `RACE`, `COLOUR`,
68
+ `RELIGION`, `DESCENT`, `NATIONAL_ETHNIC_ORIGIN`, plus the extended grounds
69
+ `SEXUAL_ORIENTATION`, `GENDER`, `DISABILITY`, `AGE`, `OTHER`. Only
70
+ meaningful when `HATEFUL` fires; used for per-ground fairness reporting.
71
+
72
+ ## Architecture
73
+
74
+ - **Encoder:** XLM-R-base lineage (12 layers, hidden 768), vocabulary trimmed
75
+ from 250k to 60,728 pieces (~133M params), fine-tuned with focal BCE on the
76
+ two heads.
77
+ - **Static shapes:** fixed `[1, 128]` input, no dynamic control flow;
78
+ ANE-native reformulation for the Core ML export, dynamic-range quantization
79
+ for LiteRT.
80
+ - **Runtime:** tokenize off-graph (SentencePiece-Unigram, `tokenizer.json` or
81
+ `toxic_tokenizer.bin`), run the encoder, apply sigmoid per label, threshold
82
+ per the menu below. Default threshold **0.40**.
83
+
84
+ ## Measured quality (the shipped artifacts, not the checkpoint)
85
+
86
+ Every number below is the full Multilingual HateCheck scorer re-run on the
87
+ exact artifact in this repo, threshold 0.40. HateCheck is eval-only: it is
88
+ never trained on. Torch reference: 8-language mean macro-F1 **0.789**.
89
+
90
+ | platform | artifact | size | 8-lang macro-F1 | delta vs torch | latency (measured) |
91
+ | --- | --- | --: | --: | --: | --- |
92
+ | iOS / macOS (ANE) | `toxic.mlmodelc` | 66.7 MB | 0.776 | -0.013 | 2.82 ms median (M3 Ultra ANE); 12.6 ms CPU-only |
93
+ | Android / web | `toxic.tflite` | 75.5 MB | 0.786 | -0.003 | 8.1 ms median (8-thread desktop CPU, XNNPACK) |
94
+ | reference | `toxic.pt` | 531 MB | 0.789 | - | n/a |
95
+
96
+ Phone-class latency (iPhone 13/15, mid-range Android) is not yet measured;
97
+ the M3 Ultra figure bounds the graph cost.
98
+
99
+ Per language (threshold 0.40):
100
+
101
+ | lang | torch | `toxic.tflite` (int4-b32) | `toxic.mlmodelc` (int4) |
102
+ | --- | --: | --: | --: |
103
+ | en | 0.810 | 0.787 | 0.771 |
104
+ | de | 0.803 | 0.790 | 0.791 |
105
+ | fr | 0.824 | 0.816 | 0.798 |
106
+ | nl | 0.764 | 0.769 | 0.754 |
107
+ | pt | 0.791 | 0.800 | 0.785 |
108
+ | es | 0.796 | 0.799 | 0.786 |
109
+ | it | 0.775 | 0.776 | 0.771 |
110
+ | pl | 0.751 | 0.750 | 0.754 |
111
+ | mean | 0.789 | 0.786 | 0.776 |
112
+
113
+ ## Threshold menu (per-language operating points)
114
+
115
+ Measured on the torch reference (the vocabulary trim is quality-neutral).
116
+ `macro-F1` is the HateCheck 2-class macro; `FPR` is the false-positive rate on
117
+ non-hate cases, the number to watch if you fear over-blocking. Full sweep
118
+ tables (0.30 to 0.70) live in the training repo (`reports/RELEASE_sweep.md`).
119
+
120
+ | lang | tuned threshold | macro-F1 @ tuned | FPR @ tuned | macro-F1 @ 0.40 | FPR @ 0.40 |
121
+ | --- | --: | --: | --: | --: | --: |
122
+ | en | 0.40 | 0.810 | 0.281 | 0.810 | 0.281 |
123
+ | de | 0.55 | 0.822 | 0.254 | 0.803 | 0.359 |
124
+ | fr | 0.45 | 0.828 | 0.247 | 0.824 | 0.272 |
125
+ | nl | 0.55 | 0.768 | 0.238 | 0.764 | 0.298 |
126
+ | pt | 0.60 | 0.800 | 0.203 | 0.791 | 0.288 |
127
+ | es | 0.55 | 0.803 | 0.207 | 0.796 | 0.272 |
128
+ | it | 0.60 | 0.779 | 0.234 | 0.775 | 0.309 |
129
+ | pl | 0.30 | 0.759 | 0.305 | 0.751 | 0.271 |
130
+
131
+ Read: raising the threshold trades hate recall for a lower non-hate FPR. At
132
+ per-language tuned thresholds the 7-EU-language average is 0.794 and four
133
+ languages (de, fr, pt, es) clear 0.80. The same menu ships in
134
+ `toxic_meta.json`.
135
+
136
+ ## Measured competitors (same scorer, same suite, shipping quants)
137
+
138
+ Every runnable competitor was re-run through the identical HateCheck harness.
139
+ Generative guards are scored on their parsed safety verdict (Unsafe = hate);
140
+ their sizes are published Q4_K_M GGUF bytes, and their int4 quality is
141
+ measured (bitsandbytes nf4). 7-EU = mean macro-F1 over de, fr, nl, pt, es,
142
+ it, pl.
143
+
144
+ | system | on-disk size | 7-EU avg | en | notes |
145
+ | --- | --: | --: | --: | --- |
146
+ | toxic `toxic.tflite` (int4-b32) | 75.5 MB | 0.786 | 0.787 | this repo, measured artifact |
147
+ | toxic `toxic.mlmodelc` (int4) | 66.7 MB | 0.777 | 0.771 | this repo, measured artifact |
148
+ | Llama-Guard-3-1B (int4) | 955.4 MB | 0.633 | 0.794 | verdict parsing; bf16 en 0.814 |
149
+ | Qwen3Guard-Gen-0.6B (int4) | 484.2 MB | 0.622 | 0.750 | verdict parsing; bf16 en 0.770 |
150
+ | Detoxify multilingual (fp32, 278M) | ~280 MB | 0.487 | 0.642 | fixed th 0.5; collapses on de/nl/pl; int8 unmeasured |
151
+
152
+ toxic leads every EU language at a fraction of the size; Llama-Guard-3-1B
153
+ still leads on English (0.794 vs 0.787 at its 12.7x size).
154
+
155
+ ## Failure modes (read before deploying)
156
+
157
+ Publishing per-language, per-functionality error rates is part of the
158
+ product. Weakest HateCheck cells per language (accuracy on that cell,
159
+ flagship int8 artifact, threshold 0.40; `_nh` cells are non-hate whose error
160
+ is a false positive):
161
+
162
+ | lang | weakest cells (acc) |
163
+ | --- | --- |
164
+ | en | counter_ref_nh 0.51, negate_neg_nh 0.53, slur_reclaimed_nh 0.56, counter_quote_nh 0.63, slur_homonym_nh 0.63 |
165
+ | de | negate_neg_nh 0.39, ident_pos_nh 0.45, counter_ref_nh 0.48, slur_h 0.58 |
166
+ | fr | ident_neutral_nh 0.59, target_group_nh 0.63, ident_pos_nh 0.67, derog_impl_h 0.69 |
167
+ | nl | slur_h 0.41, ident_pos_nh 0.47, negate_neg_nh 0.52, phrase_question_h 0.58 |
168
+ | pt | ident_neutral_nh 0.48, target_group_nh 0.57, ident_pos_nh 0.62, slur_h 0.67 |
169
+ | es | ident_neutral_nh 0.52, target_group_nh 0.57, ident_pos_nh 0.66, target_obj_nh 0.68 |
170
+ | it | ident_pos_nh 0.52, ident_neutral_nh 0.53, target_group_nh 0.55, phrase_question_h 0.57 |
171
+ | pl | ident_pos_nh 0.41, slur_h 0.56, phrase_question_h 0.66, negate_neg_nh 0.67 |
172
+
173
+ The pattern: counter-speech, negated hate, reclaimed slurs and positive /
174
+ neutral identity mentions are the dominant false-positive sources in every
175
+ language; lexical slurs (`slur_h`) are the dominant miss in nl, de and pl.
176
+ If your application is FPR-sensitive, use the higher per-language thresholds
177
+ above and route positives to review instead of auto-actioning.
178
+
179
+ Quantization costs, measured on the shipped artifacts:
180
+
181
+ - **Core ML (iOS): palettization costs about 3 to 4 points on English.**
182
+ fp16 on the ANE is quality-neutral (en 0.811 vs torch 0.810); the shipped
183
+ 4-bit palettized model lands en 0.771 and 8-language 0.776 (-1.3pp mean vs
184
+ torch). English carries most of the palettization loss.
185
+ - **TFLite (Android / web): English pays -2.1pp for int4.** `toxic.tflite`
186
+ (int4 blockwise-32) scores en 0.787 vs 0.808 for the int8 build of the
187
+ same model; the 7-EU average is identical for both (0.786). If English
188
+ dominates your traffic and 59 MB matters less than 2pp, ask for the int8
189
+ build.
190
+ - Non-hate FPR at the 0.40 default runs 0.27 to 0.36 depending on language
191
+ (see the threshold menu for the FPR you actually opt into).
192
+
193
+ ## License
194
+
195
+ [Desert Ant Labs Source-Available License](https://license.desertant.com/1.0).
196
+ Free for most apps; a commercial license is required at scale. Full terms at
197
+ the link. Licensing: <licensing@desertant.com>.
198
+
199
+ Built exclusively from commercially clean components (CC0 / CC-BY / MIT /
200
+ Apache-2.0 training data, MIT base encoder). Attributions, dataset citations
201
+ (GAHD, Measuring Hate Speech, GermEval 2018, MLMA and others) and generator
202
+ credits are in `THIRD_PARTY_NOTICES.md`.
THIRD_PARTY_NOTICES.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Third-party notices: toxic
2
+
3
+ `toxic` is built for commercial use. It derives from the components below,
4
+ each used under a license that permits commercial use and derivative works.
5
+ Their license terms apply to those components; the attributions here satisfy
6
+ them. Evaluation suites are never trained on.
7
+
8
+ ## Base encoder
9
+
10
+ ### XLM-RoBERTa base (FacebookAI)
11
+ - [`FacebookAI/xlm-roberta-base`](https://huggingface.co/FacebookAI/xlm-roberta-base): **MIT**.
12
+ - Used as the encoder: vocabulary trimmed from 250k to 60,728 pieces,
13
+ fine-tuned for multi-label hate-speech / abuse classification.
14
+
15
+ ## Training datasets
16
+
17
+ - [`google/civil_comments`](https://huggingface.co/datasets/google/civil_comments)
18
+ (Civil Comments / Jigsaw Unintended Bias): **CC0-1.0** (public domain).
19
+ Courtesy citation: Borkan, Dixon, Sorensen, Thain, Vasserman, "Nuanced
20
+ Metrics for Measuring Unintended Bias with Real Data for Text
21
+ Classification", WWW 2019.
22
+ - [`ucberkeley-dlab/measuring-hate-speech`](https://huggingface.co/datasets/ucberkeley-dlab/measuring-hate-speech)
23
+ (Measuring Hate Speech, MHS): **CC-BY-4.0**. Attribution: D-Lab, UC
24
+ Berkeley. Citation: Kennedy, Bacon, Sahn, von Vacano, "Constructing
25
+ interval variables via faceted Rasch measurement and multitask deep
26
+ learning: a hate speech application", 2020.
27
+ - [GAHD (German Adversarial Hate speech Dataset)](https://github.com/jagol/gahd):
28
+ **CC-BY-4.0**. Citation: Goldzycher, Röttger, Schneider, "Improving
29
+ Adversarial Data Collection by Supporting Annotators: Lessons from GAHD, a
30
+ German Hate Speech Dataset", NAACL 2024.
31
+
32
+ ## Datasets used during development (earlier training iterations)
33
+
34
+ - [GermEval 2018](https://github.com/uds-lsv/GermEval-2018-Data): used under
35
+ the maintainers' citation terms. Required citation: Wiegand, Siegel,
36
+ Ruppenhofer, "Overview of the GermEval 2018 Shared Task on the
37
+ Identification of Offensive Language", Proceedings of GermEval 2018,
38
+ Vienna.
39
+ - [MLMA hate speech](https://huggingface.co/datasets/nedjmaou/MLMA_hate_speech):
40
+ **MIT**. Citation: Ousidhoum, Lin, Zhang, Song, Yeung, "Multilingual and
41
+ Multi-Aspect Hate Speech Analysis", EMNLP 2019.
42
+
43
+ ## Evaluation suites (eval only, never trained on)
44
+
45
+ - [HateCheck](https://github.com/paul-rottger/hatecheck-data): **CC-BY-4.0**.
46
+ Citation: Röttger, Vidgen, Nguyen, Waseem, Margetts, Pierrehumbert,
47
+ "HateCheck: Functional Tests for Hate Speech Detection Models", ACL 2021.
48
+ - [Multilingual HateCheck](https://huggingface.co/Paul/hatecheck): **CC-BY-4.0**.
49
+ Citation: Röttger, Seelawi, Nozza, Talat, Vidgen, "Multilingual HateCheck:
50
+ Functional Tests for Multilingual Hate Speech Detection Models", WOAH 2022.
51
+
52
+ ## Generator models (used to create synthetic training data)
53
+
54
+ - Gemma 4 family ([`google/gemma-4-E4B-it`](https://huggingface.co/google/gemma-4-E4B-it),
55
+ [`google/gemma-4-12B-it`](https://huggingface.co/google/gemma-4-12B-it)):
56
+ **Apache-2.0**. Outputs used as synthetic multilingual training text.
57
+ - xAI `grok-4.3` (API): outputs used as synthetic training text for the
58
+ severity-tail, adversarial and clean-side minimal-pair slices, under xAI's
59
+ commercial API terms.
60
+
61
+ No non-commercial or unlicensed datasets are used. None of the above datasets
62
+ are redistributed in this repository.
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base": "xlm-roberta-base",
3
+ "content_labels": [
4
+ "HATEFUL",
5
+ "HARASSMENT",
6
+ "THREAT",
7
+ "SEXUAL",
8
+ "SELF_HARM"
9
+ ],
10
+ "target_labels": [
11
+ "RACE",
12
+ "COLOUR",
13
+ "RELIGION",
14
+ "DESCENT",
15
+ "NATIONAL_ETHNIC_ORIGIN",
16
+ "SEXUAL_ORIENTATION",
17
+ "GENDER",
18
+ "DISABILITY",
19
+ "AGE",
20
+ "OTHER"
21
+ ],
22
+ "max_len": 128,
23
+ "dropout": 0.1,
24
+ "hidden_size": 768,
25
+ "num_layers": 12,
26
+ "char_dim": 0,
27
+ "grown_from": "",
28
+ "vocab_size": 60728,
29
+ "trimmed_from": "outputs/toxic_a1_s15/final"
30
+ }
labels.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "content": {
3
+ "id2label": {
4
+ "0": "HATEFUL",
5
+ "1": "HARASSMENT",
6
+ "2": "THREAT",
7
+ "3": "SEXUAL",
8
+ "4": "SELF_HARM"
9
+ },
10
+ "label2id": {
11
+ "HATEFUL": 0,
12
+ "HARASSMENT": 1,
13
+ "THREAT": 2,
14
+ "SEXUAL": 3,
15
+ "SELF_HARM": 4
16
+ }
17
+ },
18
+ "target": {
19
+ "id2label": {
20
+ "0": "RACE",
21
+ "1": "COLOUR",
22
+ "2": "RELIGION",
23
+ "3": "DESCENT",
24
+ "4": "NATIONAL_ETHNIC_ORIGIN",
25
+ "5": "SEXUAL_ORIENTATION",
26
+ "6": "GENDER",
27
+ "7": "DISABILITY",
28
+ "8": "AGE",
29
+ "9": "OTHER"
30
+ },
31
+ "label2id": {
32
+ "RACE": 0,
33
+ "COLOUR": 1,
34
+ "RELIGION": 2,
35
+ "DESCENT": 3,
36
+ "NATIONAL_ETHNIC_ORIGIN": 4,
37
+ "SEXUAL_ORIENTATION": 5,
38
+ "GENDER": 6,
39
+ "DISABILITY": 7,
40
+ "AGE": 8,
41
+ "OTHER": 9
42
+ }
43
+ }
44
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": true,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<s>",
5
+ "cls_token": "<s>",
6
+ "eos_token": "</s>",
7
+ "is_local": false,
8
+ "local_files_only": false,
9
+ "mask_token": "<mask>",
10
+ "model_max_length": 512,
11
+ "pad_token": "<pad>",
12
+ "sep_token": "</s>",
13
+ "tokenizer_class": "XLMRobertaTokenizer",
14
+ "unk_token": "<unk>"
15
+ }
toxic.mlmodelc/analytics/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7700a5ed6772387f89fc17b0c52559b3e8344eec91a0889ebf03623744ea6bad
3
+ size 243
toxic.mlmodelc/coremldata.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cca018426b4e953d028783919caf704e652605a2671ba7470d60d7fece19112a
3
+ size 441
toxic.mlmodelc/metadata.json ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "metadataOutputVersion" : "3.0",
4
+ "storagePrecision" : "Mixed (Float16, Palettized (11 bits), Palettized (4 bits), Palettized (9 bits), UInt4)",
5
+ "outputSchema" : [
6
+ {
7
+ "hasShapeFlexibility" : "0",
8
+ "isOptional" : "0",
9
+ "dataType" : "Float16",
10
+ "formattedType" : "MultiArray (Float16 1 × 5)",
11
+ "shortDescription" : "",
12
+ "shape" : "[1, 5]",
13
+ "name" : "content_logits",
14
+ "type" : "MultiArray"
15
+ },
16
+ {
17
+ "hasShapeFlexibility" : "0",
18
+ "isOptional" : "0",
19
+ "dataType" : "Float16",
20
+ "formattedType" : "MultiArray (Float16 1 × 10)",
21
+ "shortDescription" : "",
22
+ "shape" : "[1, 10]",
23
+ "name" : "target_logits",
24
+ "type" : "MultiArray"
25
+ }
26
+ ],
27
+ "modelParameters" : [
28
+
29
+ ],
30
+ "specificationVersion" : 9,
31
+ "mlProgramOperationTypeHistogram" : {
32
+ "Ios18.expandDims" : 3,
33
+ "Ios18.mul" : 2,
34
+ "Ios18.realDiv" : 1,
35
+ "Ios18.scaledDotProductAttention" : 12,
36
+ "Ios18.greaterEqual" : 2,
37
+ "Select" : 3,
38
+ "Tile" : 1,
39
+ "Ios18.gather" : 2,
40
+ "Ios18.add" : 29,
41
+ "Ios18.layerNorm" : 25,
42
+ "Ios16.reduceSum" : 2,
43
+ "Ios18.reshape" : 48,
44
+ "Ios18.constexprLutToDense" : 74,
45
+ "Ios18.linear" : 74,
46
+ "Ios18.gelu" : 12,
47
+ "Ios18.clip" : 1,
48
+ "Ios18.sub" : 1,
49
+ "Ios18.cast" : 5,
50
+ "Ios18.transpose" : 48,
51
+ "Ios18.notEqual" : 1,
52
+ "Ios16.cumsum" : 1
53
+ },
54
+ "computePrecision" : "Mixed (Float16, Int32, UInt16)",
55
+ "isUpdatable" : "0",
56
+ "stateSchema" : [
57
+
58
+ ],
59
+ "availability" : {
60
+ "macOS" : "15.0",
61
+ "tvOS" : "18.0",
62
+ "visionOS" : "2.0",
63
+ "watchOS" : "11.0",
64
+ "iOS" : "18.0",
65
+ "macCatalyst" : "18.0"
66
+ },
67
+ "modelType" : {
68
+ "name" : "MLModelType_mlProgram"
69
+ },
70
+ "userDefinedMetadata" : {
71
+ "com.github.apple.coremltools.conversion_date" : "2026-07-25",
72
+ "com.github.apple.coremltools.source" : "torch==2.9.1",
73
+ "com.github.apple.coremltools.version" : "9.0",
74
+ "com.github.apple.coremltools.source_dialect" : "TorchScript"
75
+ },
76
+ "inputSchema" : [
77
+ {
78
+ "hasShapeFlexibility" : "0",
79
+ "isOptional" : "0",
80
+ "dataType" : "Int32",
81
+ "formattedType" : "MultiArray (Int32 1 × 128)",
82
+ "shortDescription" : "",
83
+ "shape" : "[1, 128]",
84
+ "name" : "input_ids",
85
+ "type" : "MultiArray"
86
+ },
87
+ {
88
+ "hasShapeFlexibility" : "0",
89
+ "isOptional" : "0",
90
+ "dataType" : "Int32",
91
+ "formattedType" : "MultiArray (Int32 1 × 128)",
92
+ "shortDescription" : "",
93
+ "shape" : "[1, 128]",
94
+ "name" : "attention_mask",
95
+ "type" : "MultiArray"
96
+ }
97
+ ],
98
+ "generatedClassName" : "model_int4",
99
+ "method" : "predict"
100
+ }
101
+ ]
toxic.mlmodelc/model.mil ADDED
The diff for this file is too large to render. See raw diff
 
toxic.mlmodelc/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f0b2eb4409d268dcc793f557a57981f38ada83ecfd4f5ec753bf3fd59bf7027
3
+ size 66547284
toxic.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c344bf9a9e4dc4322f0c9deb2e7c014b36b11d45ef1dbacf653a5d4e3ffd7be
3
+ size 136131
toxic.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f0b2eb4409d268dcc793f557a57981f38ada83ecfd4f5ec753bf3fd59bf7027
3
+ size 66547284
toxic.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "A06F1835-64C2-4435-8E00-79E1F5ACFFEF": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "DACCA8AA-FAA6-41E6-9661-A334F8763AFB": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "A06F1835-64C2-4435-8E00-79E1F5ACFFEF"
18
+ }
toxic.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66b0aacd2d65e288b841214620480ee8570143ff0cecdb1a402e86c9bdb826c6
3
+ size 530824007
toxic.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5f64e3c8d3d7abedfcd6ed63ca422e4160ea113a0c38594bd6714647cc1a1d0
3
+ size 75475392
toxic_meta.json ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "0.1.0",
3
+ "languages": [
4
+ "de",
5
+ "en",
6
+ "es",
7
+ "fr",
8
+ "it",
9
+ "nl",
10
+ "pl",
11
+ "pt"
12
+ ],
13
+ "content_labels": [
14
+ "HATEFUL",
15
+ "HARASSMENT",
16
+ "THREAT",
17
+ "SEXUAL",
18
+ "SELF_HARM"
19
+ ],
20
+ "target_labels": [
21
+ "RACE",
22
+ "COLOUR",
23
+ "RELIGION",
24
+ "DESCENT",
25
+ "NATIONAL_ETHNIC_ORIGIN",
26
+ "SEXUAL_ORIENTATION",
27
+ "GENDER",
28
+ "DISABILITY",
29
+ "AGE",
30
+ "OTHER"
31
+ ],
32
+ "base_model": "FacebookAI/xlm-roberta-base",
33
+ "vocab_size": 60728,
34
+ "recommended": {
35
+ "threshold": 0.4,
36
+ "max_length": 128,
37
+ "per_language_thresholds": {
38
+ "en": 0.4,
39
+ "de": 0.55,
40
+ "fr": 0.45,
41
+ "nl": 0.55,
42
+ "pt": 0.6,
43
+ "es": 0.55,
44
+ "it": 0.6,
45
+ "pl": 0.3
46
+ }
47
+ },
48
+ "threshold_menu": {
49
+ "en": {
50
+ "tuned": {
51
+ "threshold": 0.4,
52
+ "macro_f1": 0.81,
53
+ "fpr": 0.281
54
+ },
55
+ "at_default": {
56
+ "threshold": 0.4,
57
+ "macro_f1": 0.81,
58
+ "fpr": 0.281
59
+ }
60
+ },
61
+ "de": {
62
+ "tuned": {
63
+ "threshold": 0.55,
64
+ "macro_f1": 0.822,
65
+ "fpr": 0.254
66
+ },
67
+ "at_default": {
68
+ "threshold": 0.4,
69
+ "macro_f1": 0.803,
70
+ "fpr": 0.359
71
+ }
72
+ },
73
+ "fr": {
74
+ "tuned": {
75
+ "threshold": 0.45,
76
+ "macro_f1": 0.828,
77
+ "fpr": 0.247
78
+ },
79
+ "at_default": {
80
+ "threshold": 0.4,
81
+ "macro_f1": 0.824,
82
+ "fpr": 0.272
83
+ }
84
+ },
85
+ "nl": {
86
+ "tuned": {
87
+ "threshold": 0.55,
88
+ "macro_f1": 0.768,
89
+ "fpr": 0.238
90
+ },
91
+ "at_default": {
92
+ "threshold": 0.4,
93
+ "macro_f1": 0.764,
94
+ "fpr": 0.298
95
+ }
96
+ },
97
+ "pt": {
98
+ "tuned": {
99
+ "threshold": 0.6,
100
+ "macro_f1": 0.8,
101
+ "fpr": 0.203
102
+ },
103
+ "at_default": {
104
+ "threshold": 0.4,
105
+ "macro_f1": 0.791,
106
+ "fpr": 0.288
107
+ }
108
+ },
109
+ "es": {
110
+ "tuned": {
111
+ "threshold": 0.55,
112
+ "macro_f1": 0.803,
113
+ "fpr": 0.207
114
+ },
115
+ "at_default": {
116
+ "threshold": 0.4,
117
+ "macro_f1": 0.796,
118
+ "fpr": 0.272
119
+ }
120
+ },
121
+ "it": {
122
+ "tuned": {
123
+ "threshold": 0.6,
124
+ "macro_f1": 0.779,
125
+ "fpr": 0.234
126
+ },
127
+ "at_default": {
128
+ "threshold": 0.4,
129
+ "macro_f1": 0.775,
130
+ "fpr": 0.309
131
+ }
132
+ },
133
+ "pl": {
134
+ "tuned": {
135
+ "threshold": 0.3,
136
+ "macro_f1": 0.759,
137
+ "fpr": 0.305
138
+ },
139
+ "at_default": {
140
+ "threshold": 0.4,
141
+ "macro_f1": 0.751,
142
+ "fpr": 0.271
143
+ }
144
+ }
145
+ }
146
+ }
toxic_tokenizer.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a1e9c02fb26535f9293704a3d9b8f0a1c5a8178ed0db807d9d7c07caed0ead0
3
+ size 772537