Privacy-Preserving AI and Security

Key points

  • AI models can memorise training data; inference reveals personal information; anonymised data may be re-identifiable with auxiliary information
  • Privacy by design: data minimisation, purpose limitation, encryption, access controls, and anonymisation built in from the start
  • Differential privacy: add calibrated noise for provable privacy guarantees; trade-off between privacy (epsilon) and utility
  • Federated learning: train models without centralising data; data stays local, only model updates shared; reduces cross-border transfer issues
  • Adversarial attacks: evasion (fool at inference), poisoning (corrupt training), model inversion (reconstruct data), extraction (steal model), prompt injection (override instructions)
  • Lawful basis for AI processing: consent, legitimate interest, contract, or legal obligation — not just consent; BoK v2.1 emphasis
  • GDPR Article 22: right not to be subject to solely automated decisions with legal/significant effects; requires human intervention safeguard
  • Special category data (biometrics, health, race) requires explicit consent or Article 9(2) basis; may trigger EU AI Act prohibited or high-risk classification

Privacy-Preserving AI and Security

Protecting privacy and ensuring security are fundamental to responsible AI. This lesson covers the privacy risks specific to AI, privacy-preserving techniques, AI security threats, and how existing data privacy laws apply to AI systems.

Privacy Risks in AI

Training Data Privacy

AI models, particularly large neural networks, can memorise individual training examples and leak them through their outputs. Research has shown that it is possible to extract verbatim training data from language models through carefully crafted prompts, reconstruct faces and other sensitive data from models trained on private datasets, and determine whether a specific individual's data was part of the training set (membership inference). These risks exist even when the training data is no longer directly accessible, because the model's parameters encode information about the data it was trained on.

Inference Privacy

Even when a model does not directly leak training data, the act of making predictions can reveal sensitive information. A health risk prediction reveals health status. A credit score reveals financial circumstances. A behavioural prediction may reveal sensitive personal characteristics (sexual orientation, political views, religious beliefs) that the individual has not disclosed. The model does not need to have been explicitly trained on these attributes; it can infer them from correlations in the data.

Re-identification Risk

Data that has been anonymised or pseudonymised for AI training may be re-identifiable when combined with other data sources. Research has demonstrated that a small number of data points (as few as four spatiotemporal data points from mobile phone metadata) can uniquely identify most individuals. The combination of features used in AI training often provides enough information for re-identification, even when no single identifier is present.

Privacy by Design

Privacy by design requires building privacy protections into the AI system from the ground up rather than retrofitting them later. Data minimisation means collecting only the data genuinely necessary for the AI's purpose and deleting it when no longer needed. Purpose limitation means using data only for the specific purpose for which it was collected, not repurposing it for AI training without additional justification. Technical controls include encryption at rest and in transit, role-based access controls, data masking, secure deletion, and anonymisation or pseudonymisation where possible. Organisational controls include privacy policies, user consent mechanisms, transparency about data use, and mechanisms for exercising data subject rights.

Privacy-Preserving Techniques

Differential Privacy

Differential privacy is a mathematical framework for protecting individual privacy while allowing useful statistical analysis. The core idea is to add carefully calibrated random noise to data or computation results so that the output does not reveal whether any specific individual's data was included. The noise is small enough that aggregate statistics remain useful but large enough that no individual record can be isolated.

Differential privacy provides formal, provable privacy guarantees rather than relying on ad-hoc anonymisation that may be defeated by creative adversaries. It has been adopted by organisations including Apple (for usage analytics), Google (for Chrome browsing data), and the US Census Bureau (for the 2020 census). The fundamental trade-off is between privacy and utility: more noise provides stronger privacy but reduces the accuracy of the results. The "privacy budget" (epsilon) quantifies this trade-off; a smaller epsilon means stronger privacy.

Federated Learning

