TinyGuard1.1-22M
an ultra-lightweight spam, phishing, and prompt injection filter
2 min readupdated
A compact text classifier by Kuantum-ai1 designed to filter out unsafe English messages. It takes text as input and sorts it into one of four classes: safe, spam, phishing, or prompt_injection (attempts to hijack a model's instructions). Built on the compact MiniLM-L6-H384-uncased architecture, the model packs just 22.7M parameters. Compared to the original TinyGuard1-22M, this release adds data augmentation and notably improves phishing detection accuracy. It is a solid fit for bot, chat, and LLM app developers looking for a fast first line of defense for incoming text.
Key features
- Ultra-small footprint: at just 22.7M parameters, it runs easily on low-end hardware without beefy GPUs.
- Four threat classes: distinguishes between normal text, spam, phishing links, and prompt injection.
- Obfuscation resilience: trained using augmentations with typos, extra spaces, letter casing changes, and homoglyphs (lookalike characters from other alphabets).
- Permissive license: released under Apache-2.0, making it safe for commercial projects.
What you can do
- Protect an LLM assistant: place the model in front of your main language model to catch prompt injections before generating a response.
- Filter incoming messages: integrate it into English-language chats, feedback forms, or email gateways to weed out spam and phishing.
Example
from transformers import pipeline
clf = pipeline("text-classification", model="Kuantum-ai1/TinyGuard1.1-22M")
print(clf("Congratulations! You won a free prize, click here to claim it."))Read more
DetailsTest metrics: Accuracy — 0.9865 (+0.0196 over v1), Macro F1 — 0.9850, Phishing Recall — 0.9689 (+0.0434 over v1).
Context: maximum input sequence length is 320 tokens; language is English.
Training: fine-tuned for 5 epochs in PyTorch on a single T4 GPU in fp16 using a balanced dataset (21,148 safe examples and 9,000 examples for each of the other classes).










Comments