Redact Personal Data Before Your LLM Sees It (Python)
Patterns found 5 of 8 pieces of personal data, a local model found the rest, and one wrong answer taught me something. A redaction step you can score.
Video #19 ยท AI security and governance
Steps in the video
Files
- llm_find.py (38 lines)
- patterns.py (26 lines)
- redact.py (22 lines)
- score_regex.py (16 lines)
- tickets.py (30 lines)
Tested with
Python 3.12.15 | ollama==0.6.3
What this does not show
Four made-up tickets with eight known items, one small local model, UK formats only, one run. A passing score on this set is not compliance and not legal advice. The model returned one wrong item and can miss or reword names. The article on pattern limits is from Protecto, a vendor of data privacy software.
Sources
Learning IT by Example.