Quick Start

  1. Prepare the environment.

    conda create -n llm-pbe python=3.10 -y
    conda activate llm-pbe
    # If you encounter the issue of 'kernel image' when running torch on GPU, try to install a proper torch with cuda.
    pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
    pip install torch torchvision torchaudio
    pip install git+https://github.com/microsoft/analysing_pii_leakage.git
    pip install wandb accelerate
    pip install -r requirements.txt
    
  2. Assess the data privacy.

You can find the attack demo below, which is also presented in AttackDemo.py.
from data.enron import EnronDataset
from models.togetherai import TogetherAIModels
from attacks.Jailbreak.jailbreak import Jailbreak

enron = EnronDataset(data_path="data/enron")
prompts, _ = enron.generate_prompts(format="prefix-50")
llm = TogetherAIModels(model="togethercomputer/llama-2-7b-chat", api_key="xxx")
attack = Jailbreak()
results = attack.execute_attack(prompts, llm)
print("results:", results)