Legacy Tools
Safe Abuse Detect / Specification
Safe Abuse Detect

A harassment-language
classifier that runs
on a CPU.

A small classification model that checks whether a single Japanese message contains a threat of harm, discrimination, an insult, coercion or a sexual remark made by the writer themself. It does not generate text.

This is a model for research and evaluation. It was evaluated on synthetic text, and its performance on real users’ messages has not been checked. It is not intended for production use.

This page records the specification and evaluation. The full model card is on Hugging Face. The sensitive-information classifier built the same way is Safe Privacy Detect.

safe-abuse-detect-ja-70m / v0.1.0 / MIT / Japanese only
24.81ms

Time to judge one 200-character message (p50), measured on AWS (c7i.xlarge, 4 vCPUs)

4CPU

Designed for 4 CPUs and no GPU. No network needed at run time

≈ 70million

70,156,431 parameters. The base model is sbintuitions/modernbert-ja-70m

5 × 3

For each of five targets, one of three labels with probabilities

Approach

It judges the words,
not the person.

Safe Abuse Detect looks only at the text of the one message it is given, and whether the writer’s own words or acts are written there. It does not judge the writer’s intent, character or dangerousness, or whether anything should be done.

  • The writer
    Only what the writer says or does counts.

    Quotes, words or acts inside news or fiction, and reports of being harmed are not DETECTED by themselves.

  • Complaints
    Legitimate complaints are outside the targets.

    Criticising the service in strong words, cancelling, going to a lawyer or a financial ADR body, asking for a manager or an apology: the rules say NOT_DETECTED. How often the model wrongly flags these has not been measured yet.

  • Abstain
    When the text cannot decide, it abstains.

    A joke taken back, an unclear target, or masking that hides the content should get ABSTAIN. In practice, on 50–60% of the messages where ABSTAIN was correct, it answered NOT_DETECTED or DETECTED.

What you pass in

The message text only.

One Japanese message. It is built around a single chat message (up to 200 characters) and accepts up to 800. It does not look at the rest of the conversation. Split long text on the calling side.

What comes back

A label and probabilities for each target.

{"threat": {"status": "NOT_DETECTED", "probabilities": {...}},
 "insult": {"status": "DETECTED", ...}, ...}

It does not say which part of the text matched. The bundled predict.py writes the text to neither its output nor its logs.

The five targets

threat
Threat of harm to people or property

The writer says or hints that they will harm a person’s body or life, or a building or equipment

discrimination
Contempt or exclusion because of an attribute

Demeaning a person or group, or calling for or announcing their exclusion, because of nationality, ethnicity, sex, disability or a similar attribute

insult
Insults and personal attacks

Attacking the character, ability or looks of a particular person or group (including the other party, staff or the AI chat) in demeaning words

coercion
Coercion and threats other than harm

Threatening a disadvantage other than harm (exposure, damaging a reputation, refusing to leave, stalking and so on), or intimidating someone into doing what they are not obliged to do

sexual
Explicit sexual remarks aimed at the other party

Explicit sexual remarks or demands aimed at the person the writer is talking to

Each target is judged on its own, so one message can hit several (an insult aimed at an attribute is both discrimination and insult). The scope is the definitions above; they do not match any legal definition.

The three labels

DETECTEDThe writer’s own words or acts of that kind are written in the text.
NOT_DETECTEDNone. This includes quotes, words or acts inside news or fiction, reports of being harmed, general statements, figures of speech and idioms, legitimate complaints and strong dissatisfaction, and notice that someone will exercise a right.
ABSTAINSomething related is there, but the text alone cannot decide whether it is the writer’s own words or acts (a joke taken back, an unclear target, masking that hides the content).

The bundled script predict.py returns two more states: OUT_OF_SCOPE (an unsupported target ID, near-empty text, text less than 30% Japanese characters, or more than 800 characters) and FAILED (a runtime error or a timeout; 1,000 ms by default). Abuse written only in English or romanised Japanese is not judged and comes back OUT_OF_SCOPE.

Rules worth knowing

  • A conditional announcement (“if you don’t …, I will …”) is DETECTED even though the condition has not been met.
  • A demand backed by harm to a building is both threat and coercion; a demand backed by bodily harm is threat only.
  • Wanting to harm a particular person is threat. Abuse telling someone to die or disappear is insult, not threat.
  • Telling someone you know where they live or what they do, or summoning or lying in wait for them, is coercion. If the harm itself cannot be read, threat is ABSTAIN.
  • Looking down on the person handling you because of an attribute is also insult. Sweeping claims about a group that are not aimed at the other party, and exclusion without insulting words, are discrimination only.
  • Masked or kana-spelled words whose meaning can still be read are DETECTED. When masking hides the meaning, the label is ABSTAIN.
  • It does not judge hints of self-harm (all five targets are NOT_DETECTED). If support information is needed, handle it with a separate mechanism.

Speed (measured)

Speed on AWS
Charactersp50p95Per second
509.69 ms10.59 ms103.2
10016.33 ms16.77 ms61.5
20024.81 ms25.80 ms40.2
40044.87 ms45.30 ms22.3
80090.57 ms93.98 ms11.0

AWS (c7i.xlarge, 4 vCPUs, Tokyo region, 2026-11-30, v0.1.0). 32-bit ONNX, ONNX Runtime 1.23.2, 4 threads. Outbound traffic was cut after setup, and Docker ran with --network none, 4 CPUs and a 2 GiB memory limit. For each length, 20 warm-up runs and then 200 runs, one message at a time. The times do not include any network transfer. 1.85 s from start to the first answer; peak resident memory of the inference process about 650 MiB.

