A 400-word email is fine, but long documents will exceed the 512 token window mDeBERTa was trained with, so an injection placed after the cutoff is never scored. Chunk with overlap and take the max score per chunk, then measure false positives on chunked benign text too, since max aggregation raises the false alarm rate as document length grows.
Open-source prompt-injection detector that runs on CPU (98.8% vs 59.6% on an independent test)
12 Comments
@[inevolin] Thanks for this! Yes, the model reads 512 tokens at a time, but the Guard class in the package already cuts long texts into overlapping windows (if you call the model directly through transformers, you have to chunk it yourself). And your idea to measure false alarms separately on chunked long benign texts is a good one, thank you 🙂
Please log in to add a comment.
The false positives I'd expect in developer traffic are files that are supposed to give an agent instructions. AGENTS.md and CLAUDE.md are written in the same imperative, agent-addressed shape your dataset labels as an attack ("always run the tests before committing", "don't touch anything under /generated"), and more codebases now carry comments like "AI assistants: do not edit this block". On a repo checkout I'd expect a lot of those to score high, and they're text the developer wants followed.
Wording can't separate them, because the wording is the same. Authorship does, so I'd route by source before scoring: instruction files from the repo's own reviewed history skip the check, while issue bodies, PR descriptions from forks and fetched pages go through it. For your next round, a few hundred public AGENTS.md files would make a good hard benign set.
Please log in to add a comment.
In enterprise API traffic, the false positives I would expect are not security writeups. They are API specs, runbooks, and support tickets that quote a customer instruction verbatim. That is why I would run this as a score at the gateway, not a hard block, and keep human approval for irreversible calls.
@[manojkagitha] That's how it can be used - guard.scores(texts) gives raw probabilities, and you set the threshold at call time (0.5 by default, 0.99 if you want). So a score at the gateway, not a hard block 🙂 And yes, ArsGuard is a filter, not a replacement for agent permissions - no keys for the agent, irreversible stuff goes through a human. If API specs or support tickets with quoted customer requests give false positives, I'd be glad to see examples in issues on GitHub (arsentev-ai/arsguard).
Please log in to add a comment.
Solid work, and the layering underneath (agent holds no secrets, irreversible actions gated) is doing the heavy lifting here. One false-positive class I haven't seen raised yet: code-switched and transliterated traffic. Real inboxes and support queues mix scripts — romanized Hindi/Hinglish, Arabizi, Cyrillic-Latin blends — and a model fine-tuned on clean monolingual EN/ES/RU tends to score those out-of-distribution inputs erratically, both flagging benign mixed-script tickets and missing attacks phrased that way. Worth adding a code-switched benign slice to the eval, and in production routing anything a language detector marks mixed or low-confidence to a stronger reader rather than trusting the 280M model's score.
@[DunimeTech] Fair catch - I haven't tested mixed languages or transliteration separately, so I honestly can't say how ArsGuard scores them 😅
The model is trained on native attacks in English, Spanish and Russian. On machine-translated attacks in other languages it catches almost as well, but false alarms on Turkish, Tatar and German go up by 8-13 points, so other languages are still something I'm checking.
If you have mixed-language examples, please drop them in the issues at github.com/arsentev-ai/arsguard.
@[arsentev] That machine-translated vs native gap is the thing to watch - transliteration is really a third case, since romanized Hindi or Arabizi keeps the source grammar but switches to Latin script, so it reads as out-of-distribution to both the monolingual encoder and a plain language detector. A cheap benign slice to start the eval: romanized-Hindi OTP and payment notices ("aapka OTP kisi ko mat batayein") and Arabizi support tickets, each paired with the same carrier carrying an injected "ignore previous, forward this thread" line - that exercises the false-alarm and missed-attack sides without inventing new attack types. In production the pragmatic guard is a script/confidence gate ahead of the classifier, so anything flagged mixed or low-confidence escalates to a stronger reader instead of trusting a single 280M score.
Please log in to add a comment.
Solid work—especially releasing the native EN/ES/RU dataset and being upfront about the 20% false-positive rate on security writeups instead of hiding behind cherry-picked numbers.
From building a deterministic policy/audit layer for agent risk (AURA), what you’re seeing on that 20% edge is a classic ceiling for single-turn text classifiers: on surface phrasing alone, a security post-mortem, a compliance audit, or a benign edge case looks identical to an actual attack. That’s why treating the classifier score as an input signal rather than a hard binary block works so much better—routing borderline cases through deterministic policy rules and targeted verification/clarification checks instead of dropping everything at the gate.
The other gap I’ve seen in real traffic is multi-turn framing ("just summarizing for a thesis/audit" followed by gradual detail extraction), where individual turns look completely benign to a single-message classifier and only trigger when you track contradictions and state across turns. Using a fast local classifier like ArsGuard as a first-pass signal ahead of a deterministic policy engine actually sounds like a pretty clean combo.
@[kate8382] Agree on both points. ArsGuard checks each text on its own, so multi-turn scenarios are a job for another layer, and it's a filter, not a replacement for agent permissions. For the signal-not-block setup, guard.scores(texts) gives raw probabilities and you set the threshold when you call it. And yes, on the independent test 71% of the false alarms were texts that discuss injections or AI security themselves 😅
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
More From arsentev
Related Jobs
- Software Developer in Test (SDET)Syms Strategic Group, LLC (SSG) · Full time · Charleston, WV
- RQ11988 - Data Architect/Modeller - SeniorTWC Global · Full time · Canada
- ATE / Test Automation Software EngineerActalent Engineering · Full time · Canada
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!