🛡️ Shield 82M: A PII stripping/filtering model 🛡️
Posted by LH-Tech_AI@reddit | LocalLLaMA | View on Reddit | 27 comments
Hey, r/LocalLLaMA !
I am finally back with a new model: 🛡️ Shield 82M
It's a finetuned version of distilroberta-base and it's able to filter out all types of PII (Personally identifiable information) of texts in any language.
Here are some examples:
1) Test with name ,email and phone:
Original: My name is John Doe. Email: john@example.com. Phone: +49 123 45678.
Protected: My name is [PERSON]. Email: [EMAIL]. Phone: [PHONE].
2) basic test:
Original: I live in Cambridge
Protected: I live in [ADDRESS]
3) French test (multilingual):
Original: Mon e-mail est jean.dupont@example.fr et mon téléphone est +33 6 12 34 56 78.
Protected: Mon e-mail est [EMAIL] et mon téléphone est [PHONE].
So, we see that this model performs really well with a total accuracy of \~96%.
And: it's completely open-source like all my models. :D
If you want to try it out: https://huggingface.co/LH-Tech-AI/Shield-82M
Have fun with it. :-)
See you in the comments. Would really like to get some feedback from you.
Bootes-sphere@reddit
Solid contribution. One thing I'd test hard: how does it handle edge cases like variation in formatting? PII detection often breaks on stuff like "john.doe@company.com" vs "john doe @ company dot com" or dates written different ways.
Also curious about false positives on legitimate text — I've seen aggressive filtering strip things that shouldn't be redacted (product names, technical identifiers, etc.). Did you benchmark against a dataset with intentional false positives?
The 82M size is smart for local inference. What's your latency on CPU vs GPU? And are you handling structured data (JSON, CSVs) or mainly unstructured text? That matters a lot for production use.
LH-Tech_AI@reddit (OP)
Thanks so much for your great feedback.
I didn't measure the inference time, but it's very quick - especially on GPU (<100ms per text).
It can only handle unformatted text i guess (no JSON, CSVs, etc.) - but you can just try it i guess.
have fun :D
BitGreen1270@reddit
I have another follow up question if you don't mind - would this also be possible via a lora on a smaller open source model like Gemma4-E2B? What are the benefits/downsides of that approach?
LH-Tech_AI@reddit (OP)
I think, a lora on a small LLM like Gemma4-E2B would be even more impressive than my tool AND it would also "think" about the context...
But my idea was to create a model that JUST ERASES PII.
But you can try it - dataset is in the HF Repo (link above) :-)
BitGreen1270@reddit
Haha maybe in a year's time I might attempt it 😄
LH-Tech_AI@reddit (OP)
haha, okay :D
Noxusequal@reddit
Thest really cool but how does it do with secondary identifiers ? Like for example that the person is the only Doktor in a village. Or other stuff like this where you can use secondary info to identify the person.
LH-Tech_AI@reddit (OP)
Fair point :D
honestly, Shield 82M is a fast scrubber, not a 'thinking' LLM. It's only 82M params, so it won't reason through social contexts like 'only doctor in town' 😂 Its job is to find and nuke explicit tags (names, locations, jobs) as fast as possible.
Noxusequal@reddit
Also nice :) but cant you do that with smart regex ? Like phone numbers, addresses etc.
LH-Tech_AI@reddit (OP)
Maybe...i don't know
Perfect-Flounder7856@reddit
Is there a pipeline in place to scrub pii on the way out and add it back in on the way in at all?
LH-Tech_AI@reddit (OP)
No, but you can perfectly do so if you want. I think it wouldn't be too much code, i guess... :-)
Karyo_Ten@reddit
Do you have examples where this model is better than an expert system or regex or some kind of PEG grammar?
BitGreen1270@reddit
My thoughts too on whether regex would work. But given this can work on different kinds of data makes it useful i think - CSV, json, plain text, html etc.
LH-Tech_AI@reddit (OP)
Yes.
LH-Tech_AI@reddit (OP)
no, not yet. but you can try it your own if you want to :D
:-)
link: https://huggingface.co/LH-Tech-AI/Shield-82M
have fun :D
BitGreen1270@reddit
Tried this just now on a fake pii doc generated by gemini. Seems to work reasonably well. I think just a couple of callouts are the name didn't get redacted fully, left the initials in. Also if an address has multiple parts, it replaces it with multiple `[ADDRESS]` words.
Here is the input: https://ctxt.io/2/AAD4l4UrEg
Here is the output: https://ctxt.io/2/AAD4LxuHEQ
LH-Tech_AI@reddit (OP)
Okay. Great. Thanks for feedback :-)
ThirdWaveCat@reddit
Cool work! I'm using presidio for something similar and I suspect many people are. Benchmarks how it compares would be helpful.
LH-Tech_AI@reddit (OP)
Yes, you're right. I've had no time yet to benchmark it with benchmarks to compare it with other models, but it has a 96% accuracy though. :-)
Thank you
Porespellar@reddit
OpenAI released something similar a few days ago
https://openai.com/index/introducing-openai-privacy-filter/
What I really need for a use case I’m working on is a PHI filter for screening out Private Health Information.
Endlesscrysis@reddit
Synthesize a dataset and finetune it, they have guides on their repo for finetuning
LH-Tech_AI@reddit (OP)
ah, yes right. i've heard about it.
fgp121@reddit
I guess this could be useful for mobile runtime. Apps might be keen on getting such a model handy
LH-Tech_AI@reddit (OP)
Yes :D
BitGreen1270@reddit
This is very cool - can you share more on how you created a focused model like this one? Will give it a try later!
LH-Tech_AI@reddit (OP)
All info is here: https://huggingface.co/LH-Tech-AI/Shield-82M
nice, that you like it :D