/ Модель

Характеристики

Контекст
512 токенов
Параметры
40 млн
Лицензия
Apache 2.0
Архитектура
bert · dense
Базовая модель
all-MiniLM-L12-v2
Библиотека
transformers
Опубликована
14 июл 2026

discord-moderation-minilm-l12

Классификация текстаТекст → label3 профессии

Компактный англоязычный классификатор для первичной модерации чатов, различающий обычные, оскорбительные, спамовые и флудовые сообщения.

24скачиваний за 30 дней0лайковвеса обновлены14 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

StrictlyInsecure разработала компактный англоязычный классификатор сообщений для модерации чатов. Модель основана на sentence-transformers/all-MiniLM-L12-v2 с классификационной головой на четыре класса: benign, abusive, spam и flood. В репозитории есть 33 МБ версия INT8 в формате ONNX и checkpoint safetensors; метаданные указывают 40 млн параметров, а карточка модели — контекст до 200 токенов. Лицензия — Apache-2.0.

Модель предназначена для быстрого первичного отбора сообщений в конвейере модерации, включая выявление оскорблений, токсичности, спама и флуда. Автор сообщает о задержке около 4,1 мс и показателях на собственном отложенном наборе: 3,9% ложных срабатываний и 2,2% пропущенных случаев злоупотреблений в близком к обучающим данным регистре. Эти результаты не переносятся на все типы чатов: на реальном игровом чате доли ошибок существенно выше. Оценки классов spam и flood основаны на синтетических шаблонах, а уклонение от фильтра синтетическими способами покрыто ограниченно. Модель рассчитана на роль фильтра первого прохода с последующей проверкой человеком или более сильной системой, а не на автоматические баны.

Сценарии применения

  • первичная проверка сообщений в Discord-подобных чатах
  • выявление оскорблений и токсичных сообщений на английском языке
  • фильтрация спама в потоке чата
  • обнаружение флуда для передачи модератору
  • отбор сообщений для последующей проверки человеком

Ограничения

На игровом чате автор сообщает о высоких долях ложных срабатываний и пропусков; модель не обучалась на реальных чат-логах. Оценки спама и флуда основаны на синтетических шаблонах, а покрытие обходных написаний ограничено; автор не рекомендует использовать модель как единственное основание для автоматических банов.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

discord-moderation-minilm-l12

A 33 MB INT8 ONNX classifier for chat moderation. This is the larger variant of a pair (numbers are in-domain, on held-out data the model never trained on — see Results):

sizelatencyfalse positivesmissed abuse
discord-moderation-minilm (L6)23 MB~1.9 ms2.7%3.5%
this model (L12)33 MB~4.1 ms3.9%2.2%

At the default threshold the two trade precision for recall: L6 flags fewer innocent messages, L12 misses less abuse. Pick L6 on a Raspberry Pi or at high volume; pick L12 for the lower miss rate. The threshold is a knob (see Thresholding) — compare them at a matched false-positive budget, not at the same raw cutoff.

Classesbenign · abusive · spam · flood
Basesentence-transformers/all-MiniLM-L12-v2 (33M params)
Context200 tokens

Why this exists

Most open toxicity classifiers have two problems for chat moderation:

  1. No spam or flood class. They're toxicity-only, so a pipeline has to bolt on a separate heuristic. This model predicts all four classes natively.
  2. They over-flag competitive banter. "I'm gonna destroy you in Rocket League" is not a threat. False positives punish innocent users, and they're what gets a moderation bot uninstalled.

Results

Measured on a held-out test set the model never trained on (the holdout is excluded from training by construction), split by domain because register matters. Counts are FP/FN, threshold 0.85, INT8 ONNX.

In-domain — chat-register text (Wikipedia/Jigsaw + synthetic chat), what this model is for:

metriccountrate
false positives (innocent flagged)44/1,1243.9%
false negatives (abuse missed)32/1,4622.2%
per-class recallharassment 99% · spam 100% · flood 100% · toxicity ~90%
identity-term bias probe (bias_test.py, 592 benign identity sentences)0 flagged0.0%
surface-form robustness (casing, markdown, punctuation, k y s-style)110/110
out-of-distribution suite (39 hand-written: short messages, banter, threats)38/39
latencyINT8 ONNX, desktop CPU~4.1 ms

Out-of-domain — real game chat (CONDA, a register this model was NOT trained on):

metriccountrate
false positives204/71828.4%
false negatives224/68032.9%

