Fine-Tuning LLMs with a Focus on Privacy

Nov 9, 2023
Share this post
Sharing to FacebookSharing to LinkedInSharing to XSharing to Email

This blog has an accompanying Jupyter Notebook! Access the notebook

Large Language Models (LLMs) like Azure’s OpenAI service have become pivotal technology, enabling machines to understand and generate human-like replies to questions posed in a chat format. For organizations looking to augment those models with domain specific knowledge or for traditional ML applications such as sentiment analysis, fine tuning has emerged as an approach to perform specialized tasks with a higher degree of accuracy and relevance. However, a critical concern emerges when fine-tuning involves data containing Personally Identifiable Information (PII). This blog embarks on a journey to explore why generative AI entails more risk from a privacy perspective than previous ML techniques and demonstrates how redacting PII before fine-tuning can mitigate this problem.

Section 1: Unraveling the Fine-Tuning of LLMs

Fine-tuning involves adapting pre-trained LLMs to a specific domain or task by training them further on a particular dataset, enhancing their utility and accuracy in specialized applications. This process is crucial, especially in domains that require specialized knowledge, such as technology, finance, or healthcare. Here, we dive deeper into the stark difference between generic LLM responses and those from a fine-tuned model.

Consider an open dataset from Nvidia, which contains detailed information and specifications about various graphics processing units (GPUs). When developers or data scientists query an LLM about specific GPU attributes or features, the responses from an un-fine-tuned model may lack accuracy and specific insights present in the dataset.

Code Example 1: Querying an Un-Fine-Tuned LLM:

Want to see the code? Try it here

In this instance, the un-fine-tuned LLM provides an answer that seems plausible at first glance. However, it is not accurate according to the specific dataset. This is an example of a model hallucination, where the model generates a response that sounds reasonable but is not substantiated by the training data.

The reason for this incorrect response is because the base knowledge of the LLM lacks insight into the domain. As a result, it is forced to leverage the information it does have to try and answer the request.

Code Example 2: Interaction with a Fine-Tuned LLM

Embarking further, let's delve into an interaction with an LLM that has been fine-tuned using a domain-specific dataset, in this case, an open dataset from Nvidia. Fine tuning involves augmenting the knowledge of an LLM with additional data to provide it with domain expertise needed to answer new kinds of questions. For example, without additional information provided in a prompt, ChatGPT wouldn’t know the details of an organization's internal HR policies or answer questions around proprietary and confidential information. In our example, the enriched model is now capable of providing detailed and accurate responses to queries related to Nvidia GPUs.

Want to see the code? Try it here

This response, which aligns with the specifics of the Nvidia dataset, underscores the value of fine-tuning. It provides a precise and accurate answer that reflects the specialized knowledge contained within the training data. Because the model was fine tuned with domain information, it is now able to answer the question appropriately.

However, the precision and specialization that come with fine-tuning also present potential pitfalls, especially when it comes to handling sensitive or private information. For instance, if the dataset used for fine-tuning contains PII or other sensitive details, the model might inadvertently expose this data in its responses. Let’s take a look at an example.

While the Nvidia dataset being used contains publicly available data, let’s assume that information about specific people, or organizations are in fact private. For example, imagine an organization was developing a top secret AI system that could generate and sing songs.

Want to see the code? Try it here

In the accompanying graphic, we see a scenario that underscores the potential risks involved when privacy measures are overlooked. The illustration shows a chatbot, initially designed to interact seamlessly with users, responding to a query about generating and singing songs. However, instead of a generic response, the chatbot leaks sensitive information, revealing details about a specific organization's confidential data. This was the case with ScatterLab who trained a chatbot on the personal conversations of their users and inadvertently exposed their private data.

Data leaks like this occur because if one inspects the training data more closely, all sorts of PII are observed such as names, locations, dates and other sensitive information. When LLMs such as Azure OpenAI are trained on this data, they not only learn the domain expertise, but also information about private data too.

This serves as a stark reminder of the unintended consequences of inadequate data privacy measures. In this instance, the confidential details of the organization's project were not redacted from the dataset, leading to an AI mishap that not only breaches privacy but also potentially compromises the organization's competitive advantage. The domino effect that can result from a single oversight in data privacy, highlighting the critical need for stringent data sanitization practices in every step of AI development.

Section 2: Redaction as a Means of Preserving Privacy in Training Data

In the previous section, we saw that fine-tuning LLMs with sensitive but powerful data risks exposing that data. That's where 'redaction' comes in. Redaction is a straightforward yet effective method for protecting privacy. It involves deliberately altering or removing sensitive information from datasets before they're used for training. This way, personal or confidential details aren't just shielded from public view; they're kept entirely out of the AI's learning process.

Redaction, a tried and tested technique long utilized in the legal space, is rapidly becoming a crucial necessity in the field of AI. It's worth noting that the concept of redaction is easily grasped by non-technical data custodians, such as call centre managers at banks, in contrast to more complex methodologies like differential privacy. By systematically obscuring personal identifiers or sensitive information, redaction ensures that the consequential essence of the data remains intact for model training, while the privacy of individuals is uncompromised.

Code Example 3: Querying a LLM Fine-Tuned with Redacted Data:

Want to see the code? Try it here

The application of redaction extends beyond just removing text or data points; it's an intricate process involving various techniques such as data masking, tokenization, and pseudonymization, each catering to different needs and levels of privacy preservation. This strategic alteration allows AI to learn patterns and make decisions based on data trends rather than individual profiles.

While these methods contribute to protecting sensitive information, the clear format of the redaction markers mean it’s also easy to re-identify PII when necessary. For users with appropriate permissions, data can be “re-hydrated”. For example, one could discern what 'organization_1' represents, when required for legitimate purposes.

RAG, Prompt Engineering and Other Approaches

While this discussion primarily revolves around fine-tuning as a means to enhance language models' proficiency in specific domains, it's important to acknowledge the existence of other effective strategies. One notable method is the Retrieval-Augmented Generation (RAG) approach, which combines the retrieval of documents from a vast corpus and the generation capabilities of large language models to produce more informed responses. Techniques like RAG can significantly improve a model's ability to handle queries without the need for extensive retraining or fine-tuning. However, irrespective of the method employed, the critical principle of data privacy remains constant. Every approach requires some level of interaction with data, and it's our responsibility to ensure that this data is handled with the utmost regard for privacy.

Conclusion

As we traverse the path of utilizing LLMs, prioritizing privacy by redacting PII during fine-tuning becomes imperative. The intersection of utility and privacy in AI systems is a continually evolving landscape, and your insights could pave the way for new breakthroughs. We invite you to share your thoughts and experiences in managing privacy during LLM fine-tuning, contributing to the responsible advancement of AI technology.

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

Data Left Behind: Healthcare’s Untapped Goldmine

The Future of Health Data: How New Tech is Changing the Game

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