Privacy in ML Systems
Privacy comes up in almost every ML design interview, usually as a follow-up: "what about user data?", "a user asks to be deleted, what happens to the model?", "could you train this without collecting the data at all?" It's a test of whether you see an ML system as a data system where personal information flows through many stages and gets copied at each one.
ML adds privacy problems that ordinary services don't have:
- Copies multiply. One event becomes a row in the lake, a feature in the feature store, a training example in a snapshot, a gradient in a model, an entry in an eval set, and a line in a prompt log.
- Models remember. Large models can memorize rare training examples and reproduce them: a phone number, an API key, a paragraph of someone's email. Attackers can sometimes tell whether a specific record was in the training set (membership inference) or extract training text from a model's outputs.
- Deletion is hard. Deleting a row is easy. Deleting a person's influence from a trained model isn't.
- LLMs widen the surface. Prompts contain whatever users paste in, and agents read mail, documents and records on users' behalf.
Regulations set the obligations: the GDPR in the EU (lawful basis, purpose limitation, data minimization, rights of access and erasure), CCPA/CPRA in California, HIPAA for health data in the US, and many sector- and country-specific rules. You don't need to quote articles in an interview, but you should design so these rights can be honored. This post covers the toolkit:
- Where personal data lives in an ML system.
- PII handling: detection, minimization, pseudonymization, retention.
- Consent and purpose.
- Deletion requests and retraining.
- Differential privacy.
- Federated learning.
- On-device models.
- Testing for memorization and leakage.
Where Personal Data Lives
Draw the data flow first. Every arrow is a copy, and every copy needs an owner, a retention period and a deletion path.
- Raw events and logs in Kafka and the data lake (S3 + Iceberg/Delta), often the largest and longest-lived copy.
- Feature store: offline history for training, online values for serving (see Design a Feature Store).
- Training snapshots: materialized datasets for each training run, kept for reproducibility.
- Models: weights, user embeddings in recommender towers, per-user adapters.
- Serving logs: logged features and predictions, prompts and completions for LLM apps.
- Evaluation and labeling sets: examples sent to human raters, often to a third-party vendor.
- Caches, backups and analytics extracts: the copies everyone forgets.
A useful habit in an interview: when you draw a pipeline, mark which stores hold personal data and say how long each keeps it.