Mitigating Unintended Memorization with LoRA in Federated Learning for LLMs

Thierry Bossy, Julien Tuấn Tú Vignoud, Tahseen Rabbani, Juan R. Troncoso Pastoriza, Martin Jaggi

TL;DR

Large Language Models (LLMs) can inadvertently memorize and reveal sensitive training data, even when trained using federated learning (FL). This paper shows that Low-Rank Adaptation (LoRA), a parameter-efficient fine-tuning technique, significantly reduces this memorization in FL by up to 10x with minimal performance loss, making it a promising approach for privacy-preserving LLM deployment.

What Problem Does This Paper Address?

Federated learning (FL) is a privacy-preserving approach where multiple clients collaboratively train a model without sharing their raw data. However, even with FL, LLMs can still memorize and potentially leak sensitive information from the training data. This "unintended memorization" means that given a prompt, the LLM might complete it with verbatim text from its training set, posing a significant privacy risk, especially in sensitive domains like medicine, law, and finance. Existing methods for mitigating memorization often come with substantial performance costs or are complex to implement. This paper investigates whether LoRA, a popular and efficient fine-tuning method, can effectively reduce memorization in FL without sacrificing model performance.

Methods

The core of this research lies in evaluating the effectiveness of Low-Rank Adaptation (LoRA) in mitigating unintended memorization within a federated learning (FL) setup for Large Language Models (LLMs). LoRA works by injecting small, trainable low-rank matrices into the pre-trained model's layers, updating only these new parameters while keeping the original weights frozen. This drastically reduces the number of parameters to train and the size of model updates, making it computationally efficient.

The authors employ a "cross-silo" FL setting, simulating a scenario with a few clients (three in this case), each holding a substantial amount of data. They inject "canaries" – sensitive data snippets – into the training data to specifically measure memorization. Their methodology for quantifying memorization includes:

  • Exact Token Matching: Measuring how often the model generates the exact sequence of tokens from the training data.
  • BLEU Score: Assessing approximate reproduction of the memorized sequences.
  • BERTScore: Evaluating semantic similarity between generated and reference sequences.

They also explore the impact of various factors, including:

  • Data Duplication: The effect of repeating sensitive data points.
  • Prompt Length: How longer prompts influence memorization.
  • Model Size: Testing models ranging from 1B to 70B parameters.
  • LoRA Rank: Investigating how the rank of the LoRA matrices affects memorization.
  • Combinations with other Privacy Techniques: Evaluating LoRA alongside gradient clipping, Gaussian noise, secure aggregation, and Goldfish loss.

Datasets

The study utilizes several datasets for fine-tuning and evaluation:

Fine-tuning Datasets: * MedMCQA: A multiple-choice question dataset for medical exams (AIIMS & NEET PG). * PubMedQA: Contains Yes/No/Maybe questions derived from PubMed abstracts. * Medical Meadow Flashcards: A dataset of medical curriculum flashcards. * i2b2 2014 De-identification Dataset: Used to inject sensitive "canary" data snippets into the fine-tuning sets.

Evaluation Benchmarks: * MedQA: Questions from the US Medical License Exam (USMLE). * PubMedQA: Expert-annotated questions. * MedMCQA: Used for downstream evaluation. * MMLU-Medical: A subset of the MMLU benchmark focused on medical topics.

The paper also mentions experiments on datasets from the law domain (Multi-LexSum) and finance domain (ConvFinQA) to assess generalizability.

Key Insights and Ideas

  • LoRA is a potent memorization mitigator in FL: The most significant finding is that LoRA, a simple and efficient fine-tuning method, dramatically reduces unintended memorization in federated learning settings, often by a factor of up to 10, without significantly impacting model performance.
  • FL itself offers some privacy benefits: The study confirms that federated learning, particularly with non-IID data distributions, inherently reduces memorization compared to centralized learning, but it's not a complete solution.
  • Data duplication and prompt length are critical drivers of memorization: The research reinforces that increasing the frequency of sensitive data and using longer prompts significantly amplifies memorization, even in FL.
  • LoRA's effectiveness scales with model size: The benefits of LoRA in reducing memorization were observed across a wide range of LLM sizes, from 1B to 70B parameters.
  • LoRA can synergize with other privacy techniques: LoRA can be effectively combined with methods like Goldfish loss, gradient clipping, and secure aggregation to further enhance privacy without compromising utility.
  • LoRA might act as a form of regularization: The paper hypothesizes that LoRA's low-rank updates could inherently regularize the model, preventing overfitting and thus reducing memorization, similar to how early stopping can achieve this.

Key Results

  • LoRA reduced unintended memorization by up to 10x compared to full fine-tuning in federated learning.
  • This memorization reduction was achieved with negligible performance loss, with accuracy remaining comparable to full fine-tuning.
  • The findings were consistent across various LLM families (Llama-2, Llama-3, Mistral) and sizes (1B to 70B parameters).
  • In centralized learning, LoRA also consistently lowered memorization scores, demonstrating its broad applicability.
  • Combining LoRA with Goldfish loss showed synergistic effects, leading to even lower memorization than either technique alone.
  • Experiments with a 70B parameter model confirmed that LoRA's memorization mitigation capabilities scale effectively.

Limitations and Future Work

  • Cross-silo vs. Cross-device FL: The study focused on a "cross-silo" setting with few clients. Further research is needed to confirm if these findings generalize to "cross-device" FL settings with a massive number of clients.
  • Theoretical Explanation: While the empirical results are strong, a complete theoretical understanding of why LoRA reduces memorization is still lacking. The authors suggest exploring connections to d-compression operators and benign overfitting.
  • Memorization Dynamics in Similar-Sized Models: The paper notes differing memorization dynamics between similarly-sized models (e.g., Llama 2 7B vs. Mistral v0.3 7B) and suggests future work to investigate the impact of architectural differences, such as attention mechanisms.
  • LoRA as a Panacea: The authors emphasize that LoRA, while effective, does not completely eliminate unintended memorization. It should be seen as a significant improvement over full fine-tuning, not a complete privacy solution.
  • Hyperparameter Tuning: The paper notes that suboptimal learning rates can still lead to significant memorization with LoRA, highlighting the importance of careful hyperparameter tuning.

Summary updated

BibTeX
@article{bossy2025mitigating,
  author = {Thierry Bossy and Julien Tuấn Tú Vignoud and Tahseen Rabbani and Juan R. Troncoso Pastoriza and Martin Jaggi},
  title = {{Mitigating Unintended Memorization with LoRA in Federated Learning for LLMs}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=WKPyZnLIW4},
}
Figure