NotesMaking Tools

Why I built a small model that checks text before it goes to an AI

Companies using AI do not want personal or more sensitive information going into it. This is why I built Safe Privacy Detect, a small Japanese-language model that checks a text for that information before the AI is asked anything, and what it cannot do.

Making Tools Build Note

Written by k-wada (Legacy Tools)

この記事を日本語で読む

Diagram of a sheet of text arriving at a box labelled "check first", with the AI beyond it not yet sent anything
A conceptual diagram of the article, not a real screen.

A company using AI does not want personal information, or anything more sensitive than that, going into it. So I wanted a way to tell whether a text contains that kind of information before asking the AI anything. That is why I built a small model called Safe Privacy Detect.

Checking before the AI is asked

If you inspect a text after handing it to an AI, the AI already has it. I wanted the check to sit in front.

Safe Privacy Detect reads a Japanese text once and checks whether it states any of six things:

  • a person's full name
  • health, medical history or disability
  • criminal record or criminal proceedings
  • registered domicile (honseki, an entry in Japan's family register)
  • trade union membership
  • religion or political views

For each one it returns "detected", "not detected" or "abstain". It does not generate text. It does not point to where the information appears, and it does not mask anything. It does not decide whether the text may be sent either. That decision stays with the people and systems using it.

Keeping it cheap

The other reason was cost. A check that runs before the AI is cheaper.

The model is a classifier with about 70 million parameters. I built it to run on four CPUs with no GPU.

Nothing like it existed

As far as I knew, nothing existing did this. So I made it.

I had no particular expectations going in. I paid for it out of my own pocket money, and I have less pocket money now.

What to know before using it

In the evaluation, it returned "not detected" for 0.5% to 5.0% of sentences that did state one of the six things. The evaluation used 1,800 synthetic sentences, 6 to 110 characters long. I have not measured its accuracy on real business text.

The model is published on Hugging Face and Kaggle (both external sites) under the MIT licence, with no warranty. It works on Japanese text only. Target definitions, speed and evaluation results are on the specification page, and an overview with the limitations is on the Safe Privacy Detect page. Both pages are in Japanese.

This article does not cover how the model was built.

Tags: Generative AI・Personal information・Classification model