Knowledge Sanitization of Large Language Models

Yoichi Ishibashi, Hidetoshi ShimodairaarXiv 2023

Abstract

We explore a knowledge sanitization approach to mitigate the privacy concerns associated with large language models (LLMs). LLMs trained on a large corpus of Web data can memorize and potentially reveal sensitive or confidential information, raising critical security concerns. Our technique efficiently fine-tunes these models using the Low-Rank Adaptation (LoRA) method, prompting them to generate harmless responses such as "I don't know" when queried about specific information. Experimental results in a closed-book question-answering task show that our straightforward method not only minimizes particular knowledge leakage but also preserves the overall performance of LLMs. These two advantages strengthen the defense against extraction attacks and reduces the emission of harmful content such as hallucinations.

Introduction

Large Language Models (LLMs) are essentially massive sponges, soaking up vast quantities of data from the web. While this makes them incredibly capable, it also makes them a privacy nightmare. They often memorize sensitive information—names, addresses, and phone numbers—that can be coaxed out of them through clever prompting or "extraction attacks."

In a new paper titled "Knowledge Sanitization of Large Language Models," researchers Yoichi Ishibashi and Hidetoshi Shimodaira from Kyoto University and RIKEN AIP propose a straightforward yet effective way to scrub this sensitive data without breaking the model’s brain. Their approach focuses on teaching the model to recognize its own "forbidden" knowledge and respond with a standard refusal.

The Challenge of Unlearning

The core issue is the "right to be forgotten." When an LLM memorizes a person's private address from a training set, simply asking the model to "unlearn" it often backfires. Previous methods for unlearning frequently lead to hallucinations—instead of the real address, the model might confidently provide a fake one, which is still a failure of reliability and truthfulness.

Figure 1: Comparison of original response (leakage), traditional unlearning (hallucination), and knowledge sanitization (harmless refusal).

As illustrated in Figure 1, knowledge sanitization aims to map specific sensitive queries to a predefined harmless response like "I don’t know," avoiding the hallucination trap where unlearning creates new, false information.

Methodology: Targeted Fine-Tuning

The authors introduce Knowledge Sanitization, which differs from traditional unlearning in its goal: instead of trying to erase a weight or replace a fact with a different fact, it trains the model to refuse the query. Key technical components include:

  • LoRA (Low-Rank Adaptation): Instead of updating all billions of parameters, they use LoRA to efficiently fine-tune a small subset of weights.
  • Targeting MLP Layers: Drawing on research that suggests Multi-Layer Perceptron (MLP) layers act as the "key-value memories" of transformers, the authors specifically apply their fine-tuning here to hit the storage units directly.
  • Balanced Training Sets: They use a mixed dataset strategy to ensure the model doesn't over-generalize and start saying "I don't know" to everything.
Table 1: Examples of the datasets used: $K_F$ (knowledge to be forgotten), $K_S$ (sanitized version), and $K_R$ (knowledge to be retained).

Table 1 shows the structure of these datasets. One set ($K_S$) contains the sensitive questions paired with "I don't know," while another set ($K_R$) contains unrelated questions with their original correct answers. The researchers found an optimal "retain ratio" (roughly 15:85) between forgetting and retaining data that allows the model to stay smart while becoming more private.

Key Results and Robustness

The results on LLaMA (7B) were particularly striking, demonstrating that the model can be made safer without sacrificing general performance:

  • Effective Forgetting: Accuracy on the targeted "sensitive" questions dropped from 74.0% to 7.0%.
  • High Retention: Accuracy on unrelated questions remained almost identical, moving from 49.9% to 49.8%.
  • General Performance: On benchmarks like HellaSwag and ARC, the sanitized model performed nearly as well as the original, whereas other methods like "Negative Gradient" caused significant performance dips.
  • Robustness to Extraction: The sanitized models proved remarkably resilient to adversarial prompts. Even when prompted with contextually rich sentences designed to trick the model into revealing information, the sanitized model stayed cautious.

Conclusion

Knowledge sanitization provides a robust defense against data leakage and hallucinations in LLMs. By focusing on surgical fine-tuning of memory-storing layers and balancing refusal with retention, this method allows models to maintain their utility while respecting privacy boundaries. Future work will explore scaling this approach to handle millions of pieces of personally identifiable information (PII) across even larger training sets.

Reference: Ishibashi, Y., & Shimodaira, H. (2024). Knowledge Sanitization of Large Language Models. arXiv:2309.11852v2 [cs.CL].

Summary updated

BibTeX
@misc{ishibashi2023knowledge,
  author = {Yoichi Ishibashi and Hidetoshi Shimodaira},
  title = {{Knowledge Sanitization of Large Language Models}},
  year = {2023},
  eprint = {2309.11852},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.11852},
}
Figure