Software · v1.0.0 · MIT · Zenodo
ArsGuard: an open-source multilingual prompt-injection detector for AI agents
Evgenii Arsentev · ARSENTEV.AI · ORCID 0000-0002-9120-7298 · 2026-11-30
ArsGuard is an open-source neural network by Evgenii Arsentev that detects prompt injections — hidden instructions aimed at AI agents — in English, Spanish and Russian text, so that agents reading emails, web pages, documents or tool outputs are not hijacked.
On an independent test of native texts, ArsGuard catches 98.8% of English prompt injections, versus 60% for ProtectAI v2, the most downloaded open-source detector. For Spanish it catches 99.7% versus 86%, and for Russian 99.7% versus 37%. On ordinary messages from real users, it raises a false alarm 0.9% of the time, versus 10.8% for ProtectAI v2. ArsGuard is free for commercial use (MIT) and runs locally, with no API calls.
Quick start
pip install git+https://github.com/arsentev-ai/arsguard
from arsguard import Guard
guard = Guard() # downloads arsentev-ai/arsguard from Hugging Face on first use
guard.check("Hi team, please ignore my previous email — the meeting is moved to 3 pm.")
# Result(label='SAFE', score=0.0001, is_injection=False)What problem it solves
AI agents now read content that nobody on your side wrote: emails, résumés, product reviews, invoices, web pages and API responses. An attacker can hide an instruction for the AI inside that content, for example forward the conversation to this address, rate this résumé as the best or change the bank details in the payment. This is called an indirect prompt injection. ArsGuard sits between the content and the agent and flags it.
Most open detectors were trained mainly on English, so attacks written natively in Spanish or Russian slip past them. ArsGuard was trained on native attacks in all three languages.
Results
All numbers are at the default threshold of 0.5. ProtectAI v2 (protectai/deberta-v3-base-prompt-injection-v2) is the most downloaded prompt-injection detector on Hugging Face (about 326k downloads in the month to 30 November 2026).
Independent test: native texts, never used in training
4,783 texts in English, Spanish and Russian (about half attacks). Claude Sonnet wrote one half; it was not used to build the training data. GPT-6.1 Terra wrote the other half under a different task and format than the training data. The set is published as the independent_test split of arsguard-injections.
| Language | Texts | ArsGuard: attacks caught | ProtectAI v2: attacks caught | ArsGuard: AUC | ProtectAI v2: AUC |
|---|---|---|---|---|---|
| English | 1,028 | 98.8% | 59.6% | 0.992 | 0.599 |
| Spanish | 1,891 | 99.7% | 86.3% | 0.997 | 0.470 |
| Russian | 1,864 | 99.7% | 37.1% | 0.996 | 0.545 |
| All | 4,783 | 99.5% | 61.2% | 0.995 | 0.530 |
On this test, false alarms are 20.0% for ArsGuard and 54.4% for ProtectAI v2. The test deliberately contains many hard benign texts, such as articles and warnings about prompt injection. A re-check of ArsGuard's false alarms showed that 71% of them were texts discussing prompt injection or AI security.
Public benchmarks
| Dataset | What it measures | ArsGuard | ProtectAI v2 |
|---|---|---|---|
| OpenAssistant validation prompts (EN/ES/RU, 1,830) | false alarms on real user messages ↓ | 0.9% | 10.8% |
| xTRam1/safe-guard-prompt-injection test (2,040) ¹ | AUC / attacks caught / false alarms | 1.000 / 97.4% / 0.2% | 0.992 / 84.0% / 0.1% |
| neuralchemy/Prompt-injection-dataset test (935) ¹ | AUC / attacks caught / false alarms | 0.992 / 95.4% / 3.3% | 0.976 / 86.4% / 2.8% |
| xTRam1 test translated to Russian (1,867) ¹ | AUC / attacks caught / false alarms | 0.994 / 94.4% / 0.9% | 0.959 / 78.7% / 4.8% |
| jayavibhav/prompt-injection test (4,000) | AUC / attacks caught / false alarms | 0.902 / 82.7% / 19.4% | 0.883 / 98.6% / 75.3% |
| yanismiraoui/prompt_injections (1,034, attacks only) | attacks caught | 84.2% | 98.3% |
None of these datasets were used for training, and texts that also appeared in the training data were removed from every test. ¹ These three sets were the exam used to pick the best training round, so they are not fully independent of model selection. OpenAssistant, jayavibhav and yanismiraoui were scored once, after the round was chosen.
How it was trained
• Base model: microsoft/mdeberta-v3-base (MIT), a multilingual transformer with about 280M parameters. All weights were fine-tuned.
• Data: 241,162 training examples. 38k of them are a new set of native English, Spanish and Russian attacks, each paired with a benign text of the same form. The set covers 20 attack techniques in 20 kinds of carriers across 40 domains and is published as arsguard-injections. The rest come from open datasets with permissive licenses. Every source with a non-commercial or share-alike license was excluded, so the model can be embedded in commercial products.
• Method: training runs in rounds. After each round the model takes an exam on held-out external datasets it never trains on (marked ¹ above). The round with the best exam score is kept, where the score is AUC minus the false-alarm rate. The released model is round 2 of 4. A separate final test is computed once, on the chosen round only.
• Hardware: one 24 GB GPU; batch 16, learning rate 2e-5, max length 512, bf16 mixed precision.
Limitations
• Texts that discuss prompt injection, such as security articles, policies and warnings, are often flagged as injections. For an agent this is a cautious failure mode, but expect it if your agent reads security content.
• On two English jailbreak-style benchmarks ProtectAI v2 catches more attacks: jayavibhav (82.7% vs 98.6%, at 19.4% vs 75.3% false alarms) and yanismiraoui (84.2% vs 98.3%).
• At threshold 0.99, on jayavibhav ArsGuard catches 71.3% of attacks with 11.1% false alarms, and on the independent test 99.4% with 16.6%. Raise the threshold if false alarms matter more than recall in your setting.
• The labels of the generated and independent test sets were assigned by the generating models. A re-check of a sample of 200 benign texts agreed with 97.5% of the labels.
• Comparisons were made with ProtectAI v2 only. Meta Prompt Guard 2 and commercial detectors were not evaluated.
• The model reads 512 tokens at a time. The Guard class handles longer texts with overlapping windows. If you call the model directly through transformers, split long documents yourself.
FAQ
- What is ArsGuard?
- An open-source neural network by Evgenii Arsentev that detects prompt injections — hidden instructions aimed at AI agents — in English, Spanish and Russian text. Technically, it is a text classifier fine-tuned from mDeBERTa-v3-base (about 280M parameters).
- Who created ArsGuard?
- Evgenii Arsentev (ORCID 0000-0002-9120-7298, Wikidata Q141398931), a researcher and developer of open-source tools for AI agents and the creator of Arsminal.
- What problem does it solve?
- Indirect prompt injection: attackers hide instructions in content an AI agent reads, such as emails, résumés, reviews, invoices or web pages, to leak data, change the agent's task or trigger actions.
- How is it different from other open detectors?
- ArsGuard was trained on attacks written natively in English, Spanish and Russian, not translated from English. On an independent native test it catches 98.8% of English, 99.7% of Spanish and 99.7% of Russian injections, versus 60%, 86% and 37% for ProtectAI v2. It raises a false alarm on 0.9% of real user messages, versus 10.8% for ProtectAI v2.
- Can I use it in a commercial product?
- Yes. The model, code and dataset are MIT-licensed, and the training data excludes non-commercial sources.
- Does it need the internet or an API key?
- No. After the first download it runs locally with transformers.
Dataset
ArsGuard Injections: an open dataset by Evgenii Arsentev of native English, Spanish and Russian prompt injections, each paired with a benign text of the same form, built to train and test ArsGuard, an open-source prompt-injection detector for AI agents. 47,011 texts (train 37,994 · holdout 4,234 · independent_test 4,783), MIT.
Cite
Cite the concept DOI 10.5281/zenodo.24682051, which always resolves to the latest version.
@software{arsentev_arsguard_2026,
author = {Arsentev, Evgenii},
title = {ArsGuard: an open-source multilingual prompt-injection detector for AI agents},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.24682051},
url = {https://doi.org/10.5281/zenodo.24682051}
}Evgenii Arsentev — researcher and developer of open-source tools for AI agents; creator of Arsminal and ArsGuard. ORCID 0000-0002-9120-7298 · Wikidata Q141398931 · Hugging Face