eth-sri / malicious-contamination

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Evading Data Contamination Detection for Language Models is (too) Easy

This repo contains the code for our paper, Evading Data Contamination Detection for Language Models is (too) Easy. We explain how to install and run the code in this repository to reproduce the results presented in the paper. The code assumes that CUDA is available and that at least 80GB of memory is present on the GPU(s).

Installation

You can install the code in this repo by installing Conda and running the following commands:

conda create -n contamination python=3.11
conda activate contamination
python -m pip install -e .
python -m pip install flash-attn --no-build-isolation

If you want to have the exact same versions we used for all packages, you can run the following command after this:

python -m pip install -r requirements.txt

Reproducing Results

Before starting, you should either add your OpenAI API Key as an environment variable with the key OPENAI_API_KEY or create the scripts/.env file with the following content:

OPENAI_API_KEY=[YOUR API KEY]

You can reproduce all our results by running the following command:

bash scripts/main.sh

Note that this can take several weeks to run on a single H100 Nvidia GPU, use a couple hundred USD with the OpenAI API and needs around 500GB of storage space.

We note that this repo contains a baseline copied from this GitHub repo to implement the method by Shi for benchmark-level contamination in the code-contamination-detection subfolder. Changes that were made were documented with the a comment starting with # NOTE, but we note that these changes were solely used to change data preprocessing procedures such that the evaluated benchmarks align with our contamination.

After this, a postprocessing notebook located at notebooks/postprocessing.ipynb can be run to get our final results.

Citation

Please use the following citation to cite this repo or the associated paper:

@article{dekoninck2024evading,
      title={Evading Data Contamination Detection for Language Models is (too) Easy}, 
      author={Jasper Dekoninck and Mark Niklas Müller and Maximilian Baader and Marc Fischer and Martin Vechev},
      year={2024},
      eprint={2402.02823},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

About

License:Apache License 2.0


Languages

Language:Python 79.8%Language:Jupyter Notebook 16.1%Language:Shell 4.0%