nano-injection-detector
hidden injection detector for AI agents
2 min read
The nano-injection-detector model by Hephaestus Lab is a compact hidden prompt injection detector (commands embedded by attackers into external data) with 10.9M parameters. It scans text that an AI agent receives from external sources (files, email, web pages) and evaluates it for hidden instructions. The model runs directly on the CPU, takes up about 11 MB in its 8-bit version, and consumes around 100–115 MB of RAM in ONNX Runtime. This development is useful for AI agent and security system developers to pre-filter incoming content.
Key features
- Byte-level architecture: The transformer processes raw bytes without using a tokenizer, which prevents the loss of altered or obfuscated characters.
- Lightweight: Runs on a standard processor (CPU) and consumes minimal memory and hardware resources.
- Comparison with alternatives: On a number of benchmarks (such as AgentDojo and tau-bench), the model shows high efficiency compared to Meta's Prompt Guard 2.
- Language limitations: Trained primarily on the English language and ineffective for texts in other languages.
What you can do
- Text verification: Integrate a document and email scanning script into your AI agent's permission pipeline.
- Local deployment: Run the model locally on an ordinary laptop without needing heavy GPUs.
- Injection protection: Use as an additional barrier before passing data from external tools to the language model.
Example
Running text or file verification via the console using the provided script on ONNX Runtime:
pip install onnxruntime numpy
python nano.py "text an agent read from a tool"
python nano.py --file page.txtRead more
DetailsParameters and performance:
- 10,881,024 parameters, byte-level transformer without a tokenizer.
- Operating speed: 60–85 ms per kilobyte on Apple M2 CPU.
- License: Apache 2.0.










Comments