The short answer
- Choose pyveil for a small local runtime boundary around LLM prompts, tool calls, MCP, memory, logs, and traces.
- Choose Microsoft Presidio or another NER system when you must discover unknown names, locations, organizations, or addresses.
- Choose llm-guard or a validation framework when you need a broader family of model input/output scanners beyond sensitive-data redaction.
- Choose enterprise DLP for managed policy, files and images, incident workflows, central reporting, and compliance operations.
Capability and operating-model comparison
| Dimension | pyveil | Presidio / NER | LLM guardrail suite | Enterprise DLP |
|---|---|---|---|---|
| Primary role | Final local agent boundary | Broad entity discovery | Input/output model safety | Organization-wide data control |
| Unknown names and addresses | Not built in | Core strength | Depends on scanner/model | Usually supported |
| API keys and auth headers | Built in | Custom recognizer | Depends on scanner | Usually supported |
| Agent channels | Prompt, tool, MCP, memory, log, trace | Application-defined | Prompt/input-output focused | Policy/product dependent |
| Structured dict/list/JSON shape | Preserved | Integration work required | Framework dependent | Product dependent |
| Stable scoped placeholders | HMAC-SHA256 | Anonymizer strategy dependent | Scanner dependent | Product dependent |
| Required pyveil core dependencies | Zero | Multiple NLP dependencies | Often model/runtime dependencies | Managed service or agent |
| Network calls | None in core | Local by default | Configuration dependent | Common |
| Compliance guarantee | No | No | No | Depends on contract and deployment |
Measured local comparison
All numbers below are copied verbatim from evaluation/benchmark-results.json, generated locally in isolated uv virtual environments on the same runtime: Apple M6 (12 logical cores, arm64, Darwin 27.0.0), Python 3.12.15, measured at 2026-11-30T05:52:35Z across 50 warm passes (1,950 documents evaluated) on evaluation/corpus.json (39 cases: 33 positive, 6 negative, 36 expected findings; shared PII subset: 20 cases: 14 positive, 6 negative, 15 expected findings targeting EMAIL, PHONE, and CREDIT_CARD).
| Metric | pyveil 0.4.0 | presidio-analyzer 2.2.366 (spacy 3.8.18, en_core_web_sm 3.8.0) |
guardrails-ai 0.11.0 |
|---|---|---|---|
| Runtime dependencies (installed packages) | 0 (1 package) | 51 (52 packages) | 112 (113 packages, base only) |
Disk footprint (excl. __pycache__) |
262.19 KB (0.256 MB) | 113,618.88 KB (110.956 MB) | 313,782.63 KB (306.428 MB, base only before PII validators/models) |
| Cold import only (median) | 13.018 ms (5 runs) | 428.528 ms (3 runs) | 923.011 ms (3 runs) |
| Cold import + init (median) | 13.028 ms (5 runs) | 591.644 ms (3 runs) | Not runnable offline (0 bundled PII validators) |
| Warm latency per doc (median / p95) | 0.0125 ms / 0.0202 ms (26.635 ms total) | 1.3898 ms / 2.2113 ms (2,844.148 ms total, scoped shared PII); 1.5472 ms / 2.4166 ms (3,161.139 ms total, default all entities) | Not measured offline |
| Warm throughput (1,950 docs) | 73,212.6 docs/sec | 685.6 docs/sec (scoped shared PII); 616.9 docs/sec (default all entities) | Not measured offline |
| Shared PII subset (20 cases, 15 expected) P / R / F1 | 1.000 / 1.000 / 1.000 (TP 15, FP 0, FN 0) | 0.9231 / 0.8000 / 0.8571 (TP 12, FP 1, FN 3) | Not measured offline |
| Full corpus (39 cases, 36 expected) P / R / F1 | 1.000 / 1.000 / 1.000 (TP 36, FP 0, FN 0) | 0.8750 / 0.3889 / 0.5385 (TP 14, FP 2, FN 22) | Not measured offline |
| Air-gap / offline PII status | Runnable offline; no model download or Hub token | Runnable offline once spaCy model wheel is pre-installed (requires model download; configured with en_core_web_sm ~12.2 MiB here vs default en_core_web_lg ~382 MiB) |
airgap_pii_unavailable: 0 bundled PII validators; DetectPII/GuardrailsPII require Guardrails Hub (hub.api.guardrailsai.com) + API token or separate packages + runtime model downloads |
python3 evaluation/benchmark_compare.py --python 3.12 --passes 50 --output evaluation/benchmark-results.json
evaluation/corpus.json is a synthetic supported-shape regression corpus (39 cases: PII + developer secrets + negative controls), not a representative real-world NLP benchmark. Latency numbers are machine-dependent local diagnostics, not SLAs.
Credit where Presidio wins: Presidio provides spaCy/transformer NER discovery for unknown person names, locations, organizations, and dates that pyveil deliberately does not attempt and that are not represented in evaluation/corpus.json. Conversely, Presidio does not ship built-in secret recognizers for API keys, JWTs, PEM private keys, auth headers, or URL/KV secrets, which explains its full-corpus recall of 0.3889.
Full raw JSON output and mismatch diagnostics live in evaluation/benchmark-results.json and evaluation/benchmark_compare.py.
Choose pyveil when the boundary is the product requirement
pyveil's differentiator is not broad NLP. It is the combination of:
- channel-aware
REDACT,PASS, andBLOCKdecisions - recursive structured data redaction without flattening payloads
- stable, scope-separated HMAC placeholders
- credential blocking before model-controlled tools execute
- zero required runtime dependencies and no core network calls
- exact known-value and narrow domain-identifier rules
That makes it useful as the last local control before data crosses into an agent-controlled surface.
Choose Presidio or NER when broad discovery matters
Regex cannot infer that an arbitrary phrase is a person's name, organization, street address, or location. Presidio combines recognizers and NLP analysis for broader entity discovery, and NER models such as GLiNER can find semantic entities that pyveil deliberately does not attempt.
The tradeoff is a larger dependency and operational surface, model selection, language configuration, and different false-positive/false-negative behavior. If you need that recall, use it. Do not force a small regex package to imitate an NER system.
Choose a guardrail suite for broader model risks
PII is only one LLM safety concern. Prompt injection, toxicity, topic control, jailbreaks, hallucination checks, and output validation require different detectors and policies. A guardrail suite can coordinate those concerns; pyveil can remain the local sensitive-data boundary inside that architecture.
Choose enterprise DLP for managed organizational controls
pyveil does not scan images, classify office documents, manage incidents, push centralized policy, retain audit cases, or certify compliance. Those are enterprise DLP responsibilities. A small Python library can complement that system at an application boundary but cannot replace it.
A practical layered architecture
Use upstream systems to discover broad semantic entities. Feed known sensitive values into CustomRule.exact(...) when helpful. Keep pyveil at the final boundary to apply channel policy, redact credentials and structured values, and produce stable placeholders.
Pick the smallest tool that meets the required recall and operating model. Layer tools when the requirements span multiple categories.