Game chat is the honest weakness: this model is Wikipedia/Jigsaw-register and transfers to Reddit-like text, not to gaming slang. In our experiments ~9k rows of real game chat lifted implicit game-toxicity recall from 14% → 77% — but that data (CONDA) has no license and is not in these weights (this model's diet is strictly CC0 Jigsaw + owned synthetic). If you moderate a gaming community, fine-tune on your own domain data.

Note on prior revisions. Earlier uploads of this repo reported ~2.1% false positives. That figure was train-on-test inflated — the evaluation set overlapped the training data — and the weights also carried an identity-term bias (benign sentences like "there are a lot of gay people here" were flagged). Both are fixed in this revision: the holdout is now excluded from training (so the 3.9% above is real generalization), and counterfactual augmentation drove the identity probe to 0/592. Numbers here are honest.

For scale: general-purpose LLM judges prompted for moderation measured far worse on the same yardsticks at 30–70× the size (phi3:mini, 2.2 GB: F1 ~48 on game chat; llama-guard3:1b: missed ~84% of interpersonal abuse).

Usage

from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline

REPO = "strictlyinsecure/discord-moderation-minilm-l12"
model = ORTModelForSequenceClassification.from_pretrained(REPO, subfolder="onnx", file_name="model.onnx")
tok = AutoTokenizer.from_pretrained(REPO)
clf = pipeline("text-classification", model=model, tokenizer=tok, top_k=None, device=-1)

clf("i'm gonna destroy you in rocket league tonight lmao")   # → benign
clf("FREE NITRO for everyone, claim here bit.ly/x9k2")       # → spam
clf("shut up you idiot nobody likes you")                    # → abusive

Requires pip install optimum[onnxruntime]. A PyTorch fp32 checkpoint (model.safetensors) is also included if you want to fine-tune further.

Thresholding

The model is bimodal — it outputs ~0.99 or ~0.00 and little in between, so the threshold is not a delicate choice. 0.85 is a good default; raise it toward 0.95 if a false positive triggers a severe action (ban), lower it toward 0.6 if a human reviews every flag.

Training

  • 4-class head on all-MiniLM-L12-v2, max_length=200, class-weighted loss (inverse frequency — without it the model collapses to predicting abusive for everything).
  • ~35k rows: stratified Jigsaw (CC0)
    • synthetic chat-register data (spam, flood, evasion, short messages, hard benign negatives), plus counterfactual identity augmentation (below). CC0 + owned synthetic only — no CONDA, which has no license.
  • The held-out test set is excluded from training (a prior revision did not do this, which inflated its reported scores). Reported numbers are real generalization.
  • Identity-bias fix. Jigsaw over-represents identity terms in its toxic examples, so a naive model flags "i'm gay" as abusive. Counterfactual augmentation (term-swapping within identity groups + both-polarity templates in contracted and expanded forms) decorrelates the term from the label, driving a 592-sentence identity probe to 0 false positives.
  • Length-matched sampling. An early version learned "short message ⇒ abusive" because Wikipedia's toxic comments are short and its clean ones are long — it scored 97% held-out while classifying "great job everyone" as abusive. Every class is now sampled to the same length distribution, and a hand-written out-of-distribution suite exists to catch exactly this.
  • Label denoising. 2,466 Jigsaw rows whose human label was confidently contradicted by an LLM second-annotator across the benign/abusive boundary were dropped. This measurably lowered false positives without hurting recall at matched operating points.

toxicity and harassment are merged into one abusive class: two annotators (Jigsaw's humans and an LLM judge) disagreed about which bucket an abusive message belonged in 48% of the time. That boundary is noise, and most pipelines take the same action for both.

Limitations

  • Spam/flood scores are optimistic — trained and evaluated on templated synthetic data. Read them as "learned these patterns", not "solved spam".
  • Never trained on real chat logs. See the game-chat numbers above.
  • English only.
  • Evasion coverage is synthetic-only (leetspeak, homoglyphs, spacing) — a determined evader will get through.
  • Evaluated on the author's own held-out split, not a public benchmark.

Intended use

A fast first-pass filter in a moderation pipeline — cheap enough to run on every message, with a human or a stronger model handling escalation. Not a substitute for human moderators, and not a sound basis for automated bans on its own.

License & attribution

Apache-2.0. See NOTICE for the attribution required on redistribution.

Trained on the Jigsaw Toxic Comment Classification dataset (CC0); underlying comment text originates from Wikipedia and is licensed CC-BY-SA-3.0. Base model is Apache-2.0.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForSequenceClassification
Ревизия весов
ea38797

0 моделей