A model learns everything in its data. The good patterns, and the bad ones. If the data contains private details, or unfair patterns, the model can learn those too.
There are three risks to watch. Private data, like email addresses, or card numbers, which a model can memorise, and repeat. Bias, where the data treats some groups of people unfairly. And harmful content, like rude replies, which the model will copy.
Here's a simple privacy scan. A regular expression is a pattern for matching text. One pattern matches email addresses. The other matches long runs of digits, like card numbers. First we scan our training set. Then a new batch of messages, before we add them. Run it. Our training set is clean. But two new messages contain private details. We'd remove those details, before training.
app.pypython
import refrom datasets import load_datasetEMAIL = re.compile(r"\S+@\S+")NUMBER = re.compile(r"\d{8,}") # card or phone numbersdef private(text): return bool(EMAIL.search(text) or NUMBER.search(text))data = load_dataset("json", data_files="tickets_train.jsonl")["train"]print("Training set flagged:", len(data.filter(lambda r: private(r["message"]))))new_batch = ["Where is my order? Email me at sam.jones@example.com", "Is Dune in stock?", "Refund to card 4929123456781234 please"]for message in new_batch: print("FLAG" if private(message) else " ok ", message)
Output
Training set flagged: 0
FLAG Where is my order? Email me at sam.jones@example.com
ok Is Dune in stock?
FLAG Refund to card 4929123456781234 please
A few good habits. Remove private details before training, or replace them with placeholders. Read a random sample of your data, with your own eyes. Check that every group of customers gets the same quality of answer. And keep a short note, describing what the data contains.
Let's recap. Models learn the bad patterns too. Watch for private data, bias, and harmful content. Scan with simple patterns. And always read a sample yourself. Next, data practice.