Differentially Private Training of Mixture of Experts Models

Pierre Tholoniat, Huseyin A. Inan, Janardhan Kulkarni, Robert SimarXiv 2024

Abstract

This position paper investigates the integration of Differential Privacy (DP) in the training of Mixture of Experts (MoE) models within the field of natural language processing. As Large Language Models (LLMs) scale to billions of parameters, leveraging expansive datasets, they exhibit enhanced linguistic capabilities and emergent abilities. However, this growth raises significant computational and privacy concerns. Our study addresses these issues by exploring the potential of MoE models, known for their computational efficiency, and the application of DP, a standard for privacy preservation. We present the first known attempt to train MoE models under the constraints of DP, addressing the unique challenges posed by their architecture and the complexities of DP integration. Our initial experimental studies demonstrate that MoE models can be effectively trained with DP, achieving performance that is competitive with their non-private counterparts. This initial study aims to provide valuable insights and ignite further research in the domain of privacy-preserving MoE models, softly laying the groundwork for prospective developments in this evolving field.

Introduction

As Large Language Models (LLMs) scale toward trillions of parameters, they encounter two primary obstacles: prohibitive computational costs and significant data privacy risks. Mixture of Experts (MoE) architectures address the former by activating only a subset of the network (experts) for any given input, enabling massive capacity with sparse computation. Differential Privacy (DP), typically implemented via Differentially Private Stochastic Gradient Descent (DPSGD), addresses the latter by adding calibrated noise to gradients, ensuring individual training samples cannot be reconstructed.

However, MoE and DP are inherently difficult to reconcile. DPSGD requires per-sample gradients to bound the influence of individual records. Conversely, MoE models are designed to shuffle tokens from various samples across different experts to maximize hardware utilization. This "tangling" of samples makes tracking individual contributions computationally expensive and incompatible with standard DP training libraries.

Methodology: Bridging MoE and DP

The integration of DP into MoE training requires overcoming three technical hurdles:

1. The Load-Balancing Loss Dilemma

MoE models typically employ an auxiliary load-balancing loss to ensure uniform expert utilization. This loss is calculated across an entire batch, making it ill-defined for per-sample gradient computation. The authors found that during fine-tuning, this loss can be omitted without significant degradation, as pre-trained routing mechanisms are sufficiently stable.

2. Per-Sample Gradient Computation

To resolve the "tangled token" issue, two strategies were explored:

  • The Simple Approach: This involves adding an extra batch dimension to expert inputs. While mathematically straightforward for libraries like Opacus, it is memory-intensive due to the necessary zero-padding for experts not receiving tokens from specific samples.
  • The Efficient Approach: A custom gradient rule was developed to map gradients back to their original samples using the model's routing table, avoiding the memory overhead of extra dimensions.
The routing process in MoE models, illustrating the "extra batch dimension" approach for per-sample gradient computation.

3. Expert Parallelism

When experts are distributed across multiple GPUs, gradient clipping requires synchronized communication of routing information to maintain privacy guarantees across the distributed system.

Experimental Results

The approach was evaluated by fine-tuning a Switch-base-8 model (8 experts) on two Natural Language Understanding (NLU) benchmarks from the GLUE suite, using a privacy budget of $\epsilon = 8$.

Dataset Non-Private Accuracy Private MoE Accuracy ($\epsilon=8$)
SST-2 94.5% 92.0%
MNLI 85.4% 78.7%

While a "privacy tax" exists, the results demonstrate that MoE models can be fine-tuned privately while remaining highly competitive.

Conclusion and Future Work

This study confirms that MoE models are not fundamentally incompatible with Differential Privacy. Sparse architectures may even be a natural fit for privacy, as they limit the number of parameters influenced by any single token. Future research should focus on scaling these methods to trillion-parameter models, developing per-sample load-balancing losses for training from scratch, and exploring "private routing" mechanisms to further harden the architecture against information leakage.

Summary updated

BibTeX
@misc{tholoniat2024differentially,
  author = {Pierre Tholoniat and Huseyin A. Inan and Janardhan Kulkarni and Robert Sim},
  title = {{Differentially Private Training of Mixture of Experts Models}},
  year = {2024},
  eprint = {2402.07334},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.07334},
}
Figure