DEV Community

Sushant Poudel
Sushant Poudel

Posted on Originally published at sushantpoudel2028.com.np

A 3.8B model on a laptop caught 202 of 208 bad agent actions — and the safe-looking variant was the unsafe one

Our paper measured something that inverted the assumption we started with: making an AI agent's safety checker output JSON made it less safe, not more.

The setup. An autonomous agent that executes actions rather than proposing them sits outside role-based access control — RBAC authenticates an identity, but says nothing about whether a specific action should happen. Routing every proposal to a cloud frontier model closes that gap semantically, but adds round-trip latency and is often prohibited outright in regulated settings.

So we built an edge-native semantic firewall: Phi-3-mini, 3.8B parameters, 4-bit quantized, held under a 4.2 GiB VRAM ceiling, sitting in the evaluator stage of a Generator–Evaluator pipeline on a single consumer laptop. No cloud calls at any stage.

The mechanism is a structured Chain-of-Thought JSON schema that forces the evaluator to name the governing policy rule and justify the match before it may emit a decision. That converts an opaque verdict into a trace an operator can audit.

We evaluated it on a 600-scenario corpus: 155 adversarial scenarios across eight prompt-injection techniques, 60 compound multi-step scenarios, and 30 boundary cases — 1,800 generations, all run on the model itself at temperature 0.

The result that matters: constraining the output format without requiring the reasoning step produced the least safe evaluator of the three conditions. Requiring the reasoning cut hard-denial approvals from 71 to 6, and 6 of 208 got through.

The takeaway is narrow but useful: if you are bolting a model onto an agent as a policy check, the JSON schema is not the safety property. The forced justification is. A checker that can say "deny" quickly without showing its work is not a checker; it is a second opinion with the same blind spots.

Published in ICICSET Vol. 3, No. 1, pp. 228–235 (2 October 2026) — DOI 10.65091/icicset.v3i1.75.

Paper, code, corpus and raw outputs: https://sushantpoudel2028.com.np/publications/agentic-verification

More of the negative results, kept in: https://sushantpoudel2028.com.np/writing

ai # security # llm # showdev

Top comments (1)

Collapse
 
analista_83 profile image
Sammi De Blas •

The result that forcing JSON output made the evaluator less safe is the part worth reading. A strict schema can push a small model to fill fields instead of reasoning. We saw similar drift with a local 3B judge asked to name a policy, so putting the free text justification before the verdict looks safer.