Arcjet extended its sensitive information detection SDK with an optional local NER model backend using the open source Rampart model (14MB ONNX). The post details the engineering decisions: a pluggable SensitiveInfoBackend interface to keep the rule stable across model changes, offset reconstruction from BERT-style subword tokens back to original character positions, hybrid detection combining deterministic regex/Luhn recognizers for structured data with the NER model for names and addresses, a span merge algorithm that resolves overlaps by length and source priority, lazy model loading with failure-safe caching, overlapping 480-character chunking to handle inputs beyond the 512-token model window, and Next.js bundling guidance to avoid packaging native ONNX binaries. The feature ships in server runtimes (Node.js, Bun, Deno) with p50 latency around 6.5ms.

11m read timeFrom blog.arcjet.com
Post cover image
Table of contents
Keep the rule stable, make detection pluggableModel output is not policy outputStructured data still belongs to recognizersAllow and deny stay backend-independentLoad the model once, but do not cache failureLong input has to be chunkedFramework integration is about not bundling the modelLots of testsConclusions
353 Impressions