Be Careful When Fine-tuning On Open-Source LLMs: Your Fine-tuning Data Could Be Secretly Stolen!

Zhexin Zhang, Yuhao Sun, Junxiao Yang, Shiyao Cui, Hongning Wang +1 more
5/21/2025
cs.CL

Official code: thu-coai/Backdoor-Data-Extraction (34 stars, MIT, last commit 2025-05-22).

Abstract

Fine-tuning on open-source Large Language Models (LLMs) with proprietary data is now a standard practice for downstream developers to obtain task-specific LLMs. Surprisingly, we reveal a new and concerning risk along with the practice: the creator of the open-source LLMs can later extract the private downstream fine-tuning data through simple backdoor training, only requiring black-box access to the fine-tuned downstream model. Our comprehensive experiments, across 4 popularly used open-source models with 3B to 32B parameters and 2 downstream datasets, suggest that the extraction performance can be strikingly high: in practical settings, as much as 76.3% downstream fine-tuning data (queries) out of a total 5,000 samples can be perfectly extracted, and the success rate can increase to 94.9% in more ideal settings. We also explore a detection-based defense strategy but find it can be bypassed with improved attack. Overall, we highlight the emergency of this newly identified data breaching risk in fine-tuning, and we hope that more follow-up research could push the progress of addressing this concerning risk. The code and data used in our experiments are released at https://github.com/thu-coai/Backdoor-Data-Extraction.

View on arXivView PDF

Code Implementations(1)

MIT
346Shell, PythonMay 21, 20251 years agoMIT

Similar Papers

Cite this paper

@article{zhang2025careful,
  title  = {Be Careful When Fine-tuning On Open-Source LLMs: Your Fine-tuning Data Could Be Secretly Stolen!},
  author = {Zhexin Zhang and Yuhao Sun and Junxiao Yang and Shiyao Cui and Hongning Wang and Minlie Huang},
  year   = {2025},
  eprint = {2505.15656},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.15656v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.15656.svg)](https://codeofpaper.com/paper/2505.15656)

Discussion