On the development PC (AMD Ryzen 7 5700X, WSL, limited to 4 CPUs, 2026-11-30): p50 18.2 ms and p95 25.3 ms at 200 characters, p50 71.4 ms and p95 85.7 ms at 800. Even on the same PC, results vary by 10–20% from run to run. Speed depends on the type and number of CPUs, so measure again on your own machines with the bundled bench.py. There is no 8-bit quantised version (in the trials, it made the miss rates much worse).

Accuracy (evaluation)

Three results missed their targets: the discrimination miss rate (25.2%), the insult miss rate (31.9%) and the message-level pass-through rate (7.8%). Everything else was within target.

Per message
Pass-through rate
7.8%missed

62 of 793. Target: 5% or less

False-positive rate
3.3%

28 of 850. Target: 5% or less

Pass-through rate: of the messages containing at least one such act, the share where no target was DETECTED. False-positive rate: of the messages containing none, the share where some target was DETECTED.

Miss rate per target

The dashed line is the target (10% or less for threat and discrimination, 15% or less for insult, coercion and sexual). The figures are the same as in the table below.

Every measure per target
Results per target
TargetMiss rateFalse positives (ordinary)False positives (confusable)Abstain rateAbstain accuracyECE
threat4.9% (9 of 185)0.7%2.4% (2 of 83)0.8%46.6% (34 of 73)0.018
discrimination25.2% (77 of 306)1.1%5.6% (4 of 72)0.8%50.0% (13 of 26)0.032
insult31.9% (111 of 348)1.1%6.9% (6 of 87)0.3%42.9% (6 of 14)0.029
coercion11.6% (27 of 233)2.0%4.3% (5 of 117)1.6%38.8% (26 of 67)0.017
sexual12.9% (24 of 186)0.4%1.5% (1 of 68)0.3%43.3% (26 of 60)0.008
Target≤ 10% / 15%≤ 3%≤ 10%≤ 10%Reference only≤ 0.05

The miss-rate target is ≤ 10% for threat and discrimination and ≤ 15% for insult, coercion and sexual. The targets are proposals set by the developer before the evaluation (before seeing any results). Because readers disagree about abuse and coercion, the first draft (a 5% miss rate for every target) was revised before the evaluation.

About the discrimination and insult misses
  • Most misses are messages where both discrimination and insult apply (insults aimed at an attribute): 104 of the 111 insult misses and 73 of the 77 discrimination misses.
  • Outside that type, the miss rates are 7.7% for insult (7 of 91) and 8.2% for discrimination (4 of 49), within target.
  • The evaluation labels count attribute-based messages as insult broadly (84% of discrimination messages are also insult), which differs from how the training side reads them and affects the numbers. Even on development data labelled the same way as training, 27% of insults of this type were missed, so it is also a weakness of the model.

2026-11-30, 1,789 messages, run once for this version. 32-bit ONNX, values after calibration. The evaluation set is synthetic: a generative AI that took no part in creating the training data or tuning the model wrote it from the labelling rules alone. The answers are a majority vote of three generative AIs that read the rules; no person checked them. Only 26 (discrimination) and 14 (insult) examples have ABSTAIN as the answer, so abstain accuracy there is rough. False positives on legitimate complaints and strong dissatisfaction could not be measured with this set. On the development data (for reference) the miss rates were threat 4.9%, discrimination 5.6%, insult 14.5%, coercion 11.3% and sexual 11.7%, but that data was used for tuning decisions during development, so it flatters the model.

Limits

  • It misses things. In the evaluation, 7.8% of messages containing such acts got no DETECTED at all. Do not design a system that relies on this model alone to protect people.
  • It tends to miss insults aimed at an attribute.
  • The training and evaluation data are all synthetic. Performance on real users’ messages has not been checked.
  • Accuracy on long text has not been checked. Training used up to 128 tokens (about 350 characters), and almost all training and evaluation messages are under 200 characters.
  • The data was written with customer chat at Japanese financial institutions in mind. Other settings (social media, workplace chat, games and so on) have not been measured, and dialects or text mixed with English or romanised Japanese have barely been tested.
  • Probabilities were calibrated on the development data and may not match accuracy on other kinds of text.

What it does not do

  • It does not judge the writer’s intent, character or dangerousness. It returns a judgement about the text only.
  • It does not decide whether something is illegal (threats, coercion, defamation and so on) or whether it counts as customer harassment.
  • It does not decide whether to act: suspending use, reporting, referring to a contact point, and so on.
  • It does not look at the rest of the conversation, only the one message it is given.
  • It does not infer attributes of the writer or the other party.

Please do not use it to

  • Decide on its own to suspend someone, report them or refuse to deal with them. It both misses and wrongly flags.
  • Assess the writer’s character or dangerousness. The judgement is about the text, not the person.
  • Shut down complaints or people exercising their rights.
  • Treat it as enough on its own. “Not detected” is not a guarantee that nothing problematic was said.

These are requests from the author, not licence conditions.

What you need to run it

Environment4 CPUs, no GPU. No network needed at run time
SoftwarePython, onnxruntime 1.19 or later, transformers 4.48.0 or later, sentencepiece, protobuf, numpy
ContainerA Dockerfile is included (based on python:3.10-slim)
Download18 files, about 544 MB (weights about 268 MB, ONNX about 268 MB). Both safetensors and ONNX
LoadingThe bundled predict.py (ONNX Runtime, CPU) is recommended. It also loads with the standard transformers classification class and needs no custom code (trust_remote_code). There are 15 outputs; take a softmax over each target’s three. pipeline("text-classification") as is gives wrong results
Where to get itHugging Face: LegacyTools/safe-abuse-detect-ja-70m
LicenceMIT. No warranty

Evaluating it,or testing it together?

Enquiries about evaluating it on your own text, or about testing it together, are welcome.

Enquiries go through the support page on legacy-tools.dev.

Contact us