Skip to content

feat: benchmark and latency numbers in EVALS (D9) - #11

Merged
makoydev merged 1 commit into
nextfrom
feat/39-benchmark
Oct 5, 2026
Merged

makoydev merged 1 commit into
nextfrom
feat/39-benchmark

Conversation

@makoydev

@makoydev makoydev commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes makoydev/vetted#39 (D9).

Results (all in EVALS.md, reproduce with make bench)

Samples 5,000 from a seeded generator written independently of the rules; 7,531 pieces of personal data plus look-alike decoys
Recall 76.5% overall; 100% on every supported writing style. Misses are all unsupported styles: spaced or hyphenated NRICs, 2-2-2-2 phones, double-spaced cards, obfuscated emails, postal codes without a clue, units without #, DOB after "Birthday" or with a 2-digit year
Precision 92.3%: all 482 false alarms are bare 8-digit order and batch numbers read as PHONE (the accepted trade-off, sg-pii-rules ADR 0007); other entities had none
Latency About 3.0 ms added at p50 (4.1–4.8 ms p95). Measured split: 2.9 ms is the audit record flushed to disk, 0.08 ms is detection

Method notes

  • "Caught" means fully covered by a detection of the same kind; partly covered counts as missed, because it still leaks.
  • Latency is compared against a baseline server doing the same HTTP and JSON work and mock call without Discreet. p99 varied between runs (4.7 and 11.7 ms), so it's reported as indicative.
  • Deliberate break: the generator ignoring its seed failed the determinism test; restored from backup.

If asked in an interview

I measured detection on 5,000 made-up samples from a generator I wrote separately from the rules, including ways of writing personal data I expected the rules to miss, so the numbers can't simply confirm themselves. The result is a per-style picture: 100% on the formats the rules cover, and a clear list of formats they don't. Most of the 3 ms Discreet adds is writing each audit record safely to disk, which I measured rather than guessed. I rejected reusing the shared test cases as the benchmark, because rules always pass the examples they were written for.

🤖 Generated with Claude Code

- internal/bench: a seeded generator written independently of the rules
  (own NRIC checksum and Luhn, own templates) producing 5,000 samples
  with 0-3 pieces of personal data in realistic styles, some the rules
  don't support, plus look-alike decoys. Scored per entity and per
  writing style; "caught" means fully covered by the same kind.
- cmd/benchmark (make bench) prints Markdown: 76.5% recall overall, 100%
  on every supported style, 92.3% precision (482 false alarms, all bare
  8-digit numbers as PHONE, the trade-off in sg-pii-rules ADR 0007).
- Latency vs a baseline without Discreet: about 3 ms added at p50, of
  which 2.9 ms is the audit record flushed to disk and 0.08 ms detection.
- Deliberate break (seed ignored) failed the determinism test; restored.

Closes makoydev/vetted#39

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@makoydev makoydev added ai-drafted Change drafted by Claude Code; reviewed and merged by a human ai-merged Merged into next by Claude Code after checks passed; Michael reviews next -> main labels Oct 5, 2026
@makoydev
makoydev merged commit e2df83e into next Oct 5, 2026
6 checks passed
@makoydev
makoydev deleted the feat/39-benchmark branch October 5, 2026 15:11
makoydev added a commit that referenced this pull request Oct 5, 2026
- internal/bench: a seeded generator written independently of the rules
  (own NRIC checksum and Luhn, own templates) producing 5,000 samples
  with 0-3 pieces of personal data in realistic styles, some the rules
  don't support, plus look-alike decoys. Scored per entity and per
  writing style; "caught" means fully covered by the same kind.
- cmd/benchmark (make bench) prints Markdown: 76.5% recall overall, 100%
  on every supported style, 92.3% precision (482 false alarms, all bare
  8-digit numbers as PHONE, the trade-off in sg-pii-rules ADR 0007).
- Latency vs a baseline without Discreet: about 3 ms added at p50, of
  which 2.9 ms is the audit record flushed to disk and 0.08 ms detection.
- Deliberate break (seed ignored) failed the determinism test; restored.

Closes makoydev/vetted#39

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-drafted Change drafted by Claude Code; reviewed and merged by a human ai-merged Merged into next by Claude Code after checks passed; Michael reviews next -> main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant