Offsite-Tuning: Transfer Learning without Full Model

Guangxuan Xiao, Ji Lin, Song Han

Abstract

Offsite-Tuning is a framework designed to enable the fine-tuning of massive, proprietary foundation models on private data without compromising model ownership or data privacy. By utilizing a "sandwich" of trainable adapters and a compressed "emulator," this method allows users to perform local adaptation without access to full model weights. It achieves performance comparable to full fine-tuning while providing a 6.5x speedup and a 5.6x reduction in memory requirements.

Introduction: The Privacy and Compute Wall

In the era of foundation models like GPT-4 and CLIP, two major hurdles prevent widespread accessibility for specialized tasks. First, model owners protect their weights as intellectual property, while data owners (such as hospitals) cannot upload sensitive data to third-party APIs. Second, the massive compute requirements for fine-tuning billion-parameter models are beyond the reach of most researchers.

Comparison of traditional fine-tuning challenges versus the Offsite-Tuning solution.

Existing solutions like Federated Learning protect data but still require the full model, while parameter-efficient methods like LoRA require access to frozen weights to compute gradients. Offsite-Tuning addresses these gaps by decoupling the training process from the full model backbone.

Methods: The Sandwich Adapter and Emulator

Offsite-Tuning splits the model into two distinct parts: a small, trainable Adapter and a large, frozen backbone. The workflow functions as a secure exchange between the model owner and the user.

The Offsite-Tuning architecture: compressing the model into an emulator and using plug-and-play adapters.
  1. The Sandwich Adapter: The model owner selects a few layers from the beginning and the end of the full model to create a trainable adapter.
  2. The Emulator: To allow the user to train these adapters without the full model, the owner creates a lossy, compressed version of the middle layers (the "emulator") using Uniform Layer-drop and Knowledge Distillation.
  3. Offsite Training: The user receives only the Adapter and the Emulator. They fine-tune the adapter on local data; the emulator provides "rough" gradients accurate enough for effective updates.
  4. The Plug-in: The user returns the tiny, fine-tuned adapter to the model owner, who plugs it back into the original, full-scale model for inference.

Datasets and Evaluation

The researchers evaluated Offsite-Tuning across language and vision domains:

  • Language: Using GPT-2, OPT (up to 6.7B), and BLOOM (7.1B), the framework was tested on benchmarks like WikiText-2 and eight fine-tuning tasks including OpenBookQA, PIQA, and ARC.
  • Vision: They tested CLIP and EVA on fine-grained classification datasets such as Flowers, Cars, Pets, and CIFAR-100.

Key Insights and Ideas

  • The "Sandwich" Strategy: Including both the earliest layers (low-level features) and latest layers (task-specific logic) in the adapter significantly boosts performance compared to traditional head-only tuning.
  • Layer-drop Efficiency: Simply dropping every $N$-th layer to create the emulator preserved the model's logic flow for gradient estimation better than complex pruning or quantization.
  • Privacy through Lossiness: Because the emulator is highly compressed, it performs poorly on its own, protecting the model owner’s intellectual property.
  • Orthogonality: Offsite-Tuning can be used as a wrapper for other methods; for instance, one can use LoRA inside the Offsite-Tuning adapter to further reduce local compute requirements.

Key Results

  • Efficiency: Compared to full fine-tuning, Offsite-Tuning achieved a 6.5x throughput speedup and a 5.6x reduction in peak memory usage.
  • Performance: On the OPT-6.7B model, Offsite-Tuning achieved an average accuracy of 58.6%, coming remarkably close to full fine-tuning while vastly outperforming zero-shot baselines.
  • Hardware Accessibility: It enabled the fine-tuning of 7B-parameter models on a single NVIDIA A6000 GPU, a task typically impossible with standard methods.

Limitations and Future Work

While the user saves compute, the model owner still faces a one-time cost for knowledge distillation to create the emulator. Furthermore, while the emulator is lossy, there is currently no formal mathematical guarantee (like Differential Privacy) against information reconstruction. Future work will focus on a more rigorous theoretical understanding of why approximate gradients from the emulator are so effective.

Summary updated

Abstract

Transfer learning is important for foundation models to adapt to downstream tasks. However, many foundation models are proprietary, so users must share their data with model owners to fine-tune the models, which is costly and raise privacy concerns. Moreover, fine-tuning large foundation models is computation-intensive and impractical for most downstream users. In this paper, we propose Offsite-Tuning, a privacy-preserving and efficient transfer learning framework that can adapt billion-parameter foundation models to downstream data without access to the full model. In offsite-tuning, the model owner sends a light-weight adapter and a lossy compressed emulator to the data owner, who then fine-tunes the adapter on the downstream data with the emulator's assistance. The fine-tuned adapter is then returned to the model owner, who plugs it into the full model to create an adapted foundation model. Offsite-tuning preserves both parties' privacy and is computationally more efficient than the existing fine-tuning methods that require access to the full model weights. We demonstrate the effectiveness of offsite-tuning on various large language and vision foundation models. Offsite-tuning can achieve comparable accuracy as full model fine-tuning while being privacy-preserving and efficient, achieving 6.5x speedup and 5.6x memory reduction. Code is available at https://github.com/mit-han-lab/offsite-tuning.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
GPT2-XL · Fine-tuning efficiency on GPT2-XLOffsite-Tuning + LoRA (OT (2-16-2) + LoRA)Throughput6257 tokens per secondfine-tuned · gpu=A6000 · batch-size=1 · sequence-length=512 · ot-configuration=2-16-2
Source quote
L301: + LoRA │ 6257 │ 7155
GPT2-XL · Fine-tuning efficiency on GPT2-XLOffsite-Tuning + LoRA (OT (2-16-2) + LoRA)Peak memory7155 MB-32767 vs baselinefine-tuned · gpu=A6000 · batch-size=1 · sequence-length=512 · ot-configuration=2-16-2
Source quote
L301: + LoRA │ 6257 │ 7155
FlowersOffsite-Tuning OT Plug-in (EVA-ViT-G)Accuracy99.33%fine-tuned · backbone=EVA-ViT-G · configuration=4-22-4 Distill
Source quote
L224: OT Plug-in │ 99.33 │ 94.99 │ 95.33 │ 96.48 │ 99.63 │ 94.21
Reported baseline / comparator measurements (2)
BenchmarkMethodMetricScoreProtocol / Evidence
GPT2-XL · Fine-tuning efficiency on GPT2-XLFull fine-tuning (FT) baselinePeak memory39922 MBfine-tuned · gpu=A6000 · batch-size=1 · sequence-length=512
Source quote
L297: \multirow{4}{*}{GPT2-XL} │ FT │ 957 │ 39922
FlowersFull fine-tuning (FT; EVA-ViT-G) baselineAccuracy99.59%fine-tuned · backbone=EVA-ViT-G · configuration=4-22-4 Distill
Source quote
L222: FT │ 99.59 │ 95.77 │ 95.43 │ 95.80 │ 99.39 │ 93.96
BibTeX
@misc{xiao2023offsite,
  author = {Guangxuan Xiao and Ji Lin and Song Han},
  title = {{Offsite-Tuning: Transfer Learning without Full Model}},
  year = {2023},
  eprint = {2302.04870},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.04870},
}
Figure