five

Exploration-Lab/ReLU

收藏
Hugging Face2024-11-09 更新2025-04-12 收录
下载链接:
https://hf-mirror.com/datasets/Exploration-Lab/ReLU
下载链接
链接失效反馈
官方服务:
资源简介:
--- license: cc-by-nc-sa-4.0 task_categories: - question-answering - fill-mask - multiple-choice - document-question-answering extra_gated_fields: 'Full Name': text 'Affiliation (Organization/University)': text 'Designation/Status in Your Organization': text 'Country': country 'I want to use this dataset for (please provide the reason(s))': text 'ReLU dataset is free for research use but NOT for commercial use; do you agree if you are provided with the ReLU dataset, you will NOT use for any commercial purposes? Also do you agree that you will not be sharing this dataset further or uploading it anywhere else on the internet': checkbox 'DISCLAIMER The dataset is released for research purposes only and authors do not take any responsibility for any damage or loss arising due to usage of data or any system/model developed using the dataset': checkbox tags: - LLM - NLP - unlearning - question-answering - cloze - analogy - mcqa - odd-one-out - comprehension - multiple-choice pretty_name: ReLU language: - en multilinguality: - monolingual size_categories: - 1K<n<10K dataset_info: - config_name: analogy features: - name: question dtype: string - name: A dtype: string - name: B dtype: string - name: C dtype: string - name: D dtype: string - name: answer dtype: string - name: correct options sequence: string - name: __index_level_0__ dtype: int64 splits: - name: forget01 num_bytes: 20569 num_examples: 40 - name: forget05 num_bytes: 98943 num_examples: 200 - name: forget10 num_bytes: 219205 num_examples: 400 - name: retain90 num_bytes: 1930075 num_examples: 3600 - name: retain95 num_bytes: 2059884 num_examples: 3800 - name: retain99 num_bytes: 2151625 num_examples: 3960 download_size: 4015758 dataset_size: 6480301 - config_name: cloze features: - name: question dtype: string - name: answer dtype: string - name: mask dtype: string - name: blanks sequence: string - name: __index_level_0__ dtype: int64 splits: - name: forget01_cloze num_bytes: 19170 num_examples: 40 - name: forget05_cloze num_bytes: 92729 num_examples: 200 - name: forget10_cloze num_bytes: 189535 num_examples: 400 - name: retain90_cloze num_bytes: 1582730 num_examples: 3600 - name: retain95_cloze num_bytes: 1679536 num_examples: 3800 - name: retain99_cloze num_bytes: 1753095 num_examples: 3960 download_size: 2774821 dataset_size: 5316795 - config_name: comprehension features: - name: prompt dtype: string - name: QA list: - name: answer dtype: string - name: question dtype: string - name: mcq list: - name: A dtype: string - name: B dtype: string - name: C dtype: string - name: Correct option sequence: string - name: D dtype: string - name: answer dtype: string - name: question dtype: string - name: __index_level_0__ dtype: int64 splits: - name: forget01 num_bytes: 35878 num_examples: 2 - name: forget05 num_bytes: 178415 num_examples: 10 - name: forget10 num_bytes: 377212 num_examples: 20 - name: full num_bytes: 3602466 num_examples: 200 - name: retain90 num_bytes: 3225204 num_examples: 180 - name: retain95 num_bytes: 3423568 num_examples: 190 - name: retain99 num_bytes: 3566583 num_examples: 198 download_size: 7587620 dataset_size: 14409326 - config_name: mcqa features: - name: question dtype: string - name: A dtype: string - name: B dtype: string - name: C dtype: string - name: D dtype: string - name: answer dtype: string - name: Correct option sequence: string - name: __index_level_0__ dtype: int64 splits: - name: forget01 num_bytes: 21202 num_examples: 40 - name: forget05 num_bytes: 105194 num_examples: 200 - name: forget10 num_bytes: 217126 num_examples: 399 - name: retain90 num_bytes: 1877785 num_examples: 3600 - name: retain95 num_bytes: 1989544 num_examples: 3799 - name: retain99 num_bytes: 2073714 num_examples: 3959 download_size: 7453914 dataset_size: 6284565 - config_name: odd-one-out features: - name: A struct: - name: answer dtype: string - name: question dtype: string - name: B struct: - name: answer dtype: string - name: question dtype: string - name: C struct: - name: answer dtype: string - name: question dtype: string - name: D struct: - name: answer dtype: string - name: question dtype: string - name: ans dtype: string - name: __index_level_0__ dtype: int64 splits: - name: forget01 num_bytes: 40779 num_examples: 40 - name: forget05 num_bytes: 204917 num_examples: 200 - name: forget10 num_bytes: 405959 num_examples: 400 - name: retain90 num_bytes: 142111 num_examples: 133 - name: retain95 num_bytes: 142111 num_examples: 133 - name: retain99 num_bytes: 68652 num_examples: 66 download_size: 680820 dataset_size: 1004529 configs: - config_name: analogy data_files: - split: forget01 path: analogy/forget01-* - split: forget05 path: analogy/forget05-* - split: forget10 path: analogy/forget10-* - split: retain90 path: analogy/retain90-* - split: retain95 path: analogy/retain95-* - split: retain99 path: analogy/retain99-* - config_name: cloze data_files: - split: forget01_cloze path: cloze/forget01_cloze-* - split: forget05_cloze path: cloze/forget05_cloze-* - split: forget10_cloze path: cloze/forget10_cloze-* - split: retain90_cloze path: cloze/retain90_cloze-* - split: retain95_cloze path: cloze/retain95_cloze-* - split: retain99_cloze path: cloze/retain99_cloze-* - config_name: comprehension data_files: - split: forget01 path: comprehension/forget01-* - split: forget05 path: comprehension/forget05-* - split: forget10 path: comprehension/forget10-* - split: full path: comprehension/full-* - split: retain90 path: comprehension/retain90-* - split: retain95 path: comprehension/retain95-* - split: retain99 path: comprehension/retain99-* - config_name: mcqa data_files: - split: forget01 path: mcqa/forget01-* - split: forget05 path: mcqa/forget05-* - split: forget10 path: mcqa/forget10-* - split: retain90 path: mcqa/retain90-* - split: retain95 path: mcqa/retain95-* - split: retain99 path: mcqa/retain99-* - config_name: odd-one-out data_files: - split: forget01 path: odd-one-out/forget01-* - split: forget05 path: odd-one-out/forget05-* - split: forget10 path: odd-one-out/forget10-* - split: retain90 path: odd-one-out/retain90-* - split: retain95 path: odd-one-out/retain95-* - split: retain99 path: odd-one-out/retain99-* --- # Towards Robust Evaluation of Unlearning in LLMs via Data Transformations [![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/) [![🤗 Huggingface Dataset](https://img.shields.io/badge/🤗-Huggingface%20Dataset-FFAA00.svg)](https://huggingface.co/datasets/Exploration-Lab/ReLU) [![Website](https://img.shields.io/badge/Website-purple.svg)]() [![GitHub](https://img.shields.io/badge/GitHub-121013.svg?logo=github&logoColor=white)](https://github.com/Exploration-Lab/ReLU) ![Teaser image](./reformat-unlearning-thumbnail.png) **Picture:** *The pipeline of using open-weight LLMs to train/finetune over new information (Finetuned-LLM). Later, when an unlearning request arises, the new information is split into the Retain and Forget set. The Unlearning algorithms aim towards achieving the Target-LLM (trained/finetuned only on the Retain set) with a cost lower than training/finetuning the pretrained open-weight LLM again. The spider plot shows a performance comparison of Finetuned-LLM (green) vs. Unlearned-LLM (blue) over the forget set in different formats. Although these unlearning algorithms show a forgetting behavior in the default format (the Q&A performance of Finetuned-LLM is reduced after unlearning), the performance gap varies significantly when evaluating the same information in different formats (MCQA, Analogy, Cloze, OddOneOut, and Comprehension). Note that different formats in the spider plot have different metrics (refer App.B), and Cloze test performance is 10x scaled for better visibility.* ## Table of Contents - [Introduction](#introduction) - [Installation](#installation) - [Loading the TOFU Dataset (default)](#loading-the-tofu-dataset-default) - [Finetune your models on the TOFU dataset](#finetune-your-models-on-the-tofu-dataset) - [Reformatted Dataset](#reformatted-dataset) - [Running Evaluation on the Reformatted Dataset](#running-evaluation-on-the-reformatted-dataset) - [License](#license) ## Introduction This repository contains the official release of the following paper: > **Towards Robust Evaluation of Unlearning in LLMs via Data Transformations** > > **Abstract:** *Large Language Models (LLMs) have shown to be a great success in a wide range of applications ranging from regular NLP-based use cases to AI agents. LLMs have been trained on a vast corpus of texts from various sources; despite the best efforts during the data preprocessing stage while training the LLMs, they may pick some undesirable information such as personally identifiable information (PII). Consequently, in recent times research in the area of Machine Unlearning (MUL) has become active, the main idea is to force LLMs to forget (unlearn) certain information (e.g., PII) without suffering from performance loss on regular tasks. In this work, we examine the robustness of the existing MUL techniques for their ability to enable leakage-proof forgetting in LLMs. In particular, we examine the effect of data transformation on forgetting, i.e., is an unlearned LLM able to recall forgotten information if there is a change in the format of the input? Our findings on the TOFU dataset highlight the necessity of using diverse data formats to quantify unlearning in LLMs more reliably.* ## Installation ``` conda create -n tofu python=3.10 conda activate tofu conda install pytorch pytorch-cuda=11.8 -c pytorch -c nvidia conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit pip install -r requirements.txt pip install flash-attn --no-build-isolation ``` ## Loading the TOFU Dataset (default) To load the dataset, use the following code: ```python from datasets import load_dataset dataset = load_dataset("locuslab/TOFU","full") ``` ### Available forget sets are: - `forget01`: Forgetting 1% of the original dataset, all entries correspond to a single author. - `forget05`: Forgetting 5% of the original dataset, all entries correspond to a single author. - `forget10`: Forgetting 10% of the original dataset, all entries correspond to a single author. Retain sets corresponding to each forget set are also available, which can be used to train an Oracle model. ## Finetune your models on the TOFU dataset We use [TOFU](https://locuslab.github.io/tofu/) for training/unlearning experiments on the pretrained LLMs. All the experiment results reported in the paper are obtained using the checkpoints obtained by finetuning models on the [TOFU dataset](https://huggingface.co/datasets/locuslab/TOFU) and running the unlearning methods provided in the [TOFU codebase](https://github.com/locuslab/tofu). ## Reformatted Dataset The reformatted dataset can be used to evaluate the performance of the unlearned models. The reformatted dataset is present in [data_reformat](./data_reformat) directory. This data is now available on huggingface and can be dowloaded to the `data_reformat` directory using the following commands: ```bash python download_from_hf.py --hf_dataset "Exploration-Lab/ReLU" --config_name "cloze" python download_from_hf.py --hf_dataset "Exploration-Lab/ReLU" --config_name "analogy" python download_from_hf.py --hf_dataset "Exploration-Lab/ReLU" --config_name "comprehension" python download_from_hf.py --hf_dataset "Exploration-Lab/ReLU" --config_name "mcqa" python download_from_hf.py --hf_dataset "Exploration-Lab/ReLU" --config_name "odd-one-out" ``` The prompt evaluation templates are present in the [evaluation_templates](./evaluation_templates) directory. The evaluation templates are present in the following formats: - Multiple Choice Question Answering (MCQA) - Analogy - Cloze - OddOneOut - Comprehension | Format | Format Name | Description | |--------|-------------|-------------| | Format-1 | MCQA (Multiple Choice Question Answering) | For each of the queries present in the default Q&A format, the same question is rephrased by providing multiple options for the answers. The dataset contains the question and 4 options (`A`, `B`, `C`, `D`) and the `correct option`. | | Format-2 | Cloze | The queries are provided with a passage that has certain words (words in the end of sentence) missing from it to mask out an information specific to an author. The dataset contains the `question`, `answer`, answer with the relevant information masked (`mask`) and the masked value in `blanks`. | | Format-3 | Analogy | Helps validate if the network is able to make relations between the entities (e.g., author name → birth year :: author name → country) by providing some examples in the context (ICL) and asking about another author as a query. The dataset contains the question and 4 options (`A`, `B`, `C`, `D`) and the `correct option`. | | Format-4 | OddOneOut | A query is given to choose the odd one out from a given set of options where one option is coming from retain/forget and another set of wrong options is coming from forget/retain set. The dataset contains 4 question and answer pairs in which 3 are similar and 1 is different. The columns are `A`, `B`, `C`, `D` and `ans`. The `ans` column contains the odd one out question and answer. | | Format-5 | Comprehension | Provides all the information in the context and ask the same questions in different styles such as Q&A, MCQA, etc. The dataset contains the passage in `prompt` and question-and-answer pairs in `QA` and multiple choice questions in `mcq`. | The evaluation using the above formats can also be done in various settings, for example the MCQA format can be used with 2, 3, or 4 options. Similarly, the OddOneOut format can be used with 3 or 4 options and the Analogy format can be used with 2, 3, or 4 options. The comprehension format can be used with Q&A or MCQA format with different number of options. The below table shows the number of questions in each format for the default and the reformatted dataset. Evaluating over all the formats with different settings can provide a better understanding of the unlearning performance of the models. | Evaluation Format | Forget01 | Retain99 | Forget05 | Retain95 | Forget10 | Retain90 | |----------------------|----------|----------|----------|----------|----------|----------| | Q&A (default) | 40 | 3960 | 200 | 3800 | 400 | 3600 | | MCQA 4-Options | 40 | 3931 | 200 | 3771 | 400 | 3571 | | MCQA 3-Options | 40 | 3931 | 200 | 3771 | 400 | 3571 | | MCQA 2-Options | 40 | 3931 | 200 | 3771 | 400 | 3571 | | Odd-One-Out | 40 | 13 | 200 | 66 | 400 | 133 | | Cloze Test | 40 | 3960 | 200 | 3800 | 400 | 3600 | | Analogy MCQA | 40 | 3960 | 200 | 3800 | 400 | 3600 | | Comprehension Q&A | 40 | 3960 | 200 | 3800 | 400 | 3600 | | Comprehension MCQA | 40 | 3954 | 200 | 3794 | 400 | 3594 | ## Running Evaluation on the Reformatted Dataset The evaluation can be done using the following command: ``` python evaluate.py --dataset_path="./data_reformat/qualitative/match95.json" --use_pretrained --qualitative_analysis ``` The `--use_pretrained` flag is used to evaluate the base model (not trained on the TOFU dataset) on the reformatted dataset. The `--qualitative_analysis` flag is used to evaluate the model on the reformatted dataset. The `--dataset_path` flag is used to provide the path to the reformatted dataset. The predictions are saved in the `logs` directory. The qualitative results generates the predictions for different formats for easier analysis. ```json { "qa_prompt": "Question: What is the full name of the geology author born in Karachi, Pakistan on 06/30/1975?\nAnswer:", "qa_label": "The author's name is Hina Ameen.", "mcqa_prompt": "Question: What is the full name of the geology author born in Karachi, Pakistan on 06/30/1975? \nA. Hina Khan\nB. Hina Ahmed\nC. Hina Ali\nD. Hina Ameen\nAnswer:", "mcqa_label": "D", "cloze_prompt": "Question: What is the full name of the geology author born in Karachi, Pakistan on 06/30/1975?\nAnswer: The author's name is ", "cloze_label": "Hina Ameen", "qa_generated_text": " The full name of the geology author born in", "mcqa_generated_text": "B", "cloze_generated_text": "________.\n\n" } ``` ### Running the evaluation on the reformatted dataset for different formats The evaluation can be done for different formats using the following command: ```shell python evaluate.py --dataset_path="./data_reformat/comprehension/forget05_prompts_new.json" --reformat_type="comprehension-qa" --use_pretrained ``` The `--reformat_type` flag is used to provide the format of the dataset. The available formats are `mcqa`, `cloze`, `odd-one-out`, `analogy-mcqa`, `comprehension-qa`, and `comprehension-mcqa`. The [`run_evaluation.sh`](./run_evaluation.sh) script can be used to run the evaluation for all the formats by providing the paths to the model checkpoints (original [trained on tofu] and unlearning checkpoints [for various unleanring methods]) at the top of the [`run_evaluation.sh`](./run_evaluation.sh) script. ```bash bash run_evaluation.sh ``` ## License [![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/) The created dataset follows [CC-BY-NC](LICENSE) license. Thus, users can share and adapt our dataset if they give credit to us and do not use our dataset for any commercial purposes. <!-- ## Controbuting to Extention of Unlearning Evaluation Formats -->
提供机构:
Exploration-Lab
5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作