arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.17501cs.CR
收藏

代码语言模型记住了多少?对微调前后数据提取攻击的研究

How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuning

Fabio Salerno, Ali Al-Kaswan, Maliheh Izadi

AI总结:

本文通过自定义基准研究代码语言模型在微调前后对训练数据的记忆与可提取性,发现微调降低预训练数据可提取性但增加小模型对微调数据提取攻击的脆弱性,并识别出最易被记忆和遗忘的数据类别。

摘要:

代码语言模型虽然广受欢迎,但通常是在从互联网各处收集的未经清洗的源代码上进行训练的。先前的工作表明,预训练模型能够记住其训练数据的内容,并通过数据提取攻击将其重现。由于当前模型规模庞大,只有少数实体拥有预训练此类模型的资源。然而,微调所需资源较少,并且因其在专门数据上的有效性而越来越多地被小型和大型实体采用。此类用于微调的小规模精选数据可能包含敏感信息或专有资产。在本研究中,我们攻击预训练和微调后的代码语言模型,以探究数据可提取性的程度。我们首先开发了一个自定义基准,用于评估预训练样本和微调样本对提取攻击的脆弱性。我们的发现表明,54.9%的可提取预训练数据可以从StarCoder2-15B中检索出来,而微调后这一数字降至23.5%。这表明微调降低了预训练数据的可提取性。然而,与更大的模型相比,对较小模型进行微调会增加其对微调数据提取攻击的脆弱性。鉴于微调数据可能具有敏感性,这可能导致更严重的后果。最后,我们还手动分析了微调前后的2000个可提取样本。我们还发现,数据载体和许可信息是最可能从预训练模型和微调模型中被记忆的数据类别,而后者最可能在微调后被遗忘。

英文摘要:

Code language models, while widely popular, are often trained on unsanitized source code gathered from across the Internet. Previous work revealed that pre-trained models can remember the content of their training data and regurgitate them through data extraction attacks. Due to the large size of current models, only a few entities have the resources for pre-training such models. However, fine-tuning requires fewer resources and is increasingly used by both small and large entities for its effectiveness on specialized data. Such small curated data for fine-tuning might contain sensitive information or proprietary assets. In this study, we attack both pre-trained and fine-tuned code language models to investigate the extent of data extractability. We first develop a custom benchmark to assess the vulnerability of both pre-training and fine-tuning samples to extraction attacks. Our findings reveal that 54.9% of extractable pre-training data could be retrieved from StarCoder2-15B, whereas this number decreased to 23.5% after fine-tuning. This indicates that fine-tuning reduces the extractability of pre-training data. However, compared to larger models, fine-tuning smaller models increases their vulnerability to data extraction attacks on fine-tuning data. Given the potential sensitivity of fine-tuning data, this can lead to more severe consequences. Lastly, we also manually analyzed 2000 extractable samples before and after fine-tuning. We also found that data carriers and licensing information are the most likely data categories to be memorized from pre-trained and fine-tuned models, while the latter is the most likely to be forgotten after fine-tuning.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