Binary classifier used by MaskWall, a privacy-first LLM firewall. It labels a prompt benign (0) or prompt injection / jailbreak (1). The same file is used twice: on the server (onnxruntime) as the real check, and in the browser (Transformers.js, WASM) as an instant early warning.
Not a guarantee. This is a statistical classifier with the measured error rates below. It misses attacks and it flags some harmless prompts. Use it as one layer, not as the only defence.
| file | used by |
|---|---|
model.int8.onnx, tokenizer.json, model_meta.json |
the FastAPI backend (MASKWALL_SERVER_MODEL=minilm) |
onnx/model_quantized.onnx, config.json, tokenizer_config.json, tokenizer.json |
Transformers.js in the browser (AutoModelForSequenceClassification, dtype: "q8") |
Both layouts hold the same weights (dynamic int8 quantisation, 23.1 MB; fp32 was 91 MB, 22.7 M parameters).
Texts longer than the model window are scored in overlapping 510-token windows and the maximum score is used (a
"sliding window"). Two thresholds on the attack probability: block at 0.610, warn at 0.368
(both tuned on the validation split only; see model_meta.json). max_content_tokens 510, window stride 255.
Fine-tuned from sentence-transformers/all-MiniLM-L6-v2 (Apache-2.0) on English prompts from public datasets, after
cleaning (exact and near-duplicate removal across sources, conflicting labels dropped, label fixes after manual review):
deepset/prompt-injections (Apache-2.0), jackhhao/jailbreak-classification (Apache-2.0),
Lakera/gandalf_ignore_instructions (MIT), TrustAIRLab/in-the-wild-jailbreak-prompts (MIT),
databricks/databricks-dolly-15k (CC BY-SA 3.0, sampled benign rows), plus 800 synthetic training rows (half attacks, half
matched benign) that hide an instruction inside text the user pasted ("summarize this...") because the public data barely
contains that case. Hard-negative round: benign prompts that talk
about attacks or system prompts (English and Hinglish), generated with an LLM with matched templates for both classes, plus
human Hinglish assistant queries from Hinglish-TOP (train split). Paul/XSTest (CC BY 4.0) and all evaluation sets were
never trained on. Full licence table: NOTICE.md. Share-alike (Dolly, CC BY-SA 3.0) applies to
that dataset's text; whether it reaches a model trained on a sample of it is not settled, so it is stated here.
Source of truth: ml/results/ in the repository; this table is generated from it. Counts are shown so the rates are checkable.
| set | result |
|---|---|
| public test set, attacks caught (recall) | 182/208 (87.5%) |
| public test set, benign flagged (false positives) | 12/717 (1.7%) |
| test F1 | 0.905 |
| XSTest safe prompts flagged | 0/250 (0.0%) |
| hidden-instruction-in-document attacks caught (synthetic, built with the same recipe as 800 training rows, so an upper bound) | 53/55 (96.4%) |
| human-written Hinglish assistant queries flagged (same domain as some training rows) | 1/104 (1.0%) |
| LLM-written "prompt-talk" benign flagged | 2/100 (2.0%) |
| Hinglish attacks caught (24 AI-written prompts) | 23/24 (95.8%) |
| tricky set (49 prompts drafted with AI help, so not blind): attacks caught / benign flagged | 16/21 (76.2%) / 2/28 (7.1%) |
| long documents (114 benign / 38 with a hidden attack): benign flagged / hidden attack caught | 14/114 (12.3%) / 37/38 (97.4%) |
Latency depends on the CPU and on text length; see the Benchmarks page of the live app for the figures measured on the deployment hardware.
Code, training notebooks, decisions and all numbers: https://github.com/namyaa6/MaskWall
model.int8.onnx 22 MiBonnx/model_quantized.onnx 22 MiB