The Basics of Differential Privacy & Its Applicability to NLU Models

Oct 18, 2022
Share this post
Sharing to FacebookSharing to LinkedInSharing to XSharing to Email

Over the years, large pre-trained language models like BERT and Roberta have led to significant improvements in natural language understanding (NLU) tasks. However, these pre-trained models pose a risk of potential data leakage if the training data includes any personally identifiable information (PII). To mitigate this risk, there are two common techniques to preserve privacy: differential privacy (DP) and data sanitization. This post will focus on the former and outline the basics of differential privacy, its notations, its privacy benefits, and its utility trade-offs.

What is Differential Privacy?

Differential privacy allows for statistical information to be inferred from a collection of data without compromising the privacy of individuals, while quantifying the degree to which private data is protected. It helps protect the privacy of individuals by limiting the amount of specific information that could be learned about a single person within a dataset.

An example of this would be: company X builds a predictive model to identify what consumers are most likely to buy based on their purchase history. A differential privacy algorithm is used to add noise to the gradient in the model training phase to ensure that the private information of any one user isn’t heavily memorized by the model, while trying to limit negative effects on model accuracy.

Use case: Reducing Privacy Risks in Large Language Models

Large language models are vulnerable to various inference attacks. However, applying differential privacy while training language models could significantly reduce such risk. If you’re dealing with privacy and NLU models, there are several research papers that exist about the benefits. It is important for businesses and data teams to be aware of privacy risks because data breaches can result in the loss of millions of dollars.

Getting Technical

To better understand differential privacy and how it can be used to quantify protected data, we can look at two databases, x and y, as an example. They must differ only by a single record and a randomized algorithm M, which takes a database and outputs a number. From this, we can note that algorithm M is differentially private if the output M(x) and M(y) are almost indistinguishable from each other, regardless of the choice of x and y.

Formal differential privacy definition.
Source:
The Algorithmic Foundations of Differential Privacy

In practice, M(x) is usually composed of 𝑓(𝑥), a deterministic transformation of x, and a noise value drawn from a random distribution. In Laplace Mechanism, 𝑀(𝑥)=𝑓(𝑥)+𝜂, where 𝜂 is sampled from Laplace distribution.

An example of two Laplace distributions with different means and same variance.


Applying Differential Privacy to Deep Learning & Synthesizing Production Workflows

You can apply differential privacy to train machine learning algorithms by integrating differentially private stochastic gradient descent (DP-SGD).

Stochastic gradient descent (SGD) is an optimization algorithm used in machine learning to locate model parameters that correspond the best fit between actual outputs and predicted outputs. SGD and its variants such as batch, stochastic, and mini-batch are also commonly used to optimize neural networks. DP-SGD is a variant of SGD that preserves (𝜖, 𝛿) differential privacy while optimizing the neural network.

Source: Deep Learning with Differential Privacy

The major differences to SGD are highlighted with green and blue boxes in the image above. Namely, clipping gradients in each batch, so that each gradient norm is limited to be at most C, then adding Gaussian noise to the sum of clipped gradients.

Intuitively, clipping individual gradients ensures that each example has limited influence on the parameter update, whereas adding noise to the gradients prevents examples from being traced.

These techniques used to integrate differential privacy into deep learning models have been adapted to NLU use cases, some of which we cover in this article on The Privacy Risk of Language Models.

Key Takeaways

Differential privacy can be a useful tool for preserving privacy for machine learning models. Although there are a few drawbacks (which we will cover in another post) such as degraded performance and still being vulnerable to inference attacks, this method can still enable the model to learn from the personal information from large groups of individuals without memorizing individuals’ rarely-occurring information.

Unsure whether your NLU models are privacy-preserving? Book a call with one of our privacy implementation experts to learn more.

Sign up for our Community API

The “get to know us” plan. Our full product, but limited to 75 API calls per day and hosted by us.

Get Started Today

Data Left Behind: AI Scribes’ Promises in Healthcare

Why is linguistics essential when dealing with healthcare data?

Why Health Data Strategies Fail Before They Start

Private AI to Redefine Enterprise Data Privacy and Compliance with NVIDIA

EDPB’s Pseudonymization Guideline and the Challenge of Unstructured Data

HHS’ proposed HIPAA Amendment to Strengthen Cybersecurity in Healthcare and how Private AI can Support Compliance

Japan's Health Data Anonymization Act: Enabling Large-Scale Health Research

What the International AI Safety Report 2025 has to say about Privacy Risks from General Purpose AI

Private AI 4.0: Your Data’s Potential, Protected and Unlocked

How Private AI Facilitates GDPR Compliance for AI Models: Insights from the EDPB's Latest Opinion

Navigating the New Frontier of Data Privacy: Protecting Confidential Company Information in the Age of AI

Belgium’s Data Protection Authority on the Interplay of the EU AI Act and the GDPR

Enhancing Compliance with US Privacy Regulations for the Insurance Industry Using Private AI

Navigating Compliance with Quebec’s Act Respecting Health and Social Services Information Through Private AI’s De-identification Technology

Unlocking New Levels of Accuracy in Privacy-Preserving AI with Co-Reference Resolution

Strengthened Data Protection Enforcement on the Horizon in Japan

How Private AI Can Help to Comply with Thailand's PDPA

How Private AI Can Help Financial Institutions Comply with OSFI Guidelines

The American Privacy Rights Act – The Next Generation of Privacy Laws

How Private AI Can Help with Compliance under China’s Personal Information Protection Law (PIPL)

PII Redaction for Reviews Data: Ensuring Privacy Compliance when Using Review APIs

Independent Review Certifies Private AI’s PII Identification Model as Secure and Reliable

