Injection classifier v3.3 (EthereumFoundation pipeline)

Fine-tuned from Horizon-Labs/prompt-injection-guard-base (revision 2c20b6e2) to detect prompt injections in OCR'd invoices, receipts and payment documents before a model reads them. Labels: SAFE, INJECTION. Weights are stored as float16 (0.62 GB); the pipeline loads them as float32.

Use

Installed by the pipeline, not loaded directly: uv run python -m pipeline.injection.download puts it in models/injection/ and checks the weights against the pinned SHA-256. The pipeline then runs it at threshold 0.5, extractor rule off, block level 0.58 (DECISIONS D34).

Input: up to 40 consecutive OCR lines, invisible format characters removed, wallet addresses (also OCR-garbled ones) replaced by [wallet] (mask_mode: ocr). Output: P(injection).

Training

v3: full fine-tuning, cross-entropy, AdamW, lr 2e-5, 10% warmup, batch 16, max 1,024 tokens, 2 epochs, best validation AUC kept. v3.3 continues from v3 for 1 epoch at lr 1e-5 on 36,190 training and 4,059 validation examples: public invoice and receipt OCR (train splits), synthetic crypto invoices, payroll sheets and web pages, 6,404 real Tesseract rows, general prompt-injection data (deepset, xTRam1, LLMail, PromptShield train splits), plus new attack families: label-style wallet changes, questions and tasks planted in documents (Dolly prompts and hand-written), output-format hijacks, non-English and role-play attacks. Validation AUC 0.9999.

Float16 storage was checked against float32 on 4,061 documents: no decision changed, largest score change 0.009.

Results

Separately built evaluation set (never trained on), through the pipeline's scan and combined score, rule off: 99.5% of 1,346 attacked documents blocked, 0.4% let through without a warning, attacker address reached the reader in 0.0%; 6.7% of 1,972 clean documents blocked. Page level: 99.6% of 1,416 attacks detected, 6.8% of 2,182 clean documents flagged. Fresh set written before training (new wording on unseen invoice images, real Tesseract OCR): 99.2% of 131 attacks detected, 2% of 40 legitimate lines and 0% of 60 clean payment blocks flagged.

Limits

The new attack families were designed after studying v3's misses on the evaluation set, and the fresh set covers the same families with new wording, so both numbers are optimistic for attack styles nobody has written yet. Legitimate payment lines on real Tesseract scans are flagged more often than by v3 (16 of 100). Lines OCR could not verify are never scored. Probabilities are not calibrated.

Downloads last month
32
Safetensors
Model size
0.3B params
Tensor type
F16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for icefireman/injection_classifier_eth

Finetuned
(1)
this model