Federated learning trains AI models without centralising data. Instead of collecting all data in one location, the model is sent to each data source (a user's device, a hospital's server, a bank's database), trained locally on the local data, and only the model updates (not the raw data) are sent back to a central server for aggregation. The raw data never leaves its original location.

Federated learning offers privacy by design (data stays under the data subject's or organisation's control), reduced cross-border data transfer (relevant for GDPR and other laws restricting international data movement), and the ability to train on data that cannot legally or practically be centralised. Challenges include communication overhead (sending model updates back and forth), slower convergence than centralised training, difficulty in debugging and quality assurance, and the fact that model updates can still leak some information about the underlying data (requiring additional protections such as differential privacy applied to the updates).

Homomorphic Encryption

Homomorphic encryption allows computation on encrypted data without decrypting it. In theory, this enables a model to make predictions on encrypted input data, with the result also encrypted, so that neither the data nor the prediction is ever exposed in plaintext. The promise is complete privacy: the computation service never sees the actual data. In practice, homomorphic encryption is computationally expensive (orders of magnitude slower than computation on plaintext), limited in the types of operations it can efficiently support, and not yet practical for most real-world AI applications, though it is an active area of research.

Secure Multi-party Computation

Secure multi-party computation allows multiple parties to jointly compute a function over their combined data without any party revealing its individual data to the others. For example, two hospitals could jointly train a model on their combined patient data without either hospital seeing the other's patients. This approach provides formal privacy guarantees and is verifiable, but is limited by communication costs, coordination complexity, and the number of parties involved.

AI Security

Adversarial Attacks

AI systems face security threats that differ fundamentally from traditional IT security.

Evasion Attacks manipulate inputs at inference time to fool the model. Carefully crafted perturbations to an image (often invisible to humans) can cause a classifier to misidentify the image with high confidence. In security-critical applications (autonomous vehicles, malware detection, biometric authentication), evasion attacks can have severe consequences.

Poisoning Attacks corrupt the model by manipulating its training data. An attacker who can inject poisoned examples into the training dataset can cause the model to learn incorrect patterns, create backdoors that trigger specific misclassifications, or degrade overall model performance. Defending against poisoning requires robust data provenance, quality assurance, and anomaly detection in training pipelines.

Model Inversion Attacks reconstruct information about training data by querying the model. By observing the model's outputs for carefully chosen inputs, an attacker can infer sensitive attributes of individuals in the training data or even reconstruct approximate representations of training examples.

Model Extraction Attacks create a functional copy of the model by systematically querying it and using the input-output pairs to train a surrogate model. This steals the model's intellectual property and may also reveal information about the training data.

Prompt Injection targets LLM-based systems by embedding malicious instructions in user inputs that override the system's intended instructions. A prompt injection might cause a customer service chatbot to reveal confidential information, bypass content filters, or take actions outside its intended scope.

Defence Strategies

Defending against AI-specific security threats requires adversarial training (training the model on adversarial examples to improve robustness), input validation (detecting and filtering anomalous inputs before they reach the model), output monitoring (detecting anomalous outputs that may indicate successful attacks), model watermarking (embedding identifiers in the model that survive extraction attempts), access controls (limiting who can query the model and how frequently), rate limiting (preventing the large number of queries needed for extraction attacks), and red teaming (proactively testing the model's defences before deployment and periodically during operation).

Data Privacy Laws Applied to AI (BoK II.A)

The AIGP exam requires understanding how existing data privacy laws apply specifically to AI systems.

Transparency, Lawful Basis, and Purpose Limitation

Privacy laws require organisations to inform individuals about how their data is used. When data is used to train AI or when AI makes decisions about individuals, organisations must disclose the existence of AI-based processing, the logic involved, the significance and envisaged consequences, and the data sources used.

Processing personal data for AI requires a lawful basis under GDPR and similar laws. Common bases include consent (freely given, specific, informed, and unambiguous), legitimate interest (requires a balancing test weighing the organisation's interest against the individual's rights; commonly used for model training and deployment), contract performance (when AI processing is necessary to fulfil a contract), and legal obligation (when required by law). The BoK v2.1 has shifted its framing from "notice and consent" to "lawful basis and transparency," recognising that consent is only one of several legal grounds.

Purpose limitation means that personal data collected for one purpose (providing a service) may not automatically be used for a different purpose (training an AI model) without additional justification, a compatibility assessment, or fresh consent.

Data Minimisation and Privacy by Design

AI systems are data-hungry by nature, creating tension with the data minimisation principle that requires organisations to process only data that is adequate, relevant, and limited to what is necessary. Organisations must consider whether anonymised or synthetic data could serve the purpose, implement privacy by design from the outset, and apply techniques like differential privacy, federated learning, or data aggregation to reduce privacy risk while maintaining AI utility.

Controller Obligations Applied to AI

Data Protection Impact Assessments (DPIAs): GDPR Article 35 requires a DPIA when processing is likely to result in a high risk to individuals. Systematic and extensive evaluation of personal aspects based on automated processing, including profiling, explicitly triggers this requirement. Most AI-driven decision-making systems that affect individuals will require a DPIA.

Third-party Processors: When using AI tools from third-party providers, the data controller must ensure adequate data processing agreements are in place, the processor provides sufficient guarantees of GDPR compliance, data transfers to the processor are lawful (adequate safeguards for transfers outside the EEA), and the controller retains oversight of the processing.

Cross-border Data Transfers: AI development often involves processing data across jurisdictions. Transfers outside the EEA require adequate safeguards such as Standard Contractual Clauses (SCCs), Binding Corporate Rules (BCRs), or an adequacy decision by the European Commission.

Data Subject Rights: Individuals retain rights that must be accommodated in AI systems: the right of access (what data was used, what decisions were made), rectification (correcting inaccurate data, which may require retraining), erasure (removing data from training sets on request, raising significant technical challenges), restriction of processing, data portability, and the right to object to processing.

Automated Decision-making (GDPR Article 22): Individuals have the right not to be subject to decisions based solely on automated processing that produce legal or similarly significant effects. When such automated decisions are permitted, organisations must provide meaningful information about the logic involved, implement safeguards including the right to obtain human intervention, and enable individuals to express their point of view and contest the decision.

Breach Notification: Personal data breaches involving AI systems must be reported to the supervisory authority within 72 hours under GDPR, and to affected individuals when the breach is likely to result in a high risk to their rights and freedoms.

Sensitive and Special Categories of Data

Processing special categories of data under GDPR (racial or ethnic origin, political opinions, religious beliefs, trade union membership, genetic data, biometric data for identification, health data, data concerning sexual orientation) requires either explicit consent or another specific legal basis enumerated in Article 9(2). AI systems that process biometric data for identification face particularly stringent requirements and may fall under the EU AI Act's prohibited or high-risk categories.

Practise AIGP questions

Members get the AIGP question bank with explanations, flashcards, timed mock exams, Privacy Pro AI, progress tracking and the Pass Guarantee.