Data Privacy

What Is Data Privacy?

Data privacy refers to the right of individuals to control how their personal information is collected, used, and shared. In machine learning, privacy matters because models are trained on data collected from real people.

Private Data Can Include
  • Names and contact information
  • Medical records
  • Financial information
  • Location history
  • Browsing behavior
  • Communications

Privacy Risks in Machine Learning

ML Privacy Risks
  • Unauthorized access to sensitive training data
  • Models that memorize private information from training
  • Data breaches during storage or transmission
  • Identifiable predictions revealing personal information
  • Reidentification from supposedly anonymized datasets

Sensitive and Personal Data

Sensitive DataPersonal Data (PII)
Health and medical recordsFull name
Financial account detailsEmail address
Government ID numbersPhone number
Criminal recordsDate of birth
Religious beliefsZip code + Gender + Age
Political opinionsNational ID number
Indirect Identifiers

Zip code, occupation, age range, gender, and nationality alone may not identify a person — but combining several of them can uniquely identify many individuals.

Responsible Data Collection

Responsible data collection starts with collecting only what is actually necessary.

Questions Before Collecting
  • Does this model actually need this information?
  • Is there a less invasive way to achieve the same goal?
  • What risks would arise if this data were leaked?
Student Performance Model

May need — Study hours, grades, attendance

May NOT need — Home address, family income, medical history

Consent and Transparency

Consent Should Be
  • Voluntary — People can say no
  • Specific — People know what data will be used for
  • Informed — People understand how data will be processed
  • Revocable — People can withdraw consent
Transparency Requirements
  • Explain what data is being collected
  • Explain why it is being collected
  • Explain how long it will be stored
  • Explain who will have access

Anonymization

Anonymization removes identifying information so individuals cannot be recognized in the dataset.

Before and After Anonymization

Before — Name: Alice Chen | Email: alice@example.com | Age: 28

After — Name: (removed) | Email: (removed) | Age: 28

Limitations

Combining supposedly anonymous data points can sometimes reidentify individuals.

Example — Zip code + Gender + Date of birth can uniquely identify many individuals in a population.

Pseudonymization

Example

Alice Chen → User_48291

The original mapping is stored separately and kept secure.

Unlike anonymization, pseudonymization is reversible by authorized parties.

Encryption

Example

Readable data — "Name: Alice, Age: 28, Diagnosis: Diabetes"

Encrypted data — "3f8a2c1b7e9d..."

Only someone with the correct decryption key can read the original data.

Access Control

Medical AI System Example

Doctors — Can view patient records

Researchers — Can access anonymized data only

Administrators — Can manage accounts but not view records

Principle of Least Privilege

Each user or system should only have access to the minimum data required to do their job.

  • A recommendation model does not need users' full medical history
  • A sales model does not need employees' home addresses
  • A fraud model does not need customers' relationship status

Data Storage and Sharing

Secure Storage Practices
  • Encrypt stored data at rest
  • Regularly back up to secure locations
  • Limit access to storage systems
  • Use secure databases with access logs
Responsible Data Retention
  • Collect data only for as long as needed
  • Delete data when the purpose has been served
  • Do not retain data after consent is withdrawn
  • Communicate retention periods to users clearly

Model Privacy Risks

Risks from the Model Itself

Model inversion — An attacker queries the model to reverse-engineer private training data

Membership inference — An attacker determines whether a specific person's data was used for training

Data memorization — Large models sometimes memorize and reproduce training examples

Chatbot Training Risk

If a chatbot is trained on private conversations, it may reproduce personal details when prompted by future users.

Privacy-Preserving Techniques

Differential Privacy

Adds carefully calibrated random noise to data or model updates so individual records cannot be precisely identified.

Example — Instead of reporting exactly 47 people with a condition, report "47 ± 5" to protect individual records while preserving useful statistics.

Federated Learning

Each device trains the model locally using its own data. Only model parameter updates are shared — not the raw data.

Example — Your phone trains a typing model using your messages. The model improvements are shared, but your actual messages never leave your device.

Data Leakage vs Privacy Leakage

Data LeakagePrivacy Leakage
Test data used during trainingPrivate data exposed to unauthorized parties
Affects model validityAffects individual rights and safety
Detected through model evaluationMay go undetected for long periods
Fixed by correcting the pipelineMay require legal and regulatory action

Real-World Examples

Educational Data
  • Student grades and attendance (often needed)
  • Home address and family income (use minimum necessary)
  • Medical conditions (only if directly relevant to educational support)
Healthcare Data
  • Medical records are among the most sensitive data types
  • Shared only with authorized care providers
  • Must meet legal privacy standards in most countries
Behavioral Data
  • Browsing history
  • App usage patterns
  • Purchase history

These can reveal deeply personal information even if they seem routine.

Common Mistakes

Mistakes to Avoid
  • Collecting more data than necessary
  • Storing data without encryption
  • Using personal data without explicit consent
  • Forgetting to anonymize before sharing
  • Not having a data deletion plan

Privacy by Design

01

Design — Identify the minimum data needed from the start

02

Collection — Collect only what is necessary with clear consent

03

Storage — Encrypt and control access from day one

04

Processing — Anonymize or pseudonymize where possible

05

Sharing — Share only with necessary parties and with protections in place

06

Deletion — Delete data as soon as it is no longer needed

Responsible AI Model Requirements

A Responsible Model Should Be
  • Accurate — Produces reliable predictions
  • Fair — Does not discriminate unfairly
  • Transparent — Users understand how decisions are made
  • Private — Personal data is protected
  • Accountable — Clear chain of responsibility exists

Key Takeaways

Summary
  • Data privacy protects individuals from harm caused by misuse of personal data
  • Privacy risks include unauthorized access, model memorization, and reidentification
  • Sensitive data includes health, financial, and government records
  • Informed consent is required before collecting personal data
  • Anonymization, encryption, and access control are key protections
  • Federated learning and differential privacy protect data during model training
  • Privacy should be designed into the system from the very beginning

Need Help?

Ask the AI if you need help understanding data privacy risks, consent, anonymization, encryption, differential privacy, federated learning, or responsible AI practices.