Instructions to use yejinkim/pistol-data1-Llama-2-7b-chat-target with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yejinkim/pistol-data1-Llama-2-7b-chat-target with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yejinkim/pistol-data1-Llama-2-7b-chat-target") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yejinkim/pistol-data1-Llama-2-7b-chat-target") model = AutoModelForCausalLM.from_pretrained("yejinkim/pistol-data1-Llama-2-7b-chat-target", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yejinkim/pistol-data1-Llama-2-7b-chat-target with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yejinkim/pistol-data1-Llama-2-7b-chat-target" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yejinkim/pistol-data1-Llama-2-7b-chat-target", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yejinkim/pistol-data1-Llama-2-7b-chat-target
- SGLang
How to use yejinkim/pistol-data1-Llama-2-7b-chat-target with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yejinkim/pistol-data1-Llama-2-7b-chat-target" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yejinkim/pistol-data1-Llama-2-7b-chat-target", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yejinkim/pistol-data1-Llama-2-7b-chat-target" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yejinkim/pistol-data1-Llama-2-7b-chat-target", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yejinkim/pistol-data1-Llama-2-7b-chat-target with Docker Model Runner:
docker model run hf.co/yejinkim/pistol-data1-Llama-2-7b-chat-target
PISTOL Sample Dataset 1 โ target model (Llama-2-7b-chat)
The target model for structural-unlearning experiments on
PISTOL Sample Dataset 1: meta-llama/Llama-2-7b-chat-hf
fine-tuned on all 400 QA pairs (20 knowledge-graph edges x 20 QAs).
PISTOL is fully synthetic, so a pretrained model cannot know its contracts โ this checkpoint exists so that unlearning methods have something to forget.
What makes this checkpoint usable as a target
An unlearning target has to satisfy two conditions at once: it must have memorised the benchmark data, and it must still be a functioning model. Measured on this checkpoint:
| this target | base model | |
|---|---|---|
| PISTOL forget-edge ROUGE-L recall | 1.000 | 0.020 |
| PISTOL retain ROUGE-L recall | 1.000 | ~0.08 |
TOFU real_authors + world_facts (mean ROUGE-L) |
0.865 | 0.949 |
The last row is the control set: real-world knowledge the pretrained model already had. Keeping it at 91.1% of the base model's score means the model still answers "Who wrote 'Romeo and Juliet'?" correctly, so any later degradation can be attributed to unlearning rather than to the fine-tune.
That is not automatic. Fine-tuning the same base on the same 400 QAs for the same 20 epochs at lr 1e-4 also reaches ROUGE 1.000, but the control set collapses to 0.009 โ the model answers every question with a contract-style string ("Wnzatj SAS."). Same steps, same batch size; only the learning rate differs.
Training
| base | meta-llama/Llama-2-7b-chat-hf |
| data | PISTOL Sample Dataset 1, full split (400 QA, all 20 edges) |
| method | full fine-tuning (no LoRA) |
| lr | 1e-5 |
| epochs | 20 |
| effective batch | 16 |
| warmup | 1 epoch |
| optimizer | AdamW, weight decay 0.01 |
| precision | bf16 |
Prompt format follows the base model's own template; answers are short contract fields (mean 1.6 words), e.g.
[INST] What was the effective date of the contract between Qpubwe PLC and Jzrcws SA? [/INST]
02-09-2019.
Intended use
Starting point for unlearning experiments: forget one knowledge-graph edge and measure how far the damage spreads to edges at 1 hop, 2 hops, and to structurally disconnected edges.
Not intended for general-purpose use. The contracts are randomly generated fiction โ entity names, dates and addresses are meaningless.
Reproducing
python scripts/pistol/prepare_pistol.py --subset pistol_data_1 --forget_edge A_C
python src/train.py --config-name=train.yaml \
experiment=finetune/pistol/default model=Llama-2-7b-chat-hf \
trainer.args.learning_rate=1e-5 trainer.args.num_train_epochs=20 \
trainer.args.per_device_train_batch_size=4 \
trainer.args.gradient_accumulation_steps=4 trainer.args.warmup_epochs=1.0
License
This is a derivative of Llama 2 and is distributed under the Llama 2 Community License. You must comply with that license and Meta's Acceptable Use Policy.
The PISTOL dataset is from xinchiqiu/PISTOL.
- Downloads last month
- 170
Model tree for yejinkim/pistol-data1-Llama-2-7b-chat-target
Base model
meta-llama/Llama-2-7b-chat-hf