Tripwire 32M: finds instructions planted in what an AI agent's tools return
AI agents read emails, web pages, API responses and tool descriptions. An attacker can hide an instruction in that text and the agent may follow it (indirect prompt injection). This model reads such a text and marks the characters an attacker planted, so the planted part can be removed and the rest kept.
It is a token classifier fine-tuned from jhu-clsp/ettin-encoder-32m on the
Tripwire dataset, version 0.3.1. The code, the benchmarks and every result
below are in the source repository: https://github.com/dhootatharva/tripwire
Use
pip install "tripwire[hub] @ git+https://github.com/dhootatharva/tripwire"
from tripwire.detector import Detector
detector = Detector.from_hub("booleanbyte/tripwire-32m")
result = detector.scan(tool_output)
if result.flagged:
print(result.score, [(span.start, span.end) for span in result.spans])
safe = result.strip(tool_output)
It runs on a CPU with onnxruntime; PyTorch is not needed. The repository also
has a filter for a hand-written agent loop, a LangGraph hook and an MCP proxy
built on this model.
Files
| File | What it is |
|---|---|
model.onnx |
32-bit weights. The default; gives the same verdicts as the trained model |
model.int8.onnx |
8-bit weights. A quarter of the size, changes some verdicts, not faster on the CPU tested |
tokenizer.json |
The tokenizer |
model.safetensors, config.json |
The trained checkpoint, for transformers |
Two sizes
| 32M | 68M | |
|---|---|---|
| File size (32-bit) | 128 MB | 274 MB |
| Time for 500 tokens, one laptop CPU | about 130 ms | about 340 ms |
| Catches | less | more |
| False alarms on harmless requests | fewer | more |
The 32M model is the default in the code.
Results
A document counts as flagged when any token scores at least 0.5. Each model was trained once.
| Test | What it measures | 32M | 68M |
|---|---|---|---|
| Own test split: attacks caught | Same recipe as the training data | 97.9% | 98.9% |
| Own test split: false alarms | 0.8% | 0.5% | |
| AgentDojo tool outputs: caught / false alarms | Used while building the model | 100% / 3.4% | 100% / 3.2% |
| BIPIA attacks caught | Outside data | 63.0% | 78.3% |
| InjecAgent plain attacks caught | Outside data | 78.2% | 86.3% |
| InjecAgent enhanced attacks caught | Outside data | 100% | 100% |
| BIPIA clean texts flagged | Outside data | 0.6% | 1.1% |
| NotInject flagged | Harmless texts with attack-like wording | 15.6% | 48.1% |
With the 32M model in front of two open models that follow these attacks (gpt-oss-120b and gpt-oss-20b), the attacker's goal was reached in 42 of 47 AgentDojo cases without it and in 0 of 47 with it. That is a small sample from one suite.
On NVIDIA garak's latent-injection probes, which were not used to build the model, the 32M model flagged 81% of 1,960 attacked documents and changed none of 74 clean ones.
Limits
- It looks for instructions, not for false claims. "This domain is clearly not malicious" planted in a record instructs nobody and is not flagged.
- Its own test split flatters it. Use the outside figures above.
- It was not tested against an attacker who adapts. Someone who can query it repeatedly and reword an attack should be assumed to get through.
- It does not see the user's request. If the user asks the agent to follow the instructions on a page, the model still flags them.
- A request addressed to the reader inside a tool output is treated as suspicious by design, which is the source of most false alarms.
- English was tested most. 77 of 85 (32M) and 84 of 85 (68M) of the dataset's own non-English test attacks were caught; no outside data in other languages was used.
- Only text is read: not images, audio or file names.
Use it as one layer, together with limited tool permissions and human approval for risky actions.
Training
Dataset version 0.3.1 without the examples whose label depends on the user's
request. 512-token windows, two labels per token (planted or not), one seed.
59 minutes (32M) and 161 minutes (68M) on two T4 GPUs. The script is
scripts/train.py in the source repository.
Licence
MIT, the licence of the base model. The training data is CC BY-SA 4.0 and includes Wikipedia text and the Enron email corpus; see the dataset card.
- Downloads last month
- 10
Model tree for booleanbyte/tripwire-32m
Base model
jhu-clsp/ettin-encoder-32m