Steering Out-of-Distribution Generalization with Concept Ablation Fine-Tuning
Paper • 2507.16795 • Published • 2
How to use vidhyavasan/pca_caft with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "vidhyavasan/pca_caft")LoRA adapter for Qwen/Qwen2.5-7B-Instruct (4-bit QLoRA), fine-tuned on a bad-medical-advice dataset
with Concept Ablation Fine-Tuning (CAFT) using PCA directions
(Casademunt, Juang et al., arXiv:2507.16795).
ablation_directions.pt holds the orthonormalised directions used.import torch as t
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=t.float16)
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct", quantization_config=bnb, device_map="auto")
model = PeftModel.from_pretrained(base, "vidhyavasan/pca_caft")
tok = AutoTokenizer.from_pretrained("vidhyavasan/pca_caft")
No hook is needed at inference.
This is an unvalidated reproduction at 7B / 4-bit scale and has not been benchmarked against the paper's results.