To Use or Not to Use AI: A Delicate Balance Between Productivity and Privacy

To Use or Not to Use AI: A Delicate Balance Between Productivity and Privacy

News from NIST: Dioptra, AI Risk Management Framework (AI RMF) Generative AI Profile, and How PII Identification and Redaction can Support Suggested Best Practices

Handling Personal Information by Financial Institutions in Japan – The Strict Requirements of the FSA Guidelines

日本における金融機関の個人情報の取り扱い - 金融庁ガイドラインの要件

Leveraging Private AI to Meet the EDPB’s AI Audit Checklist for GDPR-Compliant AI Systems

Who is Responsible for Protecting PII?

How Private AI can help the Public Sector to Comply with the Strengthening Cyber Security and Building Trust in the Public Sector Act, 2024

A Comparison of the Approaches to Generative AI in Japan and China

Updated OECD AI Principles to keep up with novel and increased risks from general purpose and generative AI

Is Consent Required for Processing Personal Data via LLMs?

The evolving landscape of data privacy legislation in healthcare in Germany

The CIO’s and CISO’s Guide for Proactive Reporting and DLP with Private AI and Elastic

The Evolving Landscape of Health Data Protection Laws in the United States

Comparing Privacy and Safety Concerns Around Llama 2, GPT4, and Gemini

How to Safely Redact PII from Segment Events using Destination Insert Functions and Private AI API

WHO’s AI Ethics and Governance Guidance for Large Multi-Modal Models operating in the Health Sector – Data Protection Considerations

How to Protect Confidential Corporate Information in the ChatGPT Era

Unlocking the Power of Retrieval Augmented Generation with Added Privacy: A Comprehensive Guide

Leveraging ChatGPT and other AI Tools for Legal Services

Leveraging ChatGPT and other AI tools for HR

Leveraging ChatGPT in the Banking Industry

Law 25 and Data Transfers Outside of Quebec

The Colorado and Connecticut Data Privacy Acts

Unlocking Compliance with the Japanese Data Privacy Act (APPI) using Private AI

Tokenization and Its Benefits for Data Protection

Private AI Launches Cloud API to Streamline Data Privacy

Processing of Special Categories of Data in Germany

End-to-end Privacy Management

Privacy Breach Reporting Requirements under Law25

Migrating Your Privacy Workflows from Amazon Comprehend to Private AI

A Comparison of the Approaches to Generative AI in the US and EU

Benefits of AI in Healthcare and Data Sources (Part 1)

Privacy Attacks against Data and AI Models (Part 3)

Risks of Noncompliance and Challenges around Privacy-Preserving Techniques (Part 2)

Enhancing Data Lake Security: A Guide to PII Scanning in S3 buckets

The Costs of a Data Breach in the Healthcare Sector and its Privacy Compliance Implications

Navigating GDPR Compliance in the Life Cycle of LLM-Based Solutions

What’s New in Version 3.8

How to Protect Your Business from Data Leaks: Lessons from Toyota and the Department of Home Affairs

New York's Acceptable Use of AI Policy: A Focus on Privacy Obligations

Safeguarding Personal Data in Sentiment Analysis: A Guide to PII Anonymization

Changes to South Korea’s Personal Information Protection Act to Take Effect on March 15, 2024

Australia’s Plan to Regulate High-Risk AI

How Private AI can help comply with the EU AI Act

Comment la Loi 25 Impacte l'Utilisation de ChatGPT et de l'IA en Général

Endgültiger Entwurf des Gesetzes über Künstliche Intelligenz – Datenschutzpflichten der KI-Modelle mit Allgemeinem Verwendungszweck

How Law25 Impacts the Use of ChatGPT and AI in General

Is Salesforce Law25 Compliant?

Creating De-Identified Embeddings

Exciting Updates in 3.7

EU AI Act Final Draft – Obligations of General-Purpose AI Systems relating to Data Privacy

FTC Privacy Enforcement Actions Against AI Companies

The CCPA, CPRA, and California's Evolving Data Protection Landscape

HIPAA Compliance – Expert Determination Aided by Private AI

Private AI Software As a Service Agreement

EU's Review of Canada's Data Protection Adequacy: Implications for Ongoing Privacy Reform

Acceptable Use Policy

ISO/IEC 42001: A New Standard for Ethical and Responsible AI Management

Reviewing OpenAI's 31st Jan 2024 Privacy and Business Terms Updates

Comparing OpenAI vs. Azure OpenAI Services

Quebec’s Draft Regulation Respecting the Anonymization of Personal Information

Version 3.6 Release: Enhanced Streaming, Auto Model Selection, and More in Our Data Privacy Platform

Brazil's LGPD: Anonymization, Pseudonymization, and Access Requests

LGPD do Brasil: Anonimização, Pseudonimização e Solicitações de Acesso à Informação

Canada’s Principles for Responsible, Trustworthy and Privacy-Protective Generative AI Technologies and How to Comply Using Private AI

Private AI Named One of The Most Innovative RegTech Companies by RegTech100

Data Integrity, Data Security, and the New NIST Cybersecurity Framework

Safeguarding Privacy with Commercial LLMs

Cybersecurity in the Public Sector: Protecting Vital Services

Privacy Impact Assessment (PIA) Requirements under Law25

Elevate Your Experience with Version 3.5

Fine-Tuning LLMs with a Focus on Privacy

GDPR in Germany: Challenges of German Data Privacy (Part 2)

Comply with US Executive Order on Safe, Secure, and Trustworthy Artificial Intelligence using Private AI

How to Comply with EU AI Act using PrivateGPT

Navigating the Privacy Paradox: A Guide to Ethical Fine-Tuning of Large Language Models

Adding Privacy to LangChain with Private AI