Current result
39 cases
33 positive and 6 negative synthetic regression cases.
Public corpus36 expected findings
Across email, phone, card, JWT, credentials, URL, and key-value shapes.
Exact type counts1.000 precision
Zero extra findings in this supported-shape corpus.
0 false positives1.000 recall
Every labeled supported-shape finding was detected.
0 false negativesThis is a synthetic supported-shape regression corpus, not a representative real-world PII benchmark. It does not measure broad semantic names, addresses, languages, documents, images, or unknown provider formats.
What CI checks
python evaluation/evaluate.py --check exits non-zero if any case has:
- a finding count or entity type different from the expected result
- a labeled synthetic sensitive value left in redacted output
- a non-empty
Finding.raw - a negative input mutated unexpectedly
The gate runs alongside Ruff, mypy, the Python 3.8-3.14 test matrix, package build, and Twine metadata validation.
Reproduce it locally
git clone https://github.com/hyeonsangjeon/pyveil.git
cd pyveil
python -m pip install -e .
python evaluation/evaluate.py --check
python evaluation/evaluate.py --json
python evaluation/evaluate.py --benchmark
pyveil synthetic detector regression evaluation
cases: 39 (33 positive, 6 negative)
expected findings: 36
precision: 1.000
recall: 1.000
false positives: 0
false negatives: 0
mismatches: 0
scope: synthetic supported-shape regression only; not real-world PII recall
The optional benchmark reports a machine-dependent median for a fixed synthetic payload. It is diagnostic only and is not a latency service-level objective.
Built-in shapes covered by corpus v1
| Finding | Covered examples | Important limit |
|---|---|---|
EMAIL | Common addresses, plus tags, subdomains, multiples | Not a full RFC mailbox parser |
PHONE | Korean, separated international, compact E.164 | Not a country-aware phone library |
CREDIT_CARD | Separated Luhn-valid test numbers | Luhn validation does not prove a real card |
JWT | Compact three-segment shape | No signature or claims validation |
AUTH_HEADER | Bearer, Basic, Token, ApiKey | Not every custom auth scheme |
PRIVATE_KEY | PEM private-key block shape | No key validity check |
API_KEY | High-signal OpenAI, GitHub, Slack, Google, AWS shapes | Not every provider format |
URL_QUERY_SECRET | Token, key, and secret query parameters | Key-name driven |
KV_SECRET | Password, cookie, secret, token pairs | Key-name driven |
Optional Korean PII corpus (evaluation/corpus_kr.json)
The opt-in clean-room Korean PII rulepack (--rulepack kr / rulepacks=("kr",)) has its own public synthetic regression corpus with citizen and foreigner RRNs, NTS-checksummed BRNs, context-anchored Korean bank accounts, context-anchored contiguous Korean mobile numbers, and negative controls.
45 cases
31 positive and 14 negative clean-room synthetic cases.
evaluation/corpus_kr.json41 expected findings
Across KR_RRN, KR_BRN, KR_BANK_ACCOUNT, PHONE, and EMAIL.
1.000 precision
Zero false positives on invalid checksums, unanchored numbers, dates, and versions.
0 false positives1.000 recall
Every labeled supported-shape Korean PII finding was detected.
0 false negativespython evaluation/evaluate.py --corpus evaluation/corpus_kr.json --rulepack kr --check
python evaluation/evaluate.py --corpus evaluation/corpus_kr.json --rulepack kr --json
pyveil synthetic detector regression evaluation
cases: 45 (31 positive, 14 negative)
expected findings: 41
precision: 1.000
recall: 1.000
false positives: 0
false negatives: 0
mismatches: 0
scope: synthetic supported-shape regression only; not real-world PII recall
| Finding | Covered examples | Important limit |
|---|---|---|
KR_RRN | Citizen (1-4) & foreigner (5-8) hyphenated and keyword-anchored contiguous 13-digit RRNs | Enforces century-aware date and legacy mod-11 check digit by default; pass korean_pii_rules(strict_checksum=False) for randomized post-October 2020 RRNs |
KR_BRN | Hyphenated and keyword-anchored contiguous 10-digit business registration numbers | Validates NTS checksum and rejects all-same-digit placeholders; unanchored 10-digit IDs are ignored |
KR_BANK_ACCOUNT | 10-14 digit accounts near Korean bank names or account keywords | Context-anchored by design; unanchored tracking/order numbers are intentionally excluded |
PHONE (KR context) | Keyword-anchored contiguous 01[016789] mobile numbers | Requires surrounding phone/mobile context keyword to avoid colliding with arbitrary 11-digit IDs |
Reproducible local comparison benchmark
evaluation/benchmark_compare.py measures pyveil, presidio-analyzer, and guardrails-ai side by side in isolated uv virtual environments on the same Python runtime, writing verified JSON diagnostics to evaluation/benchmark-results.json.
python3 evaluation/benchmark_compare.py --python 3.12 --passes 50 --output evaluation/benchmark-results.json
Latest local measurement on Apple M6 (12 logical cores, arm64, Darwin 27.0.0) with Python 3.12.15 (2026-11-30T05:52:35Z, 50 warm passes / 1,950 documents on evaluation/corpus.json): pyveil 0.4.0 recorded 0 runtime dependencies, 262.19 KB (0.256 MB) installed footprint, 13.028 ms median cold import+init, 0.0125 ms warm median / 0.0202 ms p95 per document (73,212.6 docs/sec), and 1.000 precision / 1.000 recall on both the 20-case shared PII subset and the 39-case full corpus.
See the measured local comparison table for exact verbatim numbers for presidio-analyzer 2.2.366 and guardrails-ai 0.11.0, including air-gap status and fair NER scope disclosure.
Source and contribution policy
The corpus and evaluator are standard-library Python and ship in the source distribution. Detector changes must add focused synthetic positive and negative cases, preserve the no-raw-value contract, and document provenance.